Skip to content

Commit

Permalink
Remove Donate from MainSettings module for production builds
Browse files Browse the repository at this point in the history
  • Loading branch information
ealymbaev committed Jan 12, 2024
1 parent 9c8b269 commit fa46718
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ open_sea_api_key =
unstoppable_domains_api_key =
one_inch_api_key =
swap_enabled = true
donate_enabled = true
blockchair_api_key =

default_words =
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ open_sea_api_key =
unstoppable_domains_api_key =
one_inch_api_key =
swap_enabled = true
blockchair_api_key =
donate_enabled = true
blockchair_api_key =
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ enum AppConfig {
Bundle.main.object(forInfoDictionaryKey: "SwapEnabled") as? String == "true"
}

static var donateEnabled: Bool {
Bundle.main.object(forInfoDictionaryKey: "DonateEnabled") as? String == "true"
}

static var blockchairApiKey: String {
(Bundle.main.object(forInfoDictionaryKey: "BlockchairApiKey") as? String) ?? ""
}
Expand Down
2 changes: 2 additions & 0 deletions UnstoppableWallet/UnstoppableWallet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
<string>${default_words}</string>
<key>DefiYieldApiKey</key>
<string>$(defiyield_api_key)</string>
<key>DonateEnabled</key>
<string>${donate_enabled}</string>
<key>EtherscanApiKey</key>
<string>${etherscan_api_key}</string>
<key>FtmscanApiKey</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,7 @@ class MainSettingsViewController: ThemeViewController {
extension MainSettingsViewController: SectionsDataSource {
func buildSections() -> [SectionProtocol] {
var sections: [SectionProtocol] = [
Section(id: "donate", headerState: .margin(height: .margin12), rows: donateRows),
Section(id: "account", headerState: .margin(height: .margin32), rows: accountRows),
Section(id: "account", headerState: .margin(height: AppConfig.donateEnabled ? .margin32 : .margin12), rows: accountRows),
Section(id: "wallet_connect", headerState: .margin(height: .margin32), rows: walletConnectRows),
Section(id: "appearance_settings", headerState: .margin(height: .margin32), rows: appearanceRows),
Section(id: "knowledge", headerState: .margin(height: .margin32), rows: knowledgeRows),
Expand All @@ -489,6 +488,10 @@ extension MainSettingsViewController: SectionsDataSource {
Section(id: "footer", headerState: .margin(height: .margin32), footerState: .margin(height: .margin32), rows: footerRows),
]

if AppConfig.donateEnabled {
sections.insert(Section(id: "donate", headerState: .margin(height: .margin12), rows: donateRows), at: 0)
}

if showTestNetSwitcher {
sections.append(
Section(
Expand Down
8 changes: 4 additions & 4 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ XCCONFIG_DEV_UNSTOPPABLE_DOMAINS_API_KEY = ENV["XCCONFIG_DEV_UNSTOPPABLE_DOMAINS
XCCONFIG_DEV_ONE_INCH_API_KEY = ENV["XCCONFIG_DEV_ONE_INCH_API_KEY"]
XCCONFIG_DEV_BLOCKCHAIR_API_KEY = ENV["XCCONFIG_DEV_BLOCKCHAIR_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"]
Expand Down Expand Up @@ -133,8 +132,9 @@ def apply_dev_xcconfig
update_dev_xcconfig('blockchair_api_key', XCCONFIG_DEV_BLOCKCHAIR_API_KEY)
end

def apply_prod_xcconfig(swap_enabled)
def apply_prod_xcconfig(swap_enabled, donate_enabled)
update_prod_xcconfig('swap_enabled', swap_enabled)
update_prod_xcconfig('donate_enabled', donate_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)
Expand Down Expand Up @@ -241,7 +241,7 @@ platform :ios do
api_key = app_store_api_key

prepare_environment(false)
apply_prod_xcconfig('false')
apply_prod_xcconfig('false', 'false')

match(
type: 'appstore',
Expand All @@ -256,7 +256,7 @@ platform :ios do
deploy_production

prepare_environment(true)
apply_prod_xcconfig('true')
apply_prod_xcconfig('true', 'true')

deploy_production

Expand Down

0 comments on commit fa46718

Please sign in to comment.