Skip to content

Internal 2way sync - #13294

Merged
AndyScherzinger merged 1 commit into
masterfrom
internal-2way-sync
Aug 26, 2024
Merged

Internal 2way sync#13294
AndyScherzinger merged 1 commit into
masterfrom
internal-2way-sync

Conversation

@tobiasKaminsky

@tobiasKaminsky tobiasKaminsky commented Jul 19, 2024

Copy link
Copy Markdown
Member
  • Tests written, or not not needed
Screenshot_20240801_111444 Screenshot_20240801_111507 Screenshot_20240801_111515

@tobiasKaminsky tobiasKaminsky linked an issue Jul 19, 2024 that may be closed by this pull request
@superzanti

Copy link
Copy Markdown

This would be a dream come true.

@sunjam sunjam mentioned this pull request Aug 7, 2024
@CptCurk

CptCurk commented Aug 8, 2024

Copy link
Copy Markdown

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/13294.apk qrcode To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

Hello,

It looks like the link is dead. Where I can download this apk for testing ?

@tobiasKaminsky
tobiasKaminsky force-pushed the internal-2way-sync branch 3 times, most recently from 8d5d4db to 9f8a3b0 Compare August 20, 2024 07:37
Comment thread app/src/main/java/com/nextcloud/client/jobs/InternalTwoWaySyncWork.kt Outdated
Comment thread app/src/main/java/com/nextcloud/client/jobs/InternalTwoWaySyncWork.kt Outdated
Comment thread app/src/main/java/com/nextcloud/client/jobs/InternalTwoWaySyncWork.kt Outdated
Comment thread app/src/main/java/com/owncloud/android/ui/activity/InternalTwoWaySyncActivity.kt Outdated
Comment thread app/src/main/java/com/nextcloud/client/jobs/InternalTwoWaySyncWork.kt Outdated
Comment thread app/src/main/java/com/owncloud/android/ui/adapter/InternalTwoWaySyncAdapter.kt Outdated
Comment thread app/src/main/java/com/owncloud/android/ui/adapter/InternalTwoWaySyncViewHolder.kt Outdated
Comment thread app/src/main/java/com/owncloud/android/ui/adapter/InternalTwoWaySyncViewHolder.kt Outdated
Comment thread app/src/main/java/com/owncloud/android/ui/activity/InternalTwoWaySyncActivity.kt Outdated
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
@github-actions

Copy link
Copy Markdown

Codacy

Lint

TypemasterPR
Warnings6060
Errors33

SpotBugs

CategoryBaseNew
Bad practice6363
Correctness6464
Dodgy code300300
Experimental11
Internationalization77
Multithreaded correctness66
Performance5353
Security1818
Total512512

@AndyScherzinger AndyScherzinger added this to the Nextcloud App 3.30.0 milestone Aug 26, 2024
@AndyScherzinger
AndyScherzinger merged commit 93809e5 into master Aug 26, 2024
@AndyScherzinger
AndyScherzinger deleted the internal-2way-sync branch August 26, 2024 07:44
@github-actions

Copy link
Copy Markdown

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/13294.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@AndyXheli

AndyXheli commented Aug 26, 2024

Copy link
Copy Markdown

Hey @AndyScherzinger so i download this on S24 Ultra to try it out and when i click on Internal two way sync i get a white screen and nothing else.

Screenshot_20240826_124603_Nextcloud QA.jpg

@phikman

phikman commented Aug 27, 2024

Copy link
Copy Markdown

Same issue and logs on Google Pixel 6 and Android 14.

Edit:
I've worked it out, looking at the screen shots above, navigate to the folder you want synced in App, go details, tick "sync" then it should appear in the settings page.

I'd suggest a UI review to see how we can make it more intuitive to the users.

Now onto testing!

@tobiasKaminsky

Copy link
Copy Markdown
Member Author

A better UI is in #13494

@GotoBeer

GotoBeer commented Sep 3, 2024

Copy link
Copy Markdown

Same issue and logs on Google Pixel 6 and Android 14.

Edit: I've worked it out, looking at the screen shots above, navigate to the folder you want synced in App, go details, tick "sync" then it should appear in the settings page.

