Skip to content

Commit

Permalink
Merge branch 'hotfix/1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
RealBonus committed Aug 14, 2018
2 parents f608602 + 17a4ac2 commit 1224972
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Adamant/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.0</string>
<string>1.1.1</string>
<key>CFBundleVersion</key>
<string>46</string>
<string>47</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
Expand Down
3 changes: 2 additions & 1 deletion Adamant/Stories/Account/AccountViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,8 @@ extension AccountViewController: AccountHeaderViewDelegate {
tableView.deselectRow(at: indexPath, animated: true)
}

dialogService.presentShareAlertFor(string: address,
let encodedAddress = AdamantUriTools.encode(request: AdamantUri.address(address: address, params: nil))
dialogService.presentShareAlertFor(string: encodedAddress,
types: [.copyToPasteboard, .share, .generateQr(sharingTip: address)],
excludedActivityTypes: ShareContentType.address.excludedActivityTypes,
animated: true,
Expand Down
39 changes: 32 additions & 7 deletions Adamant/Stories/Chats/NewChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ class NewChatViewController: FormViewController {
}.cellUpdate { (cell, _) in
cell.textLabel?.textColor = UIColor.adamant.primary
}.onCellSelection { [weak self] (cell, row) in
switch AdamantQRTools.generateQrFrom(string: address) {
let encodedAddress = AdamantUriTools.encode(request: AdamantUri.address(address: address, params: nil))
switch AdamantQRTools.generateQrFrom(string: encodedAddress) {
case .success(let qr):
guard let vc = self?.router.get(scene: AdamantScene.Shared.shareQr) as? ShareQrViewController else {
fatalError("Can't find ShareQrViewController")
Expand Down Expand Up @@ -385,15 +386,39 @@ extension NewChatViewController {
// MARK: - QRCodeReaderViewControllerDelegate
extension NewChatViewController: QRCodeReaderViewControllerDelegate {
func reader(_ reader: QRCodeReaderViewController, didScanResult result: QRCodeReaderResult) {
guard let uri = AdamantUriTools.decode(uri: result.value) else {
dialogService.showWarning(withMessage: String.adamantLocalized.newChat.wrongQrError)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
reader.startScanning()
let address: String?
var name: String? = nil

if let uri = AdamantUriTools.decode(uri: result.value) {
switch uri {
case .address(address: let addr, params: let params):
address = addr

if let params = params {
for param in params {
switch param {
case .label(let label):
name = label
break
}
}
}

case .passphrase(_):
address = nil
}
} else {
switch AdamantUtilities.validateAdamantAddress(address: result.value) {
case .valid, .system:
address = result.value

case .invalid:
address = nil
}
return
}

if startNewChat(with: uri) {
if let address = address {
startNewChat(with: address, name: name)
dismiss(animated: true, completion: nil)
} else {
dialogService.showWarning(withMessage: String.adamantLocalized.newChat.wrongQrError)
Expand Down

0 comments on commit 1224972

Please sign in to comment.