added QRC view for own wallet address
This commit is contained in:
parent
5f5fa8f331
commit
be6c8c34ca
|
@ -113,6 +113,11 @@
|
|||
EEBEBBA02208D75600A6BD18 /* MemoVCDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBEBB9F2208D66600A6BD18 /* MemoVCDelegate.swift */; };
|
||||
EEBEBBA12208D75A00A6BD18 /* MemoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBEBB9C2208D60100A6BD18 /* MemoVC.swift */; };
|
||||
EEBEBBA22208D76200A6BD18 /* Memo.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EEBEBB9A2208D4FD00A6BD18 /* Memo.storyboard */; };
|
||||
EEE15B0A2270DA23008231B6 /* QRC.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EEE15B092270D93B008231B6 /* QRC.storyboard */; };
|
||||
EEE15B0D2270E736008231B6 /* QrcVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE15B0C2270E736008231B6 /* QrcVC.swift */; };
|
||||
EEE15B0F2270E89F008231B6 /* QrcVCDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE15B0E2270E89F008231B6 /* QrcVCDelegate.swift */; };
|
||||
EEE15B112270E903008231B6 /* QrcVCViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE15B102270E903008231B6 /* QrcVCViewModel.swift */; };
|
||||
EEE15B132270ECE8008231B6 /* QrcGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEE15B122270ECE8008231B6 /* QrcGenerator.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
|
@ -228,6 +233,11 @@
|
|||
EEBEBB9C2208D60100A6BD18 /* MemoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoVC.swift; sourceTree = "<group>"; };
|
||||
EEBEBB9D2208D64C00A6BD18 /* AmountVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmountVC.swift; sourceTree = "<group>"; };
|
||||
EEBEBB9F2208D66600A6BD18 /* MemoVCDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoVCDelegate.swift; sourceTree = "<group>"; };
|
||||
EEE15B092270D93B008231B6 /* QRC.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = QRC.storyboard; sourceTree = "<group>"; };
|
||||
EEE15B0C2270E736008231B6 /* QrcVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QrcVC.swift; sourceTree = "<group>"; };
|
||||
EEE15B0E2270E89F008231B6 /* QrcVCDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QrcVCDelegate.swift; sourceTree = "<group>"; };
|
||||
EEE15B102270E903008231B6 /* QrcVCViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QrcVCViewModel.swift; sourceTree = "<group>"; };
|
||||
EEE15B122270ECE8008231B6 /* QrcGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QrcGenerator.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -274,6 +284,7 @@
|
|||
EE377EB221E5303D00138385 /* ViewFactory.swift */,
|
||||
EE377ED921F4BE5500138385 /* TrxHistoryProvider.swift */,
|
||||
EE73BAD72260EC6C00A6C82C /* PaymentParser.swift */,
|
||||
EEE15B122270ECE8008231B6 /* QrcGenerator.swift */,
|
||||
);
|
||||
path = Services;
|
||||
sourceTree = "<group>";
|
||||
|
@ -439,6 +450,7 @@
|
|||
EEBEBB9A2208D4FD00A6BD18 /* Memo.storyboard */,
|
||||
EE96916F21D561BE00BE1289 /* Passphrase.storyboard */,
|
||||
EE57702C21D38A8200433CAB /* Pin.storyboard */,
|
||||
EEE15B092270D93B008231B6 /* QRC.storyboard */,
|
||||
EEBEBB7221FF8B6D00A6BD18 /* RecipientAddress.storyboard */,
|
||||
EE94A74D2214AA2100882BB1 /* Review.storyboard */,
|
||||
EEBEBB7E2200E41D00A6BD18 /* Scan.storyboard */,
|
||||
|
@ -466,6 +478,7 @@
|
|||
EE57702121CFD03500433CAB /* Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EEE15B0B2270E541008231B6 /* QRC */,
|
||||
EE4AFAAB2266528700997CE3 /* Address */,
|
||||
EEBEBB822206FB3200A6BD18 /* Amount */,
|
||||
EE377ED021F47D5200138385 /* Home */,
|
||||
|
@ -603,6 +616,16 @@
|
|||
path = Memo;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EEE15B0B2270E541008231B6 /* QRC */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EEE15B0C2270E736008231B6 /* QrcVC.swift */,
|
||||
EEE15B0E2270E89F008231B6 /* QrcVCDelegate.swift */,
|
||||
EEE15B102270E903008231B6 /* QrcVCViewModel.swift */,
|
||||
);
|
||||
path = QRC;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
|
@ -710,6 +733,7 @@
|
|||
EEBEBBA22208D76200A6BD18 /* Memo.storyboard in Resources */,
|
||||
EE76B84221D7EC3F0093571F /* Home.storyboard in Resources */,
|
||||
EE57700821CFCC5600433CAB /* LaunchScreen.storyboard in Resources */,
|
||||
EEE15B0A2270DA23008231B6 /* QRC.storyboard in Resources */,
|
||||
EEBEBB812206F81F00A6BD18 /* Amount.storyboard in Resources */,
|
||||
EE76B85E21D8D1930093571F /* SourceSansPro-ExtraLightItalic.ttf in Resources */,
|
||||
EE57700521CFCC5600433CAB /* Assets.xcassets in Resources */,
|
||||
|
@ -767,16 +791,19 @@
|
|||
EE1876A9221EE0B2004853A7 /* Payment.swift in Sources */,
|
||||
EE576FFE21CFCC5500433CAB /* AppDelegate.swift in Sources */,
|
||||
EE94A74C22135B7200882BB1 /* TrxDetailsVCDelegate.swift in Sources */,
|
||||
EEE15B0F2270E89F008231B6 /* QrcVCDelegate.swift in Sources */,
|
||||
EE377EC021E7D92200138385 /* PinEntryMode.swift in Sources */,
|
||||
EE21434D22298F8900F3902D /* UINavigationController-Extension.swift in Sources */,
|
||||
EE377EB721E6831E00138385 /* CreateNewWalletCoordinator.Delegate.swift in Sources */,
|
||||
EEBEBB7D2200E10B00A6BD18 /* ScanVCDelegate.swift in Sources */,
|
||||
EE377ED421F4827500138385 /* HomeTrxTableViewCell.swift in Sources */,
|
||||
EEE15B132270ECE8008231B6 /* QrcGenerator.swift in Sources */,
|
||||
EE377EB521E6821F00138385 /* CreateNewWalletCoordinator.swift in Sources */,
|
||||
EE377ECF21EB56AD00138385 /* ZWKeyboardLayoutConstraint.swift in Sources */,
|
||||
EEBEBB7521FF8DC800A6BD18 /* RecipientAddressVC.swift in Sources */,
|
||||
EE377EBC21E68AB000138385 /* PinVC.swift in Sources */,
|
||||
EE4AFAAF2266554100997CE3 /* AddressVCDelegate.swift in Sources */,
|
||||
EEE15B0D2270E736008231B6 /* QrcVC.swift in Sources */,
|
||||
EE94A7502214B52900882BB1 /* ReviewVC.swift in Sources */,
|
||||
EE377EC221E7DFD200138385 /* Constants.swift in Sources */,
|
||||
EE377EC921E8F67000138385 /* PassphraseVCDelegate.swift in Sources */,
|
||||
|
@ -792,6 +819,7 @@
|
|||
EE57702F21D38BAD00433CAB /* ZWPinDotView.swift in Sources */,
|
||||
EE1876AB221F4CD0004853A7 /* MemoVCViewModel.swift in Sources */,
|
||||
EEBEBB7721FF91B700A6BD18 /* RecipientAddressDelegate.swift in Sources */,
|
||||
EEE15B112270E903008231B6 /* QrcVCViewModel.swift in Sources */,
|
||||
EE4AFAAD226652E500997CE3 /* AddressVC.swift in Sources */,
|
||||
EEBEBBA12208D75A00A6BD18 /* MemoVC.swift in Sources */,
|
||||
EE07A45021E23E43006031C8 /* MainVC.swift in Sources */,
|
||||
|
|
|
@ -128,3 +128,7 @@
|
|||
|
||||
"address.title.edit" = "Empfänger-Adresse ändern";
|
||||
|
||||
"qrc.title" = "Wallet-Adresse";
|
||||
|
||||
"qrc.button.copy" = "In Pasteboard kopieren";
|
||||
|
||||
|
|
|
@ -128,3 +128,7 @@
|
|||
|
||||
"address.title.edit" = "Edit Recipient Address";
|
||||
|
||||
"qrc.title" = "Wallet Address";
|
||||
|
||||
"qrc.button.copy" = "Copy to pasteboard";
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// QrcGenerator.swift
|
||||
// ZWallet
|
||||
//
|
||||
// Created by loj on 24.04.19.
|
||||
// Copyright © 2019 XMR Systems LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import CoreImage
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
|
||||
public class QrcGenerator {
|
||||
|
||||
public static func generate(from string: String?, scale: CGFloat) -> UIImage? {
|
||||
if let filter = CIFilter(name: "CIQRCodeGenerator"),
|
||||
let data = string?.data(using: String.Encoding.ascii)
|
||||
{
|
||||
filter.setValue(data, forKey: "inputMessage")
|
||||
filter.setValue("H", forKey: "inputCorrectionLevel") // L(ow) M(edium) Q H(igh)
|
||||
let transform = CGAffineTransform(scaleX: scale, y: scale)
|
||||
if let output: CIImage = filter.outputImage?.transformed(by: transform) {
|
||||
|
||||
let context = CIContext(options: nil)
|
||||
if let cgImage: CGImage = context.createCGImage(output, from: output.extent) {
|
||||
let image: UIImage? = UIImage(cgImage: cgImage)
|
||||
return image
|
||||
}
|
||||
|
||||
return UIImage(ciImage: output)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@ internal protocol ViewFactoryProtocol {
|
|||
func getMemoVC() -> MemoVC
|
||||
func getReviewVC() -> ReviewVC
|
||||
func getAddressVC() -> AddressVC
|
||||
func getQrcVC() -> QrcVC
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,6 +72,10 @@ internal class ViewFactory: ViewFactoryProtocol {
|
|||
return self.view(withName: "Address", onStoryboard: "Address")
|
||||
}
|
||||
|
||||
func getQrcVC() -> QrcVC {
|
||||
return self.view(withName: "QRC", onStoryboard: "QRC")
|
||||
}
|
||||
|
||||
private func view<T>(withName viewName: String, onStoryboard storyboardName: String) -> T {
|
||||
let sb = UIStoryboard(name: storyboardName, bundle: nil)
|
||||
let vc = sb.instantiateViewController(withIdentifier: viewName) as! T
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.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>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
|
||||
<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="SourceSansPro-Bold.ttf">
|
||||
<string>SourceSansPro-Bold</string>
|
||||
</array>
|
||||
<array key="SourceSansPro-Regular.ttf">
|
||||
<string>SourceSansPro-Regular</string>
|
||||
</array>
|
||||
<array key="SourceSansPro-SemiBold.ttf">
|
||||
<string>SourceSansPro-SemiBold</string>
|
||||
</array>
|
||||
</customFonts>
|
||||
<scenes>
|
||||
<!--QrcVC-->
|
||||
<scene sceneID="5TK-63-Amy">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="QRC" id="M2V-hB-lEq" customClass="QrcVC" customModule="ZWallet" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="MfU-s3-T92">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="!!Own Address" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="r9g-U1-6GC">
|
||||
<rect key="frame" x="24" y="172" width="366" height="31"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="31" id="TKL-j1-J2Y"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="SourceSansPro-Bold" family="Source Sans Pro" pointSize="24"/>
|
||||
<color key="textColor" red="0.2901675105" green="0.29021433000000002" blue="0.29015725850000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="H0N-Ax-m9d" customClass="ZWButton" customModule="ZWallet">
|
||||
<rect key="frame" x="24" y="814" width="366" height="48"/>
|
||||
<color key="backgroundColor" red="0.2404455543" green="0.49460166690000001" blue="0.8346244693" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="48" id="brW-Yb-hQ5"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="SourceSansPro-SemiBold" family="Source Sans Pro" pointSize="16"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<state key="normal" title="!!Copy Address to Clipboard"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="4"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
|
||||
<real key="value" value="0.0"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="textColor">
|
||||
<color key="value" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
|
||||
<color key="value" red="0.2404455543" green="0.49460166690000001" blue="0.8346244693" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="copyButtonTouched" destination="M2V-hB-lEq" eventType="touchUpInside" id="UEy-kC-vdZ"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BD7-Xi-ojG" userLabel="BackButton">
|
||||
<rect key="frame" x="14" y="48" width="44" height="44"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="8S4-IY-aNc"/>
|
||||
<constraint firstAttribute="width" constant="44" id="onO-tg-fYE"/>
|
||||
</constraints>
|
||||
<state key="normal" image="ArrowBack"/>
|
||||
<connections>
|
||||
<action selector="backButtonTouched" destination="M2V-hB-lEq" eventType="touchUpInside" id="h6T-dN-BGR"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="dhk-cI-tcc" userLabel="QRCBackground">
|
||||
<rect key="frame" x="24" y="265" width="366" height="366"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="dhk-cI-tcc" secondAttribute="height" multiplier="1:1" id="emH-nQ-axd"/>
|
||||
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="500" id="zSb-S4-Rp7"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="QRCode" translatesAutoresizingMaskIntoConstraints="NO" id="7E0-Vx-mNI">
|
||||
<rect key="frame" x="36" y="277" width="342" height="342"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<color key="tintColor" red="0.2404455543" green="0.49460166690000001" blue="0.8346244693" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="22of8.ch2 22of8.ch2 22of8.ch2 22of8.ch2 22of8.ch2 22of8.ch2 22of8.ch2" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="E7Z-gG-TRz">
|
||||
<rect key="frame" x="24" y="784.5" width="366" height="21.5"/>
|
||||
<fontDescription key="fontDescription" name="SourceSansPro-Regular" family="Source Sans Pro" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="dhk-cI-tcc" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Vyu-5m-YUx" secondAttribute="leading" constant="24" id="3Oi-h6-NoS"/>
|
||||
<constraint firstItem="E7Z-gG-TRz" firstAttribute="leading" secondItem="Vyu-5m-YUx" secondAttribute="leading" constant="24" id="4lB-dW-v7w"/>
|
||||
<constraint firstItem="7E0-Vx-mNI" firstAttribute="leading" secondItem="dhk-cI-tcc" secondAttribute="leading" constant="12" id="B3r-DC-JeO"/>
|
||||
<constraint firstItem="dhk-cI-tcc" firstAttribute="centerY" secondItem="MfU-s3-T92" secondAttribute="centerY" id="CdO-RJ-d0Q"/>
|
||||
<constraint firstItem="r9g-U1-6GC" firstAttribute="top" secondItem="BD7-Xi-ojG" secondAttribute="bottom" constant="80" id="FI1-ai-blt"/>
|
||||
<constraint firstItem="Vyu-5m-YUx" firstAttribute="bottom" secondItem="H0N-Ax-m9d" secondAttribute="bottom" id="FPj-Sn-BCT"/>
|
||||
<constraint firstItem="Vyu-5m-YUx" firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="dhk-cI-tcc" secondAttribute="trailing" constant="24" id="FdI-DU-xsM"/>
|
||||
<constraint firstItem="dhk-cI-tcc" firstAttribute="trailing" secondItem="7E0-Vx-mNI" secondAttribute="trailing" constant="12" id="H1g-tL-fB5"/>
|
||||
<constraint firstItem="dhk-cI-tcc" firstAttribute="centerX" secondItem="MfU-s3-T92" secondAttribute="centerX" id="JH8-RR-EZM"/>
|
||||
<constraint firstItem="BD7-Xi-ojG" firstAttribute="leading" secondItem="Vyu-5m-YUx" secondAttribute="leading" constant="14" id="KeI-Mb-OeO"/>
|
||||
<constraint firstItem="dhk-cI-tcc" firstAttribute="width" secondItem="MfU-s3-T92" secondAttribute="width" priority="750" id="Qtd-A4-ADD"/>
|
||||
<constraint firstItem="r9g-U1-6GC" firstAttribute="leading" secondItem="Vyu-5m-YUx" secondAttribute="leading" constant="24" id="WOg-Dr-Ycf"/>
|
||||
<constraint firstItem="BD7-Xi-ojG" firstAttribute="top" secondItem="Vyu-5m-YUx" secondAttribute="top" constant="4" id="XOf-4Y-77E"/>
|
||||
<constraint firstItem="7E0-Vx-mNI" firstAttribute="top" secondItem="dhk-cI-tcc" secondAttribute="top" constant="12" id="Ycw-EP-qbI"/>
|
||||
<constraint firstItem="E7Z-gG-TRz" firstAttribute="top" relation="greaterThanOrEqual" secondItem="dhk-cI-tcc" secondAttribute="bottom" constant="8" id="hDI-ir-jFh"/>
|
||||
<constraint firstItem="Vyu-5m-YUx" firstAttribute="trailing" secondItem="H0N-Ax-m9d" secondAttribute="trailing" constant="24" id="j43-qX-LKh"/>
|
||||
<constraint firstItem="H0N-Ax-m9d" firstAttribute="leading" secondItem="Vyu-5m-YUx" secondAttribute="leading" constant="24" id="mFp-Wh-To7"/>
|
||||
<constraint firstItem="dhk-cI-tcc" firstAttribute="bottom" secondItem="7E0-Vx-mNI" secondAttribute="bottom" constant="12" id="nB6-7I-5WJ"/>
|
||||
<constraint firstItem="H0N-Ax-m9d" firstAttribute="top" secondItem="E7Z-gG-TRz" secondAttribute="bottom" constant="8" id="tHn-V3-syz"/>
|
||||
<constraint firstItem="Vyu-5m-YUx" firstAttribute="trailing" secondItem="r9g-U1-6GC" secondAttribute="trailing" constant="24" id="unm-EG-rDc"/>
|
||||
<constraint firstItem="Vyu-5m-YUx" firstAttribute="trailing" secondItem="E7Z-gG-TRz" secondAttribute="trailing" constant="24" id="xnQ-8g-MGg"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="Vyu-5m-YUx"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="backButton" destination="BD7-Xi-ojG" id="wrj-hX-z7d"/>
|
||||
<outlet property="copyButton" destination="H0N-Ax-m9d" id="VwJ-hS-P0m"/>
|
||||
<outlet property="qrcImageView" destination="7E0-Vx-mNI" id="jsT-Oz-R3h"/>
|
||||
<outlet property="titleLabel" destination="r9g-U1-6GC" id="H6c-b9-yt1"/>
|
||||
<outlet property="walletAddressLabel" destination="E7Z-gG-TRz" id="vMi-li-O42"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="fNu-aZ-Pmz" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-134.78260869565219" y="-284.59821428571428"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="ArrowBack" width="24" height="24"/>
|
||||
<image name="QRCode" width="23" height="23"/>
|
||||
</resources>
|
||||
</document>
|
|
@ -44,7 +44,7 @@ extension HomeCoordinator: HomeVCDelegate {
|
|||
}
|
||||
|
||||
func homeVCReceiveButtonTouched(sender: HomeVC) {
|
||||
#warning("implement")
|
||||
self.showQrc()
|
||||
}
|
||||
|
||||
func homeVCSettingsButtonTouched(sender: HomeVC) {
|
||||
|
@ -78,6 +78,19 @@ extension HomeCoordinator: HomeVCDelegate {
|
|||
sendCoordinator.start()
|
||||
}
|
||||
|
||||
private func showQrc() {
|
||||
#warning("get correct wallet address instead of fake www")
|
||||
let address = "22of8.ch"
|
||||
let viewModel = QrcVCViewModel(walletAddress: address,
|
||||
qrcImage: QrcGenerator.generate(from: address, scale: 10.0))
|
||||
|
||||
let vc = self.viewFactory.getQrcVC()
|
||||
vc.delegate = self
|
||||
vc.localizer = self.localizer
|
||||
vc.viewModel = viewModel
|
||||
self.navigationController.pushViewController(vc, animated: true)
|
||||
}
|
||||
|
||||
private func showTrxDetailsView(for trxDetails: TrxDetails) {
|
||||
let vc = self.viewFactory.getTrxDetailsView()
|
||||
vc.delegate = self
|
||||
|
@ -153,6 +166,20 @@ extension HomeCoordinator: HomeVCDelegate {
|
|||
}
|
||||
|
||||
|
||||
extension HomeCoordinator: QrcVCDelegate {
|
||||
|
||||
func qrcVCDelegateCopyButtonTouched(sender: QrcVC, address: String?) {
|
||||
if let address = address {
|
||||
UIPasteboard.general.string = address
|
||||
}
|
||||
}
|
||||
|
||||
func qrcVCDelegateBackButtonTouched(sender: QrcVC) {
|
||||
self.navigationController.popViewController(animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extension HomeCoordinator: TrxDetailsVCDelegate {
|
||||
|
||||
func trxDetailsVCDelegateBackTouched(sender: TrxDetailsVC) {
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
//
|
||||
// QrcVC.swift
|
||||
// ZWallet
|
||||
//
|
||||
// Created by loj on 24.04.19.
|
||||
// Copyright © 2019 XMR Systems LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class QrcVC: UIViewController {
|
||||
|
||||
@IBOutlet weak var backButton: UIButton!
|
||||
@IBOutlet weak var titleLabel: UILabel!
|
||||
@IBOutlet weak var qrcImageView: UIImageView!
|
||||
@IBOutlet weak var walletAddressLabel: UILabel!
|
||||
@IBOutlet weak var copyButton: ZWButton!
|
||||
|
||||
public weak var delegate: QrcVCDelegate?
|
||||
public weak var localizer: Localizable?
|
||||
public var viewModel: QrcVCViewModel?
|
||||
|
||||
@IBAction func copyButtonTouched() {
|
||||
self.delegate?.qrcVCDelegateCopyButtonTouched(sender: self, address: viewModel?.walletAddress)
|
||||
}
|
||||
|
||||
@IBAction func backButtonTouched() {
|
||||
self.delegate?.qrcVCDelegateBackButtonTouched(sender: self)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.setup()
|
||||
}
|
||||
|
||||
private func setup() {
|
||||
if let localizer = self.localizer {
|
||||
self.titleLabel.text = localizer.localized("qrc.title")
|
||||
self.backButton.setTitle(localizer.localized("qrc.button.copy"), for: .normal)
|
||||
}
|
||||
|
||||
if let viewModel = self.viewModel {
|
||||
self.walletAddressLabel.text = viewModel.walletAddress
|
||||
self.qrcImageView.image = viewModel.qrcImage
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// QrcVCDelegate.swift
|
||||
// ZWallet
|
||||
//
|
||||
// Created by loj on 24.04.19.
|
||||
// Copyright © 2019 XMR Systems LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
internal protocol QrcVCDelegate: class {
|
||||
func qrcVCDelegateCopyButtonTouched(sender: QrcVC, address: String?)
|
||||
func qrcVCDelegateBackButtonTouched(sender: QrcVC)
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// QrcVCViewModel.swift
|
||||
// ZWallet
|
||||
//
|
||||
// Created by loj on 24.04.19.
|
||||
// Copyright © 2019 XMR Systems LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
|
||||
internal struct QrcVCViewModel {
|
||||
let walletAddress: String
|
||||
let qrcImage: UIImage?
|
||||
|
||||
init(walletAddress: String,
|
||||
qrcImage: UIImage?)
|
||||
{
|
||||
self.walletAddress = walletAddress
|
||||
self.qrcImage = qrcImage
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue