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

Move pushNotificationAppID to BuildSettings #24224

Merged
merged 1 commit into from
Mar 17, 2025
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
4 changes: 4 additions & 0 deletions Modules/Sources/BuildSettingsKit/BuildSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import Foundation
/// - warning: Most of these values exist only in Info.plist files for apps as
/// app extensions only need a tiny subset of these settings.
public enum BuildSettings {
public static var pushNotificationAppID: String {
infoPlistValue(forKey: "WPPushNotificationAppID")
}

public static var appGroupName: String {
infoPlistValue(forKey: "WPAppGroupName")
}
Expand Down
11 changes: 7 additions & 4 deletions WordPress/Classes/Services/NotificationSettingsService.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import BuildSettingsKit
import WordPressKit
import WordPressShared

Expand Down Expand Up @@ -143,10 +144,12 @@ class NotificationSettingsService {
return
}

notificationsServiceRemote?.registerDeviceForPushNotifications(token,
pushNotificationAppId: AppConstants.pushNotificationAppId,
success: success,
failure: failure)
notificationsServiceRemote?.registerDeviceForPushNotifications(
token,
pushNotificationAppId: BuildSettings.pushNotificationAppID,
success: success,
failure: failure
)
}

/// Unregisters the given deviceID for Push Notification Events.
Expand Down
16 changes: 0 additions & 16 deletions WordPress/Classes/Utility/App Configuration/AppConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@ import WordPressKit
@objc static let eventNamePrefix = "wpios"
@objc static let explatPlatform = "wpios"
@objc static let authKeychainServiceName = "public-api.wordpress.com"

/// Notifications Constants
///
#if DEBUG
static let pushNotificationAppId = "org.wordpress.appstore.dev"
#else
#if INTERNAL_BUILD
static let pushNotificationAppId = "org.wordpress.internal"
#else
#if ALPHA_BUILD
static let pushNotificationAppId = "org.wordpress.alpha"
#else
static let pushNotificationAppId = "org.wordpress.appstore"
#endif
#endif
#endif
}

// MARK: - Localized Strings
Expand Down
2 changes: 2 additions & 0 deletions WordPress/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<string>${WP_APP_GROUP_NAME}</string>
<key>WPAppKeychainAccessGroup</key>
<string>${WP_APP_KEYCHAIN_ACCESS_GROUP}</string>
<key>WPPushNotificationAppID</key>
<string>${WP_PUSH_NOTIFICATION_APP_ID}</string>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>org.wordpress.bgtask.weeklyroundup</string>
Expand Down
16 changes: 0 additions & 16 deletions WordPress/Jetpack/AppConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@ import WordPressKit
@objc static let eventNamePrefix = "jpios"
@objc static let explatPlatform = "wpios"
@objc static let authKeychainServiceName = "jetpack.public-api.wordpress.com"

/// Notifications Constants
///
#if DEBUG
static let pushNotificationAppId = "com.jetpack.appstore.dev"
#else
#if INTERNAL_BUILD
static let pushNotificationAppId = "com.jetpack.internal"
#else
#if ALPHA_BUILD
static let pushNotificationAppId = "com.jetpack.alpha"
#else
static let pushNotificationAppId = "com.jetpack.appstore"
#endif
#endif
#endif
}

// MARK: - Localized Strings
Expand Down
2 changes: 2 additions & 0 deletions WordPress/Jetpack/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<string>${WP_APP_GROUP_NAME}</string>
<key>WPAppKeychainAccessGroup</key>
<string>${WP_APP_KEYCHAIN_ACCESS_GROUP}</string>
<key>WPPushNotificationAppID</key>
<string>${WP_PUSH_NOTIFICATION_APP_ID}</string>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>org.wordpress.bgtask.weeklyroundup</string>
Expand Down
3 changes: 2 additions & 1 deletion config/Jetpack.alpha.xcconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "Common.enterprise.xcconfig"

BUILD_SCHEME=Jetpack
BUILD_SCHEME = Jetpack
WP_PUSH_NOTIFICATION_APP_ID = "com.jetpack.alpha"
3 changes: 2 additions & 1 deletion config/Jetpack.debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "Common.debug.xcconfig"

BUILD_SCHEME=Jetpack
BUILD_SCHEME = Jetpack
WP_PUSH_NOTIFICATION_APP_ID = "com.jetpack.appstore.dev"
3 changes: 2 additions & 1 deletion config/Jetpack.release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
BUILD_SCHEME=Jetpack
BUILD_SCHEME = Jetpack
WP_PUSH_NOTIFICATION_APP_ID = "com.jetpack.appstore"
3 changes: 2 additions & 1 deletion config/WordPress.alpha.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Version.public.xcconfig"
#include "Common.enterprise.xcconfig"

BUILD_SCHEME=WordPress Alpha
BUILD_SCHEME = WordPress Alpha
WP_PUSH_NOTIFICATION_APP_ID = "org.wordpress.alpha"
3 changes: 2 additions & 1 deletion config/WordPress.debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Version.public.xcconfig"
#include "Common.debug.xcconfig"

BUILD_SCHEME=WordPress
BUILD_SCHEME = WordPress
WP_PUSH_NOTIFICATION_APP_ID = "org.wordpress.appstore.dev"
3 changes: 2 additions & 1 deletion config/WordPress.release.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Version.public.xcconfig"
#include "Common.xcconfig"

BUILD_SCHEME=WordPress
BUILD_SCHEME = WordPress
WP_PUSH_NOTIFICATION_APP_ID = "org.wordpress.appstore"