mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-25 16:27:21 +00:00
commit
81031fa486
@ -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>
|
||||||
@ -529,32 +529,6 @@
|
|||||||
<service
|
<service
|
||||||
android:name="org.thoughtcrime.securesms.service.IncomingMessageObserver$ForegroundService"
|
android:name="org.thoughtcrime.securesms.service.IncomingMessageObserver$ForegroundService"
|
||||||
android:enabled="true" />
|
android:enabled="true" />
|
||||||
<service
|
|
||||||
android:name="org.thoughtcrime.securesms.service.QuickResponseService"
|
|
||||||
android:exported="true"
|
|
||||||
android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
|
|
||||||
<data android:scheme="sms" />
|
|
||||||
<data android:scheme="smsto" />
|
|
||||||
<data android:scheme="mms" />
|
|
||||||
<data android:scheme="mmsto" />
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
<service
|
|
||||||
android:name="org.thoughtcrime.securesms.service.AccountAuthenticatorService"
|
|
||||||
android:exported="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.accounts.AccountAuthenticator" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="android.accounts.AccountAuthenticator"
|
|
||||||
android:resource="@xml/authenticator" />
|
|
||||||
</service>
|
|
||||||
<service
|
<service
|
||||||
android:name="org.thoughtcrime.securesms.service.DirectShareService"
|
android:name="org.thoughtcrime.securesms.service.DirectShareService"
|
||||||
android:permission="android.permission.BIND_CHOOSER_TARGET_SERVICE">
|
android:permission="android.permission.BIND_CHOOSER_TARGET_SERVICE">
|
||||||
@ -563,48 +537,12 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
<service android:name="org.thoughtcrime.securesms.service.GenericForegroundService" />
|
<service android:name="org.thoughtcrime.securesms.service.GenericForegroundService" />
|
||||||
|
|
||||||
<receiver
|
|
||||||
android:name="org.thoughtcrime.securesms.service.SmsListener"
|
|
||||||
android:enabled="true"
|
|
||||||
android:exported="true"
|
|
||||||
android:permission="android.permission.BROADCAST_SMS">
|
|
||||||
<intent-filter android:priority="1001">
|
|
||||||
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.provider.Telephony.SMS_DELIVER" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
<receiver
|
|
||||||
android:name="org.thoughtcrime.securesms.service.SmsDeliveryListener"
|
|
||||||
android:exported="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="org.thoughtcrime.securesms.services.MESSAGE_SENT" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
<receiver
|
|
||||||
android:name="org.thoughtcrime.securesms.service.MmsListener"
|
|
||||||
android:enabled="true"
|
|
||||||
android:exported="true"
|
|
||||||
android:permission="android.permission.BROADCAST_WAP_PUSH">
|
|
||||||
<intent-filter android:priority="1001">
|
|
||||||
<action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED" />
|
|
||||||
|
|
||||||
<data android:mimeType="application/vnd.wap.mms-message" />
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" />
|
|
||||||
|
|
||||||
<data android:mimeType="application/vnd.wap.mms-message" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name="org.thoughtcrime.securesms.notifications.MarkReadReceiver"
|
android:name="org.thoughtcrime.securesms.notifications.MarkReadReceiver"
|
||||||
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
|
||||||
@ -612,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" />
|
||||||
@ -674,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">
|
||||||
@ -709,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">
|
||||||
@ -724,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
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:accountType="org.thoughtcrime.securesms"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:smallIcon="@mipmap/ic_launcher"
|
|
||||||
android:label="@string/app_name"/>
|
|
||||||
|
|
@ -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 {
|
||||||
|
@ -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));
|
||||||
|
@ -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";
|
||||||
|
|
||||||
|
@ -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";
|
||||||
|
@ -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";
|
||||||
|
@ -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";
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ import org.thoughtcrime.securesms.database.model.MediaMmsMessageRecord;
|
|||||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||||
import org.thoughtcrime.securesms.database.model.MmsMessageRecord;
|
import org.thoughtcrime.securesms.database.model.MmsMessageRecord;
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
|
import org.thoughtcrime.securesms.loki.MultiDeviceUtilities;
|
||||||
import org.thoughtcrime.securesms.mms.SlideDeck;
|
import org.thoughtcrime.securesms.mms.SlideDeck;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.service.IncomingMessageObserver;
|
import org.thoughtcrime.securesms.service.IncomingMessageObserver;
|
||||||
@ -58,6 +59,8 @@ import org.thoughtcrime.securesms.util.SpanUtil;
|
|||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
import org.thoughtcrime.securesms.webrtc.CallNotificationBuilder;
|
import org.thoughtcrime.securesms.webrtc.CallNotificationBuilder;
|
||||||
import org.whispersystems.signalservice.internal.util.Util;
|
import org.whispersystems.signalservice.internal.util.Util;
|
||||||
|
import org.whispersystems.signalservice.loki.messaging.LokiThreadFriendRequestStatus;
|
||||||
|
import org.whispersystems.signalservice.loki.utilities.PromiseUtil;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -70,6 +73,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
|
|
||||||
import me.leolin.shortcutbadger.ShortcutBadger;
|
import me.leolin.shortcutbadger.ShortcutBadger;
|
||||||
import network.loki.messenger.R;
|
import network.loki.messenger.R;
|
||||||
|
import nl.komponents.kovenant.Promise;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -316,15 +320,39 @@ public class MessageNotifier {
|
|||||||
long timestamp = notifications.get(0).getTimestamp();
|
long timestamp = notifications.get(0).getTimestamp();
|
||||||
if (timestamp != 0) builder.setWhen(timestamp);
|
if (timestamp != 0) builder.setWhen(timestamp);
|
||||||
|
|
||||||
|
long threadId = notifications.get(0).getThreadId();
|
||||||
|
|
||||||
ReplyMethod replyMethod = ReplyMethod.forRecipient(context, recipient);
|
ReplyMethod replyMethod = ReplyMethod.forRecipient(context, recipient);
|
||||||
|
|
||||||
|
|
||||||
|
// We can only reply if we are friends with the user or we're messaging a group
|
||||||
|
boolean isGroup = recipient.isGroupRecipient();
|
||||||
|
boolean isRSSFeed = isGroup && recipient.getAddress().isRSSFeed();
|
||||||
|
boolean isFriend = false;
|
||||||
|
if (!isGroup) {
|
||||||
|
isFriend = DatabaseFactory.getLokiThreadDatabase(context).getFriendRequestStatus(threadId) == LokiThreadFriendRequestStatus.FRIENDS;
|
||||||
|
// If we're not friends then we need to check if we're friends with any of the linked devices
|
||||||
|
if (!isFriend) {
|
||||||
|
Promise<Boolean, Exception> promise = PromiseUtil.timeout(MultiDeviceUtilities.isFriendsWithAnyLinkedDevice(context, recipient), 5000);
|
||||||
|
isFriend = PromiseUtil.get(promise, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean canReply = (isGroup && !isRSSFeed) || isFriend;
|
||||||
|
|
||||||
|
PendingIntent quickReplyIntent = canReply ? notificationState.getQuickReplyIntent(context, recipient) : null;
|
||||||
|
PendingIntent remoteReplyIntent = canReply ? notificationState.getRemoteReplyIntent(context, recipient, replyMethod) : null;
|
||||||
|
|
||||||
builder.addActions(notificationState.getMarkAsReadIntent(context, notificationId),
|
builder.addActions(notificationState.getMarkAsReadIntent(context, notificationId),
|
||||||
/*notificationState.getQuickReplyIntent(context, notifications.get(0).getRecipient()),*/
|
quickReplyIntent,
|
||||||
notificationState.getRemoteReplyIntent(context, notifications.get(0).getRecipient(), replyMethod),
|
remoteReplyIntent,
|
||||||
replyMethod);
|
replyMethod);
|
||||||
|
|
||||||
builder.addAndroidAutoAction(notificationState.getAndroidAutoReplyIntent(context, notifications.get(0).getRecipient()),
|
if (canReply) {
|
||||||
notificationState.getAndroidAutoHeardIntent(context, notificationId), notifications.get(0).getTimestamp());
|
builder.addAndroidAutoAction(notificationState.getAndroidAutoReplyIntent(context, recipient),
|
||||||
|
notificationState.getAndroidAutoHeardIntent(context, notificationId),
|
||||||
|
notifications.get(0).getTimestamp());
|
||||||
|
}
|
||||||
|
|
||||||
ListIterator<NotificationItem> iterator = notifications.listIterator(notifications.size());
|
ListIterator<NotificationItem> iterator = notifications.listIterator(notifications.size());
|
||||||
|
|
||||||
@ -514,7 +542,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
|
||||||
|
@ -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");
|
||||||
}
|
}
|
||||||
|
@ -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;
|
|
||||||
} else {
|
|
||||||
return ReplyMethod.UnsecuredSmsMessage;
|
|
||||||
}
|
}
|
||||||
|
return ReplyMethod.SecureMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ import org.thoughtcrime.securesms.contacts.avatars.ContactColors;
|
|||||||
import org.thoughtcrime.securesms.contacts.avatars.ContactPhoto;
|
import org.thoughtcrime.securesms.contacts.avatars.ContactPhoto;
|
||||||
import org.thoughtcrime.securesms.contacts.avatars.FallbackContactPhoto;
|
import org.thoughtcrime.securesms.contacts.avatars.FallbackContactPhoto;
|
||||||
import org.thoughtcrime.securesms.contacts.avatars.GeneratedContactPhoto;
|
import org.thoughtcrime.securesms.contacts.avatars.GeneratedContactPhoto;
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader;
|
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader;
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||||
@ -39,7 +38,6 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
|||||||
import org.thoughtcrime.securesms.util.BitmapUtil;
|
import org.thoughtcrime.securesms.util.BitmapUtil;
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
import org.thoughtcrime.securesms.util.Util;
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
import org.whispersystems.signalservice.loki.api.LokiPublicChat;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -156,31 +154,33 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addActions(@NonNull PendingIntent markReadIntent,
|
public void addActions(@NonNull PendingIntent markReadIntent,
|
||||||
@NonNull PendingIntent wearableReplyIntent,
|
@Nullable PendingIntent quickReplyIntent,
|
||||||
|
@Nullable PendingIntent wearableReplyIntent,
|
||||||
@NonNull ReplyMethod replyMethod)
|
@NonNull ReplyMethod replyMethod)
|
||||||
{
|
{
|
||||||
Action markAsReadAction = new Action(R.drawable.check,
|
Action markAsReadAction = new Action(R.drawable.check,
|
||||||
context.getString(R.string.MessageNotifier_mark_read),
|
context.getString(R.string.MessageNotifier_mark_read),
|
||||||
markReadIntent);
|
markReadIntent);
|
||||||
|
|
||||||
|
addAction(markAsReadAction);
|
||||||
|
|
||||||
|
NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender().addAction(markAsReadAction);
|
||||||
|
|
||||||
|
if (quickReplyIntent != null) {
|
||||||
String actionName = context.getString(R.string.MessageNotifier_reply);
|
String actionName = context.getString(R.string.MessageNotifier_reply);
|
||||||
String label = context.getString(replyMethodLongDescription(replyMethod));
|
String label = context.getString(replyMethodLongDescription(replyMethod));
|
||||||
|
|
||||||
/*
|
|
||||||
Action replyAction = new Action(R.drawable.ic_reply_white_36dp,
|
Action replyAction = new Action(R.drawable.ic_reply_white_36dp,
|
||||||
actionName,
|
actionName,
|
||||||
quickReplyIntent);
|
quickReplyIntent);
|
||||||
*/
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
/*
|
|
||||||
replyAction = new Action.Builder(R.drawable.ic_reply_white_36dp,
|
replyAction = new Action.Builder(R.drawable.ic_reply_white_36dp,
|
||||||
actionName,
|
actionName,
|
||||||
wearableReplyIntent)
|
wearableReplyIntent)
|
||||||
.addRemoteInput(new RemoteInput.Builder(MessageNotifier.EXTRA_REMOTE_REPLY)
|
.addRemoteInput(new RemoteInput.Builder(MessageNotifier.EXTRA_REMOTE_REPLY)
|
||||||
.setLabel(label).build())
|
.setLabel(label).build())
|
||||||
.build();
|
.build();
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Action wearableReplyAction = new Action.Builder(R.drawable.ic_reply,
|
Action wearableReplyAction = new Action.Builder(R.drawable.ic_reply,
|
||||||
@ -190,25 +190,17 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
|||||||
.setLabel(label).build())
|
.setLabel(label).build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
addAction(markAsReadAction);
|
|
||||||
// addAction(replyAction);
|
|
||||||
|
|
||||||
extend(new NotificationCompat.WearableExtender().addAction(markAsReadAction)
|
addAction(replyAction);
|
||||||
.addAction(wearableReplyAction));
|
wearableExtender.addAction(wearableReplyAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
extend(wearableExtender);
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
private static int replyMethodLongDescription(@NonNull ReplyMethod replyMethod) {
|
private static int replyMethodLongDescription(@NonNull ReplyMethod replyMethod) {
|
||||||
switch (replyMethod) {
|
|
||||||
case GroupMessage:
|
|
||||||
return R.string.MessageNotifier_reply;
|
return R.string.MessageNotifier_reply;
|
||||||
case SecureMessage:
|
|
||||||
return R.string.MessageNotifier_signal_message;
|
|
||||||
case UnsecuredSmsMessage:
|
|
||||||
return R.string.MessageNotifier_unsecured_sms;
|
|
||||||
default:
|
|
||||||
return R.string.MessageNotifier_reply;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMessageBody(@NonNull Recipient threadRecipient,
|
public void addMessageBody(@NonNull Recipient threadRecipient,
|
||||||
|
@ -1,80 +0,0 @@
|
|||||||
package org.thoughtcrime.securesms.service;
|
|
||||||
|
|
||||||
import android.accounts.AbstractAccountAuthenticator;
|
|
||||||
import android.accounts.Account;
|
|
||||||
import android.accounts.AccountAuthenticatorResponse;
|
|
||||||
import android.accounts.NetworkErrorException;
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.IBinder;
|
|
||||||
|
|
||||||
public class AccountAuthenticatorService extends Service {
|
|
||||||
|
|
||||||
private static AccountAuthenticatorImpl accountAuthenticator = null;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
if (intent.getAction().equals(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT)) {
|
|
||||||
return getAuthenticator().getIBinder();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized AccountAuthenticatorImpl getAuthenticator() {
|
|
||||||
if (accountAuthenticator == null) {
|
|
||||||
accountAuthenticator = new AccountAuthenticatorImpl(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return accountAuthenticator;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class AccountAuthenticatorImpl extends AbstractAccountAuthenticator {
|
|
||||||
|
|
||||||
public AccountAuthenticatorImpl(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType,
|
|
||||||
String[] requiredFeatures, Bundle options)
|
|
||||||
throws NetworkErrorException
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType,
|
|
||||||
Bundle options) throws NetworkErrorException {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAuthTokenLabel(String authTokenType) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features)
|
|
||||||
throws NetworkErrorException {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, String authTokenType,
|
|
||||||
Bundle options) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user