Skip to content
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

Provide possibility to verify login data in settings #210

Merged
merged 3 commits into from
Aug 13, 2021
Merged

Provide possibility to verify login data in settings #210

merged 3 commits into from
Aug 13, 2021

Conversation

SchoolGuy
Copy link
Contributor

This fixes #188

I will extend this once I have something presentable.

@cgeo-ci-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@SchoolGuy
Copy link
Contributor Author

@bekuno Can I somehow disable the CI Bot until this is out of WIP/Draft state. I think that would save you some resources.

@Lineflyer
Copy link
Member

@SchoolGuy Not a big issue. It will do nothing until we give it the OK. So tell when ready, then we trigger the CI.

@SchoolGuy
Copy link
Contributor Author

@Lineflyer Okay thanks for the info. I will remove the WIP progress and convert it to a "ready" PR when I am done.

@SchoolGuy
Copy link
Contributor Author

Okay this was laying around. But I am starting to now dive into how this is done. The implementation of the Settings in WhereYouGo are so custom that I will just rewrite this. It works yes but it is ugly as hell. There are shared Preferences for a reason and then why not just use them. Currently we do this in custom classes etc. Also our Folder Picker is not updated and won't work on Fragments, thus this needs also to be changed. So this will take a while until I can fix all of that.

BUT all of this means that we will get a huge modernization of the app, allowing us to be more aligned with other changed from Android.

@bekuno
Copy link
Member

bekuno commented Oct 27, 2020

@SchoolGuy This sounds very good. A modernization of the app is needed and welcome.

@SchoolGuy
Copy link
Contributor Author

Lol. Just found out that we are not using AppCompatActivity anywhere and instead are using a CustomActivity. I thought this will be simple thing and now I am rewriting everything... Oh boy this PR will be fun when its done.

@SchoolGuy
Copy link
Contributor Author

SchoolGuy commented Oct 27, 2020

Okay new TODO list to get the button we actually want with this PR:

  • Rewrite the UI so we are using AppCompatActivty - this gives us the advantage so we don't need to take care of backward compability
  • Rewrite preferences so we are using the Android framework and not our own Preferences - even more alignment with Android
  • Add the actual button

@SchoolGuy
Copy link
Contributor Author

Just to amuse the rest reading this...

clearPackageFromMemory(); // XXX not work on 2.2 and higher!!!

As far as I understand this comment we have code which is worrying about clearing up the memory on Android 2.2. I think We can safely remove this. Can't we? 😂

@SchoolGuy
Copy link
Contributor Author

Commit 4e342f3 makes it possible to navigate through the settings again. BUT header bar is missing, edit is not tested, preview was deleted and I didn't check for any new bugs caused by changed to the AppCompat Themes.

@SchoolGuy
Copy link
Contributor Author

@bekuno I think I am now deep enough in the code to understand what is vaguely done where... How much should I separate my efforts to fix tech-debt and fix the issue of checking the login data? Or should I just smash everything in here?

@bekuno
Copy link
Member

bekuno commented Oct 28, 2020

Please divide the changes into parts as small as possible and reasonable. This facilitates the evaluation and a possibly necessary troubleshooting.
If the topic is in need of discussion then an issue should be created. Of course also if it is a topic that cannot be solved immediately.
Please always write to the PR what his task is and explain the solution if necessary.

I have noticed some sub areas of this PR, for example

  • Change of the minSdk - why is this necessary?
  • Abolition of the logger class - why?
  • Migration to androidx preferences
  • Adaptation of the theme styles

These are such typical single PR topics.

@SchoolGuy
Copy link
Contributor Author

SchoolGuy commented Oct 28, 2020

  • Okay I checked regarding the minSdk. Apparently the reasons why I did this had other root reasons, now this is working again.
  • Abolition of the logger class? - Well is was just tailcalling the Android framework and logging to a file partly. The rest is explained in the commit. For me this is just dead code. We really don't gain any advantages through this.
  • Migration to androidx preferences & Adaption of Theme Styles... Well this is just removing tech-debt and enabling my self to add that so much desired button.

So if we ignore the commits which are related to just removing literal dead code then all of this is directly related to this PR.

