From 1ffeee9df2e7bea3cb05d64e536518f660c380c5 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Fri, 10 Jan 2025 03:06:43 +0100 Subject: [PATCH 1/4] Fix CD for macOS --- .github/actions/xcbuild/action.yml | 3 --- .github/workflows/cd.yml | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/actions/xcbuild/action.yml b/.github/actions/xcbuild/action.yml index 0facc0bae..c2a774ecc 100644 --- a/.github/actions/xcbuild/action.yml +++ b/.github/actions/xcbuild/action.yml @@ -25,9 +25,6 @@ inputs: KEYCHAIN_PASSWORD: required: false default: mysecretpassword - KEYCHAIN_PROFILE: - required: false - default: build-profile XC_WORKSPACE: required: false default: Kiwix.xcodeproj/project.xcworkspace/ diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 74d0e1ab4..30432f634 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -9,6 +9,12 @@ name: CD # |-----------------|---------|------------------------|----------------|---------------------| # | UPLOAD_FOLDER | nightly | - | - | release/kiwix-macos | # |-----------------|---------|------------------------|----------------|---------------------| + +# Signing certificates: +# - iOS/macOS + app-store: Apple Distribution +# - iOS + FTP: Apple Development +# - macOS + FTP: Developer ID + on: schedule: - cron: '32 1 * * *' # Nightly download.kiwix.org @ 01:32 @@ -52,6 +58,11 @@ jobs: - name: Install python dependencies run: pip install pyyaml==6.0.1 + # https://developer.apple.com/help/account/reference/supported-capabilities-macos + - name: Remove In App Purchase capability for macOS FTP (Developer ID signing) + if: matrix.platform == 'macOS' && matrix.destination == 'ftp' + run: sed -i '' '/in-app-payments/d' project.yml + - name: Set VERSION from code shell: python run: | @@ -111,8 +122,8 @@ jobs: if: matrix.platform == 'iOS' && contains(env.UPLOAD_TO, matrix.destination) run: echo "EXTRA_XCODEBUILD=-sdk iphoneos ${{ env.APPLE_AUTH_PARAMS }}" >> $GITHUB_ENV - - name: Set EXTRA_XCODEBUILD for macOS AppStore - if: matrix.platform == 'macOS' && matrix.destination == 'app-store' + - name: Set macOS extra xcode params + if: matrix.platform == 'macOS' && contains(env.UPLOAD_TO, matrix.destination) run: echo "EXTRA_XCODEBUILD=${{ env.APPLE_AUTH_PARAMS }}" >> $GITHUB_ENV - name: Set macOS FTP export method, and Developer ID Certificate @@ -150,7 +161,6 @@ jobs: DEPLOYMENT_SIGNING_CERTIFICATE_P12_PASSWORD: ${{ env.SIGNING_CERTIFICATE_P12_PASSWORD }} KEYCHAIN: ${{ env.KEYCHAIN }} KEYCHAIN_PASSWORD: ${{ env.KEYCHAIN_PASSWORD }} - KEYCHAIN_PROFILE: ${{ env.KEYCHAIN_PROFILE }} EXTRA_XCODEBUILD: ${{ env.EXTRA_XCODEBUILD }} - name: Add altool credentials to Keychain From 64b2c49cd548c0ce6d2f4baa42bc96ff5d69f4c0 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Sun, 12 Jan 2025 11:46:21 +0100 Subject: [PATCH 2/4] Conditionally remove support link for macOS FTP --- App/App_macOS.swift | 2 +- Model/Brand.swift | 5 +++++ project.yml | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/App/App_macOS.swift b/App/App_macOS.swift index f7c48b887..9265b0246 100644 --- a/App/App_macOS.swift +++ b/App/App_macOS.swift @@ -196,7 +196,7 @@ struct RootView: View { } .frame(minWidth: 160) .safeAreaInset(edge: .bottom) { - if Payment.paymentButtonType() != nil { + if Payment.paymentButtonType() != nil && Brand.supportDonationVisible { SupportKiwixButton { openWindow(id: "donation") } diff --git a/Model/Brand.swift b/Model/Brand.swift index d9a13055a..41ed89470 100644 --- a/Model/Brand.swift +++ b/Model/Brand.swift @@ -51,6 +51,10 @@ enum Brand { static let aboutText: String = Config.value(for: .aboutText) ?? "settings.about.description".localized static let aboutWebsite: String = Config.value(for: .aboutWebsite) ?? "https://www.kiwix.org" + // currently only used by Kiwix brand + // if this is missing from project.yml we fall back to true + // and hide the support for donation (for macOS FTP) + static let supportDonationVisible: Bool = Config.value(for: .supportDonationVisible) ?? false static var defaultExternalLinkPolicy: ExternalLinkLoadingPolicy { guard let policyString: String = Config.value(for: .externalLinkDefaultPolicy), @@ -81,6 +85,7 @@ enum Config: String { case showSearchSnippetInSettings = "SETTINGS_SHOW_SEARCH_SNIPPET" case aboutText = "CUSTOM_ABOUT_TEXT" case aboutWebsite = "CUSTOM_ABOUT_WEBSITE" + case supportDonationVisible = "SUPPORT_DONATION_VISIBLE" static func value(for key: Config) -> T? where T: LosslessStringConvertible { guard let object = Bundle.main.object(forInfoDictionaryKey: key.rawValue) else { diff --git a/project.yml b/project.yml index 796a2db5e..7ccfe5ea9 100644 --- a/project.yml +++ b/project.yml @@ -98,7 +98,7 @@ targets: entitlements: properties: com.apple.security.files.downloads.read-write: true - com.apple.developer.in-app-payments: [merchant.org.kiwix.apple] + com.apple.developer.in-app-payments: [merchant.org.kiwix.apple] # this line is removed for macOS FTP settings: base: MARKETING_VERSION: "3.7.0" @@ -106,6 +106,7 @@ targets: INFOPLIST_KEY_CFBundleDisplayName: Kiwix INFOPLIST_FILE: Support/Info.plist INFOPLIST_KEY_UILaunchStoryboardName: SplashScreenKiwix.storyboard + SUPPORT_DONATION_VISIBLE: true # this line is removed for macOS FTP, where the donation pop up is hidden (not supported) sources: - path: Support excludes: From d50d8e2c240760f86df34f0adbe9a683ce1129f2 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Sun, 12 Jan 2025 12:31:01 +0100 Subject: [PATCH 3/4] Add Visibility for support donation --- .github/workflows/cd.yml | 4 +++- App/App_macOS.swift | 2 +- Model/Brand.swift | 4 ++-- project.yml | 1 - 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 30432f634..36fcdbb3a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -61,7 +61,9 @@ jobs: # https://developer.apple.com/help/account/reference/supported-capabilities-macos - name: Remove In App Purchase capability for macOS FTP (Developer ID signing) if: matrix.platform == 'macOS' && matrix.destination == 'ftp' - run: sed -i '' '/in-app-payments/d' project.yml + run: | + sed -i '' '/in-app-payments/d' project.yml + plutil -insert HIDE_DONATION -bool true Support/Info.plist - name: Set VERSION from code shell: python diff --git a/App/App_macOS.swift b/App/App_macOS.swift index 9265b0246..52bee99e9 100644 --- a/App/App_macOS.swift +++ b/App/App_macOS.swift @@ -196,7 +196,7 @@ struct RootView: View { } .frame(minWidth: 160) .safeAreaInset(edge: .bottom) { - if Payment.paymentButtonType() != nil && Brand.supportDonationVisible { + if Payment.paymentButtonType() != nil && Brand.hideDonation != true { SupportKiwixButton { openWindow(id: "donation") } diff --git a/Model/Brand.swift b/Model/Brand.swift index 41ed89470..4452e4093 100644 --- a/Model/Brand.swift +++ b/Model/Brand.swift @@ -54,7 +54,7 @@ enum Brand { // currently only used by Kiwix brand // if this is missing from project.yml we fall back to true // and hide the support for donation (for macOS FTP) - static let supportDonationVisible: Bool = Config.value(for: .supportDonationVisible) ?? false + static let hideDonation: Bool = Config.value(for: .hideDonation) ?? false static var defaultExternalLinkPolicy: ExternalLinkLoadingPolicy { guard let policyString: String = Config.value(for: .externalLinkDefaultPolicy), @@ -85,7 +85,7 @@ enum Config: String { case showSearchSnippetInSettings = "SETTINGS_SHOW_SEARCH_SNIPPET" case aboutText = "CUSTOM_ABOUT_TEXT" case aboutWebsite = "CUSTOM_ABOUT_WEBSITE" - case supportDonationVisible = "SUPPORT_DONATION_VISIBLE" + case hideDonation = "HIDE_DONATION" static func value(for key: Config) -> T? where T: LosslessStringConvertible { guard let object = Bundle.main.object(forInfoDictionaryKey: key.rawValue) else { diff --git a/project.yml b/project.yml index 7ccfe5ea9..2136e4c57 100644 --- a/project.yml +++ b/project.yml @@ -106,7 +106,6 @@ targets: INFOPLIST_KEY_CFBundleDisplayName: Kiwix INFOPLIST_FILE: Support/Info.plist INFOPLIST_KEY_UILaunchStoryboardName: SplashScreenKiwix.storyboard - SUPPORT_DONATION_VISIBLE: true # this line is removed for macOS FTP, where the donation pop up is hidden (not supported) sources: - path: Support excludes: From 54464176abd466e6f1c51c5097f353709f262ccd Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Sun, 12 Jan 2025 12:33:33 +0100 Subject: [PATCH 4/4] Update docs --- Model/Brand.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Model/Brand.swift b/Model/Brand.swift index 4452e4093..26a8c636a 100644 --- a/Model/Brand.swift +++ b/Model/Brand.swift @@ -51,9 +51,10 @@ enum Brand { static let aboutText: String = Config.value(for: .aboutText) ?? "settings.about.description".localized static let aboutWebsite: String = Config.value(for: .aboutWebsite) ?? "https://www.kiwix.org" - // currently only used by Kiwix brand - // if this is missing from project.yml we fall back to true - // and hide the support for donation (for macOS FTP) + // currently only used under the Kiwix brand + // if this is set to true in Support/Info.plist the support/donation button is hidden (for macOS FTP) + // if not set, we fall back to false, and display the support/donation button + // for non Kiwix brands, it has no effect static let hideDonation: Bool = Config.value(for: .hideDonation) ?? false static var defaultExternalLinkPolicy: ExternalLinkLoadingPolicy {