destroy-gcm-support.patch 7.66 KB
Newer Older
CapsLock's avatar
CapsLock committed
1
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
2
index 7606e5809..f3e976cd1 100644
CapsLock's avatar
CapsLock committed
3 4
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
5
@@ -589,13 +589,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" />
10
+    <!-- <service android:name=".gcm.FcmFetchService" /> -->
11
 
CapsLock's avatar
CapsLock committed
12
-    <service android:name=".gcm.FcmReceiveService">
13 14 15 16
+    <!-- <service android:name=".gcm.FcmReceiveService">
         <intent-filter>
             <action android:name="com.google.firebase.MESSAGING_EVENT" />
         </intent-filter>
CapsLock's avatar
CapsLock committed
17
-    </service>
18
+    </service> -->
19
 
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
23
index 679575419..f4beccd6f 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
-    if (fcmStatus == PlayServicesUtil.PlayServicesStatus.SUCCESS) {
31
-      confirmNumberPrompt(context, e164number, () -> handleRequestVerification(context, e164number, true));
CapsLock's avatar
CapsLock committed
32
-    } else if (fcmStatus == PlayServicesUtil.PlayServicesStatus.MISSING) {
33 34 35 36
+    // if (fcmStatus == PlayServicesUtil.PlayServicesStatus.SUCCESS) {
+    //   confirmNumberPrompt(context, e164number, () -> handleRequestVerification(context, e164number, true));
+    // } else if (fcmStatus == PlayServicesUtil.PlayServicesStatus.MISSING) {
       confirmNumberPrompt(context, e164number, () -> 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
53
index 9c0ccf56c..b851cab54 100644
CapsLock's avatar
CapsLock committed
54 55
--- a/app/src/main/java/org/thoughtcrime/securesms/registration/service/CodeVerificationRequest.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/registration/service/CodeVerificationRequest.java
56
@@ -209,6 +209,7 @@ public final class CodeVerificationRequest {
CapsLock's avatar
CapsLock committed
57 58 59
     String                      registrationLockV2 = kbsData != null ? kbsData.getMasterKey().deriveRegistrationLock() : null;
     String                      registrationLockV1 = isV2RegistrationLock ? null : pin;
     boolean                     hasFcm             = fcmToken != null;
CapsLock's avatar
typo  
CapsLock committed
60
+    hasFcm = false;
CapsLock's avatar
CapsLock committed
61 62 63 64
 
     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
65
index 07928f3da..30f81a4bf 100644
CapsLock's avatar
CapsLock committed
66 67
--- a/app/src/main/java/org/thoughtcrime/securesms/util/PlayServicesUtil.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/util/PlayServicesUtil.java
68 69
@@ -22,41 +22,41 @@ public class PlayServicesUtil {
   }
70
 
CapsLock's avatar
CapsLock committed
71
   public static PlayServicesStatus getPlayServicesStatus(Context context) {
72 73 74
-    int gcmStatus = 0;
+    // int gcmStatus = 0;
 
CapsLock's avatar
CapsLock committed
75 76 77 78
-    try {
-      gcmStatus = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
-    } catch (Throwable t) {
-      Log.w(TAG, t);
79 80 81 82
+    // try {
+    //   gcmStatus = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
+    // } catch (Throwable t) {
+    //   Log.w(TAG, t);
CapsLock's avatar
CapsLock committed
83 84
       return PlayServicesStatus.MISSING;
-    }
CapsLock's avatar
tpo  
CapsLock committed
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
-
-    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;
-    }
112
+    // }
113
+
114
+    // Log.i(TAG, "Play Services: " + gcmStatus);
115
+
116 117 118 119 120 121
+    // 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);
122
+
123 124 125 126 127 128
+    //       if (applicationInfo != null && !applicationInfo.enabled) {
+    //         return PlayServicesStatus.MISSING;
+    //       }
+    //     } catch (PackageManager.NameNotFoundException e) {
+    //       Log.w(TAG, e);
+    //     }
129
+
130 131 132 133 134 135 136 137 138 139
+    //     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
tpo  
CapsLock committed
140
   }
CapsLock's avatar
CapsLock committed
141
 
CapsLock's avatar
tpo  
CapsLock committed
142
 }
CapsLock's avatar
CapsLock committed
143
diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java b/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java
144
index 6d8325d02..7ac27044e 100644
CapsLock's avatar
CapsLock committed
145 146
--- a/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java
147
@@ -443,7 +443,8 @@ public class TextSecurePreferences {
CapsLock's avatar
CapsLock committed
148 149 150 151
   }
 
   public static boolean isFcmDisabled(Context context) {
-    return getBooleanPreference(context, GCM_DISABLED_PREF, false);
152
+    // return getBooleanPreference(context, GCM_DISABLED_PREF, false);
CapsLock's avatar
typo  
CapsLock committed
153
+    return true;
CapsLock's avatar
CapsLock committed
154 155 156
   }
 
   public static void setFcmDisabled(Context context, boolean disabled) {
157 158
-- 
2.25.4