Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WIP/Don't Merge] Migrated Profile from Rxjava to Retroift & added MVVM Architecture (part 1) #6082

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

Draft
neeldoshii wants to merge 2 commits into commons-app:main
base: main
Choose a base branch
Loading
from neeldoshii:retrofit

Conversation

@neeldoshii
Copy link
Contributor

@neeldoshii neeldoshii commented Dec 26, 2024
edited
Loading

Part of:

Description:

The following PR focuses on removing the RxJava usage for Achievement Screen, split the code into a MVVM pattern, cleaned the code and also fixed the flow of the AchievementScreen.

Also, there seems to be an improvement in the loading time of the achievements by some seconds (probably 1-2 seconds) compared to the main branch.

2024年12月26日 20:25:54.028 loadTime fr.free.nrw.commons D The loadtime is 3318ms

@neeldoshii neeldoshii marked this pull request as draft December 26, 2024 15:04
@neeldoshii neeldoshii changed the title (削除) Migrated from Rxjava to Retroift, added MVVM Architecture. (削除ここまで) (追記) [Don't Merge] Migrated Profile from Rxjava to Retroift & added MVVM Architecture (part 1) (追記ここまで) Dec 26, 2024
import timber.log.Timber
import javax.inject.Inject

class ProfileRepository @Inject constructor(private val apiService: APIService) {

This comment was marked as resolved.

) : Response<Int>


// https://tools.wmflabs.org/commons-android-app/tool-commons-android-app//feedback.py?user=Devanonymous
Copy link
Contributor Author

@neeldoshii neeldoshii Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this should I provide kdoc here? and if yes kdoc should I link the common apps API endpoint doc or provide a CURL link here?

Copy link
Member

@nicolas-raoul nicolas-raoul Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API endpoint doc is great if there is one. :-)

@neeldoshii neeldoshii changed the title (削除) [Don't Merge] Migrated Profile from Rxjava to Retroift & added MVVM Architecture (part 1) (削除ここまで) (追記) [WIP/Don't Merge] Migrated Profile from Rxjava to Retroift & added MVVM Architecture (part 1) (追記ここまで) Dec 26, 2024
Copy link
Contributor Author

Hi @nicolas-raoul,
I have been trying to break Achievement Fragment for a while on main.

compositeDisposable.add(
okHttpJsonApiClient
.getAchievements(userName ?: return)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{ response ->
if (response != null) {
setUploadCount(Achievements.from(response))
} else {
Timber.d("Success")
// TODO Create a Method to Hide all the Statistics
// binding.layoutImageReverts.visibility = View.INVISIBLE
// binding.achievementBadgeImage.visibility = View.INVISIBLE
// If the number of edits made by the user are more than 150,000
// in some cases such high number of wiki edit counts cause the
// achievements calculator to fail in some cases, for more details
// refer Issue: #3295
if (numberOfEdits <= 150_000) {
showSnackBarWithRetry(false)
} else {
showSnackBarWithRetry(true)
}
}
},

My Question :

  1. Difference between the editcount received from both the api (https://commons.wikimedia.org/w/api.php?action=query&list=users&usprop=editcount&ususers=Syced&format=json) & ((https://commons-android-app.toolforge.org/tool-commons-android-app/wikidataedits.py?user=Syced)

  2. I have hardcoded my username to your username(Syced) to test achievement with a high upload profile. Despite your edit count having less than 150000 server times out at your username (https://tools.wmflabs.org/commons-android-app/tool-commons-android-app/feedback.py?user=Syced) why is that? what should be the ideal editcount for our server to be able to handle it?

Copy link
Contributor Author

Soft ping @nicolas-raoul any idea about this #6082 (comment)

Copy link
Member

  1. https://commons-android-app.toolforge.org/tool-commons-android-app/wikidataedits.py?user=Syced is only for Wikidata edits.It gets shown as "Nearby edits" in Achievements.

  2. I guess the script got slower for some reason. Maybe we should change from 150000 to 10000 or something similar.

Copy link
Contributor Author

I guess the script got slower for some reason. Maybe we should change from 150000 to 10000 or something similar.

My guess is something else is the reason. From Leaderboard -> Weekly -> Upload. I see the top user as GeographBot who has around 29k upload counts. Even his profile is not opening.

Wikidata edits Url of GeographBot (0 EditCount) : https://tools.wmflabs.org/commons-android-app/tool-commons-android-app/wikidataedits.py?user=GeographBot

Achievements : https://tools.wmflabs.org/commons-android-app/tool-commons-android-app/feedback.py?user=GeographBot (Weekly Upload Count 29k)

This GeographBot has 0 wikidataedits still achievements doesn't load. So I think the wikidataeduts is not the reason for not loading achievements.

Sturm User Url : https://tools.wmflabs.org/commons-android-app/tool-commons-android-app/feedback.py?user=Sturm (Weekly Upload Count : 440)

On closer look I am unable to open top users achievement who has highest upload count from leaderboard. I am not sure what the actual reason for timeout needs investigation.

Copy link
Member

If the focus of this PR is architecture, don't worry too much about achievement timeouts or wrong counts, don't hesitate to file other issues for these. :-)

neeldoshii reacted with thumbs up emoji

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

Reviewers

@nicolas-raoul nicolas-raoul nicolas-raoul left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /