Basics of push

This commit is contained in:
Mario Danic 2017-03-28 12:29:59 +02:00 committed by tobiasKaminsky
parent a49f8792ee
commit 9ea45c74a7
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
8 changed files with 76 additions and 9 deletions

View file

@ -94,7 +94,14 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
return e.getFailureBundle(); return e.getFailureBundle();
} }
Intent intent = new Intent(mContext, AuthenticatorActivity.class); Intent intent;
if (!mContext.getResources().getBoolean(R.bool.push_enabled) &&
!mContext.getResources().getBoolean(R.bool.analytics_enabled)) {
intent = new Intent(mContext, AuthenticatorActivity.class);
} else {
intent = new Intent(mContext, ModifiedAuthenticatorActivity.class);
}
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType); intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
intent.putExtra(KEY_REQUIRED_FEATURES, requiredFeatures); intent.putExtra(KEY_REQUIRED_FEATURES, requiredFeatures);
@ -138,7 +145,14 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
return e.getFailureBundle(); return e.getFailureBundle();
} }
Intent intent = new Intent(mContext, AuthenticatorActivity.class); Intent intent;
if (!mContext.getResources().getBoolean(R.bool.push_enabled)
&& !mContext.getResources().getBoolean(R.bool.analytics_enabled)) {
intent = new Intent(mContext, AuthenticatorActivity.class);
} else {
intent = new Intent(mContext, ModifiedAuthenticatorActivity.class);
}
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
response); response);
intent.putExtra(KEY_ACCOUNT, account); intent.putExtra(KEY_ACCOUNT, account);
@ -189,7 +203,13 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
} }
/// if not stored, return Intent to access the AuthenticatorActivity and UPDATE the token for the account /// if not stored, return Intent to access the AuthenticatorActivity and UPDATE the token for the account
Intent intent = new Intent(mContext, AuthenticatorActivity.class); Intent intent;
if (!mContext.getResources().getBoolean(R.bool.push_enabled)
&& !mContext.getResources().getBoolean(R.bool.analytics_enabled)) {
intent = new Intent(mContext, AuthenticatorActivity.class);
} else {
intent = new Intent(mContext, ModifiedAuthenticatorActivity.class);
}
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType); intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
intent.putExtra(KEY_LOGIN_OPTIONS, options); intent.putExtra(KEY_LOGIN_OPTIONS, options);
@ -220,7 +240,13 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
Account account, String authTokenType, Bundle options) Account account, String authTokenType, Bundle options)
throws NetworkErrorException { throws NetworkErrorException {
Intent intent = new Intent(mContext, AuthenticatorActivity.class); Intent intent;
if (!mContext.getResources().getBoolean(R.bool.push_enabled) &&
!mContext.getResources().getBoolean(R.bool.analytics_enabled)) {
intent = new Intent(mContext, AuthenticatorActivity.class);
} else {
intent = new Intent(mContext, ModifiedAuthenticatorActivity.class);
}
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
intent.putExtra(KEY_ACCOUNT, account); intent.putExtra(KEY_ACCOUNT, account);
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType); intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);

View file

