destroy-gcm-support.patch 7.61 KB
Newer Older
CapsLock's avatar
CapsLock committed
1
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
CapsLock's avatar
CapsLock committed
2
index ab96f79f4..7c3e9cfc6 100644
CapsLock's avatar
CapsLock committed
3 4
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
5
@@ -537,13 +537,13 @@
CapsLock's avatar
CapsLock committed
6
 
CapsLock's avatar
CapsLock committed
7
     <service android:name=".service.GenericForegroundService"/>
CapsLock's avatar
CapsLock committed
8
 
9
-    <service android:name=".gcm.FcmFetchService" />
CapsLock's avatar
CapsLock committed
10
+    <!-- <service android:name=".gcm.FcmFetchService" /> -->
11
 
CapsLock's avatar
CapsLock committed
12 13
-    <service android:name=".gcm.FcmReceiveService">
+    <!-- <service android:name=".gcm.FcmReceiveService">
14 15 16
         <intent-filter>
             <action android:name="com.google.firebase.MESSAGING_EVENT" />
         </intent-filter>
CapsLock's avatar
CapsLock committed
17
-    </service>
18 19
+    </service> -->
 
CapsLock's avatar
CapsLock committed
20 21
     <receiver android:name=".service.SmsListener"
               android:permission="android.permission.BROADCAST_SMS"
