Differentiate Signal actions from Signal actions

This commit is contained in:
Mikunj Varsani 2020-03-12 09:52:42 +11:00
parent 34ef29a645
commit d694cfa68a
10 changed files with 19 additions and 28 deletions

View File

@ -494,7 +494,7 @@
android:label="@string/AndroidManifest_remove_photo" android:label="@string/AndroidManifest_remove_photo"
android:theme="@style/Theme.AppCompat.Dialog.Alert"> android:theme="@style/Theme.AppCompat.Dialog.Alert">
<intent-filter> <intent-filter>
<action android:name="org.thoughtcrime.securesms.action.CLEAR_PROFILE_PHOTO" /> <action android:name="network.loki.securesms.action.CLEAR_PROFILE_PHOTO" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
@ -542,7 +542,7 @@
android:enabled="true" android:enabled="true"
android:exported="false"> android:exported="false">
<intent-filter> <intent-filter>
<action android:name="org.thoughtcrime.securesms.notifications.CLEAR" /> <action android:name="network.loki.securesms.notifications.CLEAR" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver <receiver
@ -550,21 +550,21 @@
android:enabled="true" android:enabled="true"
android:exported="false"> android:exported="false">
<intent-filter> <intent-filter>
<action android:name="org.thoughtcrime.securesms.notifications.WEAR_REPLY" /> <action android:name="network.loki.securesms.notifications.WEAR_REPLY" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver <receiver
android:name="org.thoughtcrime.securesms.notifications.AndroidAutoHeardReceiver" android:name="org.thoughtcrime.securesms.notifications.AndroidAutoHeardReceiver"
android:exported="false"> android:exported="false">
<intent-filter> <intent-filter>
<action android:name="org.thoughtcrime.securesms.notifications.ANDROID_AUTO_HEARD" /> <action android:name="network.loki.securesms.notifications.ANDROID_AUTO_HEARD" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver <receiver
android:name="org.thoughtcrime.securesms.notifications.AndroidAutoReplyReceiver" android:name="org.thoughtcrime.securesms.notifications.AndroidAutoReplyReceiver"
android:exported="false"> android:exported="false">
<intent-filter> <intent-filter>
<action android:name="org.thoughtcrime.securesms.notifications.ANDROID_AUTO_REPLY" /> <action android:name="network.loki.securesms.notifications.ANDROID_AUTO_REPLY" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name="org.thoughtcrime.securesms.service.ExpirationListener" /> <receiver android:name="org.thoughtcrime.securesms.service.ExpirationListener" />
@ -612,7 +612,7 @@
<receiver android:name="org.thoughtcrime.securesms.service.BootReceiver"> <receiver android:name="org.thoughtcrime.securesms.service.BootReceiver">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="org.thoughtcrime.securesms.RESTART" /> <action android:name="network.loki.securesms.RESTART" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name="org.thoughtcrime.securesms.service.DirectoryRefreshListener"> <receiver android:name="org.thoughtcrime.securesms.service.DirectoryRefreshListener">
@ -647,12 +647,12 @@
</receiver> </receiver>
<receiver android:name="org.thoughtcrime.securesms.notifications.MessageNotifier$ReminderReceiver"> <receiver android:name="org.thoughtcrime.securesms.notifications.MessageNotifier$ReminderReceiver">
<intent-filter> <intent-filter>
<action android:name="org.thoughtcrime.securesms.MessageNotifier.REMINDER_ACTION" /> <action android:name="network.loki.securesms.MessageNotifier.REMINDER_ACTION" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name="org.thoughtcrime.securesms.notifications.DeleteNotificationReceiver"> <receiver android:name="org.thoughtcrime.securesms.notifications.DeleteNotificationReceiver">
<intent-filter> <intent-filter>
<action android:name="org.thoughtcrime.securesms.DELETE_NOTIFICATION" /> <action android:name="network.loki.securesms.DELETE_NOTIFICATION" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name="org.thoughtcrime.securesms.ExperienceUpgradeActivity$AppUpgradeReceiver"> <receiver android:name="org.thoughtcrime.securesms.ExperienceUpgradeActivity$AppUpgradeReceiver">
@ -662,7 +662,7 @@
<data android:scheme="package" /> <data android:scheme="package" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="org.thoughtcrime.securesms.ExperienceUpgradeActivity.DISMISS_ACTION" /> <action android:name="network.loki.securesms.ExperienceUpgradeActivity.DISMISS_ACTION" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver <receiver

