Skip to content

"waiting for first sync" #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nicolas-raoul opened this issue Sep 8, 2015 · 8 comments
Closed

"waiting for first sync" #1

nicolas-raoul opened this issue Sep 8, 2015 · 8 comments
Labels

Comments

@nicolas-raoul
Copy link
Member

The message "waiting for first sync" stays displayed for longer than seems necessary?

screenshot_2015-09-07-18-15-34

@misaochan
Copy link
Member

I can't seem to reproduce this bug, but I think it might have something to do with the fact that the clearSyncMessage() method in ContributionsListFragment.java is never called:

    private void clearSyncMessage() {
        waitingMessage.setVisibility(View.GONE);
    }

Assuming that the IF statement to display that message is correct:

 SharedPreferences prefs = this.getActivity().getSharedPreferences("prefs", Context.MODE_PRIVATE);
 String lastModified = prefs.getString("lastSyncTimestamp", "");
 if (lastModified.equals("")) {
     waitingMessage.setVisibility(View.VISIBLE);
 }

Then I would probably need to call clearSyncMessage() at an appropriate time to fix this bug? But how do we know when the sync has occurred?

@nicolas-raoul
Copy link
Member Author

Not sure if this is a bug, or me as a new user (at that time) misunderstanding what was happening. If the latter, I feel that the UI could be improved.

@misaochan
Copy link
Member

Hrm, I still haven't been able to reproduce this bug. How do you think we could improve the UI to avoid this?

@domdomegg
Copy link
Member

Could use a loading bar to show progress to user on syncing progress

misaochan pushed a commit that referenced this issue Jun 6, 2016
@misaochan
Copy link
Member

Tested this a bit more and this bug just occurs the first time a user logs in. After the contributions are synced, the message still remains since clearSyncMessage() is never called. But the next time the logged-in user starts up the app, the if (lastModified.equals("")) line evaluates to false, so the message isn't displayed.

I think the message might be okay if we can get it to disappear once contributionsList is filled with images. Loading bar feels a bit excessive to me since the sync is usually quite quick? (Well, I'm on NZ internet which really sucks, so I figure if it's quick for me then most people wouldn't have trouble either :)).

@domdomegg
Copy link
Member

I didn't know it was so short, I thought it took a while as it had to download all the thumbnails, but I think that was probably because the message stayed up so long.

Just been testing trying to call clearSyncMessage() from the end of ContributionsSyncAdapter (after the line about the kitty) and got this error:

06-13 13:05:03.854 19157-22063/fr.free.nrw.commons E/ACRA: fr.free.nrw.commons fatal error : Only the original thread that created a view hierarchy can touch its views.
                                                           android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
                                                               at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:8128)
                                                               at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:1257)
                                                               at android.view.ViewGroup.invalidateChild(ViewGroup.java:5428)
                                                               at android.view.View.invalidateInternal(View.java:13927)
                                                               at android.view.View.invalidate(View.java:13891)
                                                               at android.view.View.setFlags(View.java:11776)
                                                               at android.view.View.setVisibility(View.java:7988)
                                                               at fr.free.nrw.commons.contributions.ContributionsListFragment.clearSyncMessage(ContributionsListFragment.java:162)
                                                               at fr.free.nrw.commons.contributions.ContributionsSyncAdapter.onPerformSync(ContributionsSyncAdapter.java:129)
                                                               at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:272)

idk yet how to get around this, some listener needs to be created in onCreateView I think

@misaochan
Copy link
Member

Ah, good point, I only have 130 photos so maybe that's why mine loads fairly quick.

Will try to look into that error when I can.

@misaochan
Copy link
Member

I think I might have fixed this. Just needed to change clearSyncMessage() to protected, and call it in ContributionsActivity.java 's onLoadFinished() method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants