Skip to content

Commit 9ea94cb

Browse files
committed
Login related customization.
1 parent 5c38fc5 commit 9ea94cb

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

app/src/debug/res/values/setup.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- webview_login_url should be empty in debug mode to show login url input screen
4+
this will be useful in switching the environments during testing -->
5+
<string name="webview_login_url" translatable="false" />
6+
</resources>

app/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,13 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
539539
if (accountSetupWebviewBinding != null && event.getAction() == KeyEvent.ACTION_DOWN &&
540540
keyCode == KeyEvent.KEYCODE_BACK) {
541541
if (accountSetupWebviewBinding.loginWebview.canGoBack()) {
542-
accountSetupWebviewBinding.loginWebview.goBack();
542+
// NMC-2602 Fix
543+
// On back press "Webpage not available" error comes
544+
// because login urls doesn't maintain the backstack hierarchy
545+
// to solve it we are recreating the activity with the actual login url
546+
// if user presses back from other urls which is not first or login url
547+
// it will recreate the activity else it will finish the activity
548+
recreate();
543549
} else {
544550
finish();
545551
}
@@ -577,6 +583,10 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
577583
public void onPageFinished(WebView view, String url) {
578584
super.onPageFinished(view, url);
579585

586+
//scroll to top when url loads
587+
//because directly loading Telekom login page it scrolls down automatically
588+
view.scrollTo(0,0);
589+
580590
accountSetupWebviewBinding.loginWebviewProgressBar.setVisibility(View.GONE);
581591
accountSetupWebviewBinding.loginWebview.setVisibility(View.VISIBLE);
582592

app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,8 @@ protected void onStop() {
12151215

12161216
@Subscribe(threadMode = ThreadMode.MAIN)
12171217
public void onAccountRemovedEvent(AccountRemovedEvent event) {
1218-
restart();
1218+
//NMC customization
1219+
finish();
12191220
}
12201221

12211222
/**

app/src/main/res/values/setup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<color name="login_text_hint_color">#7fC0E3</color>
6666

6767
<!-- Multiaccount support -->
68-
<bool name="multiaccount_support">true</bool>
68+
<bool name="multiaccount_support">false</bool>
6969

7070
<!-- Drawer options -->
7171
<bool name="recently_modified_enabled">false</bool>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- webview_login_url prod -->
4+
<string name="webview_login_url" translatable="false" >https://magentacloud.de/index.php/login/flow</string>
5+
</resources>

0 commit comments

Comments
 (0)