View File

@ -33,7 +33,7 @@ import network.loki.messenger.R;
public class ExperienceUpgradeActivity extends BaseActionBarActivity implements TypingIndicatorIntroFragment.Controller, LinkPreviewsIntroFragment.Controller { public class ExperienceUpgradeActivity extends BaseActionBarActivity implements TypingIndicatorIntroFragment.Controller, LinkPreviewsIntroFragment.Controller {
private static final String TAG = ExperienceUpgradeActivity.class.getSimpleName(); private static final String TAG = ExperienceUpgradeActivity.class.getSimpleName();
private static final String DISMISS_ACTION = "org.thoughtcrime.securesms.ExperienceUpgradeActivity.DISMISS_ACTION"; private static final String DISMISS_ACTION = "network.loki.securesms.ExperienceUpgradeActivity.DISMISS_ACTION";
private static final int NOTIFICATION_ID = 1339; private static final int NOTIFICATION_ID = 1339;
private enum ExperienceUpgrade { private enum ExperienceUpgrade {

View File

@ -102,7 +102,7 @@ public final class AvatarSelection {
} }
if (includeClear) { if (includeClear) {
extraIntents.add(new Intent("org.thoughtcrime.securesms.action.CLEAR_PROFILE_PHOTO")); extraIntents.add(new Intent("network.loki.securesms.action.CLEAR_PROFILE_PHOTO"));
} }
Intent chooserIntent = Intent.createChooser(galleryIntent, context.getString(R.string.CreateProfileActivity_profile_photo)); Intent chooserIntent = Intent.createChooser(galleryIntent, context.getString(R.string.CreateProfileActivity_profile_photo));

View File

@ -37,7 +37,7 @@ import java.util.List;
public class AndroidAutoHeardReceiver extends BroadcastReceiver { public class AndroidAutoHeardReceiver extends BroadcastReceiver {
public static final String TAG = AndroidAutoHeardReceiver.class.getSimpleName(); public static final String TAG = AndroidAutoHeardReceiver.class.getSimpleName();
public static final String HEARD_ACTION = "org.thoughtcrime.securesms.notifications.ANDROID_AUTO_HEARD"; public static final String HEARD_ACTION = "network.loki.securesms.notifications.ANDROID_AUTO_HEARD";
public static final String THREAD_IDS_EXTRA = "car_heard_thread_ids"; public static final String THREAD_IDS_EXTRA = "car_heard_thread_ids";
public static final String NOTIFICATION_ID_EXTRA = "car_notification_id"; public static final String NOTIFICATION_ID_EXTRA = "car_notification_id";

View File

@ -44,7 +44,7 @@ import java.util.List;
public class AndroidAutoReplyReceiver extends BroadcastReceiver { public class AndroidAutoReplyReceiver extends BroadcastReceiver {
public static final String TAG = AndroidAutoReplyReceiver.class.getSimpleName(); public static final String TAG = AndroidAutoReplyReceiver.class.getSimpleName();
public static final String REPLY_ACTION = "org.thoughtcrime.securesms.notifications.ANDROID_AUTO_REPLY"; public static final String REPLY_ACTION = "network.loki.securesms.notifications.ANDROID_AUTO_REPLY";
public static final String ADDRESS_EXTRA = "car_address"; public static final String ADDRESS_EXTRA = "car_address";
public static final String VOICE_REPLY_KEY = "car_voice_reply_key"; public static final String VOICE_REPLY_KEY = "car_voice_reply_key";
public static final String THREAD_ID_EXTRA = "car_reply_thread_id"; public static final String THREAD_ID_EXTRA = "car_reply_thread_id";

View File

@ -10,7 +10,7 @@ import org.thoughtcrime.securesms.database.DatabaseFactory;
public class DeleteNotificationReceiver extends BroadcastReceiver { public class DeleteNotificationReceiver extends BroadcastReceiver {
public static String DELETE_NOTIFICATION_ACTION = "org.thoughtcrime.securesms.DELETE_NOTIFICATION"; public static String DELETE_NOTIFICATION_ACTION = "network.loki.securesms.DELETE_NOTIFICATION";
public static String EXTRA_IDS = "message_ids"; public static String EXTRA_IDS = "message_ids";
public static String EXTRA_MMS = "is_mms"; public static String EXTRA_MMS = "is_mms";

View File

@ -35,7 +35,7 @@ import kotlin.contracts.Returns;
public class MarkReadReceiver extends BroadcastReceiver { public class MarkReadReceiver extends BroadcastReceiver {
private static final String TAG = MarkReadReceiver.class.getSimpleName(); private static final String TAG = MarkReadReceiver.class.getSimpleName();
public static final String CLEAR_ACTION = "org.thoughtcrime.securesms.notifications.CLEAR"; public static final String CLEAR_ACTION = "network.loki.securesms.notifications.CLEAR";
public static final String THREAD_IDS_EXTRA = "thread_ids"; public static final String THREAD_IDS_EXTRA = "thread_ids";
public static final String NOTIFICATION_ID_EXTRA = "notification_id"; public static final String NOTIFICATION_ID_EXTRA = "notification_id";

View File

@ -514,7 +514,7 @@ public class MessageNotifier {
public static class ReminderReceiver extends BroadcastReceiver { public static class ReminderReceiver extends BroadcastReceiver {
public static final String REMINDER_ACTION = "org.thoughtcrime.securesms.MessageNotifier.REMINDER_ACTION"; public static final String REMINDER_ACTION = "network.loki.securesms.MessageNotifier.REMINDER_ACTION";
@SuppressLint("StaticFieldLeak") @SuppressLint("StaticFieldLeak")
@Override @Override

View File

@ -44,7 +44,7 @@ import java.util.List;
public class RemoteReplyReceiver extends BroadcastReceiver { public class RemoteReplyReceiver extends BroadcastReceiver {
public static final String TAG = RemoteReplyReceiver.class.getSimpleName(); public static final String TAG = RemoteReplyReceiver.class.getSimpleName();
public static final String REPLY_ACTION = "org.thoughtcrime.securesms.notifications.WEAR_REPLY"; public static final String REPLY_ACTION = "network.loki.securesms.notifications.WEAR_REPLY";
public static final String ADDRESS_EXTRA = "address"; public static final String ADDRESS_EXTRA = "address";
public static final String REPLY_METHOD = "reply_method"; public static final String REPLY_METHOD = "reply_method";
@ -85,11 +85,6 @@ public class RemoteReplyReceiver extends BroadcastReceiver {
threadId = MessageSender.send(context, reply, -1, false, null); threadId = MessageSender.send(context, reply, -1, false, null);
break; break;
} }
case UnsecuredSmsMessage: {
OutgoingTextMessage reply = new OutgoingTextMessage(recipient, responseText.toString(), expiresIn, subscriptionId);
threadId = MessageSender.send(context, reply, -1, true, null);
break;
}
default: default:
throw new AssertionError("Unknown Reply method"); throw new AssertionError("Unknown Reply method");
} }

View File

@ -10,16 +10,12 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences;
public enum ReplyMethod { public enum ReplyMethod {
GroupMessage, GroupMessage,
SecureMessage, SecureMessage;
UnsecuredSmsMessage;
public static @NonNull ReplyMethod forRecipient(Context context, Recipient recipient) { public static @NonNull ReplyMethod forRecipient(Context context, Recipient recipient) {
if (recipient.isGroupRecipient()) { if (recipient.isGroupRecipient()) {
return ReplyMethod.GroupMessage; return ReplyMethod.GroupMessage;
} else if (TextSecurePreferences.isPushRegistered(context) && recipient.getRegistered() == RecipientDatabase.RegisteredState.REGISTERED && !recipient.isForceSmsSelection()) { }
return ReplyMethod.SecureMessage; return ReplyMethod.SecureMessage;
} else {
return ReplyMethod.UnsecuredSmsMessage;
}
} }
} }