Skip to content

Commit f031113

Browse files
committed
Login related customization.
1 parent 48dacdc commit f031113

6 files changed

Lines changed: 33 additions & 3 deletions

File tree

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/nextcloud/client/account/UserAccountManagerImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import com.nextcloud.common.NextcloudClient;
2424
import com.nextcloud.utils.extensions.AccountExtensionsKt;
25+
import com.nmc.android.ui.LauncherActivity;
2526
import com.owncloud.android.MainApp;
2627
import com.owncloud.android.R;
2728
import com.owncloud.android.authentication.AuthenticatorActivity;
@@ -398,6 +399,10 @@ private String getAccountType() {
398399

399400
@Override
400401
public void startAccountCreation(final Activity activity) {
402+
// NMC-3278 fix
403+
// Splash screen should be shown properly before navigating to Login screen
404+
if(activity instanceof LauncherActivity) return;
405+
401406
Intent intent = new Intent(context, AuthenticatorActivity.class);
402407

403408
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,13 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
388388
if (accountSetupWebviewBinding != null && event.getAction() == KeyEvent.ACTION_DOWN &&
389389
keyCode == KeyEvent.KEYCODE_BACK) {
390390
if (accountSetupWebviewBinding.loginWebview.canGoBack()) {
391-
accountSetupWebviewBinding.loginWebview.goBack();
391+
// NMC-2602 Fix
392+
// On back press "Webpage not available" error comes
393+
// because login urls doesn't maintain the backstack hierarchy
394+
// to solve it we are recreating the activity with the actual login url
395+
// if user presses back from other urls which is not first or login url
396+
// it will recreate the activity else it will finish the activity
397+
recreate();
392398
} else {
393399
finish();
394400
}
@@ -430,6 +436,10 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
430436
public void onPageFinished(WebView view, String url) {
431437
super.onPageFinished(view, url);
432438

439+
//scroll to top when url loads
440+
//because directly loading Telekom login page it scrolls down automatically
441+
view.scrollTo(0,0);
442+
433443
accountSetupWebviewBinding.loginWebviewProgressBar.setVisibility(View.GONE);
434444
accountSetupWebviewBinding.loginWebview.setVisibility(View.VISIBLE);
435445

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

12211221
@Subscribe(threadMode = ThreadMode.MAIN)
12221222
public void onAccountRemovedEvent(AccountRemovedEvent event) {
1223-
restart();
1223+
//NMC customization
1224+
finish();
12241225
}
12251226

12261227
/**
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)