Skip to content

Commit

Permalink
improve lock screen, max attemps 7, remove async loadEvents (older iP…
Browse files Browse the repository at this point in the history
…hones), change sender message when tx null, 312
  • Loading branch information
MIPPL committed Jan 16, 2020
1 parent dad8233 commit 5421e4b
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 87 deletions.
120 changes: 60 additions & 60 deletions breadwallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand All @@ -31,7 +31,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand All @@ -52,7 +52,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A7A31DA5934300A983D8"
BuildableName = "breadwalletTests.xctest"
BuildableName = "Wagerr Pro.xctest"
BlueprintName = "breadwalletTests"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -84,7 +84,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand All @@ -101,7 +101,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand Down
10 changes: 5 additions & 5 deletions breadwallet.xcodeproj/xcshareddata/xcschemes/Testnet.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand All @@ -31,7 +31,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand All @@ -42,7 +42,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A7A31DA5934300A983D8"
BuildableName = "breadwalletTests.xctest"
BuildableName = "Wagerr Pro.xctest"
BlueprintName = "breadwalletTests"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -74,7 +74,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand All @@ -91,7 +91,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand All @@ -31,7 +31,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand All @@ -42,7 +42,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A7A31DA5934300A983D8"
BuildableName = "breadwalletTests.xctest"
BuildableName = "Wagerr Pro.xctest"
BlueprintName = "breadwalletTests"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -85,7 +85,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand All @@ -109,7 +109,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand All @@ -31,7 +31,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand All @@ -42,7 +42,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A7A31DA5934300A983D8"
BuildableName = "breadwalletTests.xctest"
BuildableName = "Wagerr Pro.xctest"
BlueprintName = "breadwalletTests"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -84,7 +84,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand All @@ -108,7 +108,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "75A2A78F1DA5934300A983D8"
BuildableName = "Wagerr Bet.app"
BuildableName = "Wagerr Pro.app"
BlueprintName = "breadwallet"
ReferencedContainer = "container:breadwallet.xcodeproj">
</BuildableReference>
Expand Down
2 changes: 2 additions & 0 deletions breadwallet/EventDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,9 @@ class EventDetailViewController: UIViewController, Subscriber, EventBetOptionDel

private func reload() {
viewModel = event
let currChoice = (self.dataSource as! EventDetailDataSource).currChoice
self.dataSource = EventDetailDataSource(tableView: tableView, viewModel: viewModel, controller: self)
dataSource?.prepareBetLayout(choice: currChoice)
tableView.dataSource = dataSource
tableView.reloadData()
}
Expand Down
1 change: 1 addition & 0 deletions breadwallet/src/Constants/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ enum S {
static let newVersionTitle = NSLocalizedString("BetSettings.newVersion", value: "New version", comment: "New version available")
static let newVersion = NSLocalizedString("BetSettings.newVersion", value: "There is a new version available!", comment: "New version available")
static let goTo = NSLocalizedString("BetSettings.goTo", value: "Go", comment: "Go")
static let lockWarning = NSLocalizedString("BetSettings.lockWarning", value: "Attention: After the 7th incorrect pin attempt, the wallet database will be deleted. The seed phrase will be required to restore any balance", comment: "Warning")
}

