From b01f9c62ab06ac3a67ae0760d6afc7568f355700 Mon Sep 17 00:00:00 2001 From: kcw-grunt Date: Tue, 23 Apr 2024 12:39:53 +0100 Subject: [PATCH] Removed the unnessarly Task - unused code - unwrapped the Task in SyncHeaderView https://console.firebase.google.com/project/litewallet-beta/crashlytics/app/ios:com.litecoin.loafwallet/issues/fecabb7c7120dca59920bd7a1918c710?fb_utm_campaign=firebase_launch_testlab_080416&fb_utm_medium=console&fb_utm_source=Play&time=last-twenty-four-hours&versions=3.13.1%20(240322.0)&types=crash&sessionEventKey=b437df14b7bd4d36b261897a9a93476b_1939460799914430120 Signed-off-by: kcw-grunt --- .../Contents.json | 0 .../sendTabIconwhiteinterdit.pdf | Bin litewallet/BRPeerManager.swift | 7 ----- .../XIBs/SyncProgressHeaderView.xib | 10 +++---- litewallet/SyncProgressHeaderView.swift | 2 +- litewallet/TransactionsViewController.swift | 25 +++++++++--------- 6 files changed, 18 insertions(+), 26 deletions(-) rename litewallet/Assets.xcassets/{whiteinterditsendIcon.imageset => white-interdit-send-icon.imageset}/Contents.json (100%) rename litewallet/Assets.xcassets/{whiteinterditsendIcon.imageset => white-interdit-send-icon.imageset}/sendTabIconwhiteinterdit.pdf (100%) diff --git a/litewallet/Assets.xcassets/whiteinterditsendIcon.imageset/Contents.json b/litewallet/Assets.xcassets/white-interdit-send-icon.imageset/Contents.json similarity index 100% rename from litewallet/Assets.xcassets/whiteinterditsendIcon.imageset/Contents.json rename to litewallet/Assets.xcassets/white-interdit-send-icon.imageset/Contents.json diff --git a/litewallet/Assets.xcassets/whiteinterditsendIcon.imageset/sendTabIconwhiteinterdit.pdf b/litewallet/Assets.xcassets/white-interdit-send-icon.imageset/sendTabIconwhiteinterdit.pdf similarity index 100% rename from litewallet/Assets.xcassets/whiteinterditsendIcon.imageset/sendTabIconwhiteinterdit.pdf rename to litewallet/Assets.xcassets/white-interdit-send-icon.imageset/sendTabIconwhiteinterdit.pdf diff --git a/litewallet/BRPeerManager.swift b/litewallet/BRPeerManager.swift index 8e58da18c..6037469bc 100644 --- a/litewallet/BRPeerManager.swift +++ b/litewallet/BRPeerManager.swift @@ -90,13 +90,6 @@ class BRPeerManager { return BRPeerManagerEstimatedBlockHeight(cPtr) } - // Only show syncing view if more than 2 days behind - var shouldShowSyncingView: Bool { - let lastBlock = Date(timeIntervalSince1970: TimeInterval(lastBlockTimestamp)) - let cutoff = Date().addingTimeInterval(-24 * 60 * 60 * 2) // 2 days ago - return lastBlock.compare(cutoff) == .orderedAscending - } - // current network sync progress from 0 to 1 // startHeight is the block height of the most recent fully completed sync func syncProgress(fromStartHeight: UInt32) -> Double { diff --git a/litewallet/Storyboards/XIBs/SyncProgressHeaderView.xib b/litewallet/Storyboards/XIBs/SyncProgressHeaderView.xib index 86811b641..68dd55123 100644 --- a/litewallet/Storyboards/XIBs/SyncProgressHeaderView.xib +++ b/litewallet/Storyboards/XIBs/SyncProgressHeaderView.xib @@ -1,9 +1,9 @@ - + - + @@ -18,7 +18,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -74,6 +74,6 @@ - + diff --git a/litewallet/SyncProgressHeaderView.swift b/litewallet/SyncProgressHeaderView.swift index 244e7ef0f..2d0767ab5 100644 --- a/litewallet/SyncProgressHeaderView.swift +++ b/litewallet/SyncProgressHeaderView.swift @@ -39,7 +39,7 @@ class SyncProgressHeaderView: UITableViewCell, Subscriber { headerLabel.text = S.SyncingHeader.rescanning.localize() timestampLabel.text = "" progressView.alpha = 0.0 - noSendImageView.alpha = 0.0 + noSendImageView.alpha = 1.0 } else { headerLabel.text = "" timestampLabel.text = "" diff --git a/litewallet/TransactionsViewController.swift b/litewallet/TransactionsViewController.swift index 6817473de..3f7823178 100644 --- a/litewallet/TransactionsViewController.swift +++ b/litewallet/TransactionsViewController.swift @@ -19,6 +19,7 @@ class TransactionsViewController: UIViewController, UITableViewDelegate, UITable var selectedIndexes = [IndexPath: NSNumber]() var shouldBeSyncing: Bool = false var syncingHeaderView: SyncProgressHeaderView? + var shouldShowPrompt = true private var transactions: [Transaction] = [] @@ -78,18 +79,16 @@ class TransactionsViewController: UIViewController, UITableViewDelegate, UITable /// - reduxState: Current ReduxState /// - completion: Signals the initialzation of the view private func initSyncingHeaderView(reduxState: ReduxState, completion: @escaping () -> Void) { - Task(priority: .userInitiated) { - syncingHeaderView = Bundle.main.loadNibNamed("SyncProgressHeaderView", - owner: self, - options: nil)?.first as? SyncProgressHeaderView - syncingHeaderView?.isRescanning = reduxState.walletState.isRescanning - syncingHeaderView?.progress = 0.02 // Small value to show user it is in process - syncingHeaderView?.headerMessage = reduxState.walletState.syncState - syncingHeaderView?.noSendImageView.alpha = 1.0 - syncingHeaderView?.timestamp = reduxState.walletState.lastBlockTimestamp - - completion() - } + syncingHeaderView = Bundle.main.loadNibNamed("SyncProgressHeaderView", + owner: self, + options: nil)?.first as? SyncProgressHeaderView + syncingHeaderView?.isRescanning = reduxState.walletState.isRescanning + syncingHeaderView?.progress = 0.02 + syncingHeaderView?.headerMessage = reduxState.walletState.syncState + syncingHeaderView?.noSendImageView.alpha = 1.0 + syncingHeaderView?.timestamp = reduxState.walletState.lastBlockTimestamp + + completion() } private func attemptShowPrompt() { @@ -392,7 +391,7 @@ class TransactionsViewController: UIViewController, UITableViewDelegate, UITable self.shouldBeSyncing = true self.initSyncingHeaderView(reduxState: reduxState, completion: { self.syncingHeaderView?.isRescanning = reduxState.walletState.isRescanning - self.syncingHeaderView?.progress = 0.02 // Small value to show user it is in process + self.syncingHeaderView?.progress = 0.02 self.syncingHeaderView?.headerMessage = reduxState.walletState.syncState self.syncingHeaderView?.noSendImageView.alpha = 1.0 self.syncingHeaderView?.timestamp = reduxState.walletState.lastBlockTimestamp