Skip to content

Commit

Permalink
Merge pull request #1142 from MixinNetwork/feature/deposit
Browse files Browse the repository at this point in the history
Feature/deposit_not_supported
  • Loading branch information
over140 authored Oct 17, 2022
2 parents 306824f + ea3a466 commit fa3ea9c
Show file tree
Hide file tree
Showing 16 changed files with 206 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Mixin.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 7C2DEFF02824FCF500758208 /* [email protected] */; };
7C2DEFF32824FF0600758208 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 7C2DEFF22824FF0600758208 /* [email protected] */; };
Expand Down Expand Up @@ -1564,6 +1565,7 @@
7C225E8627C4C5FE00154143 /* GroupInCommonCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupInCommonCell.swift; sourceTree = "<group>"; };
7C225E8727C4C5FE00154143 /* GroupInCommonCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GroupInCommonCell.xib; sourceTree = "<group>"; };
7C2475C627795BC100112A30 /* DeleteAccountTableHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteAccountTableHeaderView.swift; sourceTree = "<group>"; };
7C2AC42828F2B384005F369A /* DepositNotSupportedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DepositNotSupportedViewController.swift; sourceTree = "<group>"; };
7C2ACDAD27D73F7C00E9DDB3 /* LeftAlignedCollectionViewFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftAlignedCollectionViewFlowLayout.swift; sourceTree = "<group>"; };
7C2DEFF02824FCF500758208 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "[email protected]"; sourceTree = "<group>"; };
7C2DEFF22824FF0600758208 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "[email protected]"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down
22 changes: 22 additions & 0 deletions Mixin/Assets.xcassets/ic_deposit_warning.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion Mixin/Extension/URLExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() ?? [:]
}
Expand Down
1 change: 1 addition & 0 deletions Mixin/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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.";
Expand Down
1 change: 1 addition & 0 deletions Mixin/Resources/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "通知でメッセージ内容を表示する";
Expand Down
1 change: 1 addition & 0 deletions Mixin/Resources/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "Предварительный просмотр текста сообщения в уведомлениях о новых сообщениях.";
Expand Down
1 change: 1 addition & 0 deletions Mixin/Resources/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "在推送通知中显示消息内容。";
Expand Down
1 change: 1 addition & 0 deletions Mixin/Resources/zh-Hant.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "在推送通知中顯示訊息內容。";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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) {

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Loading

0 comments on commit fa3ea9c

Please sign in to comment.