diff --git a/PomeloRPC.xcodeproj/project.pbxproj b/PomeloRPC.xcodeproj/project.pbxproj index 601d6e5..c4ea745 100644 --- a/PomeloRPC.xcodeproj/project.pbxproj +++ b/PomeloRPC.xcodeproj/project.pbxproj @@ -265,11 +265,12 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = PomeloRPC/PomeloRPC.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"PomeloRPC/Preview Content\""; - DEVELOPMENT_TEAM = 95J8WZ4TN8; + DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = NO; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -278,6 +279,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.stossy11.PomeloRPC; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -292,11 +294,12 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = PomeloRPC/PomeloRPC.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"PomeloRPC/Preview Content\""; - DEVELOPMENT_TEAM = 95J8WZ4TN8; + DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = NO; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; @@ -305,6 +308,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.stossy11.PomeloRPC; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/PomeloRPC/ContentView.swift b/PomeloRPC/ContentView.swift index 6a282d4..3653c2d 100644 --- a/PomeloRPC/ContentView.swift +++ b/PomeloRPC/ContentView.swift @@ -138,8 +138,7 @@ class DiscordRPCServer: ObservableObject { try await server.run() } // Connect to Discord - let connected = sword.connect() - if connected { + if isConnected { isConnected = true // Set initial empty presence @@ -147,7 +146,7 @@ class DiscordRPCServer: ObservableObject { sword.setPresence(emptyPresence) } - return connected + return true } func stop() { @@ -205,7 +204,11 @@ class DiscordRPCServer: ObservableObject { // Configure rich presence var rpc = RichPresence() rpc.details = "Playing: \(game.name) (\(game.id))" - rpc.timestamps.start = .now + if #available(macOS 12, *) { + rpc.timestamps.start = .now + } else { + rpc.timestamps.start = Date() + } rpc.state = game.developer rpc.assets.largeImage = "pomelo-icon" rpc.assets.largeText = "Pomelo Emulator" @@ -213,6 +216,9 @@ class DiscordRPCServer: ObservableObject { sword.setPresence(rpc) // Start heartbeat monitoring + + isConnected = sword.connect() + updateHeartbeat() startHeartbeatMonitoring() } @@ -269,6 +275,7 @@ class DiscordRPCServer: ObservableObject { private func handleDisconnection() async { resetPresence() currentGame = nil + self.stop() } private func stopHeartbeatMonitoring() {