I'd suggest a UI review to see how we can make it more intuitive to the users.

Now onto testing!

Same issue and logs on POCO and Android 13 and pre-syncing the folder does not help

@ivanhercaz

Copy link
Copy Markdown

Hi! First of all, thank you very much for this awesome feature, @tobiasKaminsky. It is really great to have it in Nextcloud because it is a really useful feature.

I don't know if this PR is the best place to ask about this feature, if it isn't, just let me know and I will move the comment there:

How often should the internal 2-way sync be fired? Is it scheduled to be fired in a specific amount of time (x minutes)? Or this feature depends of the workload of each user's application and server instances?

Regards

@AndyScherzinger

Copy link
Copy Markdown
Member

@ivanhercaz the sync is scheduled to run every 15 minutes and will do so given it has a WiFi connection at that time and else try 15 minutes later again

@ivanhercaz

Copy link
Copy Markdown

@AndyScherzinger, thank you very much for the information!

@superzanti

superzanti commented Sep 23, 2024

Copy link
Copy Markdown

With this latest update, when I go to "menu -> settings -> internal two way sync" I just get a black screen.

EDIT:

This appears to be the same issue as @AndyXheli but with the black theme.
If I try the solution by @phikman it results in a nextcloud crash:
I've worked it out, looking at the screen shots above, navigate to the folder you want synced in App, go details, tick "sync" then it should appear in the settings page.

Navigating to the details of a folder I get this error:

Exception in thread "main" java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference
    at com.owncloud.android.datamodel.OCFile.isInternalFolderSync(OCFile.java:1058)
    at com.owncloud.android.ui.fragment.FileDetailFragment.updateFileDetails(FileDetailFragment.java:569)
    at com.owncloud.android.ui.fragment.FileDetailFragment.onViewCreated(FileDetailFragment.java:266)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3152)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:608)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:286)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2164)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2059)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
    at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:702)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7839)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

With:

  • ID: com.nextcloud.client
  • Version: 30300090
  • Build flavor: generic

Downgrading to 30290390 fixes this problem.

@AndyScherzinger

Copy link
Copy Markdown
Member

Van you please raise it as a new ticket and ping @tobiasKaminsky and @alperozturk96 please? Thanks in advance 🙏

@superzanti

superzanti commented Sep 24, 2024

Copy link
Copy Markdown

Okay. The above issue was fixed with #13612 however, no two way sync seems to be happening.

My test:

  • enable 2 way sync on a folder
  • double check in the "internal two way sync" settings that the folder has been enabled.
  • Add a file using my android file manager to the synced folder
  • wait two hours

The file never seems to be uploaded to nextcloud.
Updating a file that already existed seems slow, but it does work. However, it doesn't seem any different than before when I would manually go into the app and click sync.

Is this behavior expected?

@AndyScherzinger

Copy link
Copy Markdown
Member

I'd say no. Expected behavior would be that the files gets picked up.

Cc @tobiasKaminsky

@alperozturk96

Copy link
Copy Markdown
Collaborator

@superzanti @tobiasKaminsky @AndyScherzinger I fix the worker as well. It should work now, fyi.

@superzanti

Copy link
Copy Markdown

Unfortunately I still have the same behavior. Is there anything I can provide to assist in the debug?

@tobias0409

Copy link
Copy Markdown

Hey,

I encountered the same behavior that I described a week ago in the Nextcloud Forum. Unfortunately, the proposed fix isn't working for me either.

I’d be happy to assist further if needed or provide any additional information that could help with the resolution.

@saziton

saziton commented Sep 27, 2024

Copy link
Copy Markdown

Test results :
At the beginning it's woukd try repeatidly to download everything with the same kind of fail downloads that the regular app has when i try to synchronize a huge number of files

Then i turned off notifications forgot about it and it seems to work perfectly now , after some weeks.

I didn't try to place a new file in the dir without using the app to see if it uploads.

@superzanti

Copy link
Copy Markdown

I didn't try to place a new file in the dir without using the app to see if it uploads.

@saziton Would you try this? It doesn't work for me.

