فهرست منبع

directly go back to app if SSO is used

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 4 سال پیش
والد
کامیت
07e4ac28df
1فایلهای تغییر یافته به همراه14 افزوده شده و 3 حذف شده
  1. 14 3
      src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java

+ 14 - 3
src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -262,7 +262,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             onboarding.launchFirstRunIfNeeded(this);
         }
 
-        onlyAdd = getIntent().getBooleanExtra(KEY_ONLY_ADD, false);
+        onlyAdd = getIntent().getBooleanExtra(KEY_ONLY_ADD, false) || checkIfViaSSO(getIntent());
 
         // delete cookies for webView
         deleteCookies();
@@ -676,7 +676,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             super.finish();
         }
 
-        onlyAdd = intent.getBooleanExtra(KEY_ONLY_ADD, false);
+        onlyAdd = intent.getBooleanExtra(KEY_ONLY_ADD, false) || checkIfViaSSO(intent);
 
         // Passcode
         PassCodeManager passCodeManager = new PassCodeManager(preferences);
@@ -702,6 +702,15 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         }
     }
 
+    private boolean checkIfViaSSO(Intent intent) {
+        Bundle extras = intent.getExtras();
+        if (extras == null) {
+            return false;
+        } else {
+            return extras.getParcelable("accountAuthenticatorResponse") != null;
+        }
+    }
+
 
     /**
      * The redirection triggered by the OAuth authentication server as response to the GET AUTHORIZATION, and deferred
@@ -1124,7 +1133,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
 
             if (success) {
                 accountManager.setCurrentOwnCloudAccount(mAccount.name);
-                if (!onlyAdd) {
+                if (onlyAdd) {
+                    finish();
+                } else {
                     Intent i = new Intent(this, FileDisplayActivity.class);
                     i.setAction(FileDisplayActivity.RESTART);
                     i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);