Skip to content

Commit

Permalink
UpdateApp
Browse files Browse the repository at this point in the history
  • Loading branch information
stossy11 committed Nov 19, 2024
1 parent 2e9f756 commit a2bc04b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
8 changes: 6 additions & 2 deletions PomeloRPC.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)";
Expand All @@ -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;
Expand All @@ -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)";
Expand Down
15 changes: 11 additions & 4 deletions PomeloRPC/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,15 @@ class DiscordRPCServer: ObservableObject {
try await server.run()
}
// Connect to Discord
let connected = sword.connect()
if connected {
if isConnected {
isConnected = true

// Set initial empty presence
let emptyPresence = RichPresence()
sword.setPresence(emptyPresence)
}

return connected
return true
}

func stop() {
Expand Down Expand Up @@ -205,14 +204,21 @@ 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"

sword.setPresence(rpc)

// Start heartbeat monitoring

isConnected = sword.connect()

updateHeartbeat()
startHeartbeatMonitoring()
}
Expand Down Expand Up @@ -269,6 +275,7 @@ class DiscordRPCServer: ObservableObject {
private func handleDisconnection() async {
resetPresence()
currentGame = nil
self.stop()
}

private func stopHeartbeatMonitoring() {
Expand Down

0 comments on commit a2bc04b

Please sign in to comment.