@alperozturk96

alperozturk96 commented Sep 30, 2024

Copy link
Copy Markdown
Collaborator

With the latest changes, these issues have been solved as well.

@tobias0409

Copy link
Copy Markdown

Unfortunately, the new version does not solve the problem for me. Perhaps someone can confirm this?

@superzanti

superzanti commented Sep 30, 2024

Copy link
Copy Markdown

@tobias0409 Confirmed.

And no matter how long I leave it syncing I still see "Not yet, soon to be synced" in Settings > Internal two way sync

image

Edit:

Scratch that. I spoke too soon. As soon as I added a file on the server, my phone pulled it down and spent about 10 minutes syncing all 213 files in that folder (it's KB so it really shouldn't take that long). Then it reported correctly as: "3 minutes ago" indicating it has synced.

Unfortunately, It's still not picking up files I add to that folder on my phone.

@alperozturk96

Copy link
Copy Markdown
Collaborator

After the latest changes, I tried and it worked as expected. Background job runs every 15 minute.

Thank you very much for your messages and feedback. @tobias0409 Could you try with this apk?

@superzanti

superzanti commented Sep 30, 2024

Copy link
Copy Markdown

I just ran the test with the new build, but had no success.

Steps:

  • Uninstall old QA app and remove all data
  • Install new QA app
  • Login to nextcloud and grant access
  • Select details on folder and check the "sync" checkbox
  • Force a sync on that folder
  • Wait till sync finishes (for a 340KB folder you'd expect this to be quick, but it takes about 10 minutes on my phone)
  • Us the phone's file browser to create a file in the nextcloud folder that I'm syncing. (Done at 11:24 my time)
  • Refresh the nextcloud folder (Done at intervals: 11:25, 11:30, 11:34, 11:38, 11:49)

The changes were never picked up.

I have noticed that every 15 minutes I get some errors:
image

@tobias0409

tobias0409 commented Sep 30, 2024

Copy link
Copy Markdown

After the latest changes, I tried and it worked as expected. Background job runs every 15 minute.

Thank you very much for your messages and feedback. @tobias0409 Could you try with this apk?

Hey, I tried the new version. Still the same issue - all data changes (create, modify, delete) outside the nc app are not recognized or reset.

@superzanti

Copy link
Copy Markdown

Are there any updates or progress on this?
If it's just a setup error on my end, I'd like to fix that.

@alperozturk96

alperozturk96 commented Oct 8, 2024

Copy link
Copy Markdown
Collaborator

Are there any updates or progress on this? If it's just a setup error on my end, I'd like to fix that.

We released 3.30.1 RC1 (fixes NPE and two-way sync worker behavior) . However, the checked status of the folder disappears after some time. We will gather more information based on this RC release and address the issue.

I suggest continue from this link. Thank you.

@tobias0409

tobias0409 commented Oct 8, 2024

Copy link
Copy Markdown

Are there any updates or progress on this? If it's just a setup error on my end, I'd like to fix that.

We released 3.30.1 RC1 (fixes NPE and two-way sync worker behavior) . However, the checked status of the folder disappears after some time. We will gather more information based on this RC release and address the issue.

I suggest continue from this link. Thank you.

Hey, thank you for the information. What about the error that files / folders that were created, modified, or deleted outside Nexcloud app are not picked up? Beside the issue, the sync runs fine without errors. As far as I can see, the issue you linked is not related to the issue. The new version (3.30.1 RC1) does not fix the issue. Thank you.

@superzanti

Copy link
Copy Markdown

@alperozturk96
Yeah it's not that syncing gets disabled, it's that I can't update outside the nextcloud app as mentioned by @tobias0409

@alperozturk96

alperozturk96 commented Oct 9, 2024

Copy link
Copy Markdown
Collaborator

@superzanti It seems like we might be dealing with two issues here, as I encountered the one I mentioned earlier.

@tobias0409 Would it be possible to create an issue for this?

I just wanted to kindly remind everyone that we have a dedicated page for discussing bugs. It would be great if we could continue the conversation there to keep things organized.

Thank you for understanding 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

↔️ 2 way sync for internal folder