diff --git a/Mixin.xcodeproj/project.pbxproj b/Mixin.xcodeproj/project.pbxproj index 212fef4898..7e58df09c4 100644 --- a/Mixin.xcodeproj/project.pbxproj +++ b/Mixin.xcodeproj/project.pbxproj @@ -556,6 +556,7 @@ 7C225E8827C4C5FE00154143 /* GroupInCommonCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C225E8627C4C5FE00154143 /* GroupInCommonCell.swift */; }; 7C225E8927C4C5FE00154143 /* GroupInCommonCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7C225E8727C4C5FE00154143 /* GroupInCommonCell.xib */; }; 7C2475C727795BC100112A30 /* DeleteAccountTableHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2475C627795BC100112A30 /* DeleteAccountTableHeaderView.swift */; }; + 7C2AC42928F2B384005F369A /* DepositNotSupportedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2AC42828F2B384005F369A /* DepositNotSupportedViewController.swift */; }; 7C2ACDAE27D73F7C00E9DDB3 /* LeftAlignedCollectionViewFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C2ACDAD27D73F7C00E9DDB3 /* LeftAlignedCollectionViewFlowLayout.swift */; }; 7C2DEFF12824FCF500758208 /* ic_time_animation_dark@3x.gif in Resources */ = {isa = PBXBuildFile; fileRef = 7C2DEFF02824FCF500758208 /* ic_time_animation_dark@3x.gif */; }; 7C2DEFF32824FF0600758208 /* ic_time_animation@3x.gif in Resources */ = {isa = PBXBuildFile; fileRef = 7C2DEFF22824FF0600758208 /* ic_time_animation@3x.gif */; }; @@ -1564,6 +1565,7 @@ 7C225E8627C4C5FE00154143 /* GroupInCommonCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupInCommonCell.swift; sourceTree = ""; }; 7C225E8727C4C5FE00154143 /* GroupInCommonCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GroupInCommonCell.xib; sourceTree = ""; }; 7C2475C627795BC100112A30 /* DeleteAccountTableHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteAccountTableHeaderView.swift; sourceTree = ""; }; + 7C2AC42828F2B384005F369A /* DepositNotSupportedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DepositNotSupportedViewController.swift; sourceTree = ""; }; 7C2ACDAD27D73F7C00E9DDB3 /* LeftAlignedCollectionViewFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftAlignedCollectionViewFlowLayout.swift; sourceTree = ""; }; 7C2DEFF02824FCF500758208 /* ic_time_animation_dark@3x.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "ic_time_animation_dark@3x.gif"; sourceTree = ""; }; 7C2DEFF22824FF0600758208 /* ic_time_animation@3x.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "ic_time_animation@3x.gif"; sourceTree = ""; }; @@ -3429,6 +3431,7 @@ DF16681D20A6F84200C45E31 /* AllTransactionsViewController.swift */, DF9E66E4205B9AF300F1A0B9 /* HiddenAssetViewController.swift */, DF5BF5601FBB2D490092AFB8 /* DepositViewController.swift */, + 7C2AC42828F2B384005F369A /* DepositNotSupportedViewController.swift */, 7B894AF2205BF8660065A1B8 /* AddressViewController.swift */, DF06D91E222FAE1300FE7FBC /* TransferOutViewController.swift */, 7B894AF4205BFC9B0065A1B8 /* NewAddressViewController.swift */, @@ -4640,6 +4643,7 @@ 7BFE47E22284394000FC4379 /* CheckmarkPeerCell.swift in Sources */, 7B369208233A43C1007321A7 /* SegmentedControl.swift in Sources */, 9427D51A25E0D42E00B1EF0E /* MusicInfoView.swift in Sources */, + 7C2AC42928F2B384005F369A /* DepositNotSupportedViewController.swift in Sources */, 7B082D1A242CACA000C5E163 /* MultipleSelectionActionView.swift in Sources */, 7BFE47DB228421D100FC4379 /* UserItemPeerViewController.swift in Sources */, 7C4C03A128532575003DE0C0 /* AddContactViewController.swift in Sources */, diff --git a/Mixin/Assets.xcassets/ic_deposit_warning.imageset/Contents.json b/Mixin/Assets.xcassets/ic_deposit_warning.imageset/Contents.json new file mode 100644 index 0000000000..5b1f7b2636 --- /dev/null +++ b/Mixin/Assets.xcassets/ic_deposit_warning.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ic_deposit_warning@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "ic_deposit_warning@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Mixin/Assets.xcassets/ic_deposit_warning.imageset/ic_deposit_warning@2x.png b/Mixin/Assets.xcassets/ic_deposit_warning.imageset/ic_deposit_warning@2x.png new file mode 100644 index 0000000000..31e3e2d634 Binary files /dev/null and b/Mixin/Assets.xcassets/ic_deposit_warning.imageset/ic_deposit_warning@2x.png differ diff --git a/Mixin/Assets.xcassets/ic_deposit_warning.imageset/ic_deposit_warning@3x.png b/Mixin/Assets.xcassets/ic_deposit_warning.imageset/ic_deposit_warning@3x.png new file mode 100644 index 0000000000..21ebe95d3c Binary files /dev/null and b/Mixin/Assets.xcassets/ic_deposit_warning.imageset/ic_deposit_warning@3x.png differ diff --git a/Mixin/Extension/URLExtension.swift b/Mixin/Extension/URLExtension.swift index 298148699e..e9d3481684 100644 --- a/Mixin/Extension/URLExtension.swift +++ b/Mixin/Extension/URLExtension.swift @@ -12,7 +12,9 @@ extension URL { static let pinTIP = URL(string: "https://tip.id")! static let deleteAccount = URL(string: "https://mixinmessenger.zendesk.com/hc/articles/4414170627988")! static let expiredMessage = URL(string: "https://mixinmessenger.zendesk.com/hc/articles/5127869180564")! - + static let deposit = URL(string: "https://mixinmessenger.zendesk.com/hc/articles/360018789931")! + static let notSupportedDeposit = URL(string: "https://mixinmessenger.zendesk.com/hc/articles/9954148870676")! + func getKeyVals() -> [String: String] { return URLComponents(url: self, resolvingAgainstBaseURL: true)?.getKeyVals() ?? [:] } diff --git a/Mixin/Resources/en.lproj/Localizable.strings b/Mixin/Resources/en.lproj/Localizable.strings index af589c7543..bdf3ea8ed8 100644 --- a/Mixin/Resources/en.lproj/Localizable.strings +++ b/Mixin/Resources/en.lproj/Localizable.strings @@ -550,6 +550,7 @@ "not_enough_partials" = "Not enough nodes return key shard"; "not_found" = "Not found"; "not_playing" = "Not playing"; +"not_supported_deposit" = "Mixin Wallet does not support the deposit for %1$@. Please note that you can continue to transfer or withdraw the deposited %2$@. Read the document to learn more"; "notification_and_confirmation" = "Notification and Confirmation"; "notification_content" = "Don't miss messages from your friends."; "notification_message_preview_description" = "Preview message text inside new message notifications."; diff --git a/Mixin/Resources/ja.lproj/Localizable.strings b/Mixin/Resources/ja.lproj/Localizable.strings index f123dc2627..9829744b6f 100644 --- a/Mixin/Resources/ja.lproj/Localizable.strings +++ b/Mixin/Resources/ja.lproj/Localizable.strings @@ -550,6 +550,7 @@ "not_enough_partials" = "Not enough nodes return key shard"; "not_found" = "見つかりません"; "not_playing" = "再生しません"; +"not_supported_deposit" = "Mixin Wallet does not support the deposit for %1$@. Please note that you can continue to transfer or withdraw the deposited %2$@. Read the document to learn more"; "notification_and_confirmation" = "通知・送金確認"; "notification_content" = "友達からのメッセージを見逃さないで!"; "notification_message_preview_description" = "通知でメッセージ内容を表示する"; diff --git a/Mixin/Resources/ru.lproj/Localizable.strings b/Mixin/Resources/ru.lproj/Localizable.strings index 224bcc6a9a..a0ae434af4 100644 --- a/Mixin/Resources/ru.lproj/Localizable.strings +++ b/Mixin/Resources/ru.lproj/Localizable.strings @@ -550,6 +550,7 @@ "not_enough_partials" = "Not enough nodes return key shard"; "not_found" = "Не найден"; "not_playing" = "Не играет"; +"not_supported_deposit" = "Mixin Wallet does not support the deposit for %1$@. Please note that you can continue to transfer or withdraw the deposited %2$@. Read the document to learn more"; "notification_and_confirmation" = "Уведомление и подтверждение"; "notification_content" = "Не пропустите сообщения от друзей."; "notification_message_preview_description" = "Предварительный просмотр текста сообщения в уведомлениях о новых сообщениях."; diff --git a/Mixin/Resources/zh-Hans.lproj/Localizable.strings b/Mixin/Resources/zh-Hans.lproj/Localizable.strings index 26501deab5..66859b5cb9 100644 --- a/Mixin/Resources/zh-Hans.lproj/Localizable.strings +++ b/Mixin/Resources/zh-Hans.lproj/Localizable.strings @@ -550,6 +550,7 @@ "not_enough_partials" = "没有足够的节点返回密钥分片"; "not_found" = "没有找到相应的消息"; "not_playing" = "未在播放"; +"not_supported_deposit" = "Mixin 钱包现已不支持 %1$@ 充值,注意已转入的 %2$@ 资产可以继续转账或提现,阅读文档了解更多"; "notification_and_confirmation" = "通知和确认"; "notification_content" = "不再遗漏好友的消息。"; "notification_message_preview_description" = "在推送通知中显示消息内容。"; diff --git a/Mixin/Resources/zh-Hant.lproj/Localizable.strings b/Mixin/Resources/zh-Hant.lproj/Localizable.strings index a6341d0747..a990b118a5 100644 --- a/Mixin/Resources/zh-Hant.lproj/Localizable.strings +++ b/Mixin/Resources/zh-Hant.lproj/Localizable.strings @@ -550,6 +550,7 @@ "not_enough_partials" = "Not enough nodes return key shard"; "not_found" = "沒有找到相應的訊息"; "not_playing" = "未在播放"; +"not_supported_deposit" = "Mixin 錢包現已不支援 %1$@ 充值,注意已轉入的 %2$@ 資產可以繼續轉賬或提現,閱讀檔案以瞭解更多"; "notification_and_confirmation" = "通知和確認"; "notification_content" = "不再遺漏好友的訊息。"; "notification_message_preview_description" = "在推送通知中顯示訊息內容。"; diff --git a/Mixin/UserInterface/Controllers/Wallet/AssetViewController.swift b/Mixin/UserInterface/Controllers/Wallet/AssetViewController.swift index d4f7517844..4a1d745ce5 100644 --- a/Mixin/UserInterface/Controllers/Wallet/AssetViewController.swift +++ b/Mixin/UserInterface/Controllers/Wallet/AssetViewController.swift @@ -104,8 +104,13 @@ extension AssetViewController: TransferActionViewDelegate { case .send: send() case .receive: - let vc = DepositViewController.instance(asset: asset) - navigationController?.pushViewController(vc, animated: true) + let controller: UIViewController + if asset.isDepositSupported { + controller = DepositViewController.instance(asset: asset) + } else { + controller = DepositNotSupportedViewController.instance(asset: asset) + } + navigationController?.pushViewController(controller, animated: true) } } diff --git a/Mixin/UserInterface/Controllers/Wallet/DepositNotSupportedViewController.swift b/Mixin/UserInterface/Controllers/Wallet/DepositNotSupportedViewController.swift new file mode 100644 index 0000000000..2c2f4d4cb7 --- /dev/null +++ b/Mixin/UserInterface/Controllers/Wallet/DepositNotSupportedViewController.swift @@ -0,0 +1,81 @@ +import UIKit +import MixinServices + +class DepositNotSupportedViewController: UIViewController { + + @IBOutlet weak var label: TextLabel! + + @IBOutlet weak var wrapperViewLeadingConstraint: NSLayoutConstraint! + @IBOutlet weak var wrapperViewTrailingConstraint: NSLayoutConstraint! + @IBOutlet weak var labelLeadingConstraint: NSLayoutConstraint! + @IBOutlet weak var labelTrailingConstraint: NSLayoutConstraint! + @IBOutlet weak var labelHeightConstraint: NSLayoutConstraint! + + private var asset: AssetItem! + + override func viewDidLoad() { + super.viewDidLoad() + container?.setSubtitle(subtitle: asset.symbol) + view.layoutIfNeeded() + + label.delegate = self + label.font = .systemFont(ofSize: 14, weight: .medium) + label.lineSpacing = 10 + label.textColor = R.color.red()! + label.linkColor = .theme + label.detectLinks = false + let text = R.string.localizable.not_supported_deposit(asset.symbol, asset.symbol) + label.text = text + let linkRange = (text as NSString).range(of: R.string.localizable.learn_more(), options: [.backwards, .caseInsensitive]) + if linkRange.location != NSNotFound && linkRange.length != 0 { + label.additionalLinksMap = [linkRange: .notSupportedDeposit] + } + } + + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + let labelWidth = view.bounds.width + - labelLeadingConstraint.constant + - labelTrailingConstraint.constant + - wrapperViewLeadingConstraint.constant + - wrapperViewTrailingConstraint.constant + let sizeToFitLabel = CGSize(width: labelWidth, height: UIView.layoutFittingExpandedSize.height) + let textLabelHeight = label.sizeThatFits(sizeToFitLabel).height + labelHeightConstraint.constant = textLabelHeight + } + + class func instance(asset: AssetItem) -> UIViewController { + let vc = R.storyboard.wallet.deposit_not_supported()! + vc.asset = asset + return ContainerViewController.instance(viewController: vc, title: R.string.localizable.deposit()) + } + +} + +extension DepositNotSupportedViewController: ContainerViewControllerDelegate { + + var prefersNavigationBarSeparatorLineHidden: Bool { + true + } + + func imageBarRightButton() -> UIImage? { + R.image.ic_titlebar_help() + } + + func barRightButtonTappedAction() { + UIApplication.shared.openURL(url: .deposit) + } + +} + +extension DepositNotSupportedViewController: CoreTextLabelDelegate { + + func coreTextLabel(_ label: CoreTextLabel, didSelectURL url: URL) { + UIApplication.shared.open(url, options: [:], completionHandler: nil) + } + + func coreTextLabel(_ label: CoreTextLabel, didLongPressOnURL url: URL) { + + } + +} diff --git a/Mixin/UserInterface/Controllers/Wallet/DepositViewController.swift b/Mixin/UserInterface/Controllers/Wallet/DepositViewController.swift index ec11ecfeda..77126be4a2 100644 --- a/Mixin/UserInterface/Controllers/Wallet/DepositViewController.swift +++ b/Mixin/UserInterface/Controllers/Wallet/DepositViewController.swift @@ -61,7 +61,7 @@ extension DepositViewController: ContainerViewControllerDelegate { } func barRightButtonTappedAction() { - UIApplication.shared.openURL(url: "https://mixinmessenger.zendesk.com/hc/articles/360018789931") + UIApplication.shared.openURL(url: .deposit) } } diff --git a/Mixin/UserInterface/Controllers/Wallet/WalletViewController.swift b/Mixin/UserInterface/Controllers/Wallet/WalletViewController.swift index b201ea7eb1..2ece7731c3 100644 --- a/Mixin/UserInterface/Controllers/Wallet/WalletViewController.swift +++ b/Mixin/UserInterface/Controllers/Wallet/WalletViewController.swift @@ -211,7 +211,11 @@ extension WalletViewController: TransferSearchViewControllerDelegate { case .send: controller = AssetViewController.instance(asset: asset, performSendOnAppear: true) case .receive: - controller = DepositViewController.instance(asset: asset) + if asset.isDepositSupported { + controller = DepositViewController.instance(asset: asset) + } else { + controller = DepositNotSupportedViewController.instance(asset: asset) + } } navigationController?.pushViewController(controller, animated: true) } diff --git a/Mixin/UserInterface/Storyboard/Wallet.storyboard b/Mixin/UserInterface/Storyboard/Wallet.storyboard index 69b02c236b..c2b9e9d8bb 100644 --- a/Mixin/UserInterface/Storyboard/Wallet.storyboard +++ b/Mixin/UserInterface/Storyboard/Wallet.storyboard @@ -1160,6 +1160,8 @@ + + @@ -1179,6 +1181,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2037,6 +2098,7 @@ + @@ -2048,7 +2110,7 @@ - + @@ -2060,7 +2122,7 @@ - + diff --git a/MixinServices/MixinServices/Database/User/Model/Asset.swift b/MixinServices/MixinServices/Database/User/Model/Asset.swift index 7658a40ea2..afe10dcc81 100644 --- a/MixinServices/MixinServices/Database/User/Model/Asset.swift +++ b/MixinServices/MixinServices/Database/User/Model/Asset.swift @@ -124,3 +124,17 @@ extension Asset { } } + +extension Asset { + + public var isDepositSupported: Bool { + !Self.depositNotSupportedAssetIds.contains(assetId) + } + + private static let depositNotSupportedAssetIds: Set = [ + "b207bce9-c248-4b8e-b6e3-e357146f3f4c", // MGD + "443e1ef5-bc9b-47d3-be77-07f328876c50", // Bytom Classic + "815b0b1a-2764-3736-8faa-42d694fa620a", // OMNI USDT + ] + +}