Skip to content

Commit

Permalink
new deeplink format
Browse files Browse the repository at this point in the history
  • Loading branch information
sidorov-panda committed Mar 11, 2020
1 parent d97f715 commit 1ae2ccd
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 64 deletions.
14 changes: 10 additions & 4 deletions MinterWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@
FA8AE85820AAD3E900F26E11 /* Session.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8AE85720AAD3E900F26E11 /* Session.swift */; };
FA8AE85B20AC196800F26E11 /* SessionHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8AE85A20AC196800F26E11 /* SessionHelper.swift */; };
FA8AE85D20AC638900F26E11 /* String+Random.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8AE85C20AC638900F26E11 /* String+Random.swift */; };
FA9307742418F624003C2E24 /* Data+Base64URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA9307732418F624003C2E24 /* Data+Base64URL.swift */; };
FA9307752418F624003C2E24 /* Data+Base64URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA9307732418F624003C2E24 /* Data+Base64URL.swift */; };
FA97F9E8237AFDB300A4828B /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA333095224A4F1D003B4763 /* Configuration.swift */; };
FA9A6E51209B1D5D0012AC96 /* SHA3+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA9A6E50209B1D5D0012AC96 /* SHA3+String.swift */; };
FA9BBCC822A9512B0030E92E /* AddressManager+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA9BBCC722A9512B0030E92E /* AddressManager+Rx.swift */; };
Expand Down Expand Up @@ -802,6 +804,7 @@
FA8AE85720AAD3E900F26E11 /* Session.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Session.swift; sourceTree = "<group>"; };
FA8AE85A20AC196800F26E11 /* SessionHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionHelper.swift; sourceTree = "<group>"; };
FA8AE85C20AC638900F26E11 /* String+Random.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Random.swift"; sourceTree = "<group>"; };
FA9307732418F624003C2E24 /* Data+Base64URL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Data+Base64URL.swift"; sourceTree = "<group>"; };
FA9A6E50209B1D5D0012AC96 /* SHA3+String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SHA3+String.swift"; sourceTree = "<group>"; };
FA9BBCC722A9512B0030E92E /* AddressManager+Rx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AddressManager+Rx.swift"; sourceTree = "<group>"; };
FA9BE30A213FE7E0002160F3 /* AnalyticsEvents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsEvents.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1912,6 +1915,7 @@
FA64E280234770EF00436BFE /* RawTransaction+RLPDecodable.swift */,
FA39488023507BB2002AD8DE /* UIApplication+AppDelegate.swift */,
FA5DB808236198C7008A8E47 /* ImpactProtocol.swift */,
FA9307732418F624003C2E24 /* Data+Base64URL.swift */,
);
path = Helper;
sourceTree = "<group>";
Expand Down Expand Up @@ -3078,6 +3082,7 @@
FA333020224A4B3C003B4763 /* TransactionsViewController.swift in Sources */,
FA333021224A4B3C003B4763 /* QRCodeReaderViewController.swift in Sources */,
FA333022224A4B3C003B4763 /* GenerateAddressSeedTableViewCell.swift in Sources */,
FA9307742418F624003C2E24 /* Data+Base64URL.swift in Sources */,
FA333023224A4B3C003B4763 /* AuthManager+Rx.swift in Sources */,
FA294E9A2294012D00382D82 /* ActivityRouter.swift in Sources */,
FAC6DDF7233A146000A7E650 /* RawTransactionViewModel.swift in Sources */,
Expand Down Expand Up @@ -3301,6 +3306,7 @@
833CF747F604B61E37401C11 /* TransactionsViewController.swift in Sources */,
FA0F296721B1740800E10F5E /* QRCodeReaderViewController.swift in Sources */,
FAA2608320935E8B009FF3DE /* GenerateAddressSeedTableViewCell.swift in Sources */,
FA9307752418F624003C2E24 /* Data+Base64URL.swift in Sources */,
FA17816F21EF455300FECDED /* AuthManager+Rx.swift in Sources */,
FA294E9B2294012D00382D82 /* ActivityRouter.swift in Sources */,
FAC6DDF8233A146000A7E650 /* RawTransactionViewModel.swift in Sources */,
Expand Down Expand Up @@ -3438,7 +3444,7 @@
CODE_SIGN_ENTITLEMENTS = MinterWallet/MinterWallet.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 251;
CURRENT_PROJECT_VERSION = 252;
DEVELOPMENT_TEAM = A26H28FPZU;
ENABLE_BITCODE = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -3452,7 +3458,7 @@
INFOPLIST_FILE = "$(SRCROOT)/MinterWallet/MinterWallet-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0.24;
MARKETING_VERSION = 1.0.25;
PRODUCT_BUNDLE_IDENTIFIER = MNT.BipWallet;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -3473,7 +3479,7 @@
CODE_SIGN_ENTITLEMENTS = MinterWallet/MinterWallet.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 251;
CURRENT_PROJECT_VERSION = 252;
DEVELOPMENT_TEAM = A26H28FPZU;
ENABLE_BITCODE = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -3487,7 +3493,7 @@
INFOPLIST_FILE = "$(SRCROOT)/MinterWallet/MinterWallet-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0.24;
MARKETING_VERSION = 1.0.25;
PRODUCT_BUNDLE_IDENTIFIER = MNT.BipWallet;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
57 changes: 57 additions & 0 deletions MinterWallet/Classes/Common/Helper/Data+Base64URL.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// Data+Base64URL.swift
// MinterWallet
//
// Created by Alexey Sidorov on 11.03.2020.
// Copyright © 2020 Minter. All rights reserved.
//

