Skip to content

Commit

Permalink
Added notifications, async stuff, yea cool
Browse files Browse the repository at this point in the history
  • Loading branch information
EmeraldLoc committed Apr 18, 2022
1 parent 68aeb7f commit df0cd28
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 58 deletions.
10 changes: 10 additions & 0 deletions sm_osx/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,61 @@
{
"images" : [
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion sm_osx/CompilationSpeed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ enum Speed: String {
case normal = "-j2"
case fast = "-j3"
case veryFast = "-j6"
case fastest = "-j"
case fastest = "-j$(nproc)"
}
35 changes: 30 additions & 5 deletions sm_osx/LauncherView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

import SwiftUI
import UniformTypeIdentifiers
import UserNotifications

struct LauncherView: View {

@State var repoView = false
@State var shell = RomView(patch: [Patches](), repo: .sm64ex, repoView: .constant(false))
var shell = Shell()
@Environment(\.managedObjectContext) var moc
@FetchRequest(sortDescriptors:[SortDescriptor(\.title)]) var launcherRepos: FetchedResults<LauncherRepos>
@State var existingRepo = URL(string: "")
Expand Down Expand Up @@ -109,7 +110,7 @@ struct LauncherView: View {
}

Button(action: {
try? print(shell.shell("\(LauncherRepo.path ?? "its broken") \(LauncherRepo.args ?? "")"))
try? print(shell.asyncShell("\(LauncherRepo.path ?? "its broken") \(LauncherRepo.args ?? "")", waitTillExit: false))

print(LauncherRepo.path ?? "")
}) {
Expand Down Expand Up @@ -164,8 +165,26 @@ struct LauncherView: View {
Text("Homebrew is REQUIRED for this software to work, please install homebrew at brew.sh")
.padding(.horizontal)

Text("\nOptional: Homebrew Intel version is nice to have. Install by launching terminal with Rosetta and installing at brew.sh")
.padding(.horizontal)

Button(action:{
print(try! shell.shell("/usr/local/bin/brew install make mingw-w64 gcc gcc@9 sdl2 pkg-config glew glfw3 libusb audiofile coreutils && brew install make mingw-w64 gcc sdl2 pkg-config glew glfw3 libusb audiofile coreutils"))
print(try! shell.shell("brew install make mingw-w64 gcc sdl2 pkg-config glew glfw3 libusb audiofile coreutils"))
print(try! shell.shell("/usr/local/bin/brew install make mingw-w64 gcc gcc@9 sdl2 pkg-config glew glfw3 libusb audiofile coreutils"))

let content = UNMutableNotificationContent()
content.title = "Finished installing dependencies"
content.subtitle = "Dependencies are now installed."
content.sound = UNNotificationSound.default

// show this notification instantly
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.0001, repeats: false)

// choose a random identifier
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)

// add our notification request
UNUserNotificationCenter.current().add(request)
}) {
Text("Install Dependencies")
}.buttonStyle(.bordered).padding(.vertical)
Expand All @@ -179,9 +198,15 @@ struct LauncherView: View {
if latestVersion != currentVersion && !latestVersion.isEmpty {
updateAlert = true
}

try? print(shell.shell("cd ~/ && mkdir SM64Repos"))

if firstLaunch {
try? print(shell.shell("cd ~/ && mkdir SM64Repos"))
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { success, error in
if success {
print("All set!")
} else if let error = error {
print(error.localizedDescription)
}
}

if launcherRepos.isEmpty {return}
Expand Down
Loading

0 comments on commit df0cd28

Please sign in to comment.