@ -41,6 +41,7 @@ import android.util.Pair;
import com.owncloud.android.R; import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.authentication.ModifiedAuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudAccount; import com.owncloud.android.lib.common.OwnCloudAccount;
@ -579,7 +580,14 @@ public class FileDownloader extends Service
if (needsToUpdateCredentials) { if (needsToUpdateCredentials) {
// let the user update credentials with one click // let the user update credentials with one click
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class); Intent updateAccountCredentials;
if (!getResources().getBoolean(R.bool.push_enabled)
&& !getResources().getBoolean(R.bool.analytics_enabled)) {
updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
} else {
updateAccountCredentials = new Intent(this, ModifiedAuthenticatorActivity.class);
}
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT,
download.getAccount()); download.getAccount());
updateAccountCredentials.putExtra( updateAccountCredentials.putExtra(

View file

@ -48,6 +48,7 @@ import android.util.Pair;
import com.owncloud.android.R; import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.authentication.ModifiedAuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.ThumbnailsCacheManager; import com.owncloud.android.datamodel.ThumbnailsCacheManager;
@ -1081,7 +1082,13 @@ public class FileUploader extends Service
if (needsToUpdateCredentials) { if (needsToUpdateCredentials) {
// let the user update credentials with one click // let the user update credentials with one click
// let the user update credentials with one click // let the user update credentials with one click
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class); Intent updateAccountCredentials;
if (!getResources().getBoolean(R.bool.push_enabled)
&& !getResources().getBoolean(R.bool.analytics_enabled)) {
updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
} else {
updateAccountCredentials = new Intent(this, ModifiedAuthenticatorActivity.class);
}
updateAccountCredentials.putExtra( updateAccountCredentials.putExtra(
AuthenticatorActivity.EXTRA_ACCOUNT, upload.getAccount() AuthenticatorActivity.EXTRA_ACCOUNT, upload.getAccount()
); );

View file

@ -37,6 +37,7 @@ import android.support.v4.app.NotificationCompat;
import com.owncloud.android.R; import com.owncloud.android.R;
import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.authentication.ModifiedAuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@ -400,7 +401,14 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
if (needsToUpdateCredentials) { if (needsToUpdateCredentials) {
// let the user update credentials with one click // let the user update credentials with one click
// let the user update credentials with one click // let the user update credentials with one click
Intent updateAccountCredentials = new Intent(getContext(), AuthenticatorActivity.class); Intent updateAccountCredentials;
if (!getContext().getResources().getBoolean(R.bool.push_enabled)
&& !getContext().getResources().getBoolean(R.bool.analytics_enabled)) {
updateAccountCredentials = new Intent(getContext(), AuthenticatorActivity.class);
} else {
updateAccountCredentials = new Intent(getContext(), ModifiedAuthenticatorActivity.class);
}
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, getAccount()); updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, getAccount());
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION,
AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN); AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN);

View file

@ -40,6 +40,7 @@ import com.owncloud.android.MainApp;
import com.owncloud.android.R; import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.authentication.ModifiedAuthenticatorActivity;
import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.ui.helpers.FileOperationsHelper; import com.owncloud.android.ui.helpers.FileOperationsHelper;
import com.owncloud.android.files.services.FileDownloader; import com.owncloud.android.files.services.FileDownloader;
@ -396,7 +397,13 @@ public abstract class FileActivity extends DrawerActivity
} }
/// step 2 - request credentials to user /// step 2 - request credentials to user
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class); Intent updateAccountCredentials;
if (!getResources().getBoolean(R.bool.push_enabled) &&
!getResources().getBoolean(R.bool.analytics_enabled)) {
updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
} else {
updateAccountCredentials = new Intent(this, ModifiedAuthenticatorActivity.class);
}
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account); updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account);
updateAccountCredentials.putExtra( updateAccountCredentials.putExtra(
AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.EXTRA_ACTION,

View file

@ -48,6 +48,7 @@ import android.widget.TextView;
import com.owncloud.android.R; import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.authentication.ModifiedAuthenticatorActivity;
import com.owncloud.android.lib.common.UserInfo; import com.owncloud.android.lib.common.UserInfo;
import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@ -285,7 +286,14 @@ public class UserInfoActivity extends FileActivity {
private void changeAccountPassword(Account account) { private void changeAccountPassword(Account account) {
// let the user update credentials with one click // let the user update credentials with one click
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class); Intent updateAccountCredentials;
if (!getResources().getBoolean(R.bool.push_enabled) &&
!getResources().getBoolean(R.bool.analytics_enabled)) {
updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
} else {
updateAccountCredentials = new Intent(this, ModifiedAuthenticatorActivity.class);
}
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account); updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account);
updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION,
AuthenticatorActivity.ACTION_UPDATE_TOKEN); AuthenticatorActivity.ACTION_UPDATE_TOKEN);

View file

@ -118,6 +118,8 @@
<!-- analytics enabled --> <!-- analytics enabled -->
<bool name="analytics_enabled">false</bool> <bool name="analytics_enabled">false</bool>
<bool name="push_enabled">false</bool>
<!-- Files becomes Home --> <!-- Files becomes Home -->
<bool name="use_home">false</bool> <bool name="use_home">false</bool>

View file

@ -112,6 +112,7 @@
<!-- analytics enabled --> <!-- analytics enabled -->
<bool name="analytics_enabled">false</bool> <bool name="analytics_enabled">false</bool>
<bool name="push_enabled">true</bool>
<!-- Files becomes Home --> <!-- Files becomes Home -->
<bool name="use_home">true</bool> <bool name="use_home">true</bool>