From 2f00a64565832d413584519adbdb779ae9a2d791 Mon Sep 17 00:00:00 2001 From: Ermat Date: Tue, 24 Oct 2023 18:57:21 +0600 Subject: [PATCH] Enable duplicate production build for testers --- .github/workflows/deploy_appstore.yml | 1 + .github/workflows/deploy_test_flight.yml | 77 +++++++++++++++++++ .../Development.template.xcconfig | 1 + .../Production.template.xcconfig | 1 + .../Adapters/Evm/EvmTransactionsAdapter.swift | 2 +- .../Tron/TronTransactionAdapter.swift | 2 +- .../Core/Providers/AppConfig.swift | 4 + .../UnstoppableWallet/Info.plist | 4 +- .../Transactions/TransactionTypeFilter.swift | 9 ++- .../WalletTokenBalanceViewItemFactory.swift | 2 +- .../Wallet/WalletViewItemFactory.swift | 2 +- fastlane/Fastfile | 2 + 12 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/deploy_test_flight.yml diff --git a/.github/workflows/deploy_appstore.yml b/.github/workflows/deploy_appstore.yml index 49f913919b..10d9b63b4f 100644 --- a/.github/workflows/deploy_appstore.yml +++ b/.github/workflows/deploy_appstore.yml @@ -56,6 +56,7 @@ jobs: APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }} APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }} + XCCONFIG_PROD_SWAP_ENABLED: false XCCONFIG_PROD_INFURA_PROJECT_ID: ${{ secrets.XCCONFIG_PROD_INFURA_PROJECT_ID }} XCCONFIG_PROD_INFURA_PROJECT_SECRET: ${{ secrets.XCCONFIG_PROD_INFURA_PROJECT_SECRET }} XCCONFIG_PROD_ETHERSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_ETHERSCAN_API_KEY }} diff --git a/.github/workflows/deploy_test_flight.yml b/.github/workflows/deploy_test_flight.yml new file mode 100644 index 0000000000..758a8e4295 --- /dev/null +++ b/.github/workflows/deploy_test_flight.yml @@ -0,0 +1,77 @@ +name: Deploy Production to TestFlight Testers + +on: + push: + branches: [ master ] + workflow_dispatch: + +jobs: + build_and_deploy: + name: Build and Deploy to TestFlight Testers + runs-on: macos-12 + + steps: + - name: Setup Xcode to 14.2 + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '14.2' + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Ruby v3 + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.0.2 + + - name: Setup Rust and Cargo + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - name: Install Lipo via Cargo + run: cargo install cargo-lipo + + - name: Add iOS targets to Rust + run: rustup target add aarch64-apple-ios x86_64-apple-ios + + - name: Run Fastlane (build, upload to TestFlight) + uses: maierj/fastlane-action@v2.0.1 + with: + lane: release + env: + BUILD_NUMBER: ${{ github.run_number }}.tf + APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }} + APP_ID: ${{ secrets.APP_ID }} + APP_IDENTIFIER_RELEASE: ${{ secrets.APP_IDENTIFIER_RELEASE }} + DEVELOPER_PORTAL_TEAM_ID: ${{ secrets.DEVELOPER_PORTAL_TEAM_ID }} + FASTLANE_APPLE_ID: ${{ secrets.FASTLANE_APPLE_ID }} + FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + GIT_AUTHORIZATION: ${{ secrets.GIT_AUTHORIZATION }} + PROVISIONING_PROFILE_SPECIFIER_APPSTORE: ${{ secrets.PROVISIONING_PROFILE_SPECIFIER_APPSTORE }} + TEMP_KEYCHAIN_PASSWORD: ${{ secrets.TEMP_KEYCHAIN_PASSWORD }} + TEMP_KEYCHAIN_USER: ${{ secrets.TEMP_KEYCHAIN_USER }} + APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }} + APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }} + APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }} + + XCCONFIG_PROD_SWAP_ENABLED: true + XCCONFIG_PROD_INFURA_PROJECT_ID: ${{ secrets.XCCONFIG_PROD_INFURA_PROJECT_ID }} + XCCONFIG_PROD_INFURA_PROJECT_SECRET: ${{ secrets.XCCONFIG_PROD_INFURA_PROJECT_SECRET }} + XCCONFIG_PROD_ETHERSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_ETHERSCAN_API_KEY }} + XCCONFIG_PROD_ARBISCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_ARBISCAN_API_KEY }} + XCCONFIG_PROD_OPTIMISM_ETHERSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_OPTIMISM_ETHERSCAN_API_KEY }} + XCCONFIG_PROD_BSCSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_BSCSCAN_API_KEY }} + XCCONFIG_PROD_POLYGONSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_POLYGONSCAN_API_KEY }} + XCCONFIG_PROD_SNOWTRACE_API_KEY: ${{ secrets.XCCONFIG_PROD_SNOWTRACE_API_KEY }} + XCCONFIG_PROD_GNOSISSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_GNOSISSCAN_API_KEY }} + XCCONFIG_PROD_FTMSCAN_API_KEY: ${{ secrets.XCCONFIG_PROD_FTMSCAN_API_KEY }} + XCCONFIG_PROD_DEFIYIELD_API_KEY: ${{ secrets.XCCONFIG_PROD_DEFIYIELD_API_KEY }} + XCCONFIG_PROD_TWITTER_BEARER_TOKEN: ${{ secrets.XCCONFIG_PROD_TWITTER_BEARER_TOKEN }} + XCCONFIG_PROD_HS_PROVIDER_API_KEY: ${{ secrets.XCCONFIG_PROD_HS_PROVIDER_API_KEY }} + XCCONFIG_PROD_WALLET_CONNECT_V2_PROJECT_KEY: ${{ secrets.XCCONFIG_PROD_WALLET_CONNECT_V2_PROJECT_KEY }} + XCCONFIG_PROD_OPEN_SEA_API_KEY: ${{ secrets.XCCONFIG_PROD_OPEN_SEA_API_KEY }} + XCCONFIG_PROD_TRONGRID_API_KEY: ${{ secrets.XCCONFIG_PROD_TRONGRID_API_KEY }} + XCCONFIG_PROD_UNSTOPPABLE_DOMAINS_API_KEY: ${{ secrets.XCCONFIG_PROD_UNSTOPPABLE_DOMAINS_API_KEY }} + XCCONFIG_PROD_ONE_INCH_API_KEY: ${{ secrets.XCCONFIG_PROD_ONE_INCH_API_KEY }} diff --git a/UnstoppableWallet/UnstoppableWallet/Configuration/Development.template.xcconfig b/UnstoppableWallet/UnstoppableWallet/Configuration/Development.template.xcconfig index d9c8238510..d839724610 100644 --- a/UnstoppableWallet/UnstoppableWallet/Configuration/Development.template.xcconfig +++ b/UnstoppableWallet/UnstoppableWallet/Configuration/Development.template.xcconfig @@ -19,5 +19,6 @@ private_cloud_container_id = iCloud.io.horizontalsystems.bank-wallet.dev open_sea_api_key = unstoppable_domains_api_key = one_inch_api_key = +swap_enabled = true default_words = diff --git a/UnstoppableWallet/UnstoppableWallet/Configuration/Production.template.xcconfig b/UnstoppableWallet/UnstoppableWallet/Configuration/Production.template.xcconfig index 576878fb05..e4536da3c9 100644 --- a/UnstoppableWallet/UnstoppableWallet/Configuration/Production.template.xcconfig +++ b/UnstoppableWallet/UnstoppableWallet/Configuration/Production.template.xcconfig @@ -19,3 +19,4 @@ private_cloud_container_id = iCloud.io.horizontalsystems.bank-wallet open_sea_api_key = unstoppable_domains_api_key = one_inch_api_key = +swap_enabled = true diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Evm/EvmTransactionsAdapter.swift b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Evm/EvmTransactionsAdapter.swift index 6c366be6f8..4c82f2402f 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Evm/EvmTransactionsAdapter.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Evm/EvmTransactionsAdapter.swift @@ -42,7 +42,7 @@ class EvmTransactionsAdapter: BaseEvmAdapter { case .all: () case .incoming: type = .incoming case .outgoing: type = .outgoing -// case .swap: type = .swap + case .swap: type = .swap case .approve: type = .approve } diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Tron/TronTransactionAdapter.swift b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Tron/TronTransactionAdapter.swift index ff7ec2fc83..5979fa29b2 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Tron/TronTransactionAdapter.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Adapters/Tron/TronTransactionAdapter.swift @@ -38,7 +38,7 @@ class TronTransactionsAdapter: BaseTronAdapter { case .all: () case .incoming: type = .incoming case .outgoing: type = .outgoing -// case .swap: type = .swap + case .swap: type = .swap case .approve: type = .approve } diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Providers/AppConfig.swift b/UnstoppableWallet/UnstoppableWallet/Core/Providers/AppConfig.swift index c0aada1326..2d311df8a6 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Providers/AppConfig.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Providers/AppConfig.swift @@ -153,4 +153,8 @@ struct AppConfig { (Bundle.main.object(forInfoDictionaryKey: "OpenSeaApiKey") as? String) ?? "" } + static var swapEnabled: Bool { + Bundle.main.object(forInfoDictionaryKey: "SwapEnabled") as? String == "true" + } + } diff --git a/UnstoppableWallet/UnstoppableWallet/Info.plist b/UnstoppableWallet/UnstoppableWallet/Info.plist index 6a3360b420..21ef5f94bd 100644 --- a/UnstoppableWallet/UnstoppableWallet/Info.plist +++ b/UnstoppableWallet/UnstoppableWallet/Info.plist @@ -87,7 +87,9 @@ ${ShowTestNetSwitcher} SnowtraceApiKey ${snowtrace_api_key} - TwitterBearerToken + SwapEnabled + ${swap_enabled} + TwitterBearerToken ${twitter_bearer_token} UIApplicationSceneManifest diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/TransactionTypeFilter.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/TransactionTypeFilter.swift index 95eaad76f6..5210461828 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/TransactionTypeFilter.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Transactions/TransactionTypeFilter.swift @@ -1,4 +1,7 @@ -enum TransactionTypeFilter: String, CaseIterable { -// case all, incoming, outgoing, swap, approve - case all, incoming, outgoing, approve +enum TransactionTypeFilter: String { + case all, incoming, outgoing, swap, approve + + static var allCases: [TransactionTypeFilter] { + AppConfig.swapEnabled ? [all, incoming, outgoing, swap, approve] : [all, incoming, outgoing, approve] + } } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Token/DataSources/WalletTokenBalance/WalletTokenBalanceViewItemFactory.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Token/DataSources/WalletTokenBalance/WalletTokenBalanceViewItemFactory.swift index 577304d5f2..54fec63d29 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Token/DataSources/WalletTokenBalance/WalletTokenBalanceViewItemFactory.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Token/DataSources/WalletTokenBalance/WalletTokenBalanceViewItemFactory.swift @@ -25,7 +25,7 @@ class WalletTokenBalanceViewItemFactory { buttons[.send] = sendButtonState buttons[.receive] = .enabled - if wallet.token.swappable { + if AppConfig.swapEnabled, wallet.token.swappable { buttons[.swap] = sendButtonState } } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/WalletViewItemFactory.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/WalletViewItemFactory.swift index e656e0ab3e..0d8af6bb32 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/WalletViewItemFactory.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/WalletViewItemFactory.swift @@ -152,7 +152,7 @@ class WalletViewItemFactory { return [ .send: .enabled, .receive: .enabled, - .swap: .enabled + .swap: AppConfig.swapEnabled ? .enabled : .hidden ] case .evmAddress, .tronAddress: return [:] } diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5a3bf55ff6..08d88d536a 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -32,6 +32,7 @@ XCCONFIG_DEV_TRONGRID_API_KEY = ENV["XCCONFIG_DEV_TRONGRID_API_KEY"] XCCONFIG_DEV_UNSTOPPABLE_DOMAINS_API_KEY = ENV["XCCONFIG_DEV_UNSTOPPABLE_DOMAINS_API_KEY"] XCCONFIG_DEV_ONE_INCH_API_KEY = ENV["XCCONFIG_DEV_ONE_INCH_API_KEY"] +XCCONFIG_PROD_SWAP_ENABLED = ENV["XCCONFIG_PROD_SWAP_ENABLED"] XCCONFIG_PROD_INFURA_PROJECT_ID = ENV["XCCONFIG_PROD_INFURA_PROJECT_ID"] XCCONFIG_PROD_INFURA_PROJECT_SECRET = ENV["XCCONFIG_PROD_INFURA_PROJECT_SECRET"] XCCONFIG_PROD_ETHERSCAN_API_KEY = ENV["XCCONFIG_PROD_ETHERSCAN_API_KEY"] @@ -129,6 +130,7 @@ def apply_dev_xcconfig end def apply_prod_xcconfig + update_prod_xcconfig('swap_enabled', XCCONFIG_PROD_SWAP_ENABLED) update_prod_xcconfig('infura_project_id', XCCONFIG_PROD_INFURA_PROJECT_ID) update_prod_xcconfig('infura_project_secret', XCCONFIG_PROD_INFURA_PROJECT_SECRET) update_prod_xcconfig('etherscan_api_key', XCCONFIG_PROD_ETHERSCAN_API_KEY)