Skip to content

Commit 8cb1687

Browse files
surinder-tsystobiasKaminsky
authored andcommitted
Login related customization.
1 parent 140e8a2 commit 8cb1687

File tree

6 files changed

+29
-4
lines changed

6 files changed

+29
-4
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
@@ -500,7 +500,13 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
500500
if (accountSetupWebviewBinding != null && event.getAction() == KeyEvent.ACTION_DOWN &&
501501
keyCode == KeyEvent.KEYCODE_BACK) {
502502
if (accountSetupWebviewBinding.loginWebview.canGoBack()) {
503-
accountSetupWebviewBinding.loginWebview.goBack();
503+
// NMC-2602 Fix
504+
// On back press "Webpage not available" error comes
505+
// because login urls doesn't maintain the backstack hierarchy
506+
// to solve it we are recreating the activity with the actual login url
507+
// if user presses back from other urls which is not first or login url
508+
// it will recreate the activity else it will finish the activity
509+
recreate();
504510
} else {
505511
finish();
506512
}
@@ -542,6 +548,10 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
542548
public void onPageFinished(WebView view, String url) {
543549
super.onPageFinished(view, url);
544550

551+
//scroll to top when url loads
552+
//because directly loading Telekom login page it scrolls down automatically
553+
view.scrollTo(0,0);
554+
545555
accountSetupWebviewBinding.loginWebviewProgressBar.setVisibility(View.GONE);
546556
accountSetupWebviewBinding.loginWebview.setVisibility(View.VISIBLE);
547557

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ protected void onNewIntent(Intent intent) {
115115
protected void onRestart() {
116116
Log_OC.v(TAG, "onRestart() start");
117117
super.onRestart();
118-
mixinRegistry.onRestart();
118+
//Fix of NMC-2303 and NMC-2441
119+
if (enableAccountHandling) {
120+
mixinRegistry.onRestart();
121+
}
119122
}
120123

121124
private void onThemeSettingsModeChanged() {

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
@@ -1217,7 +1217,8 @@ protected void onStop() {
12171217

12181218
@Subscribe(threadMode = ThreadMode.MAIN)
12191219
public void onAccountRemovedEvent(AccountRemovedEvent event) {
1220-
restart();
1220+
//NMC customization
1221+
finish();
12211222
}
12221223

12231224
/**

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)