CapsLock's avatar
CapsLock committed
22
diff --git a/app/src/main/java/org/thoughtcrime/securesms/registration/fragments/EnterPhoneNumberFragment.java b/app/src/main/java/org/thoughtcrime/securesms/registration/fragments/EnterPhoneNumberFragment.java
CapsLock's avatar
CapsLock committed
23
index 20a61e7a4..702d1d370 100644
CapsLock's avatar
CapsLock committed
24 25
--- a/app/src/main/java/org/thoughtcrime/securesms/registration/fragments/EnterPhoneNumberFragment.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/registration/fragments/EnterPhoneNumberFragment.java
CapsLock's avatar
CapsLock committed
26
@@ -146,16 +146,16 @@ public final class EnterPhoneNumberFragment extends BaseRegistrationFragment {
27
 
CapsLock's avatar
CapsLock committed
28
     PlayServicesUtil.PlayServicesStatus fcmStatus = PlayServicesUtil.getPlayServicesStatus(context);
29
 
CapsLock's avatar
CapsLock committed
30 31 32
-    if (fcmStatus == PlayServicesUtil.PlayServicesStatus.SUCCESS) {
-      handleRequestVerification(context, e164number, true);
-    } else if (fcmStatus == PlayServicesUtil.PlayServicesStatus.MISSING) {
33 34 35 36
+    // if (fcmStatus == PlayServicesUtil.PlayServicesStatus.SUCCESS) {
+    //   handleRequestVerification(context, e164number, true);
+    // } else if (fcmStatus == PlayServicesUtil.PlayServicesStatus.MISSING) {
       handlePromptForNoPlayServices(context, e164number);
CapsLock's avatar
CapsLock committed
37 38
-    } else if (fcmStatus == PlayServicesUtil.PlayServicesStatus.NEEDS_UPDATE) {
-      GoogleApiAvailability.getInstance().getErrorDialog(requireActivity(), ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED, 0).show();
CapsLock's avatar
CapsLock committed
39
-    } else {
CapsLock's avatar
CapsLock committed
40 41
-      Dialogs.showAlertDialog(context, getString(R.string.RegistrationActivity_play_services_error),
-        getString(R.string.RegistrationActivity_google_play_services_is_updating_or_unavailable));
CapsLock's avatar
CapsLock committed
42
-    }
43 44 45 46 47 48
+    // } else if (fcmStatus == PlayServicesUtil.PlayServicesStatus.NEEDS_UPDATE) {
+    //   GoogleApiAvailability.getInstance().getErrorDialog(requireActivity(), ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED, 0).show();
+    // } else {
+    //   Dialogs.showAlertDialog(context, getString(R.string.RegistrationActivity_play_services_error),
+    //     getString(R.string.RegistrationActivity_google_play_services_is_updating_or_unavailable));
+    // }
CapsLock's avatar
CapsLock committed
49 50 51
   }
 
   private void handleRequestVerification(@NonNull Context context, @NonNull String e164number, boolean fcmSupported) {
CapsLock's avatar
CapsLock committed
52
diff --git a/app/src/main/java/org/thoughtcrime/securesms/registration/service/CodeVerificationRequest.java b/app/src/main/java/org/thoughtcrime/securesms/registration/service/CodeVerificationRequest.java
CapsLock's avatar
tpo  
CapsLock committed
53
index b6bd280e8..92a75dfdc 100644
CapsLock's avatar
CapsLock committed
54 55 56 57 58 59 60 61
--- a/app/src/main/java/org/thoughtcrime/securesms/registration/service/CodeVerificationRequest.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/registration/service/CodeVerificationRequest.java
@@ -208,7 +208,9 @@ public final class CodeVerificationRequest {
     KbsPinData                  kbsData            = isV2RegistrationLock ? PinState.restoreMasterKey(pin, kbsStorageCredentials, kbsTokenResponse) : null;
     String                      registrationLockV2 = kbsData != null ? kbsData.getMasterKey().deriveRegistrationLock() : null;
     String                      registrationLockV1 = isV2RegistrationLock ? null : pin;
+
     boolean                     hasFcm             = fcmToken != null;
CapsLock's avatar
typo  
CapsLock committed
62
+    hasFcm = false;
CapsLock's avatar
CapsLock committed
63 64 65 66
 
     Log.i(TAG, "Calling verifyAccountWithCode(): reglockV1? " + !TextUtils.isEmpty(registrationLockV1) + ", reglockV2? " + !TextUtils.isEmpty(registrationLockV2));
 
diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/PlayServicesUtil.java b/app/src/main/java/org/thoughtcrime/securesms/util/PlayServicesUtil.java
CapsLock's avatar
tpo  
CapsLock committed
67
index fe629ba90..fc8258d4c 100644
CapsLock's avatar
CapsLock committed
68 69
--- a/app/src/main/java/org/thoughtcrime/securesms/util/PlayServicesUtil.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/util/PlayServicesUtil.java
CapsLock's avatar
tpo  
CapsLock committed
70
@@ -23,39 +23,39 @@ public class PlayServicesUtil {
CapsLock's avatar
CapsLock committed
71 72 73 74 75 76 77 78 79 80 81 82 83
   public static PlayServicesStatus getPlayServicesStatus(Context context) {
     int gcmStatus = 0;
 
-    try {
-      gcmStatus = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
-    } catch (Throwable t) {
-      Log.w(TAG, t);
+    // try {
+    //   gcmStatus = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
+    // } catch (Throwable t) {
+    //   Log.w(TAG, t);
       return PlayServicesStatus.MISSING;
-    }
CapsLock's avatar
tpo  
CapsLock committed
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
-
-    Log.i(TAG, "Play Services: " + gcmStatus);
-
-    switch (gcmStatus) {
-      case ConnectionResult.SUCCESS:
-        return PlayServicesStatus.SUCCESS;
-      case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
-        try {
-          ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo("com.google.android.gms", 0);
-
-          if (applicationInfo != null && !applicationInfo.enabled) {
-            return PlayServicesStatus.MISSING;
-          }
-        } catch (PackageManager.NameNotFoundException e) {
-          Log.w(TAG, e);
-        }
-
-        return PlayServicesStatus.NEEDS_UPDATE;
-      case ConnectionResult.SERVICE_DISABLED:
-      case ConnectionResult.SERVICE_MISSING:
-      case ConnectionResult.SERVICE_INVALID:
-      case ConnectionResult.API_UNAVAILABLE:
-      case ConnectionResult.SERVICE_MISSING_PERMISSION:
-        return PlayServicesStatus.MISSING;
-      default:
-        return PlayServicesStatus.TRANSIENT_ERROR;
-    }
+//    // }
+//
+//    Log.i(TAG, "Play Services: " + gcmStatus);
+//
+//    switch (gcmStatus) {
+//      case ConnectionResult.SUCCESS:
+//        return PlayServicesStatus.SUCCESS;
+//      case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
+//        try {
+//          ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo("com.google.android.gms", 0);
+//
+//          if (applicationInfo != null && !applicationInfo.enabled) {
+//            return PlayServicesStatus.MISSING;
+//          }
+//        } catch (PackageManager.NameNotFoundException e) {
+//          Log.w(TAG, e);
+//        }
+//
+//        return PlayServicesStatus.NEEDS_UPDATE;
+//      case ConnectionResult.SERVICE_DISABLED:
+//      case ConnectionResult.SERVICE_MISSING:
+//      case ConnectionResult.SERVICE_INVALID:
+//      case ConnectionResult.API_UNAVAILABLE:
+//      case ConnectionResult.SERVICE_MISSING_PERMISSION:
+//        return PlayServicesStatus.MISSING;
+//      default:
+//        return PlayServicesStatus.TRANSIENT_ERROR;
+//    }
   }
CapsLock's avatar
CapsLock committed
140
 
CapsLock's avatar
tpo  
CapsLock committed
141
 }
CapsLock's avatar
CapsLock committed
142
diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java b/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java
CapsLock's avatar
tpo  
CapsLock committed
143
index 969f146b6..1feb23cff 100644
CapsLock's avatar
CapsLock committed
144 145
--- a/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java
CapsLock's avatar
CapsLock committed
146
@@ -448,7 +448,8 @@ public class TextSecurePreferences {
CapsLock's avatar
CapsLock committed
147 148 149 150
   }
 
   public static boolean isFcmDisabled(Context context) {
-    return getBooleanPreference(context, GCM_DISABLED_PREF, false);
CapsLock's avatar
typo  
CapsLock committed
151
+    return true;
152
+    // return getBooleanPreference(context, GCM_DISABLED_PREF, false);
CapsLock's avatar
CapsLock committed
153 154 155
   }
 
   public static void setFcmDisabled(Context context, boolean disabled) {