diff --git a/.configure b/.configure index 4da74081ca7c..b7892ab8149c 100644 --- a/.configure +++ b/.configure @@ -5,27 +5,7 @@ "files_to_copy": [ { "file": "iOS/WPiOS/Secrets.swift", - "destination": "~/.configure/wordpress-ios/secrets/WordPress-Secrets.swift", - "encrypt": true - }, - { - "file": "iOS/WPiOS/Secrets-Internal.swift", - "destination": "~/.configure/wordpress-ios/secrets/WordPress-Secrets-Internal.swift", - "encrypt": true - }, - { - "file": "iOS/WPiOS/Secrets-Alpha.swift", - "destination": "~/.configure/wordpress-ios/secrets/WordPress-Secrets-Alpha.swift", - "encrypt": true - }, - { - "file": "iOS/JPiOS/Jetpack-Secrets.swift", - "destination": "~/.configure/wordpress-ios/secrets/Jetpack-Secrets.swift", - "encrypt": true - }, - { - "file": "iOS/Reader/Reader-Secrets.swift", - "destination": "~/.configure/wordpress-ios/secrets/Reader-Secrets.swift", + "destination": "~/.configure/wordpress-ios/secrets/Secrets.swift", "encrypt": true } ], diff --git a/.configure-files/Jetpack-Secrets.swift.enc b/.configure-files/Jetpack-Secrets.swift.enc deleted file mode 100644 index ea3cc37302b2..000000000000 Binary files a/.configure-files/Jetpack-Secrets.swift.enc and /dev/null differ diff --git a/.configure-files/Reader-Secrets.swift.enc b/.configure-files/Reader-Secrets.swift.enc deleted file mode 100644 index ccf158a9cbf1..000000000000 Binary files a/.configure-files/Reader-Secrets.swift.enc and /dev/null differ diff --git a/.configure-files/Secrets-Alpha.swift.enc b/.configure-files/Secrets-Alpha.swift.enc deleted file mode 100644 index 6d064130c099..000000000000 Binary files a/.configure-files/Secrets-Alpha.swift.enc and /dev/null differ diff --git a/.configure-files/Secrets-Internal.swift.enc b/.configure-files/Secrets-Internal.swift.enc deleted file mode 100644 index 034b369c157c..000000000000 Binary files a/.configure-files/Secrets-Internal.swift.enc and /dev/null differ diff --git a/Modules/Sources/BuildSettingsKit/BuildSecrets.swift b/Modules/Sources/BuildSettingsKit/BuildSecrets.swift index 520d9fa79fa8..9af9ac0fbe64 100644 --- a/Modules/Sources/BuildSettingsKit/BuildSecrets.swift +++ b/Modules/Sources/BuildSettingsKit/BuildSecrets.swift @@ -10,18 +10,6 @@ public struct BuildSecrets: Sendable { } } - public struct Google: Sendable { - public let clientId: String - public let schemeId: String - public let serverClientId: String - - public init(clientId: String, schemeId: String, serverClientId: String) { - self.clientId = clientId - self.schemeId = schemeId - self.serverClientId = serverClientId - } - } - public struct Zendesk: Sendable { public let appId: String public let url: String @@ -35,27 +23,18 @@ public struct BuildSecrets: Sendable { } public let oauth: OAuth - public let google: Google public let zendesk: Zendesk - public let sentryDSN: String - public let docsBotId: String public let encryptedLogsKey: String public let debuggingKey: String public init( oauth: OAuth, - google: Google, zendesk: Zendesk, - sentryDSN: String, - docsBotId: String, encryptedLogsKey: String, debuggingKey: String ) { self.oauth = oauth - self.google = google self.zendesk = zendesk - self.sentryDSN = sentryDSN - self.docsBotId = docsBotId self.encryptedLogsKey = encryptedLogsKey self.debuggingKey = debuggingKey } @@ -65,10 +44,7 @@ extension BuildSecrets { public static let dummy = BuildSecrets( oauth: .init(client: "", secret: ""), - google: .init(clientId: "", schemeId: "", serverClientId: ""), zendesk: .init(appId: "", url: "", clientId: ""), - sentryDSN: "", - docsBotId: "", encryptedLogsKey: "", debuggingKey: "" ) diff --git a/Modules/Sources/BuildSettingsKit/BuildSettings+Live.swift b/Modules/Sources/BuildSettingsKit/BuildSettings+Live.swift index 0a86ee048124..6c47093901a2 100644 --- a/Modules/Sources/BuildSettingsKit/BuildSettings+Live.swift +++ b/Modules/Sources/BuildSettingsKit/BuildSettings+Live.swift @@ -34,6 +34,9 @@ extension BuildSettings { zendeskSourcePlatform = bundle.infoValue(forKey: "WPZendeskSourcePlatform") mobileAnnounceAppID = bundle.infoValue(forKey: "WPMobileAnnounceAppID") authKeychainServiceName = bundle.infoValue(forKey: "WPAuthKeychainServiceName") + // The plist does not carry the URL scheme because the C preprocessor treats the `//` as a comment resulting in a truncated value. + sentryDSN = "https://" + bundle.infoValue(forKey: "WPSentryNoSchemeDSN") + docsBotId = bundle.infoValue(forKey: "WPDocsBotId") } } diff --git a/Modules/Sources/BuildSettingsKit/BuildSettings+Preview.swift b/Modules/Sources/BuildSettingsKit/BuildSettings+Preview.swift index fedbdd1bf0a1..b5611ff27b82 100644 --- a/Modules/Sources/BuildSettingsKit/BuildSettings+Preview.swift +++ b/Modules/Sources/BuildSettingsKit/BuildSettings+Preview.swift @@ -20,7 +20,9 @@ extension BuildSettings { ), zendeskSourcePlatform: "zen", mobileAnnounceAppID: "1234567890", - authKeychainServiceName: "public-api.wordpress.com" + authKeychainServiceName: "public-api.wordpress.com", + sentryDSN: "", + docsBotId: "" ) } diff --git a/Modules/Sources/BuildSettingsKit/BuildSettings.swift b/Modules/Sources/BuildSettingsKit/BuildSettings.swift index f9fcd43a0523..b1dc47c1cd9a 100644 --- a/Modules/Sources/BuildSettingsKit/BuildSettings.swift +++ b/Modules/Sources/BuildSettingsKit/BuildSettings.swift @@ -38,6 +38,12 @@ public struct BuildSettings: Sendable { public var zendeskSourcePlatform: String public var mobileAnnounceAppID: String public var authKeychainServiceName: String + /// See [Sentry: DSN utilization](https://docs.sentry.io/concepts/key-terms/dsn-explainer/#dsn-utilization) + public var sentryDSN: String + /// Empty outside Jetpack, the only app that presents the support chat bot. + /// + /// See [DocsBot: Embeddable Chat Widget](https://docsbot.ai/documentation/developer/embeddable-chat-widget) + public var docsBotId: String public struct ProductAboutDetails: Sendable { public var blogURL: URL diff --git a/Scripts/BuildPhases/GenerateCredentials.sh b/Scripts/BuildPhases/GenerateCredentials.sh index ebef9d0644cc..8afb065ffdd8 100755 --- a/Scripts/BuildPhases/GenerateCredentials.sh +++ b/Scripts/BuildPhases/GenerateCredentials.sh @@ -1,4 +1,6 @@ -#!/bin/bash -euo pipefail +#!/usr/bin/env bash + +set -euo pipefail # The Secrets File Sources SECRETS_ROOT="${HOME}/.configure/wordpress-ios/secrets" @@ -47,13 +49,8 @@ function ensure_is_in_input_files_list() { fi } -WORDPRESS_SECRETS_FILE="${SECRETS_ROOT}/WordPress-Secrets.swift" -ensure_is_in_input_files_list $WORDPRESS_SECRETS_FILE -JETPACK_SECRETS_FILE="${SECRETS_ROOT}/Jetpack-Secrets.swift" -ensure_is_in_input_files_list $JETPACK_SECRETS_FILE - -READER_SECRETS_FILE="${SECRETS_ROOT}/Reader-Secrets.swift" -ensure_is_in_input_files_list $READER_SECRETS_FILE +SECRETS_FILE="${SECRETS_ROOT}/Secrets.swift" +ensure_is_in_input_files_list $SECRETS_FILE LOCAL_SECRETS_FILE="${SRCROOT}/Credentials/Secrets.swift" EXAMPLE_SECRETS_FILE="${SRCROOT}/Credentials/Secrets-example.swift" @@ -63,26 +60,10 @@ ensure_is_in_input_files_list $EXAMPLE_SECRETS_FILE SECRETS_DESTINATION_FILE="${SCRIPT_OUTPUT_FILE_0}" mkdir -p "$(dirname "$SECRETS_DESTINATION_FILE")" -WORDPRESS_TARGETS=("WordPress" "WordPressShareExtension" "WordPressDraftActionExtension" "WordPressNotificationServiceExtension") -# If the WordPress Production Secrets are available for WordPress, use them -if [ -f "$WORDPRESS_SECRETS_FILE" ] && [[ " ${WORDPRESS_TARGETS[*]} " == *" $TARGET_NAME "* ]]; then +# WordPress, Jetpack, and Reader use all the same secrets at this time. +if [ -f "$SECRETS_FILE" ]; then echo "Applying Production Secrets" - cp -v "$WORDPRESS_SECRETS_FILE" "${SECRETS_DESTINATION_FILE}" - exit 0 -fi - -JETPACK_TARGETS=("Jetpack" "JetpackStatsWidgets" "JetpackShareExtension" "JetpackDraftActionExtension" "JetpackNotificationServiceExtension") -# If the Jetpack Secrets are available and if we're building Jetpack use them -if [ -f "$JETPACK_SECRETS_FILE" ] && [[ " ${JETPACK_TARGETS[*]} " == *" $TARGET_NAME "* ]]; then - echo "Applying Jetpack Secrets" - cp -v "$JETPACK_SECRETS_FILE" "${SECRETS_DESTINATION_FILE}" - exit 0 -fi - -# If the Reader Secrets are available and if we're building Reader use them -if [ -f "$READER_SECRETS_FILE" ] && [ "${TARGET_NAME}" == "Reader" ]; then - echo "Applying Reader Secrets" - cp -v "$READER_SECRETS_FILE" "${SECRETS_DESTINATION_FILE}" + cp -v "$SECRETS_FILE" "${SECRETS_DESTINATION_FILE}" exit 0 fi diff --git a/Scripts/BuildPhases/GenerateCredentials.xcfilelist b/Scripts/BuildPhases/GenerateCredentials.xcfilelist index c52def6be2d1..2d99cf0ff613 100644 --- a/Scripts/BuildPhases/GenerateCredentials.xcfilelist +++ b/Scripts/BuildPhases/GenerateCredentials.xcfilelist @@ -1,10 +1,6 @@ # Lists of input files for the script that populates the app's secrets with the # correct values for the current scheme and build configuration. -${HOME}/.configure/wordpress-ios/secrets/WordPress-Secrets.swift -${HOME}/.configure/wordpress-ios/secrets/WordPress-Secrets-Internal.swift -${HOME}/.configure/wordpress-ios/secrets/WordPress-Secrets-Alpha.swift -${HOME}/.configure/wordpress-ios/secrets/Jetpack-Secrets.swift -${HOME}/.configure/wordpress-ios/secrets/Reader-Secrets.swift +${HOME}/.configure/wordpress-ios/secrets/Secrets.swift # Local Secrets file that external contributors can use to specify their own # ClientID and Secrets. This file is created by the Rakefile when external @@ -18,4 +14,4 @@ ${SRCROOT}/Credentials/Secrets-example.swift # Add the script that uses this file as a source, so that, if the script # changes, Xcode will run it again on the next build. -${SRCROOT}/../Scripts/BuildPhases/ApplyConfiguration.sh +${SRCROOT}/../Scripts/BuildPhases/GenerateCredentials.sh diff --git a/Sources/Jetpack/Info.plist b/Sources/Jetpack/Info.plist index 8d43a85a56df..33b4afd61ab4 100644 --- a/Sources/Jetpack/Info.plist +++ b/Sources/Jetpack/Info.plist @@ -555,16 +555,6 @@ jetpacknotificationmigration - - CFBundleTypeRole - Editor - CFBundleURLName - GoogleSignIn - CFBundleURLSchemes - - com.googleusercontent.apps.108380595987-qmh1rvuqi418cs6otokppnemo48288c9 - - CFBundleVersion $(CURRENT_PROJECT_VERSION) @@ -666,6 +656,8 @@ jetpack.public-api.wordpress.com WPBuildConfiguration ${WP_BUILD_CONFIGURATION} + WPDocsBotId + TqTdebbGjJeUjrmBIFjh/YbAMwiheXLs2Ue5j7elH WPEventNamePrefix jpios WPExplatPlatform @@ -680,6 +672,8 @@ jetpack.com/blog WPPushNotificationAppID ${WP_PUSH_NOTIFICATION_APP_ID} + WPSentryNoSchemeDSN + ed059b31605743eb8cfb5034bc4a195c@o248881.ingest.sentry.io/5716771 WPZendeskSourcePlatform mobile_-_jp_ios diff --git a/Sources/Reader/Info.plist b/Sources/Reader/Info.plist index b801c5edef13..9745931d59f7 100644 --- a/Sources/Reader/Info.plist +++ b/Sources/Reader/Info.plist @@ -19,6 +19,8 @@ reader.public-api.wordpress.com WPBuildConfiguration ${WP_BUILD_CONFIGURATION} + WPDocsBotId + WPEventNamePrefix jpios WPExplatPlatform @@ -33,6 +35,8 @@ jetpack.com/blog WPPushNotificationAppID ${WP_PUSH_NOTIFICATION_APP_ID} + WPSentryNoSchemeDSN + 2a7b5c4f9d325dd2b93f0abff78cb9c1@o248881.ingest.us.sentry.io/4509160620621824 WPZendeskSourcePlatform mobile_-_jp_ios diff --git a/Sources/WordPress/Info.plist b/Sources/WordPress/Info.plist index 7fbac12f3607..2e80a9be1079 100644 --- a/Sources/WordPress/Info.plist +++ b/Sources/WordPress/Info.plist @@ -481,16 +481,6 @@ wordpressnotificationmigration - - CFBundleTypeRole - Editor - CFBundleURLName - GoogleSignIn - CFBundleURLSchemes - - com.googleusercontent.apps.108380595987-ujhrhknecrqli756i72gkcs4aaia6nhb - - CFBundleVersion ${VERSION_LONG} @@ -591,6 +581,8 @@ public-api.wordpress.com WPBuildConfiguration ${WP_BUILD_CONFIGURATION} + WPDocsBotId + WPEventNamePrefix wpios WPExplatPlatform @@ -605,6 +597,8 @@ wordpress.org/news/ WPPushNotificationAppID ${WP_PUSH_NOTIFICATION_APP_ID} + WPSentryNoSchemeDSN + 484d81126ac9483da3756876e80148ab@o248881.ingest.sentry.io/1438083 WPZendeskSourcePlatform mobile_-_ios diff --git a/WordPress/Classes/System/ApiCredentials+BuildSecrets.swift b/WordPress/Classes/System/ApiCredentials+BuildSecrets.swift index a0604d178be9..5d926ef77165 100644 --- a/WordPress/Classes/System/ApiCredentials+BuildSecrets.swift +++ b/WordPress/Classes/System/ApiCredentials+BuildSecrets.swift @@ -5,18 +5,11 @@ extension ApiCredentials { static func toSecrets() -> BuildSecrets { BuildSecrets( oauth: .init(client: client, secret: secret), - google: .init( - clientId: googleLoginClientId, - schemeId: googleLoginSchemeId, - serverClientId: googleLoginServerClientId - ), zendesk: .init( appId: zendeskAppId, url: zendeskUrl, clientId: zendeskClientId ), - sentryDSN: sentryDSN, - docsBotId: docsBotId, encryptedLogsKey: encryptedLogKey, debuggingKey: debuggingKey ) diff --git a/WordPress/Classes/Utility/Logging/WPCrashLoggingProvider.swift b/WordPress/Classes/Utility/Logging/WPCrashLoggingProvider.swift index db36c98e6fa1..5f082320677a 100644 --- a/WordPress/Classes/Utility/Logging/WPCrashLoggingProvider.swift +++ b/WordPress/Classes/Utility/Logging/WPCrashLoggingProvider.swift @@ -45,7 +45,7 @@ struct WPCrashLoggingDataProvider: CrashLoggingDataProvider { init( contextManager: ContextManager = .shared, - sentryDSN: String = BuildSettings.current.secrets.sentryDSN + sentryDSN: String = BuildSettings.current.sentryDSN ) { self.contextManager = contextManager self.sentryDSN = sentryDSN diff --git a/WordPress/Classes/ViewRelated/Support/SupportChatBot/SupportChatBotViewController.swift b/WordPress/Classes/ViewRelated/Support/SupportChatBot/SupportChatBotViewController.swift index 0ed817f582f4..a5cc1d15c694 100644 --- a/WordPress/Classes/ViewRelated/Support/SupportChatBot/SupportChatBotViewController.swift +++ b/WordPress/Classes/ViewRelated/Support/SupportChatBot/SupportChatBotViewController.swift @@ -71,7 +71,7 @@ final class SupportChatBotViewController: UIViewController { } /// Creating DocsBotAI JavaScript code so we could tweak configuration from within Swift code - /// https://docsbot.ai/docs/embeddable-chat-widget + /// https://docsbot.ai/documentation/developer/embeddable-chat-widget private func createDocsBotInitCode() -> String { """ (function() { diff --git a/WordPress/Classes/ViewRelated/Support/SupportChatBot/SupportChatBotViewModel.swift b/WordPress/Classes/ViewRelated/Support/SupportChatBot/SupportChatBotViewModel.swift index 63e197ddb0f7..43effc119215 100644 --- a/WordPress/Classes/ViewRelated/Support/SupportChatBot/SupportChatBotViewModel.swift +++ b/WordPress/Classes/ViewRelated/Support/SupportChatBot/SupportChatBotViewModel.swift @@ -11,7 +11,7 @@ struct SupportChatBotViewModel { init( zendeskUtils: ZendeskUtilsProtocol = ZendeskUtils.sharedInstance, - docsBotId: String = BuildSettings.current.secrets.docsBotId + docsBotId: String = BuildSettings.current.docsBotId ) { self.zendeskUtils = zendeskUtils self.docsBotId = docsBotId diff --git a/WordPress/Credentials/Secrets-example.swift b/WordPress/Credentials/Secrets-example.swift index 430f4e036212..d2483a7526af 100644 --- a/WordPress/Credentials/Secrets-example.swift +++ b/WordPress/Credentials/Secrets-example.swift @@ -7,19 +7,12 @@ class ApiCredentials: NSObject { static let client = "0" static let secret = "your-secret-here" - // Google Login - static let googleLoginClientId = "" - static let googleLoginSchemeId = "" - static let googleLoginServerClientId = "" - // ZenDesk static let zendeskAppId = "" static let zendeskUrl = "" static let zendeskClientId = "" // Other Services - static let sentryDSN = "" static let encryptedLogKey = "" static let debuggingKey = "" - static let docsBotId = "" }