enum Betting {
Expand Down
4 changes: 2 additions & 2 deletions breadwallet/src/CoreDatabase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ class CoreDatabase {
}

func loadEvents(_ eventID : UInt64,_ eventTimestamp : TimeInterval, callback: @escaping ([BetEventViewModel?])->Void) {
queue.async {

var events = [BetEventViewModel?]()
var sql: OpaquePointer? = nil
sqlite3_prepare_v2(self.db, self.getEventsQuery( eventID, eventTimestamp ), -1, &sql, nil)
Expand Down Expand Up @@ -944,7 +944,7 @@ class CoreDatabase {
if !event.zeroedOdds() {
events.append(event)
}
}


if sqlite3_errcode(self.db) != SQLITE_DONE { print("SQLITE error loadEvents: " + String(cString: sqlite3_errmsg(self.db))) }
DispatchQueue.main.async {
Expand Down
3 changes: 2 additions & 1 deletion breadwallet/src/Sender.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ class BitcoinSender: SenderBase<Wagerr, BTCWalletManager>, Sender {
}

func sendTransaction(allowBiometrics: Bool, pinVerifier: @escaping PinVerifier, completion: @escaping SendCompletion) {
guard readyToSend, let tx = transaction else { return completion(.creationError("not ready")) }
guard readyToSend else { return completion(.creationError("Not ready to send yet.")) }
guard let tx = transaction else { return completion(.creationError("Please ensure there is sufficient WGR for transaction fees")) }

if allowBiometrics && UserDefaults.isBiometricsEnabled && walletManager.canUseBiometrics(forTx: tx) {
sendWithBiometricVerification(tx: tx, pinVerifier: pinVerifier, completion: completion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ class RootNavigationController : UINavigationController {
return
})
}
completion(false)
DispatchQueue.main.async { // completion affects UI
completion(false)
}
}
else {
completion(true)
DispatchQueue.main.async {
completion(true)
}
}
})
}
Expand Down
12 changes: 11 additions & 1 deletion breadwallet/src/Views/WalletDisabledView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class WalletDisabledView : UIView {
}

private let label = UILabel(font: .customBold(size: 20.0), color: .darkText)
private let label2 = UILabel(font: .customBody(size: 16.0), color: .darkText)
private let faq: UIButton
private let blur: UIVisualEffectView
private let reset = ShadowButton(title: S.UnlockScreen.resetPin, type: .blackTransparent)
Expand All @@ -56,6 +57,7 @@ class WalletDisabledView : UIView {
private func addSubviews() {
addSubview(blur)
addSubview(label)
addSubview(label2)
addSubview(faq)
addSubview(reset)
}
Expand All @@ -65,6 +67,11 @@ class WalletDisabledView : UIView {
label.constrain([
label.centerYAnchor.constraint(equalTo: blur.centerYAnchor),
label.centerXAnchor.constraint(equalTo: blur.centerXAnchor) ])
label2.constrain([
label2.topAnchor.constraint(equalTo: label.bottomAnchor, constant: C.padding[4]),
label2.leadingAnchor.constraint(equalTo: blur.leadingAnchor, constant: C.padding[2]),
label2.trailingAnchor.constraint(equalTo: blur.trailingAnchor, constant: -C.padding[2]),
label2.centerXAnchor.constraint(equalTo: blur.centerXAnchor) ])
faq.constrain([
faq.leadingAnchor.constraint(equalTo: leadingAnchor, constant: C.padding[2]),
faq.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -C.padding[2]),
Expand All @@ -75,11 +82,14 @@ class WalletDisabledView : UIView {
reset.centerYAnchor.constraint(equalTo: faq.centerYAnchor),
reset.heightAnchor.constraint(equalToConstant: C.Sizes.buttonHeight),
reset.widthAnchor.constraint(equalToConstant: 200.0) ])

}

private func setData() {
label.textAlignment = .center

label2.textAlignment = .center
label2.numberOfLines = 4
label2.text = S.BetSettings.lockWarning
}

required init?(coder aDecoder: NSCoder) {
Expand Down
2 changes: 1 addition & 1 deletion breadwallet/src/Wallet/WalletManager+Auth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ extension BTCWalletManager : WalletAuthenticator {
else if !BTCWalletManager.failedPins.contains(pin) { // unique failed attempt
BTCWalletManager.failedPins.append(pin)

if (failCount >= 8) { // wipe wallet after 8 failed pin attempts and 24+ hours of lockout
if (failCount >= 7) { // WAGERR change to 7 (4hr) wipe wallet after 8 failed pin attempts and 24+ hours of lockout
Store.trigger(name: .wipeWalletNoPrompt)
return false
}
Expand Down

0 comments on commit 5421e4b

Please sign in to comment.