-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Precise error message password change #5544
Precise error message password change #5544
Conversation
app/src/main/java/fr/free/nrw/commons/upload/StashUploadResult.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per comments.
app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt
Outdated
Show resolved
Hide resolved
Thanks for working on this @shashankiitbhu and thanks for the feedback @domdomegg and @whym 🙂 ! I could see what this PR is a achieving is a better state than what we have now. But is it not too late to throw this at the user after they've entered all their details? Could we not do it as soon as they open the app? Doing it on each open might be a bit costly, may be we could cache the result and re-check once in a few hours? Or if that sounds too complex, may be just check the validity right when the upload is initiated via the UI? May be asynchronously to rnsure we don't block user's flow? Any thoughts? 🤔 |
So my proposed solution is: This way we are making fewer network requests and ensuring that there are no cases where the user does not get a clear message after upload failure. Please Let me know what you think about this solution |
app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/auth/csrf/CsrfTokenClient.kt
Outdated
Show resolved
Hide resolved
@sivaraam: When tokens are invalidated, it's done on the server side, and we don't know when it will happen. There is a chance that it will happen during the upload process (and the user can take time to choose categories and other options). So I don't think we have to choose between the two timings of checking - I think we want to do both. EDIT: I copy pasted the wrong user name at the top earlier, sorry. |
@whym as we have already discussed and as you said we can go with approach 1 here - https://github.com/commons-app/apps-android-commons/issues/5522#issuecomment-1942891133, I am already working on my other 2 PRs for this issue ( or should I create separate issues for those PRs?) |
# Conflicts: # app/src/main/java/fr/free/nrw/commons/upload/UploadClient.java
@nicolas-raoul Can you please Review and Merge this PR so that I have a clear indication to similarly solve for the other 2 cases as discussed in #5522 (comment) and eventually close the issue #5522 , as it's been open for a while and it's quite crucial bug |
From my perspective, this looks already okay to merge. I think we can incorporate @sivaraam's idea above in future iterations. |
@whym Great, then I'll add the other two PRs for the other two scenarios soon and get this issue fixed |
@nicolas-raoul @RitikaPahwa4444 Please Review & Merge this PR so that I can make the other two PRs |
@nicolas-raoul @RitikaPahwa4444 @sivaraam can you please review and merge it, thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay here. I just had one comment about curbing the redundant code. Kindly check the same 🙂
app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt
Outdated
Show resolved
Hide resolved
I agree with you on this. We would indeed need both of those options. On a side note, it would be worth exploring how the Wikipedia app handles this. They do have a logout method similar to ours. It would be interesting to figure out when and where they call the same. |
@sivaraam Made Required Changes , Please Review and Merge, thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kindly take care of the below comments.
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt
Outdated
Show resolved
Hide resolved
@sivaraam Made the changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick turnaround! Here are few comments to help improve the changes. Do take a look 🙂
app/src/main/java/fr/free/nrw/commons/upload/worker/UploadWorker.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/navtab/MoreBottomSheetFragment.java
Show resolved
Hide resolved
app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java
Show resolved
Hide resolved
@sivaraam Made the required changes, Please Review and Merge, thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments regarding the JavaDoc. Kindly check them.
Also, I seem to get the following crash from time to time when the app logs me out due to token invalidation:
android.database.sqlite.SQLiteException: no such table: workspec (code 1 SQLITE_ERROR): , while compiling: SELECT output FROM workspec WHERE id IN
(SELECT prerequisite_id FROM dependency WHERE work_spec_id=?)
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1053)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:660)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:62)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1546)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1521)
at androidx.sqlite.db.framework.FrameworkSQLiteDatabase.query(FrameworkSQLiteDatabase.kt:156)
at androidx.room.RoomDatabase.query(RoomDatabase.kt:481)
at androidx.room.util.DBUtil.query(DBUtil.kt:75)
at androidx.work.impl.model.WorkSpecDao_Impl.getInputsFromPrerequisites(WorkSpecDao_Impl.java:1552)
at androidx.work.impl.WorkerWrapper.runWorker(WorkerWrapper.java:223)
at androidx.work.impl.WorkerWrapper.run(WorkerWrapper.java:145)
at androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
It seems similar to this issue reported here. Am I the only one facing this? Or is it generally reproducible? If it is common, any idea on what's causing this issue?
I have not faced this Issue yet so I am not sure if that is related to this PR |
@sivaraam made the changes suggested, let me know if something else is required, Please Review and Merge, thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JavaDocs could still use some improvements. Kindly check the comments.
/** | ||
* Constructor for BaseLogoutListener | ||
* | ||
* @param ctx Application context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of the ctx is not specified clearly. Kindly clarify the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unresolved yet.
@sivaraam Made Some changes , Please Review , thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just left 2 comments. Kindly check. Rest of the changes look fine 👍
/** | ||
* Constructor for BaseLogoutListener | ||
* | ||
* @param ctx Application context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unresolved yet.
@sivaraam Made the changes, Please Review |
Thank you for your contribution @shashankiitbhu 🙂 |
The problem persists even with version 5.0.1~da0b2c28e. No meaningful message is displayed after a previous password change via the Wikipedia web interface: https://commons.wikimedia.org/wiki/File:20240701_xl_0615-no_error_messages_after_change_password.png |
Description (required)
Fixes #5522
What changes did you make and why?
Made changes in
UploadWorker
making the user go toLoginActivity
if the password is changed in their current session (which made their current session Invalid), and will display a Persistent Message to the user of what they need to do on Login Page.Tests performed (required)
Tested 4.2.1-debug-main on Xiaomi 11 Lite NE with API level 33
Screenshots (for UI changes only)