@SchoolGuy
Copy link
Contributor Author

But I understand your point and will try to seperate as much as possible.

Copy link
Collaborator

Codacy Here is an overview of what got changed by this pull request:

Issues
======
+ Solved 16
           

Complexity increasing per file
==============================
- src/main/java/menion/android/whereyougo/gui/fragments/settings/SettingsLocalizationFragment.java  1
- src/main/java/menion/android/whereyougo/gui/fragments/settings/SettingsLocationFragment.java  1
- src/main/java/menion/android/whereyougo/gui/fragments/settings/SettingsDirectionsFragment.java  1
- src/main/java/menion/android/whereyougo/gui/fragments/settings/SettingsGlobalFragment.java  1
- src/main/java/menion/android/whereyougo/gui/fragments/settings/SettingsCompassFragment.java  1
- src/main/java/menion/android/whereyougo/gui/fragments/settings/SettingsHiddenFragment.java  1
- src/main/java/menion/android/whereyougo/gui/fragments/settings/SettingsCredentialsFragment.java  1
- src/main/java/menion/android/whereyougo/gui/fragments/settings/SettingsAppearanceFragment.java  1
- src/main/java/menion/android/whereyougo/gui/fragments/settings/WhereYouGoSettingsFragment.java  1
         

Complexity decreasing per file
==============================
+ src/main/java/menion/android/whereyougo/gui/activity/XmlSettingsActivity.java  -49
         

See the complete overview on Codacy

@bekuno
Copy link
Member

bekuno commented Oct 28, 2020

That would be fine.
At the end after rebasing this PR to master with the other changes it should only consist of changes to the initial plan - fix #188.

@SchoolGuy
Copy link
Contributor Author

One last note: We generate a file called error.log. I know from experience that this file is only produced by WhereYouGo when Luacode in the Wherigo fails somehow. I see now that this is the reason for our custom logging class. I think through magic we also make use of this for normal Wherigo Logs. Thus I will drop this. I think I will instead add docs for this later...

@SchoolGuy
Copy link
Contributor Author

I force pushed because now only #240 is missing before this one. This PR currently shows the button but it has no functionality because I need to check how we are going to find out if the data is correct.

@SchoolGuy
Copy link
Contributor Author

I will continue to work on this starting tomorrow.

@SchoolGuy
Copy link
Contributor Author

I did rebase this on master. The actual button is still there but my laptop has a crashing AVD, will test it tomorrow on my main computer.

@SchoolGuy
Copy link
Contributor Author

@bekuno & @Lineflyer & other people of interest...

Okay so my rebase did mess up the code a bit. I am currently trying to fix the code again so the login check works. While I am doing this...

What is your opinion on having a round one of these boys fading one of those on success. On failure I would obviously do the some with a cross.

Second thought: Should I save the result of the check and display it the next time the user visits this page or do we want to display the result of the check only on button click?

@SchoolGuy
Copy link
Contributor Author

^ For context: I am not using the Progress Dialog due to this Deprecation Warning: https://developer.android.com/reference/android/app/ProgressDialog

@SchoolGuy
Copy link
Contributor Author

Okay that was quick... I didn't expect that. The code now works. But no user feedback is implemented on the button click yet.

@SchoolGuy
Copy link
Contributor Author

So due to some GC.com problems I can't test the positive side of the code but I think this is now read.y

@SchoolGuy SchoolGuy marked this pull request as ready for review June 20, 2021 13:11
@SchoolGuy
Copy link
Contributor Author

@bekuno Ping again?

Comment on lines 82 to 99
loginCheckdialog.setMessage("Init");
break;
case PING:
loginCheckdialog.setMessage("Pinging");
break;
case LOGIN:
loginCheckdialog.setMessage("Logging in");
break;
case LOGOUT:
loginCheckdialog.setMessage("Logging out");
break;
default:
loginCheckdialog.setMessage("Something unexpected happened. Please close the dialog!");
break;
}
break;
default:
loginCheckdialog.setMessage("Something unexpected happened. Please close the dialog!");
Copy link
Member

