Browse Source

Merge pull request #9983 from nextcloud/dependabot/gradle/com.google.firebase-firebase-messaging-23.0.2

Bump firebase-messaging from 20.1.3 to 23.0.2
Álvaro Brey 3 years ago
parent
commit
edac6e2870
2 changed files with 20 additions and 26 deletions
  1. 1 1
      app/build.gradle
  2. 19 25
      app/src/gplay/java/com/owncloud/android/utils/GooglePlayUtils.kt

+ 1 - 1
app/build.gradle

@@ -352,7 +352,7 @@ dependencies {
     implementation "com.github.stateless4j:stateless4j:2.6.0"
 
     // upon each update first test: new registration, receive push
-    gplayImplementation "com.google.firebase:firebase-messaging:20.1.3"
+    gplayImplementation "com.google.firebase:firebase-messaging:23.0.2"
 }
 
 configurations.all {

+ 19 - 25
app/src/gplay/java/com/owncloud/android/utils/GooglePlayUtils.java → app/src/gplay/java/com/owncloud/android/utils/GooglePlayUtils.kt

@@ -15,38 +15,32 @@
  * GNU Affero General Public License for more details.
  *
  * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program.  If not, see <http:></http:>//www.gnu.org/licenses/>.
  */
+package com.owncloud.android.utils
 
-package com.owncloud.android.utils;
+import android.app.Activity
+import android.util.Log
+import com.google.android.gms.common.ConnectionResult
+import com.google.android.gms.common.GoogleApiAvailability
 
-import android.app.Activity;
-import android.util.Log;
+object GooglePlayUtils {
+    private const val PLAY_SERVICES_RESOLUTION_REQUEST = 9000
+    private const val TAG = "GooglePlayUtils"
 
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GoogleApiAvailability;
-
-public final class GooglePlayUtils {
-    private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
-    private static final String TAG = "GooglePlayUtils";
-
-    private GooglePlayUtils() {
-    }
-
-    public static boolean checkPlayServices(Activity activity) {
-        GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
-        int resultCode = apiAvailability.isGooglePlayServicesAvailable(activity);
+    @JvmStatic
+    fun checkPlayServices(activity: Activity): Boolean {
+        val apiAvailability = GoogleApiAvailability.getInstance()
+        val resultCode = apiAvailability.isGooglePlayServicesAvailable(activity)
         if (resultCode != ConnectionResult.SUCCESS) {
             if (apiAvailability.isUserResolvableError(resultCode)) {
-                apiAvailability.getErrorDialog(activity, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
-                        .show();
+                apiAvailability.getErrorDialog(activity, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)?.show()
             } else {
-                Log.i(TAG, "This device is not supported.");
-                activity.finish();
+                Log.i(TAG, "This device is not supported.")
+                activity.finish()
             }
-            return false;
+            return false
         }
-        return true;
+        return true
     }
-
-}
+}