destroy-gcm-support.patch 6.92 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 89e5aefcf..7fa0ef311 100644
CapsLock's avatar
CapsLock committed
3
4
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
5
@@ -671,13 +671,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
-        <intent-filter>
-            <action android:name="com.google.firebase.MESSAGING_EVENT" />
-        </intent-filter>
CapsLock's avatar
CapsLock committed
16
-    </service>
17
18
19
20
21
+<!--    <service android:name=".gcm.FcmReceiveService">-->
+<!--        <intent-filter>-->
+<!--            <action android:name="com.google.firebase.MESSAGING_EVENT" />-->
+<!--        </intent-filter>-->
+<!--    </service>-->
22
 
CapsLock's avatar
CapsLock committed
23
24
     <receiver android:name=".service.SmsListener"
               android:permission="android.permission.BROADCAST_SMS"
CapsLock's avatar
CapsLock committed
25
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
26
index c2a767b73..d2b2ce87c 100644
CapsLock's avatar
CapsLock committed
27
28
--- a/app/src/main/java/org/thoughtcrime/securesms/registration/fragments/EnterPhoneNumberFragment.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/registration/fragments/EnterPhoneNumberFragment.java
29
@@ -160,17 +160,17 @@ public final class EnterPhoneNumberFragment extends LoggingFragment implements R
30
 
CapsLock's avatar
CapsLock committed
31
     PlayServicesUtil.PlayServicesStatus fcmStatus = PlayServicesUtil.getPlayServicesStatus(context);
32
 
CapsLock's avatar
CapsLock committed
33
-    if (fcmStatus == PlayServicesUtil.PlayServicesStatus.SUCCESS) {
34
-      confirmNumberPrompt(context, e164number, () -> handleRequestVerification(context, true));
CapsLock's avatar
CapsLock committed
35
-    } else if (fcmStatus == PlayServicesUtil.PlayServicesStatus.MISSING) {
36
37
38
39
+//    if (fcmStatus == PlayServicesUtil.PlayServicesStatus.SUCCESS) {
+//      confirmNumberPrompt(context, e164number, () -> handleRequestVerification(context, true));
+//    } else if (fcmStatus == PlayServicesUtil.PlayServicesStatus.MISSING) {
       confirmNumberPrompt(context, e164number, () -> handlePromptForNoPlayServices(context));
CapsLock's avatar
CapsLock committed
40
41
-    } else if (fcmStatus == PlayServicesUtil.PlayServicesStatus.NEEDS_UPDATE) {
-      GoogleApiAvailability.getInstance().getErrorDialog(requireActivity(), ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED, 0).show();
CapsLock's avatar
CapsLock committed
42
-    } else {
43
44
45
-      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
46
-    }
47
48
49
50
51
52
53
+//    } 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
54
55
   }
 
56
   private void handleRequestVerification(@NonNull Context context, boolean fcmSupported) {
CapsLock's avatar
CapsLock committed
57
diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/PlayServicesUtil.java b/app/src/main/java/org/thoughtcrime/securesms/util/PlayServicesUtil.java
58
index 60143358b..90936d1b7 100644
CapsLock's avatar
CapsLock committed
59
60
--- a/app/src/main/java/org/thoughtcrime/securesms/util/PlayServicesUtil.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/util/PlayServicesUtil.java
61
@@ -24,39 +24,39 @@ public class PlayServicesUtil {
CapsLock's avatar
CapsLock committed
62
   public static PlayServicesStatus getPlayServicesStatus(Context context) {
63
     int gcmStatus = 0;
64
 
CapsLock's avatar
CapsLock committed
65
66
67
68
-    try {
-      gcmStatus = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
-    } catch (Throwable t) {
-      Log.w(TAG, t);
69
70
71
72
+//    try {
+//      gcmStatus = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
+//    } catch (Throwable t) {
+//      Log.w(TAG, t);
CapsLock's avatar
CapsLock committed
73
74
       return PlayServicesStatus.MISSING;
-    }
CapsLock's avatar
tpo    
CapsLock committed
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
-
-    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;
-    }
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
+//    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
tpo    
CapsLock committed
130
   }
CapsLock's avatar
CapsLock committed
131
 
CapsLock's avatar
tpo    
CapsLock committed
132
 }
CapsLock's avatar
CapsLock committed
133
diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java b/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java
134
index 95a1ad33b..5a4982bd2 100644
CapsLock's avatar
CapsLock committed
135
136
--- a/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java
137
@@ -527,10 +527,12 @@ public class TextSecurePreferences {
CapsLock's avatar
CapsLock committed
138
139
140
141
   }
 
   public static boolean isFcmDisabled(Context context) {
-    return getBooleanPreference(context, GCM_DISABLED_PREF, false);
142
+//    return getBooleanPreference(context, GCM_DISABLED_PREF, false);
CapsLock's avatar
typo    
CapsLock committed
143
+    return true;
CapsLock's avatar
CapsLock committed
144
145
146
   }
 
   public static void setFcmDisabled(Context context, boolean disabled) {
147
148
149
150
+    disabled = true;
     setBooleanPreference(context, GCM_DISABLED_PREF, disabled);
   }
 
151
-- 
152
2.30.2