mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 07:05:49 +03:00
use result code to determinate if old login
This commit is contained in:
parent
46535cdc02
commit
0aa2aaaab1
5 changed files with 18 additions and 3 deletions
|
@ -184,7 +184,7 @@ dependencies {
|
|||
/// dependencies for app building
|
||||
implementation name: 'touch-image-view'
|
||||
implementation 'com.android.support:multidex:1.0.2'
|
||||
compile 'com.github.nextcloud:android-library:1.0.30'
|
||||
compile 'com.github.nextcloud:android-library:pushWarning-SNAPSHOT'
|
||||
implementation "com.android.support:support-v4:${supportLibraryVersion}"
|
||||
implementation "com.android.support:design:${supportLibraryVersion}"
|
||||
implementation 'com.jakewharton:disklrucache:2.0.2'
|
||||
|
|
|
@ -247,6 +247,10 @@ public class PushUtils {
|
|||
arbitraryDataProvider.storeOrUpdateKeyValue(account.name, KEY_PUSH,
|
||||
gson.toJson(pushArbitraryData));
|
||||
}
|
||||
} else if (remoteOperationResult.getCode() ==
|
||||
RemoteOperationResult.ResultCode.ACCOUNT_USES_OLD_LOGIN) {
|
||||
arbitraryDataProvider.storeOrUpdateKeyValue(account.name,
|
||||
AccountUtils.ACCOUNT_USES_OLD_LOGIN, "true");
|
||||
}
|
||||
} catch (com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException e) {
|
||||
Log_OC.d(TAG, "Failed to find an account");
|
||||
|
|
|
@ -52,6 +52,7 @@ public class AccountUtils {
|
|||
|
||||
public static final int ACCOUNT_VERSION = 1;
|
||||
public static final int ACCOUNT_VERSION_WITH_PROPER_ID = 2;
|
||||
public static final String ACCOUNT_USES_OLD_LOGIN = "ACCOUNT_USES_OLD_LOGIN";
|
||||
|
||||
/**
|
||||
* Can be used to get the currently selected ownCloud {@link Account} in the
|
||||
|
|
|
@ -152,11 +152,20 @@ public class NotificationsActivity extends FileActivity {
|
|||
} else {
|
||||
Account account = AccountUtils.getCurrentOwnCloudAccount(context);
|
||||
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
|
||||
String pushValue = arbitraryDataProvider.getValue(account.name, PushUtils.KEY_PUSH);
|
||||
|
||||
if (pushValue == null || pushValue.isEmpty()) {
|
||||
boolean usesOldLogin = arbitraryDataProvider.getBooleanValue(account.name,
|
||||
AccountUtils.ACCOUNT_USES_OLD_LOGIN);
|
||||
|
||||
if (usesOldLogin) {
|
||||
Snackbar.make(emptyContentContainer, R.string.push_notifications_old_login,
|
||||
Snackbar.LENGTH_INDEFINITE).show();
|
||||
} else {
|
||||
String pushValue = arbitraryDataProvider.getValue(account.name, PushUtils.KEY_PUSH);
|
||||
|
||||
if (pushValue == null || pushValue.isEmpty()) {
|
||||
Snackbar.make(emptyContentContainer, R.string.push_notifications_temp_error,
|
||||
Snackbar.LENGTH_INDEFINITE).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -708,4 +708,5 @@
|
|||
<string name="prefs_gpl_v2" translatable="false">GNU General Public License, version 2</string>
|
||||
<string name="push_notifications_not_implemented">Push notifications disabled due to dependencies on proprietary Google Play services.</string>
|
||||
<string name="push_notifications_old_login">No push notifications due to outdated login session. Please consider re-adding your account.</string>
|
||||
<string name="push_notifications_temp_error">Push notifications currently not available.</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue