diff --git a/.gitignore b/.gitignore
index 4b62fc423f..a918936f20 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,3 +24,5 @@ obj/
jni/libspeex/.deps/
*.sh
pkcs11.password
+fabric.properties
+play
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 0e5a5d0654..6a3cd05962 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -38,58 +38,36 @@
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
+
-
-
+
-
-
-
+
+
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
@@ -462,10 +431,6 @@
android:noHistory="true"
android:stateNotNeeded="true"
android:theme="@android:style/Theme.NoDisplay" />
-
@@ -590,20 +555,6 @@
android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
-
-
-
-
-
-
-
-
@@ -612,11 +563,6 @@
-
-
-
-
-
if (file.exists()) {
- MessageDigest md = MessageDigest.getInstance("SHA-256");
+ MessageDigest md = MessageDigest.getInstance("SHA-256")
file.eachByte 4096, {bytes, size ->
- md.update(bytes, 0, size);
+ md.update(bytes, 0, size)
}
- String digest = md.digest().collect {String.format "%02x", it}.join();
+ String digest = md.digest().collect {String.format "%02x", it}.join()
String url = variant.productFlavors.get(0).ext.websiteUpdateUrl
String apkName = file.getName()
diff --git a/proguard-firebase-messaging.pro b/proguard-firebase-messaging.pro
deleted file mode 100644
index 17af8ca94c..0000000000
--- a/proguard-firebase-messaging.pro
+++ /dev/null
@@ -1 +0,0 @@
--dontwarn com.google.firebase.analytics.connector.AnalyticsConnector
\ No newline at end of file
diff --git a/proguard-google-play-services.pro b/proguard-google-play-services.pro
deleted file mode 100644
index ae70fc4e49..0000000000
--- a/proguard-google-play-services.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-## Google Play Services 4.3.23 specific rules ##
-## https://developer.android.com/google/play-services/setup.html#Proguard ##
-
--keep class * extends java.util.ListResourceBundle {
- protected Object[][] getContents();
-}
-
--keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
- public static final *** NULL;
-}
-
--keepnames @com.google.android.gms.common.annotation.KeepName class *
--keepclassmembernames class * {
- @com.google.android.gms.common.annotation.KeepName *;
-}
-
--keepnames class * implements android.os.Parcelable {
- public static final ** CREATOR;
-}
\ No newline at end of file
diff --git a/res/layout/conversation_item_footer.xml b/res/layout/conversation_item_footer.xml
index f2d70188ab..740234f0e9 100644
--- a/res/layout/conversation_item_footer.xml
+++ b/res/layout/conversation_item_footer.xml
@@ -1,8 +1,6 @@
-
-
-
+
-
- 1:312334754206:android:a9297b152879f266
- 312334754206
- 312334754206-dg1p1mtekis8ivja3ica50vonmrlunh4.apps.googleusercontent.com
- https://api-project-312334754206.firebaseio.com
- AIzaSyDrfzNAPBPzX6key51hqo3p5LZXF5Y-yxU
- AIzaSyDrfzNAPBPzX6key51hqo3p5LZXF5Y-yxU
- api-project-312334754206
-
\ No newline at end of file
diff --git a/src/org/thoughtcrime/securesms/ApplicationContext.java b/src/org/thoughtcrime/securesms/ApplicationContext.java
index f8eed2a13d..ccef1114d2 100644
--- a/src/org/thoughtcrime/securesms/ApplicationContext.java
+++ b/src/org/thoughtcrime/securesms/ApplicationContext.java
@@ -16,7 +16,6 @@
*/
package org.thoughtcrime.securesms;
-import android.annotation.SuppressLint;
import android.arch.lifecycle.DefaultLifecycleObserver;
import android.arch.lifecycle.LifecycleOwner;
import android.arch.lifecycle.ProcessLifecycleOwner;
@@ -31,8 +30,6 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.multidex.MultiDexApplication;
-import com.google.android.gms.security.ProviderInstaller;
-
import org.conscrypt.Conscrypt;
import org.jetbrains.annotations.NotNull;
import org.signal.aesgcmprovider.AesGcmProvider;
@@ -53,7 +50,6 @@ import org.thoughtcrime.securesms.jobmanager.JobManager;
import org.thoughtcrime.securesms.jobmanager.impl.JsonDataSerializer;
import org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob;
import org.thoughtcrime.securesms.jobs.FastJobStorage;
-import org.thoughtcrime.securesms.jobs.FcmRefreshJob;
import org.thoughtcrime.securesms.jobs.JobManagerFactories;
import org.thoughtcrime.securesms.jobs.MultiDeviceContactUpdateJob;
import org.thoughtcrime.securesms.jobs.PushContentReceiveJob;
@@ -115,7 +111,6 @@ import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.TimeUnit;
import dagger.ObjectGraph;
import kotlin.Unit;
@@ -176,10 +171,8 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
initializeExpiringMessageManager();
initializeTypingStatusRepository();
initializeTypingStatusSender();
- initializeGcmCheck();
initializeSignedPreKeyCheck();
initializePeriodicTasks();
- initializeCircumvention();
initializeWebRtc();
initializePendingMessages();
initializeUnidentifiedDeliveryAbilityRefresh();
@@ -194,6 +187,9 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
if (userHexEncodedPublicKey != null) {
if (TextSecurePreferences.getNeedsIsRevokedSlaveDeviceCheck(this)) {
MultiDeviceUtilities.checkIsRevokedSlaveDevice(this);
+ } else {
+ // We always update our current device links onto the server in case we failed to do so upon linking
+ MultiDeviceUtilities.updateDeviceLinksOnServer(this);
}
}
}
@@ -337,16 +333,6 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
this.objectGraph = ObjectGraph.create(communicationModule, new AxolotlStorageModule(this));
}
- private void initializeGcmCheck() {
- if (TextSecurePreferences.isPushRegistered(this)) {
- long nextSetTime = TextSecurePreferences.getFcmTokenLastSetTime(this) + TimeUnit.HOURS.toMillis(6);
-
- if (TextSecurePreferences.getFcmToken(this) == null || nextSetTime <= System.currentTimeMillis()) {
- this.jobManager.add(new FcmRefreshJob());
- }
- }
- }
-
private void initializeSignedPreKeyCheck() {
if (!TextSecurePreferences.isSignedPreKeyRegistered(this)) {
jobManager.add(new CreateSignedPreKeyJob(this));
@@ -413,25 +399,6 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
}
}
- @SuppressLint("StaticFieldLeak")
- private void initializeCircumvention() {
- AsyncTask task = new AsyncTask() {
- @Override
- protected Void doInBackground(Void... params) {
- if (new SignalServiceNetworkAccess(ApplicationContext.this).isCensored(ApplicationContext.this)) {
- try {
- ProviderInstaller.installIfNeeded(ApplicationContext.this);
- } catch (Throwable t) {
- Log.w(TAG, t);
- }
- }
- return null;
- }
- };
-
- task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
- }
-
private void executePendingContactSync() {
if (TextSecurePreferences.needsFullContactSync(this)) {
ApplicationContext.getInstance(this).getJobManager().add(new MultiDeviceContactUpdateJob(this, true));
diff --git a/src/org/thoughtcrime/securesms/PlayServicesProblemActivity.java b/src/org/thoughtcrime/securesms/PlayServicesProblemActivity.java
deleted file mode 100644
index 216fab99f3..0000000000
--- a/src/org/thoughtcrime/securesms/PlayServicesProblemActivity.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright (C) 2014 Open Whisper Systems
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-package org.thoughtcrime.securesms;
-
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-
-public class PlayServicesProblemActivity extends FragmentActivity {
-
- @Override
- public void onCreate(Bundle bundle) {
- super.onCreate(bundle);
- PlayServicesProblemFragment fragment = new PlayServicesProblemFragment();
- fragment.show(getSupportFragmentManager(), "dialog");
- }
-}
diff --git a/src/org/thoughtcrime/securesms/PlayServicesProblemFragment.java b/src/org/thoughtcrime/securesms/PlayServicesProblemFragment.java
deleted file mode 100644
index 6931e8430b..0000000000
--- a/src/org/thoughtcrime/securesms/PlayServicesProblemFragment.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Copyright (C) 2014 Open Whisper Systems
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package org.thoughtcrime.securesms;
-
-import android.app.Activity;
-import android.app.Dialog;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v4.app.DialogFragment;
-import android.support.v7.app.AlertDialog;
-
-import com.google.android.gms.common.GoogleApiAvailability;
-
-import network.loki.messenger.R;
-
-public class PlayServicesProblemFragment extends DialogFragment {
-
- @Override
- public @NonNull Dialog onCreateDialog(@Nullable Bundle bundle) {
- int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getActivity());
- Dialog dialog = GoogleApiAvailability.getInstance().getErrorDialog(getActivity(), code, 9111);
-
- if (dialog == null) {
- return new AlertDialog.Builder(requireActivity())
- .setNegativeButton(android.R.string.ok, null)
- .setMessage(R.string.PlayServicesProblemFragment_the_version_of_google_play_services_you_have_installed_is_not_functioning)
- .create();
- } else {
- return dialog;
- }
- }
-
- @Override
- public void onCancel(DialogInterface dialog) {
- super.onCancel(dialog);
- finish();
- }
-
- @Override
- public void onDismiss(DialogInterface dialog) {
- super.onDismiss(dialog);
- finish();
- }
-
- private void finish() {
- Activity activity = getActivity();
- if (activity != null) activity.finish();
- }
-
-}
diff --git a/src/org/thoughtcrime/securesms/RegistrationActivity.java b/src/org/thoughtcrime/securesms/RegistrationActivity.java
index b4c41c6b29..ff09e7ed93 100644
--- a/src/org/thoughtcrime/securesms/RegistrationActivity.java
+++ b/src/org/thoughtcrime/securesms/RegistrationActivity.java
@@ -3,10 +3,8 @@ package org.thoughtcrime.securesms;
import android.Manifest;
import android.animation.Animator;
import android.annotation.SuppressLint;
-import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
-import android.content.IntentFilter;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
@@ -29,17 +27,6 @@ import android.widget.TextView;
import android.widget.Toast;
import com.dd.CircularProgressButton;
-import com.google.android.gms.auth.api.phone.SmsRetriever;
-import com.google.android.gms.auth.api.phone.SmsRetrieverClient;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GoogleApiAvailability;
-import com.google.android.gms.common.api.CommonStatusCodes;
-import com.google.android.gms.common.api.Status;
-import com.google.android.gms.tasks.Task;
-import com.google.i18n.phonenumbers.AsYouTypeFormatter;
-import com.google.i18n.phonenumbers.NumberParseException;
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.Phonenumber;
import net.sqlcipher.database.SQLiteDatabase;
@@ -62,7 +49,6 @@ import org.thoughtcrime.securesms.database.Address;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.IdentityDatabase;
import org.thoughtcrime.securesms.database.NoExternalStorageException;
-import org.thoughtcrime.securesms.gcm.FcmUtil;
import org.thoughtcrime.securesms.jobs.DirectoryRefreshJob;
import org.thoughtcrime.securesms.jobs.RotateCertificateJob;
import org.thoughtcrime.securesms.lock.RegistrationLockReminders;
@@ -73,12 +59,9 @@ import org.thoughtcrime.securesms.push.AccountManagerFactory;
import org.thoughtcrime.securesms.registration.CaptchaActivity;
import org.thoughtcrime.securesms.service.DirectoryRefreshListener;
import org.thoughtcrime.securesms.service.RotateSignedPreKeyListener;
-import org.thoughtcrime.securesms.service.VerificationCodeParser;
import org.thoughtcrime.securesms.util.BackupUtil;
import org.thoughtcrime.securesms.util.DateUtils;
import org.thoughtcrime.securesms.util.Dialogs;
-import org.thoughtcrime.securesms.util.PlayServicesUtil;
-import org.thoughtcrime.securesms.util.PlayServicesUtil.PlayServicesStatus;
import org.thoughtcrime.securesms.util.ServiceUtil;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.Util;
@@ -121,7 +104,6 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
private static final String TAG = RegistrationActivity.class.getSimpleName();
- private AsYouTypeFormatter countryFormatter;
private ArrayAdapter countrySpinnerAdapter;
private Spinner countrySpinner;
private LabeledEditText countryCode;
@@ -149,7 +131,6 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
private VerificationPinKeyboard keyboard;
private VerificationCodeView verificationCodeView;
private RegistrationState registrationState;
- private SmsRetrieverReceiver smsRetrieverReceiver;
private SignalServiceAccountManager accountManager;
private int debugTapCounter;
@@ -163,13 +144,11 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
initializeSpinner();
initializeNumber();
initializeBackupDetection();
- initializeChallengeListener();
}
@Override
public void onDestroy() {
super.onDestroy();
- shutdownChallengeListener();
markAsVerifying(false);
EventBus.getDefault().unregister(this);
}
@@ -179,7 +158,6 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
if (requestCode == PICK_COUNTRY && resultCode == RESULT_OK && data != null) {
this.countryCode.setText(String.valueOf(data.getIntExtra("country_code", 1)));
setCountryDisplay(data.getStringExtra("country_name"));
- setCountryFormatter(data.getIntExtra("country_code", 1));
} else if (requestCode == CAPTCHA && resultCode == RESULT_OK && data != null) {
registrationState = new RegistrationState(Optional.fromNullable(data.getStringExtra(CaptchaActivity.KEY_TOKEN)), registrationState);
@@ -286,24 +264,7 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
});
}
- @SuppressLint("MissingPermission")
private void initializeNumber() {
- Optional localNumber = Optional.absent();
-
- if (Permissions.hasAll(this, Manifest.permission.READ_PHONE_STATE)) {
- localNumber = Util.getDeviceNumber(this);
- }
-
- if (localNumber.isPresent()) {
- this.countryCode.setText(String.valueOf(localNumber.get().getCountryCode()));
- this.number.setText(String.valueOf(localNumber.get().getNationalNumber()));
- } else {
- Optional simCountryIso = Util.getSimCountryIso(this);
-
- if (simCountryIso.isPresent() && !TextUtils.isEmpty(simCountryIso.get())) {
- this.countryCode.setText(String.valueOf(PhoneNumberUtil.getInstance().getCountryCodeForRegion(simCountryIso.get())));
- }
- }
}
@SuppressLint("StaticFieldLeak")
@@ -338,14 +299,6 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
this.countrySpinnerAdapter.add(value);
}
- private void setCountryFormatter(int countryCode) {
- PhoneNumberUtil util = PhoneNumberUtil.getInstance();
- String regionCode = util.getRegionCodeForCountryCode(countryCode);
-
- if (regionCode == null) this.countryFormatter = null;
- else this.countryFormatter = util.getAsYouTypeFormatter(regionCode);
- }
-
private String getConfiguredE164Number() {
return PhoneNumberFormatter.formatE164(countryCode.getText().toString(),
number.getText().toString());
@@ -436,20 +389,6 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
Dialogs.showAlertDialog(this,
getString(R.string.RegistrationActivity_invalid_number),
String.format(getString(R.string.RegistrationActivity_the_number_you_specified_s_is_invalid), e164number));
- return;
- }
-
- PlayServicesStatus gcmStatus = PlayServicesUtil.getPlayServicesStatus(this);
-
- if (gcmStatus == PlayServicesStatus.SUCCESS) {
- handleRequestVerification(e164number, true);
- } else if (gcmStatus == PlayServicesStatus.MISSING) {
- handlePromptForNoPlayServices(e164number);
- } else if (gcmStatus == PlayServicesStatus.NEEDS_UPDATE) {
- GoogleApiAvailability.getInstance().getErrorDialog(this, ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED, 0).show();
- } else {
- Dialogs.showAlertDialog(this, getString(R.string.RegistrationActivity_play_services_error),
- getString(R.string.RegistrationActivity_google_play_services_is_updating_or_unavailable));
}
}
@@ -457,22 +396,7 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
createButton.setIndeterminateProgressMode(true);
createButton.setProgress(50);
- if (gcmSupported) {
- SmsRetrieverClient client = SmsRetriever.getClient(this);
- Task task = client.startSmsRetriever();
-
- task.addOnSuccessListener(none -> {
- Log.i(TAG, "Successfully registered SMS listener.");
- requestVerificationCode(e164number, true, true);
- });
-
- task.addOnFailureListener(e -> {
- Log.w(TAG, "Failed to register SMS listener.", e);
- requestVerificationCode(e164number, true, false);
- });
- } else {
requestVerificationCode(e164number, false, false);
- }
}
@SuppressLint("StaticFieldLeak")
@@ -485,13 +409,7 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
String password = Util.getSecret(18);
- Optional fcmToken;
-
- if (gcmSupported) {
- fcmToken = FcmUtil.getToken();
- } else {
- fcmToken = Optional.absent();
- }
+ Optional fcmToken = Optional.absent();
accountManager = AccountManagerFactory.createManager(RegistrationActivity.this, e164number, password);
accountManager.requestSmsVerificationCode(smsRetrieverSupported, registrationState.captchaToken);
@@ -939,19 +857,6 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
dialog.show();
}
- private void initializeChallengeListener() {
- smsRetrieverReceiver = new SmsRetrieverReceiver();
- IntentFilter filter = new IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION);
- registerReceiver(smsRetrieverReceiver, filter);
- }
-
- private void shutdownChallengeListener() {
- if (smsRetrieverReceiver != null) {
- unregisterReceiver(smsRetrieverReceiver);
- smsRetrieverReceiver = null;
- }
- }
-
private void markAsVerifying(boolean verifying) {
TextSecurePreferences.setVerifying(this, verifying);
@@ -961,12 +866,7 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
}
private String formatNumber(@NonNull String e164Number) {
- try {
- Phonenumber.PhoneNumber number = PhoneNumberUtil.getInstance().parse(e164Number, null);
- return PhoneNumberUtil.getInstance().format(number, PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL);
- } catch (NumberParseException e) {
- return e164Number;
- }
+ return e164Number;
}
private void onWrongNumberClicked() {
@@ -980,53 +880,16 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
else restoreBackupProgress.setText(getString(R.string.RegistrationActivity_d_messages_so_far, event.getCount()));
}
- private class SmsRetrieverReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- Log.i(TAG, "SmsRetrieverReceiver received a broadcast...");
-
- if (SmsRetriever.SMS_RETRIEVED_ACTION.equals(intent.getAction())) {
- Bundle extras = intent.getExtras();
- Status status = (Status) extras.get(SmsRetriever.EXTRA_STATUS);
-
- switch (status.getStatusCode()) {
- case CommonStatusCodes.SUCCESS:
- Optional code = VerificationCodeParser.parse(context, (String) extras.get(SmsRetriever.EXTRA_SMS_MESSAGE));
- if (code.isPresent()) {
- Log.i(TAG, "Received verification code.");
- handleVerificationCodeReceived(code.get());
- } else {
- Log.w(TAG, "Could not parse verification code.");
- }
- break;
- case CommonStatusCodes.TIMEOUT:
- Log.w(TAG, "Hit a timeout waiting for the SMS to arrive.");
- break;
- }
- } else {
- Log.w(TAG, "SmsRetrieverReceiver received the wrong action?");
- }
- }
- }
-
private class CountryCodeChangedListener implements TextWatcher {
@Override
public void afterTextChanged(Editable s) {
if (TextUtils.isEmpty(s) || !TextUtils.isDigitsOnly(s)) {
setCountryDisplay(getString(R.string.RegistrationActivity_select_your_country));
- countryFormatter = null;
return;
}
int countryCode = Integer.parseInt(s.toString());
- String regionCode = PhoneNumberUtil.getInstance().getRegionCodeForCountryCode(countryCode);
-
- setCountryFormatter(countryCode);
- setCountryDisplay(PhoneNumberFormatter.getRegionDisplayName(regionCode));
-
- if (!TextUtils.isEmpty(regionCode) && !regionCode.equals("ZZ")) {
- number.requestFocus();
- }
+ setCountryDisplay("N/A");
}
@Override
@@ -1042,24 +905,6 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
@Override
public void afterTextChanged(Editable s) {
- if (countryFormatter == null)
- return;
-
- if (TextUtils.isEmpty(s))
- return;
-
- countryFormatter.clear();
-
- String number = s.toString().replaceAll("[^\\d.]", "");
- String formattedNumber = null;
-
- for (int i=0;i subscriptionInfo = subscriptionManager.getActiveSubscriptionInfo(messageRecord.getSubscriptionId());
-
- if (subscriptionInfo.isPresent() && messageRecord.isOutgoing()) {
- simView.setText(getContext().getString(R.string.ConversationItem_from_s, subscriptionInfo.get().getDisplayName()));
- simView.setVisibility(View.VISIBLE);
- } else if (subscriptionInfo.isPresent()) {
- simView.setText(getContext().getString(R.string.ConversationItem_to_s, subscriptionInfo.get().getDisplayName()));
- simView.setVisibility(View.VISIBLE);
- } else {
- simView.setVisibility(View.GONE);
- }
- }
- }
-
@SuppressLint("StaticFieldLeak")
private void presentTimer(@NonNull final MessageRecord messageRecord) {
if (messageRecord.getExpiresIn() > 0 && !messageRecord.isPending()) {
diff --git a/src/org/thoughtcrime/securesms/components/location/SignalMapView.java b/src/org/thoughtcrime/securesms/components/location/SignalMapView.java
index 1b4eb113ab..9061021f32 100644
--- a/src/org/thoughtcrime/securesms/components/location/SignalMapView.java
+++ b/src/org/thoughtcrime/securesms/components/location/SignalMapView.java
@@ -7,26 +7,18 @@ import android.os.Build;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
-import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
-import com.google.android.gms.location.places.Place;
-import com.google.android.gms.maps.CameraUpdateFactory;
-import com.google.android.gms.maps.GoogleMap;
-import com.google.android.gms.maps.MapView;
-import com.google.android.gms.maps.OnMapReadyCallback;
-import com.google.android.gms.maps.model.MarkerOptions;
-
-import network.loki.messenger.R;
import org.thoughtcrime.securesms.util.ViewUtil;
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
import org.thoughtcrime.securesms.util.concurrent.SettableFuture;
+import network.loki.messenger.R;
+
public class SignalMapView extends LinearLayout {
- private MapView mapView;
private ImageView imageView;
private TextView textView;
@@ -49,7 +41,6 @@ public class SignalMapView extends LinearLayout {
setOrientation(LinearLayout.VERTICAL);
LayoutInflater.from(context).inflate(R.layout.signal_map_view, this, true);
- this.mapView = ViewUtil.findById(this, R.id.map_view);
this.imageView = ViewUtil.findById(this, R.id.image_view);
this.textView = ViewUtil.findById(this, R.id.address_view);
}
@@ -57,39 +48,8 @@ public class SignalMapView extends LinearLayout {
public ListenableFuture display(final SignalPlace place) {
final SettableFuture future = new SettableFuture<>();
- this.mapView.onCreate(null);
- this.mapView.onResume();
-
- this.mapView.setVisibility(View.VISIBLE);
this.imageView.setVisibility(View.GONE);
- this.mapView.getMapAsync(new OnMapReadyCallback() {
- @Override
- public void onMapReady(final GoogleMap googleMap) {
- googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(place.getLatLong(), 13));
- googleMap.addMarker(new MarkerOptions().position(place.getLatLong()));
- googleMap.setBuildingsEnabled(true);
- googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
- googleMap.getUiSettings().setAllGesturesEnabled(false);
- googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
- @Override
- public void onMapLoaded() {
- googleMap.snapshot(new GoogleMap.SnapshotReadyCallback() {
- @Override
- public void onSnapshotReady(Bitmap bitmap) {
- future.set(bitmap);
- imageView.setImageBitmap(bitmap);
- imageView.setVisibility(View.VISIBLE);
- mapView.setVisibility(View.GONE);
- mapView.onPause();
- mapView.onDestroy();
- }
- });
- }
- });
- }
- });
-
this.textView.setText(place.getDescription());
return future;
diff --git a/src/org/thoughtcrime/securesms/components/location/SignalPlace.java b/src/org/thoughtcrime/securesms/components/location/SignalPlace.java
index b5a2219ee0..0519e8d2c2 100644
--- a/src/org/thoughtcrime/securesms/components/location/SignalPlace.java
+++ b/src/org/thoughtcrime/securesms/components/location/SignalPlace.java
@@ -7,8 +7,6 @@ import android.text.TextUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.android.gms.location.places.Place;
-import com.google.android.gms.maps.model.LatLng;
import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.util.JsonUtils;
@@ -17,6 +15,22 @@ import java.io.IOException;
public class SignalPlace {
+ /* Loki - Temporary Placeholders */
+ class LatLng {
+ double latitude;
+ double longitude;
+ LatLng(double latitude, double longitude) {
+ this.latitude = latitude;
+ this.longitude = longitude;
+ }
+ }
+
+ class Place {
+ public CharSequence getName() { return ""; }
+ public CharSequence getAddress() { return ""; }
+ LatLng getLatLng() { return new LatLng(0, 0); }
+ }
+
private static final String URL = "https://maps.google.com/maps";
private static final String TAG = SignalPlace.class.getSimpleName();
diff --git a/src/org/thoughtcrime/securesms/contacts/ContactsSyncAdapter.java b/src/org/thoughtcrime/securesms/contacts/ContactsSyncAdapter.java
deleted file mode 100644
index 71d3b790d1..0000000000
--- a/src/org/thoughtcrime/securesms/contacts/ContactsSyncAdapter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.thoughtcrime.securesms.contacts;
-
-import android.accounts.Account;
-import android.content.AbstractThreadedSyncAdapter;
-import android.content.ContentProviderClient;
-import android.content.Context;
-import android.content.SyncResult;
-import android.os.Bundle;
-import org.thoughtcrime.securesms.logging.Log;
-
-import org.thoughtcrime.securesms.util.DirectoryHelper;
-import org.thoughtcrime.securesms.util.TextSecurePreferences;
-
-import java.io.IOException;
-
-public class ContactsSyncAdapter extends AbstractThreadedSyncAdapter {
-
- private static final String TAG = ContactsSyncAdapter.class.getSimpleName();
-
- public ContactsSyncAdapter(Context context, boolean autoInitialize) {
- super(context, autoInitialize);
- }
-
- @Override
- public void onPerformSync(Account account, Bundle extras, String authority,
- ContentProviderClient provider, SyncResult syncResult)
- {
- Log.i(TAG, "onPerformSync(" + authority +")");
-
- if (TextSecurePreferences.isPushRegistered(getContext())) {
- try {
- DirectoryHelper.refreshDirectory(getContext(), true);
- } catch (IOException e) {
- Log.w(TAG, e);
- }
- }
- }
-
- @Override
- public void onSyncCanceled() {
- Log.w(TAG, "onSyncCanceled()");
- }
-
- @Override
- public void onSyncCanceled(Thread thread) {
- Log.w(TAG, "onSyncCanceled(" + thread + ")");
- }
-
-}
diff --git a/src/org/thoughtcrime/securesms/contactshare/ContactUtil.java b/src/org/thoughtcrime/securesms/contactshare/ContactUtil.java
index cb4985892a..fbb7ddd641 100644
--- a/src/org/thoughtcrime/securesms/contactshare/ContactUtil.java
+++ b/src/org/thoughtcrime/securesms/contactshare/ContactUtil.java
@@ -13,11 +13,7 @@ import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import com.annimon.stream.Stream;
-import com.google.i18n.phonenumbers.NumberParseException;
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
-import network.loki.messenger.R;
import org.thoughtcrime.securesms.components.emoji.EmojiStrings;
import org.thoughtcrime.securesms.contactshare.Contact.Email;
import org.thoughtcrime.securesms.contactshare.Contact.Phone;
@@ -34,6 +30,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+import network.loki.messenger.R;
+
public final class ContactUtil {
private static final String TAG = ContactUtil.class.getSimpleName();
@@ -102,13 +100,7 @@ public final class ContactUtil {
}
private static @NonNull String getPrettyPhoneNumber(@NonNull String phoneNumber, @NonNull Locale fallbackLocale) {
- PhoneNumberUtil util = PhoneNumberUtil.getInstance();
- try {
- PhoneNumber parsed = util.parse(phoneNumber, fallbackLocale.getISO3Country());
- return util.format(parsed, PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL);
- } catch (NumberParseException e) {
- return phoneNumber;
- }
+ return phoneNumber;
}
public static @NonNull String getNormalizedPhoneNumber(@NonNull Context context, @NonNull String number) {
diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java
index 35d2193a27..628e8c85ba 100644
--- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java
+++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java
@@ -77,7 +77,6 @@ import android.widget.TextView;
import android.widget.Toast;
import com.annimon.stream.Stream;
-import com.google.android.gms.location.places.ui.PlacePicker;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -133,7 +132,6 @@ import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.DraftDatabase;
import org.thoughtcrime.securesms.database.DraftDatabase.Draft;
import org.thoughtcrime.securesms.database.DraftDatabase.Drafts;
-import org.thoughtcrime.securesms.database.GroupDatabase;
import org.thoughtcrime.securesms.database.IdentityDatabase;
import org.thoughtcrime.securesms.database.IdentityDatabase.IdentityRecord;
import org.thoughtcrime.securesms.database.IdentityDatabase.VerifiedStatus;
@@ -179,7 +177,6 @@ import org.thoughtcrime.securesms.mms.ImageSlide;
import org.thoughtcrime.securesms.mms.LocationSlide;
import org.thoughtcrime.securesms.mms.MediaConstraints;
import org.thoughtcrime.securesms.mms.OutgoingExpirationUpdateMessage;
-import org.thoughtcrime.securesms.mms.OutgoingGroupMediaMessage;
import org.thoughtcrime.securesms.mms.OutgoingMediaMessage;
import org.thoughtcrime.securesms.mms.OutgoingSecureMediaMessage;
import org.thoughtcrime.securesms.mms.QuoteId;
@@ -662,10 +659,12 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
recipient.addListener(this);
fragment.reloadList();
break;
+ /*
case PICK_LOCATION:
SignalPlace place = new SignalPlace(PlacePicker.getPlace(data, this));
attachmentManager.setLocation(place, getCurrentMediaConstraints());
break;
+ */
case PICK_GIF:
setMedia(data.getData(),
MediaType.GIF,
@@ -1240,15 +1239,13 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
}
private boolean handleDisplayQuickContact() {
- if (recipient.getAddress().isGroup()) return false;
+ return !recipient.getAddress().isGroup();
// if (recipient.getContactUri() != null) {
// ContactsContract.QuickContact.showQuickContact(ConversationActivity.this, titleView, recipient.getContactUri(), ContactsContract.QuickContact.MODE_LARGE, null);
// } else {
// handleAddToContacts();
// }
-
- return true;
}
private void handleAddAttachment() {
diff --git a/src/org/thoughtcrime/securesms/database/Address.java b/src/org/thoughtcrime/securesms/database/Address.java
index 1286b4b302..d777b6e86b 100644
--- a/src/org/thoughtcrime/securesms/database/Address.java
+++ b/src/org/thoughtcrime/securesms/database/Address.java
@@ -10,12 +10,6 @@ import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.util.Pair;
-import com.google.i18n.phonenumbers.NumberParseException;
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.Phonenumber;
-import com.google.i18n.phonenumbers.ShortNumberInfo;
-
-import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.util.DelimiterUtil;
import org.thoughtcrime.securesms.util.GroupUtil;
import org.thoughtcrime.securesms.util.NumberUtil;
@@ -111,7 +105,7 @@ public class Address implements Parcelable, Comparable {
public boolean isGroup() { return GroupUtil.isEncodedGroup(address); }
- public boolean isSignalGroup() { return !isPublicChat() && !isRSSFeed(); }
+ public boolean isSignalGroup() { return GroupUtil.isSignalGroup(address); }
public boolean isPublicChat() { return GroupUtil.isPublicChat(address); }
@@ -200,19 +194,10 @@ public class Address implements Parcelable, Comparable {
private final Optional localNumber;
private final String localCountryCode;
- private final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
private final Pattern ALPHA_PATTERN = Pattern.compile("[a-zA-Z]");
ExternalAddressFormatter(@NonNull String localNumberString) {
- try {
- Phonenumber.PhoneNumber libNumber = phoneNumberUtil.parse(localNumberString, null);
- int countryCode = libNumber.getCountryCode();
-
- this.localNumber = Optional.of(new PhoneNumber(localNumberString, countryCode, parseAreaCode(localNumberString, countryCode)));
- this.localCountryCode = phoneNumberUtil.getRegionCodeForNumber(libNumber);
- } catch (NumberParseException e) {
- throw new AssertionError(e);
- }
+ throw new AssertionError("Not Implemented");
}
ExternalAddressFormatter(@NonNull String localCountryCode, boolean countryCode) {
@@ -222,61 +207,7 @@ public class Address implements Parcelable, Comparable {
public String format(@Nullable String number) {
if (number == null) return "Unknown";
- if (GroupUtil.isEncodedGroup(number)) return number;
- if (ALPHA_PATTERN.matcher(number).find()) return number.trim();
-
- String bareNumber = number.replaceAll("[^0-9+]", "");
-
- if (bareNumber.length() == 0) {
- if (number.trim().length() == 0) return "Unknown";
- else return number.trim();
- }
-
- // libphonenumber doesn't seem to be correct for Germany and Finland
- if (bareNumber.length() <= 6 && ("DE".equals(localCountryCode) || "FI".equals(localCountryCode) || "SK".equals(localCountryCode))) {
- return bareNumber;
- }
-
- // libphonenumber seems incorrect for Russia and a few other countries with 4 digit short codes.
- if (bareNumber.length() <= 4 && !SHORT_COUNTRIES.contains(localCountryCode)) {
- return bareNumber;
- }
-
- if (isShortCode(bareNumber, localCountryCode)) {
- return bareNumber;
- }
-
- String processedNumber = applyAreaCodeRules(localNumber, bareNumber);
-
- try {
- Phonenumber.PhoneNumber parsedNumber = phoneNumberUtil.parse(processedNumber, localCountryCode);
- return phoneNumberUtil.format(parsedNumber, PhoneNumberUtil.PhoneNumberFormat.E164);
- } catch (NumberParseException e) {
- Log.w(TAG, e);
- if (bareNumber.charAt(0) == '+')
- return bareNumber;
-
- String localNumberImprecise = localNumber.isPresent() ? localNumber.get().getE164Number() : "";
-
- if (localNumberImprecise.charAt(0) == '+')
- localNumberImprecise = localNumberImprecise.substring(1);
-
- if (localNumberImprecise.length() == bareNumber.length() || bareNumber.length() > localNumberImprecise.length())
- return "+" + number;
-
- int difference = localNumberImprecise.length() - bareNumber.length();
-
- return "+" + localNumberImprecise.substring(0, difference) + bareNumber;
- }
- }
-
- private boolean isShortCode(@NonNull String bareNumber, String localCountryCode) {
- try {
- Phonenumber.PhoneNumber parsedNumber = phoneNumberUtil.parse(bareNumber, localCountryCode);
- return ShortNumberInfo.getInstance().isPossibleShortNumberForRegion(parsedNumber, localCountryCode);
- } catch (NumberParseException e) {
- return false;
- }
+ return number;
}
private @Nullable String parseAreaCode(@NonNull String e164Number, int countryCode) {
diff --git a/src/org/thoughtcrime/securesms/database/helpers/ClassicOpenHelper.java b/src/org/thoughtcrime/securesms/database/helpers/ClassicOpenHelper.java
index 5ad89598cf..8eb29d3509 100644
--- a/src/org/thoughtcrime/securesms/database/helpers/ClassicOpenHelper.java
+++ b/src/org/thoughtcrime/securesms/database/helpers/ClassicOpenHelper.java
@@ -1,24 +1,16 @@
package org.thoughtcrime.securesms.database.helpers;
-import android.Manifest;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteConstraintException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
-import android.net.Uri;
-import android.provider.ContactsContract;
import android.support.annotation.Nullable;
import android.text.TextUtils;
-import org.thoughtcrime.securesms.logging.Log;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.i18n.phonenumbers.NumberParseException;
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import com.google.i18n.phonenumbers.Phonenumber;
-import com.google.i18n.phonenumbers.ShortNumberInfo;
import org.thoughtcrime.securesms.DatabaseUpgradeActivity;
import org.thoughtcrime.securesms.crypto.AttachmentSecret;
@@ -26,7 +18,6 @@ import org.thoughtcrime.securesms.crypto.ClassicDecryptingPartInputStream;
import org.thoughtcrime.securesms.crypto.MasterCipher;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
-import org.thoughtcrime.securesms.database.Address;
import org.thoughtcrime.securesms.database.AttachmentDatabase;
import org.thoughtcrime.securesms.database.DraftDatabase;
import org.thoughtcrime.securesms.database.GroupDatabase;
@@ -37,8 +28,8 @@ import org.thoughtcrime.securesms.database.PushDatabase;
import org.thoughtcrime.securesms.database.RecipientDatabase;
import org.thoughtcrime.securesms.database.SmsDatabase;
import org.thoughtcrime.securesms.database.ThreadDatabase;
+import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.notifications.MessageNotifier;
-import org.thoughtcrime.securesms.permissions.Permissions;
import org.thoughtcrime.securesms.util.Base64;
import org.thoughtcrime.securesms.util.DelimiterUtil;
import org.thoughtcrime.securesms.util.Hex;
@@ -1385,71 +1376,18 @@ public class ClassicOpenHelper extends SQLiteOpenHelper {
add("AC");
}};
- private final Phonenumber.PhoneNumber localNumber;
private final String localNumberString;
- private final String localCountryCode;
- private final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
private final Pattern ALPHA_PATTERN = Pattern.compile("[a-zA-Z]");
public NumberMigrator(String localNumber) {
- try {
- this.localNumberString = localNumber;
- this.localNumber = phoneNumberUtil.parse(localNumber, null);
- this.localCountryCode = phoneNumberUtil.getRegionCodeForNumber(this.localNumber);
- } catch (NumberParseException e) {
- throw new AssertionError(e);
- }
+ this.localNumberString = localNumber;
}
public String migrate(@Nullable String number) {
- if (number == null) return "Unknown";
- if (number.startsWith("__textsecure_group__!")) return number;
- if (ALPHA_PATTERN.matcher(number).find()) return number.trim();
-
- String bareNumber = number.replaceAll("[^0-9+]", "");
-
- if (bareNumber.length() == 0) {
- if (TextUtils.isEmpty(number.trim())) return "Unknown";
- else return number.trim();
- }
-
- // libphonenumber doesn't seem to be correct for Germany and Finland
- if (bareNumber.length() <= 6 && ("DE".equals(localCountryCode) || "FI".equals(localCountryCode) || "SK".equals(localCountryCode))) {
- return bareNumber;
- }
-
- // libphonenumber seems incorrect for Russia and a few other countries with 4 digit short codes.
- if (bareNumber.length() <= 4 && !SHORT_COUNTRIES.contains(localCountryCode)) {
- return bareNumber;
- }
-
- try {
- Phonenumber.PhoneNumber parsedNumber = phoneNumberUtil.parse(bareNumber, localCountryCode);
-
- if (ShortNumberInfo.getInstance().isPossibleShortNumberForRegion(parsedNumber, localCountryCode)) {
- return bareNumber;
- }
-
- return phoneNumberUtil.format(parsedNumber, PhoneNumberUtil.PhoneNumberFormat.E164);
- } catch (NumberParseException e) {
- Log.w(TAG, e);
- if (bareNumber.charAt(0) == '+')
- return bareNumber;
-
- String localNumberImprecise = localNumberString;
-
- if (localNumberImprecise.charAt(0) == '+')
- localNumberImprecise = localNumberImprecise.substring(1);
-
- if (localNumberImprecise.length() == bareNumber.length() || bareNumber.length() > localNumberImprecise.length())
- return "+" + number;
-
- int difference = localNumberImprecise.length() - bareNumber.length();
-
- return "+" + localNumberImprecise.substring(0, difference) + bareNumber;
- }
+ if (number == null) return "Unknown";
+ return number;
}
}
diff --git a/src/org/thoughtcrime/securesms/database/loaders/CountryListLoader.java b/src/org/thoughtcrime/securesms/database/loaders/CountryListLoader.java
index 22b85a19a8..2c36df2a59 100644
--- a/src/org/thoughtcrime/securesms/database/loaders/CountryListLoader.java
+++ b/src/org/thoughtcrime/securesms/database/loaders/CountryListLoader.java
@@ -1,19 +1,12 @@
package org.thoughtcrime.securesms.database.loaders;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
import android.content.Context;
import android.support.v4.content.AsyncTaskLoader;
-
-import com.google.i18n.phonenumbers.PhoneNumberUtil;
-import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Map;
public class CountryListLoader extends AsyncTaskLoader>> {
@@ -23,19 +16,7 @@ public class CountryListLoader extends AsyncTaskLoader> loadInBackground() {
- Set regions = PhoneNumberUtil.getInstance().getSupportedRegions();
- ArrayList