Choose a reason for hiding this comment

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

This user visible string should be translated strings.

Is there a different behavior between the message "Logging in" (and other) and the defaults?
I dont understand, why "Please close the dialog!" is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In case for example that we receive a network disconnect or a networked changed event, the Task can't finish and the network possibly will throw a stacktrace, thus the error message for the user. Since we define the well known states inside the case, we want to catch all other situations to be safe on the usability side.

Copy link
Member

Choose a reason for hiding this comment

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

In the error situation you set the Button text to pref_gc_check_dialog_negative_button_close, the same as in the success situation.
The text "Please close the dialog!" is is therefore superfluous.

@bekuno
Copy link
Member

bekuno commented Jul 4, 2021

The login check works really fine :-). I love it.
Thanks for your work.

@SchoolGuy
Copy link
Contributor Author

@bekuno To keep the Git History vaguely clean I force pushed. Plelase re-review... :)

@SchoolGuy
Copy link
Contributor Author

@bekuno Ping?

@SchoolGuy
Copy link
Contributor Author

Wanted to clean the Git History for that space and accidently removed your commits @bekuno
Could you rebase and push them again please?

@bekuno
Copy link
Member

bekuno commented Jul 13, 2021

Wanted to clean the Git History for that space and accidently removed your commits @bekuno
Could you rebase and push them again please?

new changed with web editor.
Please rebase now.

@SchoolGuy SchoolGuy changed the title WIP: Provide possibility to verify login data in settings Provide possibility to verify login data in settings Jul 14, 2021
@SchoolGuy
Copy link
Contributor Author

@bekuno I think this is clean and ready now to be merged. If I forgot something, please point me to it.

@bekuno
Copy link
Member

bekuno commented Jul 14, 2021

I will test it the next days.
There are already 2 follow up issues - #294 and #296.

@SchoolGuy
Copy link
Contributor Author

@bekuno Ping?

@SchoolGuy
Copy link
Contributor Author

@bekuno Ping again?

@bekuno
Copy link
Member

bekuno commented Jul 28, 2021

I tested yesterday a bit.
The "Close dialog" is alredy set before "logging out", but should set after it, imho.
Please have a look at it.

@SchoolGuy
Copy link
Contributor Author

@bekuno Fixed and tested

@SchoolGuy
Copy link
Contributor Author

@bekuno Ping?

@SchoolGuy
Copy link
Contributor Author

@bekuno I really would like to get this merged soon. It is open way too long for my liking...

@SchoolGuy
Copy link
Contributor Author

@bekuno Ping?

@Lineflyer
Copy link
Member

Lets merge to do further testing.

@bekuno Hope its OK for you...but indeed this PR is open to long and I guess @SchoolGuy will anyway continue to work on it if there are any deficiencies left.

@Lineflyer Lineflyer merged commit 1d555fe into cgeo:master Aug 13, 2021
@SchoolGuy SchoolGuy deleted the feature/add-login-verify branch August 13, 2021 20:04
@bekuno
Copy link
Member

bekuno commented Aug 13, 2021

Lets merge to do further testing.

@bekuno Hope its OK for you...but indeed this PR is open to long and I guess @SchoolGuy will anyway continue to work on it if there are any deficiencies left.

@Lineflyer It' s fine for me.
@SchoolGuy Thank you very much for your work on WhereYouGo. I appreciate it very much.

I have had not much time, therefore I concentrated my work to c:geo.
I will test the change the next days. But I think the last requested change was realized.
For now we have already a bug #296 and a follow up FR #294.

@SchoolGuy
Copy link
Contributor Author

@bekuno I am aware but I will first focus on cgeo/cgeo#11298 so I don't open to many PRs at once. A day has only 24h for as well.

@bekuno
Copy link
Member

bekuno commented Aug 15, 2021

@bekuno I am aware but I will first focus on cgeo/cgeo#11298 so I don't open to many PRs at once. A day has only 24h for as well.

That's perfect.
And I hope that later the knowledge of SAF from c:geo will bring WYG forward to a new release.

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

Successfully merging this pull request may close these issues.

Provide possibility to verify login data in settings
4 participants