LN-Zap / zap-iOS

Zap Wallet - Native iOS lightning wallet focused on user experience and ease of use ⚡️
http://zaphq.io
MIT License
181 stars 47 forks source link

fix: Debouncing Sync View #289

Closed chitowncrispy closed 4 years ago

chitowncrispy commented 4 years ago

Description

I added a debounce of 2 seconds to the displaying of the sync view. This prevents a situation where there are 0-1 blocks that need to be synced and the sync view shows unnecessarily. I also added some logic so that the main page is not reloaded twice unnecessarily when switching between similar states.

Motivation and Context

This addresses issue #227

How Has This Been Tested?

The easiest way to test this was by opening and closing the app rapidly. By rapidly I mean opening the app, waiting 10 seconds and then closing the app. I did this quite a few times in a row and each time I was not seeing the sync view.

The other scenario I tested was the initial sync of the blockchain by creating a new wallet or recovering an existing wallet. Both scenarios showed the sync view in an appropriate amount of time and then concluded the sync as expected, hiding the sync view, showing the correct balance on the wallet page and badges within the tabs.

Screenshots (if appropriate):

Types of changes

Checklist:

codecov-io commented 4 years ago

Codecov Report

Merging #289 into master will decrease coverage by 0.22%. The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #289      +/-   ##
=========================================
- Coverage     7.8%   7.58%   -0.23%     
=========================================
  Files         219     219              
  Lines        8723    8727       +4     
=========================================
- Hits          681     662      -19     
- Misses       8042    8065      +23
Impacted Files Coverage Δ
Library/Coordinators/WalletCoordinator.swift 0% <0%> (ø) :arrow_up:
Library/Scenes/Wallet/WalletViewController.swift 0% <0%> (ø) :arrow_up:
...htning/Services/Misc/BlockChainHeightUpdater.swift 60.41% <0%> (-35.42%) :arrow_down:
...htning/Certificates/PinnedURLSessionDelegate.swift 93.1% <0%> (-3.45%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5a07998...92d108e. Read the comment docs.

JimmyMow commented 4 years ago

Nice one @chitowncrispy!! 🎊

ottosuess commented 4 years ago

🔥