diff --git a/build.gradle b/build.gradle index c698a56833..5d4e9036b7 100644 --- a/build.gradle +++ b/build.gradle @@ -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' diff --git a/src/gplay/java/com/owncloud/android/utils/PushUtils.java b/src/gplay/java/com/owncloud/android/utils/PushUtils.java index 908a8be7ed..a936712fd1 100644 --- a/src/gplay/java/com/owncloud/android/utils/PushUtils.java +++ b/src/gplay/java/com/owncloud/android/utils/PushUtils.java @@ -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"); diff --git a/src/main/java/com/owncloud/android/authentication/AccountUtils.java b/src/main/java/com/owncloud/android/authentication/AccountUtils.java index 4dec94fa9c..478a2b0d5c 100644 --- a/src/main/java/com/owncloud/android/authentication/AccountUtils.java +++ b/src/main/java/com/owncloud/android/authentication/AccountUtils.java @@ -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 diff --git a/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java b/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java index 4c08c0ce5c..f4ed951784 100644 --- a/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java @@ -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(); + } } } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index deb1f8b30b..25ecd30a59 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -708,4 +708,5 @@ GNU General Public License, version 2 Push notifications disabled due to dependencies on proprietary Google Play services. No push notifications due to outdated login session. Please consider re-adding your account. + Push notifications currently not available.