balance-io / balance-open

Balance Open: A GPL3-licensed macOS menu bar app for all the world’s currencies.
https://balance.io
GNU General Public License v3.0
289 stars 41 forks source link

Loading spinner on ios #530

Closed wolffan closed 6 years ago

wolffan commented 6 years ago

Forcing reload of the tab every time we enter the app (that is even when app opens) Why? because syncing process starts after we have loaded the view, therefore we can't trust the syncer state. Instead of adding a loading to the bar I just scroll the UI as if user pulled to show it's refreshing (it ends when syncer normally ends) Does this pull request close an issue? If so, which one?

508

einsteinx2 commented 6 years ago

Sounds like a reasonable solution. Testing it now.

einsteinx2 commented 6 years ago

Hmm wifi building in Xcode isn't working right now so I can't test it. I'll approve once I get to an adaptor.

einsteinx2 commented 6 years ago

This isn't doing anything for me. I don't see any loading spinner.

einsteinx2 commented 6 years ago

double checking it's using the correct code now

einsteinx2 commented 6 years ago

Actually I do see it, but it's going away really fast, way before syncing finishes.

einsteinx2 commented 6 years ago

Ahh it's because we call reloadData in viewWillAppear (after viewDidLoad) which then tells the refreshcontrol to stop.

einsteinx2 commented 6 years ago

Also ideally we wanted to show that it was loading every time, not just on launch, though this approach does solved the biggest issue.

einsteinx2 commented 6 years ago

Also it doesn't work properly if you have the cards expanded. Fixing the issues now.

einsteinx2 commented 6 years ago

Wow that UIRefreshControl tintColor bug is super annoying, but I figured out a workaround.

Besides that, here are the changes I made:

  1. Instead of calling on viewDidLoad, we now call when syncing actually starts
  2. We only move the table down if it's at the top, so it won't annoy users if they have the table dragged down and is syncs again
  3. At the end of reloadData (which is called every time we switch to the tab), we no longer call endRefreshing if the syncer is actually syncing, so if you switch back to the tab during a sync it will still show the spinner.

Doing some final testing now then will push and approve.

einsteinx2 commented 6 years ago

I tested various cases like switching tabs back when syncing has started and the table is at the top, the same when it's in the middle, first launch, etc. All is working well now.