Skip to content

Commit

Permalink
Login related customization.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed Apr 2, 2024
1 parent 280e814 commit 5b17f6c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
6 changes: 6 additions & 0 deletions app/src/debug/res/values/setup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- webview_login_url should be empty in debug mode to show login url input screen
this will be useful in switching the environments during testing -->
<string name="webview_login_url" translatable="false" />
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,13 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
if (accountSetupWebviewBinding != null && event.getAction() == KeyEvent.ACTION_DOWN &&
keyCode == KeyEvent.KEYCODE_BACK) {
if (accountSetupWebviewBinding.loginWebview.canGoBack()) {
accountSetupWebviewBinding.loginWebview.goBack();
// NMC-2602 Fix
// On back press "Webpage not available" error comes
// because login urls doesn't maintain the backstack hierarchy
// to solve it we are recreating the activity with the actual login url
// if user presses back from other urls which is not first or login url
// it will recreate the activity else it will finish the activity
recreate();
} else {
finish();
}
Expand Down Expand Up @@ -459,6 +465,10 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);

//scroll to top when url loads
//because directly loading Telekom login page it scrolls down automatically
view.scrollTo(0,0);

accountSetupWebviewBinding.loginWebviewProgressBar.setVisibility(View.GONE);
accountSetupWebviewBinding.loginWebview.setVisibility(View.VISIBLE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ protected void onNewIntent(Intent intent) {
protected void onRestart() {
Log_OC.v(TAG, "onRestart() start");
super.onRestart();
mixinRegistry.onRestart();
//Fix of NMC-2303 and NMC-2441
if (enableAccountHandling) {
mixinRegistry.onRestart();
}
}

private void onThemeSettingsModeChanged() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,8 @@ protected void onStop() {

@Subscribe(threadMode = ThreadMode.MAIN)
public void onAccountRemovedEvent(AccountRemovedEvent event) {
restart();
//NMC customization
finish();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<color name="login_text_hint_color">#7fC0E3</color>

<!-- Multiaccount support -->
<bool name="multiaccount_support">true</bool>
<bool name="multiaccount_support">false</bool>

<!-- Drawer options -->
<bool name="recently_modified_enabled">false</bool>
Expand Down
5 changes: 5 additions & 0 deletions app/src/release/res/values/setup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- webview_login_url prod -->
<string name="webview_login_url" translatable="false" >https://magentacloud.de/index.php/login/flow</string>
</resources>

0 comments on commit 5b17f6c

Please sign in to comment.