import Foundation

/// Extension for making base64 representations of `Data` safe for
/// transmitting via URL query parameters
extension Data {

/// Instantiates data by decoding a base64url string into base64
///
/// - Parameter string: A base64url encoded string
init?(base64URLEncoded string: String) {
self.init(base64Encoded: string.toggleBase64URLSafe(on: false))
}

/// Encodes the string into a base64url safe representation
///
/// - Returns: A string that is base64 encoded but made safe for passing
/// in as a query parameter into a URL string
func base64URLEncodedString() -> String {
return self.base64EncodedString().toggleBase64URLSafe(on: true)
}

}

extension String {

/// Encodes or decodes into a base64url safe representation
///
/// - Parameter on: Whether or not the string should be made safe for URL strings
/// - Returns: if `on`, then a base64url string; if `off` then a base64 string
func toggleBase64URLSafe(on: Bool) -> String {
if on {
// Make base64 string safe for passing into URL query params
let base64url = self.replacingOccurrences(of: "/", with: "_")
.replacingOccurrences(of: "+", with: "-")
.replacingOccurrences(of: "=", with: "")
return base64url
} else {
// Return to base64 encoding
var base64 = self.replacingOccurrences(of: "_", with: "/")
.replacingOccurrences(of: "-", with: "+")
// Add any necessary padding with `=`
if base64.count % 4 != 0 {
base64.append(String(repeating: "=", count: 4 - base64.count % 4))
}
return base64
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class SystemTransactionTableViewCellItem: TransactionCellItem {
var image: UIImage?
var date: String?
var time: String?
var amount: String?
}

class SystemTransactionTableViewCell: BaseTransactionCell {
Expand Down Expand Up @@ -45,6 +46,7 @@ class SystemTransactionTableViewCell: BaseTransactionCell {
@IBOutlet weak var timeLabel: UILabel!
@IBOutlet weak var dateLabel: UILabel!
@IBOutlet weak var explorerButton: DefaultButton!
@IBOutlet weak var amountLabel: UILabel!

// MARK: -

Expand Down Expand Up @@ -73,6 +75,7 @@ class SystemTransactionTableViewCell: BaseTransactionCell {
self.mainTitleLabel.text = item.title
self.dateLabel.text = item.date
self.timeLabel.text = item.time
self.amountLabel.text = item.amount
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
<array key="Ubuntu-B.ttf">
<string>Ubuntu-Bold</string>
</array>
<array key="Ubuntu-M.ttf">
<string>Ubuntu-Medium</string>
</array>
<array key="Ubuntu-R.ttf">
<string>Ubuntu</string>
</array>
Expand All @@ -27,7 +28,7 @@
<rect key="frame" x="0.0" y="0.0" width="1117" height="265"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Aj1-v8-tb1" id="flJ-RI-I5x">
<rect key="frame" x="0.0" y="0.0" width="1117" height="264.5"/>
<rect key="frame" x="0.0" y="0.0" width="1117" height="265"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BSj-cn-xAt">
Expand Down Expand Up @@ -60,34 +61,34 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="53d-2s-FoU">
<rect key="frame" x="0.0" y="52" width="1117" height="212.5"/>
<rect key="frame" x="0.0" y="52" width="1117" height="213"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Date" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xna-63-Ina">
<rect key="frame" x="20" y="20" width="25.5" height="76.5"/>
<rect key="frame" x="20" y="20" width="26.5" height="80"/>
<fontDescription key="fontDescription" name="Ubuntu" family="Ubuntu" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" text="16 March 2018" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8VJ-3D-Jk1">
<rect key="frame" x="20" y="100.5" width="121" height="21"/>
<rect key="frame" x="20" y="104" width="117" height="18"/>
<fontDescription key="fontDescription" name="UbuntuMono-Bold" family="Ubuntu Mono" pointSize="18"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Time" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fKJ-zk-80R">
<rect key="frame" x="588.5" y="51.5" width="27" height="14"/>
<rect key="frame" x="588.5" y="53" width="27" height="14"/>
<fontDescription key="fontDescription" name="Ubuntu" family="Ubuntu" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="18:34:53" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qOX-1C-MTT">
<rect key="frame" x="588.5" y="69.5" width="70.5" height="21"/>
<rect key="frame" x="588.5" y="71" width="72" height="18"/>
<fontDescription key="fontDescription" name="UbuntuMono-Bold" family="Ubuntu Mono" pointSize="18"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ORa-hs-iLf" customClass="DefaultButton" customModule="MinterWallet" customModuleProvider="target">
<rect key="frame" x="10" y="142.5" width="1097" height="50"/>
<rect key="frame" x="10" y="143" width="1097" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="dPD-xo-nRW"/>
</constraints>
Expand All @@ -113,21 +114,34 @@
<constraint firstItem="fKJ-zk-80R" firstAttribute="leading" secondItem="53d-2s-FoU" secondAttribute="centerX" constant="30" id="ybE-SZ-lC7"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="249" verticalHuggingPriority="251" horizontalCompressionResistancePriority="752" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fpa-Le-Rmx">
<rect key="frame" x="1107" y="6" width="0.0" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="cKc-S6-tR2"/>
</constraints>
<fontDescription key="fontDescription" name="Ubuntu-Medium" family="Ubuntu" pointSize="18"/>
<color key="textColor" red="0.20784313730000001" green="0.71372549019999998" blue="0.36078431370000003" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="Fpa-Le-Rmx" secondAttribute="trailing" constant="10" id="15w-Dt-64d"/>
<constraint firstItem="Tgq-Lc-ske" firstAttribute="leading" secondItem="BSj-cn-xAt" secondAttribute="trailing" constant="5" id="62y-gq-kuB"/>
<constraint firstAttribute="trailing" secondItem="53d-2s-FoU" secondAttribute="trailing" id="6zT-AZ-2Ie"/>
<constraint firstItem="BSj-cn-xAt" firstAttribute="top" secondItem="flJ-RI-I5x" secondAttribute="top" constant="5" id="H94-EW-8yg"/>
<constraint firstItem="53d-2s-FoU" firstAttribute="top" secondItem="flJ-RI-I5x" secondAttribute="top" constant="52" id="IKa-Tz-39Z"/>
<constraint firstItem="53d-2s-FoU" firstAttribute="leading" secondItem="flJ-RI-I5x" secondAttribute="leading" id="TgZ-x7-SiU"/>
<constraint firstItem="Fpa-Le-Rmx" firstAttribute="top" secondItem="flJ-RI-I5x" secondAttribute="top" constant="6" id="gea-vV-9xK"/>
<constraint firstItem="Tgq-Lc-ske" firstAttribute="centerY" secondItem="0sK-No-Htb" secondAttribute="centerY" id="hRv-2w-OMp"/>
<constraint firstItem="53d-2s-FoU" firstAttribute="top" secondItem="BSj-cn-xAt" secondAttribute="bottom" constant="3" id="mr3-uD-Nfm"/>
<constraint firstItem="Fpa-Le-Rmx" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Tgq-Lc-ske" secondAttribute="trailing" constant="5" id="opV-zm-Jss"/>
<constraint firstItem="BSj-cn-xAt" firstAttribute="leading" secondItem="flJ-RI-I5x" secondAttribute="leading" constant="5" id="xG8-rz-Og8"/>
<constraint firstAttribute="bottom" secondItem="53d-2s-FoU" secondAttribute="bottom" id="xxA-U9-6V2"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="nBa-xl-ZwS"/>
<connections>
<outlet property="amountLabel" destination="Fpa-Le-Rmx" id="eqv-Vj-6W9"/>
<outlet property="dateLabel" destination="8VJ-3D-Jk1" id="RjP-op-9JD"/>
<outlet property="detailView" destination="53d-2s-FoU" id="VNH-kH-0Tb"/>
<outlet property="explorerButton" destination="ORa-hs-iLf" id="TEy-Ij-DRv"/>
Expand Down
12 changes: 6 additions & 6 deletions MinterWallet/Classes/Common/ViewModel/BaseViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,25 +256,25 @@ extension TransactionViewableViewModel {
switch txType {
case .create:
transactionCellItem.title = "Create Coin"
break

case .createMultisig:
transactionCellItem.title = "Create Multisig"
break

case .declare:
transactionCellItem.title = "Declare Candidate"
break

case .editCandidate:
transactionCellItem.title = "Edit Candidate"
break

case .setCandidateOffline:
transactionCellItem.title = "Set Candidate Offline"
break

case .setCandidateOnline:
transactionCellItem.title = "Set Candidate Online"
break
default:
break
}
transactionCellItem.payload = transaction.payload
transactionCellItem.type = ""
transactionCellItem.image = UIImage(named: "systemTransactionImage")
return transactionCellItem
Expand Down
Loading

0 comments on commit 1ae2ccd

Please sign in to comment.