Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epic Signin Webview #171

Merged
merged 6 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 49 additions & 29 deletions Mythic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@
6A2935682BFCFAFD0035CE4B /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 6A2934F22BFCFAFD0035CE4B /* Credits.rtf */; };
6A29356A2BFCFAFD0035CE4B /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 6A2934F42BFCFAFD0035CE4B /* Localizable.xcstrings */; };
6A29356B2BFCFAFD0035CE4B /* MythicApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A2934F62BFCFAFD0035CE4B /* MythicApp.swift */; };
6A302EE22CDE652D00E11458 /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 6A302EE12CDE652D00E11458 /* FirebaseAnalytics */; };
6A302EE42CDE652D00E11458 /* FirebaseCore in Frameworks */ = {isa = PBXBuildFile; productRef = 6A302EE32CDE652D00E11458 /* FirebaseCore */; };
6A2960FC2CE0ED0D00917E90 /* EpicWebAuthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A2960FB2CE0ED0700917E90 /* EpicWebAuthView.swift */; };
6A2960FE2CE1017900917E90 /* NSApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A2960FD2CE1017700917E90 /* NSApplication.swift */; };
6A2961002CE1033200917E90 /* NSWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A2960FF2CE1033000917E90 /* NSWindow.swift */; };
6A2961032CE1DD6200917E90 /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 6A2961022CE1DD6200917E90 /* FirebaseAnalytics */; };
6A2961052CE1DD6200917E90 /* FirebaseCore in Frameworks */ = {isa = PBXBuildFile; productRef = 6A2961042CE1DD6200917E90 /* FirebaseCore */; };
6A2961072CE1DD6200917E90 /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 6A2961062CE1DD6200917E90 /* FirebaseCrashlytics */; };
6A34366E2B8D7F1200D35BCA /* Shimmer in Frameworks */ = {isa = PBXBuildFile; productRef = 6A34366D2B8D7F1200D35BCA /* Shimmer */; };
6A371B592AE7DFBF0054BF7A /* ZIPFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = 6A371B582AE7DFBF0054BF7A /* ZIPFoundation */; };
6A448E0E2CC4A53A001E9F47 /* GameListCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A448E0D2CC4A531001E9F47 /* GameListCard.swift */; };
Expand All @@ -82,7 +86,6 @@
6AAD31152B08693D0035FA69 /* SemanticVersion in Frameworks */ = {isa = PBXBuildFile; productRef = 6AAD31142B08693D0035FA69 /* SemanticVersion */; };
6AC45E092C1B2FD500ED9F64 /* SettingsFormView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AC45E082C1B2FC800ED9F64 /* SettingsFormView.swift */; };
6AC742DD2B9314AB000EA1B2 /* SwordRPC in Frameworks */ = {isa = PBXBuildFile; productRef = 6AC742DC2B9314AB000EA1B2 /* SwordRPC */; };
6ACCEC182CD0817D00611BEF /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 6ACCEC172CD0817D00611BEF /* FirebaseCrashlytics */; };
6ACCEC1B2CD08DEE00611BEF /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6ACCEC1A2CD08DEE00611BEF /* GoogleService-Info.plist */; };
6AEEFA472CA9174B0025C840 /* WindowBlurView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AEEFA462CA9173C0025C840 /* WindowBlurView.swift */; };
6AF630D92C077A17001F4E10 /* UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AF630D82C077A17001F4E10 /* UserDefaults.swift */; };
Expand Down Expand Up @@ -164,6 +167,9 @@
6A2934F42BFCFAFD0035CE4B /* Localizable.xcstrings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
6A2934F52BFCFAFD0035CE4B /* Mythic.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Mythic.entitlements; sourceTree = "<group>"; };
6A2934F62BFCFAFD0035CE4B /* MythicApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MythicApp.swift; sourceTree = "<group>"; };
6A2960FB2CE0ED0700917E90 /* EpicWebAuthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EpicWebAuthView.swift; sourceTree = "<group>"; };
6A2960FD2CE1017700917E90 /* NSApplication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSApplication.swift; sourceTree = "<group>"; };
6A2960FF2CE1033000917E90 /* NSWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSWindow.swift; sourceTree = "<group>"; };
6A448E0D2CC4A531001E9F47 /* GameListCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameListCard.swift; sourceTree = "<group>"; };
6A448E0F2CC4BC50001E9F47 /* GameCardVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameCardVM.swift; sourceTree = "<group>"; };
6A496A722C1AF75600FD637B /* Game.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Game.swift; sourceTree = "<group>"; };
Expand All @@ -185,15 +191,15 @@
files = (
6AC742DD2B9314AB000EA1B2 /* SwordRPC in Frameworks */,
6A7A81162B77093600D19E32 /* ColorfulX in Frameworks */,
6A2961052CE1DD6200917E90 /* FirebaseCore in Frameworks */,
6AFC02812ABE02970004AB77 /* Sparkle in Frameworks */,
6AFC027E2ABDB5D40004AB77 /* SwiftyJSON in Frameworks */,
6AA1744F2CD5CC290035B081 /* WhatsNewKit in Frameworks */,
6A12FF8E2B73AC4E00AA948C /* Glur in Frameworks */,
6A302EE22CDE652D00E11458 /* FirebaseAnalytics in Frameworks */,
6A34366E2B8D7F1200D35BCA /* Shimmer in Frameworks */,
6AAD31152B08693D0035FA69 /* SemanticVersion in Frameworks */,
6ACCEC182CD0817D00611BEF /* FirebaseCrashlytics in Frameworks */,
6A302EE42CDE652D00E11458 /* FirebaseCore in Frameworks */,
6A2961072CE1DD6200917E90 /* FirebaseCrashlytics in Frameworks */,
6A2961032CE1DD6200917E90 /* FirebaseAnalytics in Frameworks */,
6A371B592AE7DFBF0054BF7A /* ZIPFoundation in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -323,6 +329,7 @@
6A2934EC2BFCFAFD0035CE4B /* Unified */ = {
isa = PBXGroup;
children = (
6A2960F92CE0ECEE00917E90 /* Windows */,
6A2934DF2BFCFAFD0035CE4B /* Modules */,
6A91FEC02C2BFB8100D9F153 /* Models */,
6A2934E72BFCFAFD0035CE4B /* Sheets */,
Expand Down Expand Up @@ -364,6 +371,14 @@
path = Mythic;
sourceTree = "<group>";
};
6A2960F92CE0ECEE00917E90 /* Windows */ = {
isa = PBXGroup;
children = (
6A2960FB2CE0ED0700917E90 /* EpicWebAuthView.swift */,
);
path = Windows;
sourceTree = "<group>";
};
6A91FEC02C2BFB8100D9F153 /* Models */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -402,6 +417,8 @@
6AD44DE52C0A29BF00824C06 /* Built-in */ = {
isa = PBXGroup;
children = (
6A2960FF2CE1033000917E90 /* NSWindow.swift */,
6A2960FD2CE1017700917E90 /* NSApplication.swift */,
6A2934B32BFCFAFD0035CE4B /* Bundle.swift */,
6A2934B42BFCFAFD0035CE4B /* Color.swift */,
6A2934B52BFCFAFD0035CE4B /* Data.swift */,
Expand Down Expand Up @@ -443,10 +460,10 @@
6A7A81152B77093600D19E32 /* ColorfulX */,
6A34366D2B8D7F1200D35BCA /* Shimmer */,
6AC742DC2B9314AB000EA1B2 /* SwordRPC */,
6ACCEC172CD0817D00611BEF /* FirebaseCrashlytics */,
6AA1744E2CD5CC290035B081 /* WhatsNewKit */,
6A302EE12CDE652D00E11458 /* FirebaseAnalytics */,
6A302EE32CDE652D00E11458 /* FirebaseCore */,
6A2961022CE1DD6200917E90 /* FirebaseAnalytics */,
6A2961042CE1DD6200917E90 /* FirebaseCore */,
6A2961062CE1DD6200917E90 /* FirebaseCrashlytics */,
);
productName = Mythic;
productReference = 6AB474952AACBBE900AB9C63 /* Mythic.app */;
Expand Down Expand Up @@ -485,8 +502,8 @@
6A7A81142B77093600D19E32 /* XCRemoteSwiftPackageReference "ColorfulX" */,
6A34366C2B8D7F1200D35BCA /* XCRemoteSwiftPackageReference "SwiftUI-Shimmer" */,
6AC742DB2B9314AB000EA1B2 /* XCRemoteSwiftPackageReference "SwordRPC" */,
6ACCEC162CD0817D00611BEF /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
6AA1744D2CD5CC290035B081 /* XCRemoteSwiftPackageReference "WhatsNewKit" */,
6A2961012CE1DD6200917E90 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
);
productRefGroup = 6AB474962AACBBE900AB9C63 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -567,6 +584,7 @@
files = (
6A29353A2BFCFAFD0035CE4B /* Task.swift in Sources */,
6A2935592BFCFAFD0035CE4B /* ContainerCreationView.swift in Sources */,
6A2960FE2CE1017900917E90 /* NSApplication.swift in Sources */,
6A448E102CC4BC55001E9F47 /* GameCardVM.swift in Sources */,
6A2935562BFCFAFD0035CE4B /* GameCard.swift in Sources */,
6A2935622BFCFAFD0035CE4B /* NotImplementedView.swift in Sources */,
Expand Down Expand Up @@ -611,8 +629,10 @@
6A29353E2BFCFAFD0035CE4B /* LegendaryInterfaceExt.swift in Sources */,
6A71D3DD2BFD024D00A2C74D /* Auth.swift in Sources */,
6A29354B2BFCFAFD0035CE4B /* LocalImport.swift in Sources */,
6A2960FC2CE0ED0D00917E90 /* EpicWebAuthView.swift in Sources */,
6A29355C2BFCFAFD0035CE4B /* InstallGameView.swift in Sources */,
6A2935432BFCFAFD0035CE4B /* FileLocations.swift in Sources */,
6A2961002CE1033200917E90 /* NSWindow.swift in Sources */,
6A9FE1162CDEED7A00C36058 /* WhatsNewCollection.swift in Sources */,
6A2935402BFCFAFD0035CE4B /* LocalGamesExt.swift in Sources */,
6A2935502BFCFAFD0035CE4B /* HomeView.swift in Sources */,
Expand Down Expand Up @@ -769,7 +789,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3083;
CURRENT_PROJECT_VERSION = 3144;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\"";
Expand Down Expand Up @@ -816,7 +836,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3083;
CURRENT_PROJECT_VERSION = 3144;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\"";
Expand Down Expand Up @@ -884,6 +904,14 @@
kind = branch;
};
};
6A2961012CE1DD6200917E90 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 11.4.0;
};
};
6A34366C2B8D7F1200D35BCA /* XCRemoteSwiftPackageReference "SwiftUI-Shimmer" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/markiv/SwiftUI-Shimmer";
Expand Down Expand Up @@ -932,14 +960,6 @@
kind = branch;
};
};
6ACCEC162CD0817D00611BEF /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 11.4.0;
};
};
6AFC027C2ABDB5D40004AB77 /* XCRemoteSwiftPackageReference "SwiftyJSON" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SwiftyJSON/SwiftyJSON";
Expand All @@ -964,16 +984,21 @@
package = 6A12FF8C2B73AC4E00AA948C /* XCRemoteSwiftPackageReference "Glur" */;
productName = Glur;
};
6A302EE12CDE652D00E11458 /* FirebaseAnalytics */ = {
6A2961022CE1DD6200917E90 /* FirebaseAnalytics */ = {
isa = XCSwiftPackageProductDependency;
package = 6ACCEC162CD0817D00611BEF /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
package = 6A2961012CE1DD6200917E90 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseAnalytics;
};
6A302EE32CDE652D00E11458 /* FirebaseCore */ = {
6A2961042CE1DD6200917E90 /* FirebaseCore */ = {
isa = XCSwiftPackageProductDependency;
package = 6ACCEC162CD0817D00611BEF /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
package = 6A2961012CE1DD6200917E90 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseCore;
};
6A2961062CE1DD6200917E90 /* FirebaseCrashlytics */ = {
isa = XCSwiftPackageProductDependency;
package = 6A2961012CE1DD6200917E90 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseCrashlytics;
};
6A34366D2B8D7F1200D35BCA /* Shimmer */ = {
isa = XCSwiftPackageProductDependency;
package = 6A34366C2B8D7F1200D35BCA /* XCRemoteSwiftPackageReference "SwiftUI-Shimmer" */;
Expand Down Expand Up @@ -1004,11 +1029,6 @@
package = 6AC742DB2B9314AB000EA1B2 /* XCRemoteSwiftPackageReference "SwordRPC" */;
productName = SwordRPC;
};
6ACCEC172CD0817D00611BEF /* FirebaseCrashlytics */ = {
isa = XCSwiftPackageProductDependency;
package = 6ACCEC162CD0817D00611BEF /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseCrashlytics;
};
6AFC027D2ABDB5D40004AB77 /* SwiftyJSON */ = {
isa = XCSwiftPackageProductDependency;
package = 6AFC027C2ABDB5D40004AB77 /* XCRemoteSwiftPackageReference "SwiftyJSON" */;
Expand Down
2 changes: 1 addition & 1 deletion Mythic/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { // https://arc.net/l/quote/

extension AppDelegate: UNUserNotificationCenterDelegate {}

extension AppDelegate: SPUUpdaterDelegate {}
extension AppDelegate: SPUUpdaterDelegate {} // FIXME: nonfunctional

extension AppDelegate: SwordRPCDelegate {
func swordRPCDidConnect(_ rpc: SwordRPC) {
Expand Down
5 changes: 4 additions & 1 deletion Mythic/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -38624,6 +38624,9 @@
}
}
}
},
"Unable to sign in to Epic." : {

},
"Unable to uninstall \"%@\"." : {
"localizations" : {
Expand Down Expand Up @@ -43377,4 +43380,4 @@
}
},
"version" : "1.0"
}
}
28 changes: 10 additions & 18 deletions Mythic/MythicApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,40 +32,34 @@ struct MythicApp: App {

@State private var bootError: Error?

func toggleTitleBar(_ value: Bool) {
if let window = NSApp.windows.first {
window.titlebarAppearsTransparent = !value
window.isMovableByWindowBackground = !value
window.titleVisibility = value ? .visible : .hidden
window.standardWindowButton(.miniaturizeButton)?.isHidden = !value
window.standardWindowButton(.zoomButton)?.isHidden = !value
}
}

// MARK: - App Body
var body: some Scene {
Window("Mythic", id: "main") {
if isOnboardingPresented {
OnboardingR2(fromPhase: onboardingPhase)
.contentTransition(.opacity)
.onAppear {
toggleTitleBar(false)

// Bring to front
if let window = NSApp.mainWindow {
window.isImmersive = true

window.makeKeyAndOrderFront(nil)
NSApp.activate(ignoringOtherApps: true)
}
}
} else {
ContentView()
.transition(.opacity)
.contentTransition(.opacity)
.environmentObject(networkMonitor)
.environmentObject(sparkleController)
.frame(minWidth: 750, minHeight: 390)
.onAppear { toggleTitleBar(true) }
.onAppear {
if let window = NSApp.mainWindow {
window.isImmersive = false
}
}
}
}

.handlesExternalEvents(matching: ["open"])
.environment(
\.whatsNew,
WhatsNewEnvironment(
Expand All @@ -80,7 +74,6 @@ struct MythicApp: App {
whatsNewCollection: self
)
)

.commands {
CommandGroup(after: .appInfo) {
Button("Check for Updates...", action: sparkleController.updater.checkForUpdates)
Expand All @@ -92,7 +85,6 @@ struct MythicApp: App {
}
}
.disabled(isOnboardingPresented)
// .keyboardShortcut("O", modifiers: [.command])
}
}

Expand Down
14 changes: 14 additions & 0 deletions Mythic/Utilities/Extensions/Built-in/NSApplication.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// NSApplication.swift
// Mythic
//
// Created by Esiayo Alegbe on 11/10/24.
//

import AppKit

extension NSApplication {
func window(withID id: String) -> NSWindow? {
return windows.first { $0.identifier?.rawValue == id }
}
}
36 changes: 36 additions & 0 deletions Mythic/Utilities/Extensions/Built-in/NSWindow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// NSWindow.swift
// Mythic
//
// Created by Esiayo Alegbe on 11/10/24.
//

import AppKit

extension NSWindow {
var isImmersive: Bool {
get {
return self.titlebarAndTextHidden &&
self.isMovableByWindowBackground &&
self.standardWindowButton(.miniaturizeButton)?.isHidden == true &&
self.standardWindowButton(.zoomButton)?.isHidden == true
}
set {
self.titlebarAndTextHidden = newValue
self.isMovableByWindowBackground = newValue
self.standardWindowButton(.miniaturizeButton)?.isHidden = newValue
self.standardWindowButton(.zoomButton)?.isHidden = newValue
}
}

var titlebarAndTextHidden: Bool {
get {
return self.titlebarAppearsTransparent == true &&
self.titleVisibility == .visible
}
set {
self.titlebarAppearsTransparent = newValue
self.titleVisibility = newValue ? .hidden : .visible
}
}
}
5 changes: 4 additions & 1 deletion Mythic/Utilities/Global.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ let files: FileManager = .default
/// A simpler alias of `UserDefaults.standard`.
let defaults: UserDefaults = .standard

/// A simpler alias of `workspace`.
/// A simpler alias of `NSWorkspace.shared`.
let workspace: NSWorkspace = .shared

/// A simpler alias of `NSApp[lication].shared`.
let sharedApp: NSApplication = .shared

let notifications: UNUserNotificationCenter = .current()

let mainLock: NSRecursiveLock = .init()
Expand Down
Loading