New Update
This commit is contained in:
parent
e06b48fc00
commit
5f4ec67e33
@ -89,6 +89,9 @@
|
||||
4EE462C42CB576F400BF268E /* BottomMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EE462C32CB576F400BF268E /* BottomMenuView.swift */; };
|
||||
4EE462C62CB5770700BF268E /* TopBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EE462C52CB5770700BF268E /* TopBarView.swift */; };
|
||||
4EE462C92CB5774900BF268E /* GameGridView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EE462C82CB5774900BF268E /* GameGridView.swift */; };
|
||||
4EE473492CDEC743000A010C /* MetalHUDEnabler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EE473482CDEC73F000A010C /* MetalHUDEnabler.swift */; };
|
||||
4EE4734D2CDECABC000A010C /* iOSNav.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EE4734C2CDECAB9000A010C /* iOSNav.swift */; };
|
||||
4EE473502CDEE7B8000A010C /* SignInWithAppleButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EE4734F2CDEE7B8000A010C /* SignInWithAppleButton.swift */; };
|
||||
4EE593FF2C5FA1D1000939C4 /* AppIconProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EE593FE2C5FA1D1000939C4 /* AppIconProvider.swift */; };
|
||||
4EE9B1EC2CC47025008FA07B /* LaunchGameIntentDef.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EE9B1EB2CC47025008FA07B /* LaunchGameIntentDef.swift */; };
|
||||
4EEA0CFA2CA376AB0029A55D /* Zip in Frameworks */ = {isa = PBXBuildFile; productRef = 4EEA0CF92CA376AB0029A55D /* Zip */; };
|
||||
@ -204,6 +207,10 @@
|
||||
4EE462C32CB576F400BF268E /* BottomMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottomMenuView.swift; sourceTree = "<group>"; };
|
||||
4EE462C52CB5770700BF268E /* TopBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopBarView.swift; sourceTree = "<group>"; };
|
||||
4EE462C82CB5774900BF268E /* GameGridView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameGridView.swift; sourceTree = "<group>"; };
|
||||
4EE473452CDEC597000A010C /* libMTLHud.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libMTLHud.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.2.sdk/usr/lib/libMTLHud.tbd; sourceTree = DEVELOPER_DIR; };
|
||||
4EE473482CDEC73F000A010C /* MetalHUDEnabler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetalHUDEnabler.swift; sourceTree = "<group>"; };
|
||||
4EE4734C2CDECAB9000A010C /* iOSNav.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSNav.swift; sourceTree = "<group>"; };
|
||||
4EE4734F2CDEE7B8000A010C /* SignInWithAppleButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInWithAppleButton.swift; sourceTree = "<group>"; };
|
||||
4EE593FE2C5FA1D1000939C4 /* AppIconProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppIconProvider.swift; sourceTree = "<group>"; };
|
||||
4EE9B1EB2CC47025008FA07B /* LaunchGameIntentDef.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchGameIntentDef.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
@ -378,6 +385,7 @@
|
||||
384F188C2C1DCB4F0073375C /* Pomelo */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4EE4734A2CDECAA3000A010C /* Navigation */,
|
||||
4EE9B1EA2CC4700F008FA07B /* Intents */,
|
||||
4EE462B62CB54F0400BF268E /* ScreenshotManager */,
|
||||
4EE462B32CB548D800BF268E /* Extentions */,
|
||||
@ -447,6 +455,7 @@
|
||||
386F6F2E2C42E62200C62EBE /* SettingsViews */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4EE4734E2CDEE7AB000A010C /* Apple ID Login */,
|
||||
4EE593FD2C5FA1C4000939C4 /* AppIcon */,
|
||||
38020F572C43AFD400029E9A /* CoreSettings */,
|
||||
386F6F2F2C42E63A00C62EBE /* SettingsView.swift */,
|
||||
@ -485,6 +494,7 @@
|
||||
38C50D132C1DD4570007A953 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4EE473452CDEC597000A010C /* libMTLHud.tbd */,
|
||||
4E7E03662C9667D200C10AFD /* OpenGLES.framework */,
|
||||
38C50D162C1DD45F0007A953 /* CoreBluetooth.framework */,
|
||||
38C50D142C1DD4570007A953 /* GameController.framework */,
|
||||
@ -540,6 +550,7 @@
|
||||
4E1687CB2CC7A24000485EDB /* MetalViewHandler */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4EE473472CDEC737000A010C /* MetalHUDEnabler */,
|
||||
4E1687CD2CC7A27000485EDB /* SudachiMetalView.swift */,
|
||||
);
|
||||
path = MetalViewHandler;
|
||||
@ -626,6 +637,38 @@
|
||||
path = GameGrid;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4EE473472CDEC737000A010C /* MetalHUDEnabler */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4EE473482CDEC73F000A010C /* MetalHUDEnabler.swift */,
|
||||
);
|
||||
path = MetalHUDEnabler;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4EE4734A2CDECAA3000A010C /* Navigation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4EE4734B2CDECAAE000A010C /* iOSNavigation */,
|
||||
);
|
||||
path = Navigation;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4EE4734B2CDECAAE000A010C /* iOSNavigation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4EE4734C2CDECAB9000A010C /* iOSNav.swift */,
|
||||
);
|
||||
path = iOSNavigation;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4EE4734E2CDEE7AB000A010C /* Apple ID Login */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4EE4734F2CDEE7B8000A010C /* SignInWithAppleButton.swift */,
|
||||
);
|
||||
path = "Apple ID Login";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4EE593FD2C5FA1C4000939C4 /* AppIcon */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -776,10 +819,13 @@
|
||||
38020F432C43754700029E9A /* EnableJIT.swift in Sources */,
|
||||
38020F442C43754700029E9A /* DetectServer.swift in Sources */,
|
||||
4E4AF12D2C926BBD00BBF2DE /* FolderMonitor.swift in Sources */,
|
||||
4EE473502CDEE7B8000A010C /* SignInWithAppleButton.swift in Sources */,
|
||||
38B7FDFF2C760DE400D274FB /* Air.swift in Sources */,
|
||||
4EE462B92CB54F2100BF268E /* ScreenShotListView.swift in Sources */,
|
||||
38020F5A2C43AFFA00029E9A /* CoreSettingsView.swift in Sources */,
|
||||
4EE473492CDEC743000A010C /* MetalHUDEnabler.swift in Sources */,
|
||||
4EE462BC2CB5552900BF268E /* MotionManager.swift in Sources */,
|
||||
4EE4734D2CDECABC000A010C /* iOSNav.swift in Sources */,
|
||||
4EA0AA602CB6845700B51C64 /* JITEnabler.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -929,6 +975,7 @@
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Pomelo;
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
||||
INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace = YES;
|
||||
INFOPLIST_KEY_NSAppleMusicUsageDescription = "We need access to use Sign in with Apple.";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
INFOPLIST_KEY_NSLocalNetworkUsageDescription = "Pomelo needs local network access for P2P Multiplayer ";
|
||||
INFOPLIST_KEY_NSMicrophoneUsageDescription = "Pomelo needs Microphone so the games can access it.";
|
||||
@ -995,6 +1042,7 @@
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Pomelo;
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
||||
INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace = YES;
|
||||
INFOPLIST_KEY_NSAppleMusicUsageDescription = "We need access to use Sign in with Apple.";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
INFOPLIST_KEY_NSLocalNetworkUsageDescription = "Pomelo needs local network access for P2P Multiplayer ";
|
||||
INFOPLIST_KEY_NSMicrophoneUsageDescription = "Pomelo needs Microphone so the games can access it.";
|
||||
|
@ -9,12 +9,15 @@ import SwiftUI
|
||||
import Sudachi
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AuthenticationServices
|
||||
|
||||
|
||||
struct ContentView: View {
|
||||
@State var urlgame: PomeloGame? = nil
|
||||
@AppStorage("icloudsaves") var icloudsaves: Bool = false
|
||||
@AppStorage("useTrollStore") var useTrollStore: Bool = false
|
||||
@AppStorage("showMetalHUD") var showMetalHUD: Bool = false
|
||||
@AppStorage("canShowMetalHUD") var canShowMetalHUD: Bool = false
|
||||
@State var core = Core(games: [], root: FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0])
|
||||
var body: some View {
|
||||
//NavView(core: $core) // pain and suffering
|
||||
@ -43,6 +46,24 @@ struct ContentView: View {
|
||||
askForJIT()
|
||||
}
|
||||
|
||||
print("Show MetalHUD? \(showMetalHUD)")
|
||||
|
||||
canShowMetalHUD = openMetalDylib()
|
||||
|
||||
if showMetalHUD {
|
||||
enableMetalHUD()
|
||||
} else {
|
||||
disableMetalHUD()
|
||||
}
|
||||
|
||||
ASAuthorizationAppleIDProvider().getCredentialState(forUserID: UserDefaults.standard.string(forKey: "deviceOwnerID") ?? "0") { state, error in
|
||||
if state != .authorized {
|
||||
UserDefaults.standard.set(nil, forKey: "deviceOwnerName")
|
||||
UserDefaults.standard.set(nil, forKey: "deviceOwnerLastName")
|
||||
UserDefaults.standard.set(nil, forKey: "deviceOwnerID")
|
||||
}
|
||||
}
|
||||
|
||||
// checkFoldersInICloud()
|
||||
|
||||
do {
|
||||
|
@ -0,0 +1,36 @@
|
||||
//
|
||||
// MetalHUDEnabler.swift
|
||||
// Pomelo
|
||||
//
|
||||
// Created by Stossy11 on 9/11/2024.
|
||||
// Copyright © 2024 Stossy11. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
func enableMetalHUD() {
|
||||
// Set the environment variable
|
||||
setenv("MTL_HUD_ENABLED", "1", 1)
|
||||
|
||||
}
|
||||
|
||||
func openMetalDylib() -> Bool {
|
||||
var path = "/usr/lib/libMTLHud.dylib"
|
||||
|
||||
// Load the dynamic library
|
||||
if dlopen(path, RTLD_NOW) != nil {
|
||||
// Library loaded successfully
|
||||
print("Library loaded from \(path)")
|
||||
return true
|
||||
} else {
|
||||
// Handle error
|
||||
if let error = String(validatingUTF8: dlerror()) {
|
||||
print("Error loading library: \(error)")
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func disableMetalHUD() {
|
||||
setenv("MTL_HUD_ENABLED", "0", 1)
|
||||
}
|
@ -2,6 +2,34 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleIcons</key>
|
||||
<dict>
|
||||
<key>CFBundlePrimaryIcon</key>
|
||||
<dict>
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string>AppIcon</string>
|
||||
<string>secondary</string>
|
||||
<string>old</string>
|
||||
<string>original</string>
|
||||
</array>
|
||||
<key>CFBundleIconName</key>
|
||||
<string>AppIcon</string>
|
||||
<key>UIPrerenderedIcon</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>UINewsstandIcon</key>
|
||||
<dict>
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string></string>
|
||||
</array>
|
||||
<key>UINewsstandBindingEdge</key>
|
||||
<string>UINewsstandBindingEdgeLeft</string>
|
||||
<key>UINewsstandBindingType</key>
|
||||
<string>UINewsstandBindingTypeMagazine</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
@ -17,36 +45,10 @@
|
||||
<array>
|
||||
<string>LaunchGameIntent</string>
|
||||
</array>
|
||||
<key>Privacy - Apple ID Authentication Usage Description</key>
|
||||
<string>We need access to use Sign in with Apple.</string>
|
||||
<key>UIFileSharingEnabled</key>
|
||||
<true/>
|
||||
<key>CFBundleIcons</key>
|
||||
<dict>
|
||||
<key>CFBundlePrimaryIcon</key>
|
||||
<dict>
|
||||
<key>CFBundleIconName</key>
|
||||
<string>AppIcon</string>
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string>AppIcon</string>
|
||||
<string>secondary</string>
|
||||
<string>old</string>
|
||||
<string>original</string>
|
||||
</array>
|
||||
<key>UIPrerenderedIcon</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>UINewsstandIcon</key>
|
||||
<dict>
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string></string>
|
||||
</array>
|
||||
<key>UINewsstandBindingType</key>
|
||||
<string>UINewsstandBindingTypeMagazine</string>
|
||||
<key>UINewsstandBindingEdge</key>
|
||||
<string>UINewsstandBindingEdgeLeft</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>UIRequiresPersistentWiFi</key>
|
||||
<true/>
|
||||
<key>UTExportedTypeDeclarations</key>
|
||||
|
@ -31,8 +31,7 @@ struct LibraryView: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
|
||||
iOSNav {
|
||||
GeometryReader { geometry in
|
||||
VStack {
|
||||
TopBarView()
|
||||
@ -59,8 +58,6 @@ struct LibraryView: View {
|
||||
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
.navigationViewStyle(.stack)
|
||||
.background(Color.gray.opacity(0.1))
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
.onAppear {
|
||||
|
@ -16,6 +16,9 @@ struct TopBarView: View {
|
||||
@State private var batteryState: UIDevice.BatteryState = UIDevice.current.batteryState
|
||||
@State private var creatinguser: Bool = false
|
||||
@State private var username: String = ""
|
||||
@AppStorage("deviceOwnerName") var deviceOwnerName: String?
|
||||
@AppStorage("deviceOwnerLastName") var deviceOwnerLastName: String?
|
||||
@AppStorage("hideLastNameTop") var hideLastName: Bool = false
|
||||
|
||||
private var timer: Publishers.Autoconnect<Timer.TimerPublisher> {
|
||||
Timer.publish(every: 60, on: .main, in: .common).autoconnect() // Update every minute
|
||||
@ -56,10 +59,22 @@ struct TopBarView: View {
|
||||
}
|
||||
*/
|
||||
Spacer()
|
||||
|
||||
Text("\(hour % 12 == 0 ? 12 : hour % 12):\(String(format: "%02d", minutes)) \(hour >= 12 ? "PM" : "AM")")
|
||||
// .foregroundColor(.black)
|
||||
.font(.system(size: 22))
|
||||
if let user = deviceOwnerName {
|
||||
if hideLastName {
|
||||
Text("Welcome \(user)!")
|
||||
.font(.system(size: 22))
|
||||
} else if let deviceOwnerLastName {
|
||||
Text("Welcome \(user) \(deviceOwnerLastName)!")
|
||||
.font(.system(size: 22))
|
||||
} else {
|
||||
Text("Welcome \(user)!")
|
||||
.font(.system(size: 22))
|
||||
} // deviceOwnerLastName
|
||||
} else {
|
||||
Text("\(hour % 12 == 0 ? 12 : hour % 12):\(String(format: "%02d", minutes)) \(hour >= 12 ? "PM" : "AM")")
|
||||
// .foregroundColor(.black)
|
||||
.font(.system(size: 22))
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
@ -75,29 +90,9 @@ struct TopBarView: View {
|
||||
}
|
||||
.onAppear {
|
||||
UIDevice.current.isBatteryMonitoringEnabled = true
|
||||
|
||||
batteryLevel = UIDevice.current.batteryLevel
|
||||
batteryState = UIDevice.current.batteryState
|
||||
|
||||
|
||||
|
||||
// Add observers for battery level and state changes
|
||||
NotificationCenter.default.addObserver(
|
||||
forName: UIDevice.batteryLevelDidChangeNotification,
|
||||
object: nil,
|
||||
queue: .main) { _ in
|
||||
self.batteryLevel = UIDevice.current.batteryLevel
|
||||
}
|
||||
|
||||
NotificationCenter.default.addObserver(
|
||||
forName: UIDevice.batteryStateDidChangeNotification,
|
||||
object: nil,
|
||||
queue: .main) { _ in
|
||||
self.batteryState = UIDevice.current.batteryState
|
||||
}
|
||||
}
|
||||
.onDisappear {
|
||||
// Remove observers when the view disappears
|
||||
NotificationCenter.default.removeObserver(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
23
Pomelo/Navigation/iOSNavigation/iOSNav.swift
Normal file
23
Pomelo/Navigation/iOSNavigation/iOSNav.swift
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// iOSNav.swift
|
||||
// Pomelo
|
||||
//
|
||||
// Created by Stossy11 on 9/11/2024.
|
||||
// Copyright © 2024 Stossy11. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct iOSNav<Content: View>: View {
|
||||
@ViewBuilder var content: () -> Content
|
||||
|
||||
var body: some View {
|
||||
if #available(iOS 16, *) {
|
||||
NavigationStack(root: content)
|
||||
} else {
|
||||
NavigationView(content: content)
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
.navigationViewStyle(.stack)
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,10 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.developer.applesignin</key>
|
||||
<array>
|
||||
<string>Default</string>
|
||||
</array>
|
||||
<key>com.apple.developer.kernel.extended-virtual-addressing</key>
|
||||
<true/>
|
||||
<key>com.apple.developer.kernel.increased-debugging-memory-limit</key>
|
||||
|
@ -2,6 +2,10 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.developer.applesignin</key>
|
||||
<array>
|
||||
<string>Default</string>
|
||||
</array>
|
||||
<key>com.apple.developer.kernel.extended-virtual-addressing</key>
|
||||
<true/>
|
||||
<key>com.apple.developer.kernel.increased-debugging-memory-limit</key>
|
||||
|
@ -19,6 +19,12 @@ struct AdvancedSettingsView: View {
|
||||
@AppStorage("cangetfullpath") var canGetFullPath: Bool = false
|
||||
@AppStorage("onscreenhandheld") var onscreenjoy: Bool = false
|
||||
|
||||
@AppStorage("showMetalHUD") var showMetalHUD: Bool = false
|
||||
|
||||
@AppStorage("canShowMetalHUD") var canShowMetalHUD: Bool = false
|
||||
|
||||
@AppStorage("hideLastNameTop") var hideLastName: Bool = false
|
||||
@AppStorage("deviceOwnerLastName") var deviceOwnerLastName: String?
|
||||
@State var isshowing = false
|
||||
|
||||
var body: some View {
|
||||
@ -52,6 +58,63 @@ struct AdvancedSettingsView: View {
|
||||
.padding(.bottom)
|
||||
.font(.footnote)
|
||||
.foregroundColor(.gray)
|
||||
if canShowMetalHUD {// (Int(UIDevice.current.systemVersion) ?? 0 >= 16) || canShowMetalHUD {
|
||||
Rectangle()
|
||||
.fill(Color(uiColor: UIColor.secondarySystemBackground))
|
||||
.cornerRadius(10)
|
||||
.frame(width: .infinity, height: 50)
|
||||
.overlay() {
|
||||
HStack {
|
||||
Toggle("Show Metal HUD", isOn: $showMetalHUD)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
.onChange(of: showMetalHUD) { new in
|
||||
print("Show MetalHUD? \(new)")
|
||||
if new {
|
||||
enableMetalHUD()
|
||||
} else {
|
||||
disableMetalHUD()
|
||||
}
|
||||
}
|
||||
Text("This shows the current FPS (framerate), Memory Usage, and other information when running the emulation.")
|
||||
.padding(.bottom)
|
||||
.font(.footnote)
|
||||
.foregroundColor(.gray)
|
||||
} else {
|
||||
Rectangle()
|
||||
.fill(Color(uiColor: UIColor.secondarySystemBackground))
|
||||
.cornerRadius(10)
|
||||
.frame(width: .infinity, height: 50)
|
||||
.overlay() {
|
||||
HStack {
|
||||
Text("Metal HUD is not avalible on \(UIDevice.current.systemName) \(UIDevice.current.systemVersion)")
|
||||
.padding(.horizontal)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.padding(.bottom)
|
||||
.onAppear() {
|
||||
showMetalHUD = false
|
||||
}
|
||||
}
|
||||
|
||||
if deviceOwnerLastName != nil {
|
||||
Rectangle()
|
||||
.fill(Color(uiColor: UIColor.secondarySystemBackground))
|
||||
.cornerRadius(10)
|
||||
.frame(width: .infinity, height: 50)
|
||||
.overlay() {
|
||||
HStack {
|
||||
Toggle("Hide Last Name", isOn: $hideLastName)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
Text("Hide your last name at the top of the Game Selector Screen.")
|
||||
.padding(.bottom)
|
||||
.font(.footnote)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
|
||||
/*
|
||||
Rectangle()
|
||||
@ -136,8 +199,6 @@ struct AdvancedSettingsView: View {
|
||||
.font(.footnote)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
.navigationViewStyle(.stack)
|
||||
.onAppear() {
|
||||
// isshowing = true
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
//
|
||||
// SignInWithAppleButton.swift
|
||||
// Pomelo
|
||||
//
|
||||
// Created by Stossy11 on 9/11/2024.
|
||||
// Copyright © 2024 Stossy11. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
import AuthenticationServices
|
||||
import SwiftUI
|
||||
|
||||
struct SignInApple: View {
|
||||
var body: some View {
|
||||
|
||||
SignInWithAppleButton(
|
||||
onRequest: { request in
|
||||
request.requestedScopes = [.fullName]
|
||||
},
|
||||
onCompletion: { result in
|
||||
switch result {
|
||||
case .success(let authResults):
|
||||
if let appleIDCredential = authResults.credential as? ASAuthorizationAppleIDCredential {
|
||||
let firstName = appleIDCredential.fullName?.givenName
|
||||
let lastName = appleIDCredential.fullName?.familyName
|
||||
|
||||
|
||||
UserDefaults.standard.set(appleIDCredential.user, forKey: "deviceOwnerID")
|
||||
|
||||
UserDefaults.standard.set(firstName, forKey: "deviceOwnerName")
|
||||
UserDefaults.standard.set(lastName, forKey: "deviceOwnerLastName")
|
||||
UserDefaults.standard.synchronize()
|
||||
}
|
||||
case .failure(let error):
|
||||
print(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
)
|
||||
.frame(height: 44)
|
||||
.padding()
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import AuthenticationServices
|
||||
|
||||
struct SettingsView: View {
|
||||
@State var core: Core
|
||||
@ -14,8 +15,12 @@ struct SettingsView: View {
|
||||
@AppStorage("cantouchapplepen") var applepen: Bool = false
|
||||
|
||||
@AppStorage("useTrollStore") var useTrollStore: Bool = false
|
||||
@AppStorage("deviceOwnerID") var deviceOwnerID: String?
|
||||
|
||||
@State var isshown: Bool = true
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
iOSNav {
|
||||
ScrollView {
|
||||
VStack(alignment: .center) {
|
||||
if iconused == 1 {
|
||||
@ -123,6 +128,32 @@ struct SettingsView: View {
|
||||
|
||||
}
|
||||
.padding()
|
||||
if isshown {
|
||||
Rectangle()
|
||||
.fill(Color(uiColor: UIColor.secondarySystemBackground)) // Set the fill color (optional)
|
||||
.cornerRadius(10) // Apply rounded corners
|
||||
.frame(width: .infinity, height: 50) // Set the desired dimensions
|
||||
.overlay() {
|
||||
HStack(alignment: .center) {
|
||||
SignInApple()
|
||||
.frame(width: 200, height: 50)
|
||||
.foregroundColor(Color(uiColor: UIColor.secondarySystemBackground))
|
||||
}
|
||||
.onAppear {
|
||||
ASAuthorizationAppleIDProvider().getCredentialState(forUserID: deviceOwnerID ?? "0") { state, error in
|
||||
if state != .authorized {
|
||||
isshown = true
|
||||
UserDefaults.standard.set(nil, forKey: "deviceOwnerName")
|
||||
UserDefaults.standard.set(nil, forKey: "deviceOwnerID")
|
||||
} else {
|
||||
isshown = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
|
||||
NavigationLink(destination: AppIconSwitcherView()) {
|
||||
Rectangle()
|
||||
@ -148,11 +179,7 @@ struct SettingsView: View {
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
.navigationViewStyle(.stack)
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
.navigationViewStyle(.stack)
|
||||
.onAppear() {
|
||||
do {
|
||||
core = try LibraryManager.shared.library()
|
||||
|
Loading…
x
Reference in New Issue
Block a user