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 iTunesAppID to BuildSettings #24263

Merged
merged 2 commits into from
Mar 20, 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
1 change: 1 addition & 0 deletions Modules/Sources/BuildSettingsKit/BuildSettings+Live.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ extension BuildSettings {
appKeychainAccessGroup = bundle.infoValue(forKey: "WPAppKeychainAccessGroup")
eventNamePrefix = bundle.infoValue(forKey: "WPEventNamePrefix")
explatPlatform = bundle.infoValue(forKey: "WPExplatPlatform")
itunesAppID = bundle.infoValue(forKey: "WPItunesAppID")
}
}

Expand Down
3 changes: 2 additions & 1 deletion Modules/Sources/BuildSettingsKit/BuildSettings+Preview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ extension BuildSettings {
appGroupName: "xcpreview_app_group_name",
appKeychainAccessGroup: "xcpreview_app_keychain_access_group",
eventNamePrefix: "xcpreview",
explatPlatform: "xcpreview"
explatPlatform: "xcpreview",
itunesAppID: "1234567890"
)
}

Expand Down
1 change: 1 addition & 0 deletions Modules/Sources/BuildSettingsKit/BuildSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public struct BuildSettings: Sendable {
public var appKeychainAccessGroup: String
public var eventNamePrefix: String
public var explatPlatform: String
public var itunesAppID: String

public static var current: BuildSettings {
switch BuildSettingsEnvironment.current {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import BuildSettingsKit

struct AppStoreLookupResponse: Decodable {
let results: [AppStoreInfo]
Expand Down Expand Up @@ -29,7 +30,7 @@ protocol AppStoreSearchProtocol {
final class AppStoreSearchService: AppStoreSearchProtocol {
private(set) var appID: String

init(appID: String = AppConstants.itunesAppID) {
init(appID: String = BuildSettings.current.itunesAppID) {
self.appID = appID
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import WordPressKit
/// This configuration class has a **Jetpack** counterpart in the Jetpack bundle.
/// Make sure to keep them in sync to avoid build errors when building the Jetpack target.
@objc class AppConstants: NSObject {
static let itunesAppID = "335703880"
static let productTwitterHandle = "@WordPressiOS"
static let productTwitterURL = "https://twitter.com/WordPressiOS"
static let productBlogURL = "https://wordpress.org/news/"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import BuildSettingsKit

/// This class will help track whether or not a user should be prompted for an
/// app review. This class is loosely based on
Expand All @@ -16,7 +17,7 @@ class AppRatingUtility: NSObject {
/// The App Review URL that we send off to UIApplication to open up the app
/// store review page.
///
@objc let appReviewUrl: URL = Constants.defaultAppReviewURL
@objc var appReviewUrl: URL { Constants.defaultAppReviewURL }

/// Sets the number of days that have to pass between AppReview prompts
/// Apple only allows 3 prompts per year. We're trying to be a bit more conservative and are doing
Expand Down Expand Up @@ -337,6 +338,6 @@ class AppRatingUtility: NSObject {
}

private enum Constants {
static let defaultAppReviewURL = URL(string: "https://itunes.apple.com/app/id\(AppConstants.itunesAppID)?mt=8&action=write-review")!
static let defaultAppReviewURL = URL(string: "https://itunes.apple.com/app/id\(BuildSettings.current.itunesAppID)?mt=8&action=write-review")!
}
}
2 changes: 2 additions & 0 deletions WordPress/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<string>wpios</string>
<key>WPExplatPlatform</key>
<string>wpios</string>
<key>WPItunesAppID</key>
<string>335703880</string>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>org.wordpress.bgtask.weeklyroundup</string>
Expand Down
1 change: 0 additions & 1 deletion WordPress/Jetpack/AppConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import WordPressKit
/// This configuration class has a **WordPress** counterpart in the WordPress bundle.
/// Make sure to keep them in sync to avoid build errors when building the WordPress target.
@objc class AppConstants: NSObject {
static let itunesAppID = "1565481562"
static let productTwitterHandle = "@jetpack"
static let productTwitterURL = "https://twitter.com/jetpack"
static let productBlogURL = "https://jetpack.com/blog"
Expand Down
2 changes: 2 additions & 0 deletions WordPress/Jetpack/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<string>jpios</string>
<key>WPExplatPlatform</key>
<string>wpios</string>
<key>WPItunesAppID</key>
<string>1565481562</string>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>org.wordpress.bgtask.weeklyroundup</string>
Expand Down