Skip to content

Commit

Permalink
Update pod file, allow tap to open etherscan for wallet in KYC
Browse files Browse the repository at this point in the history
  • Loading branch information
manhlx3006 committed Jan 8, 2019
1 parent 4ee79dd commit d9bc0ff
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 37 deletions.
6 changes: 3 additions & 3 deletions KyberNetwork.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,7 @@
254CD0DB2148F0FE0079EA7A /* Profile */ = {
isa = PBXGroup;
children = (
25A293F620CE7AD4008C6759 /* Users */,
254CD0ED21492DD50079EA7A /* KYC */,
254CD0EC21492DC80079EA7A /* HomeView */,
);
Expand Down Expand Up @@ -2024,7 +2025,6 @@
254CD0DB2148F0FE0079EA7A /* Profile */,
255DC60A20A9495F002C2BBF /* Balance */,
25CC0A9A2057E2680009D0D5 /* KyberSwap */,
25A293F620CE7AD4008C6759 /* KyberGO */,
257C9FCB2078FB2000EE0128 /* Settings */,
);
path = Tabbars;
Expand Down Expand Up @@ -2567,14 +2567,14 @@
path = SelectOption;
sourceTree = "<group>";
};
25A293F620CE7AD4008C6759 /* KyberGO */ = {
25A293F620CE7AD4008C6759 /* Users */ = {
isa = PBXGroup;
children = (
25A2940E20CE9F8F008C6759 /* Storage */,
25A293FC20CE7B0F008C6759 /* Models */,
25A293FB20CE7B06008C6759 /* Screens */,
);
path = KyberGO;
path = Users;
sourceTree = "<group>";
};
25A293FB20CE7B06008C6759 /* Screens */ = {
Expand Down
6 changes: 3 additions & 3 deletions KyberNetwork/Core/Helpers/DeviceChecker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import Foundation

class DeviceChecker: JailbreakChecker {
func isJailbroken() -> Bool {
if TARGET_IPHONE_SIMULATOR == 1 {
return false
}
// if TARGET_IPHONE_SIMULATOR == 1 {
// return false
// }

let list: [String] = [
"/Applications/Cydia.app",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class KNTransactionCoordinator {
let tokenStorage: KNTokenStorage
let externalProvider: KNExternalProvider
let wallet: Wallet
fileprivate var isLoadingEnabled: Bool = false

fileprivate var pendingTxTimer: Timer?
fileprivate var allTxTimer: Timer?
fileprivate var tokenTxTimer: Timer?

deinit { self.stop() }
Expand All @@ -37,6 +37,7 @@ class KNTransactionCoordinator {
}

func start() {
self.isLoadingEnabled = true
self.startUpdatingCompletedTransactions()
self.startUpdatingPendingTransactions()

Expand All @@ -50,13 +51,17 @@ class KNTransactionCoordinator {
}

func stop() {
self.isLoadingEnabled = false
self.stopUpdatingCompletedTransaction()
self.stopUpdatingPendingTransactions()
}

func forceUpdateNewTransactionsWhenPendingTxCompleted() {
self.isLoadingEnabled = true
DispatchQueue.main.asyncAfter(deadline: .now() + 10.0) {
self.forceFetchTokenTransactions()
if self.isLoadingEnabled {
self.forceFetchTokenTransactions()
}
}
}
}
Expand All @@ -77,7 +82,10 @@ extension KNTransactionCoordinator {
withTimeInterval: KNLoadingInterval.loadingListTransactions,
repeats: true,
block: { [weak self] _ in
self?.forceFetchTokenTransactions()
guard let `self` = self else { return }
if self.isLoadingEnabled {
self.forceFetchTokenTransactions()
}
}
)
}
Expand Down Expand Up @@ -326,13 +334,19 @@ extension KNTransactionCoordinator {
withTimeInterval: KNLoadingInterval.defaultLoadingInterval,
repeats: true,
block: { [weak self] timer in
self?.shouldUpdatePendingTransaction(timer)
guard let `self` = self else { return }
if self.isLoadingEnabled {
self.shouldUpdatePendingTransaction(timer)
}
}
)
}

@objc func shouldUpdatePendingTransaction(_ sender: Any?) {
self.transactionStorage.kyberPendingTransactions.forEach { self.updatePendingTransaction($0) }
let objects = self.transactionStorage.kyberPendingTransactions
objects.forEach {
if self.isLoadingEnabled { self.updatePendingTransaction($0) }
}
}

func updatePendingTransaction(_ transaction: KNTransaction) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,10 @@ extension KNProfileHomeViewController {
extension KNProfileHomeViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
if indexPath.row < self.viewModel.wallets.count {
let address = self.viewModel.wallets[indexPath.row].1
self.openSafari(with: KNEnvironment.default.etherScanIOURLString + "address/\(address)")
}
}
}

Expand Down Expand Up @@ -414,7 +418,7 @@ extension KNProfileHomeViewController: UITableViewDataSource {
NSAttributedStringKey.kern: 0.0,
]
attributedString.append(NSAttributedString(string: " \(wallet.0)", attributes: nameAttributes))
let addressString: String = " \(wallet.1.prefix(8))...\(wallet.1.suffix(6))"
let addressString: String = " \(wallet.1.prefix(16))...\(wallet.1.suffix(10))"
attributedString.append(NSAttributedString(string: "\n\(addressString)", attributes: addressAttributes))
return attributedString
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -897,14 +897,14 @@ extension KYCPersonalInfoViewController: UITableViewDataSource {
NSAttributedStringKey.font: UIFont.Kyber.medium(with: 14),
NSAttributedStringKey.foregroundColor: UIColor.Kyber.mirage,
NSAttributedStringKey.kern: 0.0,
]
]
let addressAttributes: [NSAttributedStringKey: Any] = [
NSAttributedStringKey.font: UIFont.Kyber.medium(with: 14),
NSAttributedStringKey.foregroundColor: UIColor.Kyber.grayChateau,
NSAttributedStringKey.kern: 0.0,
]
]
attributedString.append(NSAttributedString(string: " \(wallet.0)", attributes: nameAttributes))
let addressString: String = " \(wallet.1.prefix(8))...\(wallet.1.suffix(6))"
let addressString: String = " \(wallet.1.prefix(16))...\(wallet.1.suffix(10))"
attributedString.append(NSAttributedString(string: "\n\(addressString)", attributes: addressAttributes))
return attributedString
}()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ extension KYCSubmitInfoViewController: UITableViewDataSource {
NSAttributedStringKey.kern: 0.0,
]
attributedString.append(NSAttributedString(string: " \(wallet.0)", attributes: nameAttributes))
let addressString: String = " \(wallet.1.prefix(8))...\(wallet.1.suffix(6))"
let addressString: String = " \(wallet.1.prefix(16))...\(wallet.1.suffix(10))"
attributedString.append(NSAttributedString(string: "\n\(addressString)", attributes: addressAttributes))
return attributedString
}()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -643,7 +643,7 @@
<color key="textColor" red="0.60392156860000001" green="0.6705882353" blue="0.70588235290000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="dEE-dQ-ZRh">
<tableView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="dEE-dQ-ZRh">
<rect key="frame" x="0.0" y="0.0" width="375" height="100"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ class NotificationsViewController: FormViewController {
var didChange: ((_ change: NotificationChanged) -> Void)?

private static var isPushNotificationEnabled: Bool {
guard let settings = UIApplication.shared.currentUserNotificationSettings else { return false }
return UIApplication.shared.isRegisteredForRemoteNotifications && !settings.types.isEmpty
// guard let settings = UIApplication.shared.currentUserNotificationSettings else { return false }
// return UIApplication.shared.isRegisteredForRemoteNotifications && !settings.types.isEmpty
return false
}

private var showOptionsCondition: Condition {
Expand Down
16 changes: 8 additions & 8 deletions KyberNetwork/UI/Form/SliderTextFieldRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ open class SliderTextFieldCell: Cell<Float>, CellType, UITextFieldDelegate {
public required init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: .value1, reuseIdentifier: reuseIdentifier)

NotificationCenter.default.addObserver(forName: Notification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil) { [weak self] _ in
guard let me = self else { return }
if me.shouldShowTitle {
me.titleLabel = me.textLabel
me.valueLabel = me.detailTextLabel
me.addConstraints()
}
}
// NotificationCenter.default.addObserver(forName: Notification.Name.UIContentSizeCategoryDidChange, object: nil, queue: nil) { [weak self] _ in
// guard let me = self else { return }
// if me.shouldShowTitle {
// me.titleLabel = me.textLabel
// me.valueLabel = me.detailTextLabel
// me.addConstraints()
// }
// }
}

deinit {
Expand Down
5 changes: 0 additions & 5 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ end

post_install do |installer|
installer.pods_project.targets.each do |target|
if ['JSONRPCKit'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
if ['TrustKeystore'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Owholemodule'
Expand Down
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,6 @@ SPEC CHECKSUMS:
TrustCore: 688df9a241008cf9cfa3842ec8ef28777a8b7534
TrustKeystore: ba8a33ccd7b6a46dfe25f209253d6ba13da6655c

PODFILE CHECKSUM: a1e2a993dfd255d94cefa8492ee41aff24dab664
PODFILE CHECKSUM: b1c737ffd6efc6001a3baeb5af9766e995398b51

COCOAPODS: 1.5.3

0 comments on commit d9bc0ff

Please sign in to comment.