Skip to content

Commit

Permalink
Merge pull request #353 from Adamant-im/trello.com/c/CWnyTDnm
Browse files Browse the repository at this point in the history
[trello.com/c/CWnyTDnm] No Adelina for China
  • Loading branch information
just-software-dev authored Oct 1, 2023
2 parents 8bba0b0 + 50c3110 commit 2b595da
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Adamant/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ extension AppDelegate {
unread = true
}

if let adelina = AdamantContacts.adelina.messages["chats.welcome_message"] {
if let adelina = AdamantContacts.adelina.welcomeMessage {
_ = try? await chatProvider.fakeReceived(
message: adelina.message,
senderId: AdamantContacts.adelina.address,
Expand All @@ -535,7 +535,7 @@ extension AppDelegate {
)
}

if let exchenge = AdamantContacts.adamantExchange.messages["chats.welcome_message"] {
if let exchenge = AdamantContacts.adamantExchange.welcomeMessage {
_ = try? await chatProvider.fakeReceived(
message: exchenge.message,
senderId: AdamantContacts.adamantExchange.address,
Expand All @@ -546,7 +546,7 @@ extension AppDelegate {
)
}

if let betOnBitcoin = AdamantContacts.betOnBitcoin.messages["chats.welcome_message"] {
if let betOnBitcoin = AdamantContacts.betOnBitcoin.welcomeMessage {
_ = try? await chatProvider.fakeReceived(
message: betOnBitcoin.message,
senderId: AdamantContacts.betOnBitcoin.address,
Expand All @@ -557,7 +557,7 @@ extension AppDelegate {
)
}

if let welcome = AdamantContacts.donate.messages["chats.welcome_message"] {
if let welcome = AdamantContacts.donate.welcomeMessage {
_ = try? await chatProvider.fakeReceived(
message: welcome.message,
senderId: AdamantContacts.donate.address,
Expand All @@ -568,7 +568,7 @@ extension AppDelegate {
)
}

if let welcome = AdamantContacts.adamantWelcomeWallet.messages["chats.welcome_message"] {
if let welcome = AdamantContacts.adamantWelcomeWallet.welcomeMessage {
_ = try? await chatProvider.fakeReceived(
message: welcome.message,
senderId: AdamantContacts.adamantWelcomeWallet.name,
Expand Down
18 changes: 18 additions & 0 deletions Adamant/ServiceProtocols/DataProviders/AccountsProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ extension AdamantContacts {
}
}

var welcomeMessage: SystemMessage? {
if
let regionCode = Locale.current.regionCode,
prohibitedRegions.contains(regionCode)
{ return nil }

return messages["chats.welcome_message"]
}

var messages: [String: SystemMessage] {
switch self {
case .adamantBountyWallet, .adamantNewBountyWallet:
Expand Down Expand Up @@ -168,4 +177,13 @@ extension AdamantContacts {
)]
}
}

var prohibitedRegions: [String] {
switch self {
case .adelina:
return ["CN"]
case .adamantBountyWallet, .adamantNewBountyWallet, .adamantExchange, .betOnBitcoin, .donate, .pwaBountyBot, .adamantIco, .adamantWelcomeWallet, .adamantSupport:
return []
}
}
}

0 comments on commit 2b595da

Please sign in to comment.