mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
further cleaning on V1 multi device
This commit is contained in:
parent
8e5e2fdc49
commit
0d2f5e0cde
@ -555,12 +555,6 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
if (publicChatAPI == null) { return; }
|
||||
byte[] profileKey = ProfileKeyUtil.getProfileKey(this);
|
||||
String url = TextSecurePreferences.getProfilePictureURL(this);
|
||||
String userMasterDevice = TextSecurePreferences.getMasterHexEncodedPublicKey(this);
|
||||
if (userMasterDevice != null) {
|
||||
Recipient userMasterDeviceAsRecipient = Recipient.from(this, Address.fromSerialized(userMasterDevice), false).resolve();
|
||||
profileKey = userMasterDeviceAsRecipient.getProfileKey();
|
||||
url = userMasterDeviceAsRecipient.getProfileAvatar();
|
||||
}
|
||||
Set<String> servers = DatabaseFactory.getLokiThreadDatabase(this).getAllPublicChatServers();
|
||||
for (String server : servers) {
|
||||
if (profileKey != null) {
|
||||
|
@ -92,7 +92,6 @@ public class SignalCommunicationModule {
|
||||
new DynamicCredentialsProvider(context),
|
||||
new SignalProtocolStoreImpl(context),
|
||||
BuildConfig.USER_AGENT,
|
||||
TextSecurePreferences.isMultiDevice(context),
|
||||
Optional.fromNullable(IncomingMessageObserver.getPipe()),
|
||||
Optional.fromNullable(IncomingMessageObserver.getUnidentifiedPipe()),
|
||||
Optional.of(new MessageSenderEventListener(context)),
|
||||
@ -108,7 +107,6 @@ public class SignalCommunicationModule {
|
||||
((ApplicationContext)context.getApplicationContext()).broadcaster);
|
||||
} else {
|
||||
this.messageSender.setMessagePipe(IncomingMessageObserver.getPipe(), IncomingMessageObserver.getUnidentifiedPipe());
|
||||
this.messageSender.setIsMultiDevice(TextSecurePreferences.isMultiDevice(context));
|
||||
}
|
||||
|
||||
return this.messageSender;
|
||||
|
@ -73,10 +73,9 @@ public class GroupManager {
|
||||
final Set<Address> memberAddresses = getMemberAddresses(members);
|
||||
final Set<Address> adminAddresses = getMemberAddresses(admins);
|
||||
|
||||
String masterPublicKeyOrNull = TextSecurePreferences.getMasterHexEncodedPublicKey(context);
|
||||
String masterPublicKey = masterPublicKeyOrNull != null ? masterPublicKeyOrNull : TextSecurePreferences.getLocalNumber(context);
|
||||
String userPublicKey = TextSecurePreferences.getLocalNumber(context);
|
||||
|
||||
memberAddresses.add(Address.fromSerialized(masterPublicKey));
|
||||
memberAddresses.add(Address.fromSerialized(userPublicKey));
|
||||
groupDatabase.create(groupId, name, new LinkedList<>(memberAddresses), null, null, new LinkedList<>(adminAddresses), System.currentTimeMillis());
|
||||
|
||||
groupDatabase.updateProfilePicture(groupId, avatarBytes);
|
||||
|
@ -125,10 +125,9 @@ public class GroupMessageProcessor {
|
||||
Address address = Address.fromExternal(context, GroupUtil.getEncodedId(group));
|
||||
Recipient recipient = Recipient.from(context, address, false);
|
||||
|
||||
String userMasterDevice = TextSecurePreferences.getMasterHexEncodedPublicKey(context);
|
||||
if (userMasterDevice == null) { userMasterDevice = TextSecurePreferences.getLocalNumber(context); }
|
||||
String userPublicKey = TextSecurePreferences.getLocalNumber(context);
|
||||
|
||||
if (content.getSender().equals(userMasterDevice)) {
|
||||
if (content.getSender().equals(userPublicKey)) {
|
||||
long threadId = threadDatabase.getThreadIdIfExistsFor(recipient);
|
||||
return threadId == -1 ? null : threadId;
|
||||
}
|
||||
@ -141,9 +140,9 @@ public class GroupMessageProcessor {
|
||||
}
|
||||
|
||||
// Loki - Only process update messages if we're part of the group
|
||||
Address userMasterDeviceAddress = Address.fromSerialized(userMasterDevice);
|
||||
Address userMasterDeviceAddress = Address.fromSerialized(userPublicKey);
|
||||
if (!groupRecord.getMembers().contains(userMasterDeviceAddress) &&
|
||||
!group.getMembers().or(Collections.emptyList()).contains(userMasterDevice)) {
|
||||
!group.getMembers().or(Collections.emptyList()).contains(userPublicKey)) {
|
||||
Log.d("Loki", "Received a group update message from a group we're not a member of: " + id + "; ignoring.");
|
||||
database.setActive(id, false);
|
||||
return null;
|
||||
@ -193,7 +192,7 @@ public class GroupMessageProcessor {
|
||||
}
|
||||
|
||||
// If we were removed then we need to disable the chat
|
||||
if (removedMembers.contains(Address.fromSerialized(userMasterDevice))) {
|
||||
if (removedMembers.contains(Address.fromSerialized(userPublicKey))) {
|
||||
database.setActive(id, false);
|
||||
} else {
|
||||
if (!groupRecord.isActive()) database.setActive(id, true);
|
||||
|
@ -276,17 +276,5 @@ public abstract class PushSendJob extends SendJob {
|
||||
// Loki - We don't need verification on sender certificates
|
||||
}
|
||||
|
||||
protected SignalServiceSyncMessage buildSelfSendSyncMessage(@NonNull Context context, @NonNull SignalServiceDataMessage message, Optional<UnidentifiedAccessPair> syncAccess) {
|
||||
String masterPublicKeyOrNull = TextSecurePreferences.getMasterHexEncodedPublicKey(context);
|
||||
String masterPublicKey = masterPublicKeyOrNull != null ? masterPublicKeyOrNull : TextSecurePreferences.getLocalNumber(context);
|
||||
SentTranscriptMessage transcript = new SentTranscriptMessage(masterPublicKey,
|
||||
message.getTimestamp(),
|
||||
message,
|
||||
message.getExpiresInSeconds(),
|
||||
Collections.singletonMap(masterPublicKey, syncAccess.isPresent()));
|
||||
return SignalServiceSyncMessage.forSentTranscript(transcript);
|
||||
}
|
||||
|
||||
|
||||
protected abstract void onPushSend() throws Exception;
|
||||
}
|
||||
|
@ -62,10 +62,7 @@ class CreatePrivateChatActivity : PassphraseRequiredActionBarActivity(), ScanQRC
|
||||
|
||||
fun createPrivateChatIfPossible(hexEncodedPublicKey: String) {
|
||||
if (!PublicKeyValidation.isValid(hexEncodedPublicKey)) { return Toast.makeText(this, R.string.invalid_session_id, Toast.LENGTH_SHORT).show() }
|
||||
val masterHexEncodedPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(this)
|
||||
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(this)!!
|
||||
val targetHexEncodedPublicKey = if (hexEncodedPublicKey == masterHexEncodedPublicKey) userHexEncodedPublicKey else hexEncodedPublicKey
|
||||
val recipient = Recipient.from(this, Address.fromSerialized(targetHexEncodedPublicKey), false)
|
||||
val recipient = Recipient.from(this, Address.fromSerialized(hexEncodedPublicKey), false)
|
||||
val intent = Intent(this, ConversationActivity::class.java)
|
||||
intent.putExtra(ConversationActivity.ADDRESS_EXTRA, recipient.address)
|
||||
intent.putExtra(ConversationActivity.TEXT_EXTRA, getIntent().getStringExtra(ConversationActivity.TEXT_EXTRA))
|
||||
@ -115,9 +112,7 @@ class EnterPublicKeyFragment : Fragment() {
|
||||
|
||||
private val hexEncodedPublicKey: String
|
||||
get() {
|
||||
val masterHexEncodedPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(requireContext())
|
||||
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(requireContext())!!
|
||||
return masterHexEncodedPublicKey ?: userHexEncodedPublicKey
|
||||
return TextSecurePreferences.getLocalNumber(requireContext())!!
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
|
@ -84,9 +84,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
|
||||
|
||||
private val publicKey: String
|
||||
get() {
|
||||
val masterPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(this)
|
||||
val userPublicKey = TextSecurePreferences.getLocalNumber(this)!!
|
||||
return masterPublicKey ?: userPublicKey
|
||||
return TextSecurePreferences.getLocalNumber(this)!!
|
||||
}
|
||||
|
||||
// region Lifecycle
|
||||
@ -111,9 +109,8 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
|
||||
pathStatusViewContainer.disableClipping()
|
||||
pathStatusViewContainer.setOnClickListener { showPath() }
|
||||
// Set up seed reminder view
|
||||
val isMasterDevice = (TextSecurePreferences.getMasterHexEncodedPublicKey(this) == null)
|
||||
val hasViewedSeed = TextSecurePreferences.getHasViewedSeed(this)
|
||||
if (!hasViewedSeed && isMasterDevice) {
|
||||
if (!hasViewedSeed) {
|
||||
val seedReminderViewTitle = SpannableString("You're almost finished! 80%") // Intentionally not yet translated
|
||||
seedReminderViewTitle.setSpan(ForegroundColorSpan(resources.getColorWithID(R.color.accent, theme)), 24, 27, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
seedReminderView.title = seedReminderViewTitle
|
||||
@ -191,9 +188,8 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
|
||||
super.onResume()
|
||||
if (TextSecurePreferences.getLocalNumber(this) == null) { return; } // This can be the case after a secondary device is auto-cleared
|
||||
profileButton.update()
|
||||
val isMasterDevice = (TextSecurePreferences.getMasterHexEncodedPublicKey(this) == null)
|
||||
val hasViewedSeed = TextSecurePreferences.getHasViewedSeed(this)
|
||||
if (hasViewedSeed || !isMasterDevice) {
|
||||
if (hasViewedSeed) {
|
||||
seedReminderView.visibility = View.GONE
|
||||
}
|
||||
showKeyPairMigrationSheetIfNeeded()
|
||||
|
@ -28,10 +28,6 @@ class LandingActivity : BaseActionBarActivity() {
|
||||
findViewById<View>(R.id.restoreButton).setOnClickListener { restoreFromRecoveryPhrase() }
|
||||
findViewById<View>(R.id.restoreBackupButton).setOnClickListener { restoreFromBackup() }
|
||||
|
||||
if (TextSecurePreferences.getWasUnlinked(this)) {
|
||||
Toast.makeText(this, R.string.activity_landing_device_unlinked_dialog_title, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
// Setup essentials for a new user.
|
||||
IdentityKeyUtil.generateIdentityKeyPair(this)
|
||||
|
||||
|
@ -53,10 +53,7 @@ class QRCodeActivity : PassphraseRequiredActionBarActivity(), ScanQRCodeWrapperF
|
||||
|
||||
fun createPrivateChatIfPossible(hexEncodedPublicKey: String) {
|
||||
if (!PublicKeyValidation.isValid(hexEncodedPublicKey)) { return Toast.makeText(this, R.string.invalid_session_id, Toast.LENGTH_SHORT).show() }
|
||||
val masterHexEncodedPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(this)
|
||||
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(this)
|
||||
val targetHexEncodedPublicKey = if (hexEncodedPublicKey == masterHexEncodedPublicKey) userHexEncodedPublicKey else hexEncodedPublicKey
|
||||
val recipient = Recipient.from(this, Address.fromSerialized(targetHexEncodedPublicKey!!), false)
|
||||
val recipient = Recipient.from(this, Address.fromSerialized(hexEncodedPublicKey), false)
|
||||
val intent = Intent(this, ConversationActivity::class.java)
|
||||
intent.putExtra(ConversationActivity.ADDRESS_EXTRA, recipient.address)
|
||||
intent.putExtra(ConversationActivity.TEXT_EXTRA, getIntent().getStringExtra(ConversationActivity.TEXT_EXTRA))
|
||||
@ -105,9 +102,7 @@ class ViewMyQRCodeFragment : Fragment() {
|
||||
|
||||
private val hexEncodedPublicKey: String
|
||||
get() {
|
||||
val masterHexEncodedPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(requireContext())
|
||||
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(requireContext())!!
|
||||
return masterHexEncodedPublicKey ?: userHexEncodedPublicKey
|
||||
return TextSecurePreferences.getLocalNumber(requireContext())!!
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
|
@ -63,9 +63,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
||||
|
||||
private val hexEncodedPublicKey: String
|
||||
get() {
|
||||
val masterHexEncodedPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(this)
|
||||
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(this)!!
|
||||
return masterHexEncodedPublicKey ?: userHexEncodedPublicKey
|
||||
return TextSecurePreferences.getLocalNumber(this)!!
|
||||
}
|
||||
|
||||
// region Lifecycle
|
||||
@ -85,17 +83,11 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
||||
publicKeyTextView.text = hexEncodedPublicKey
|
||||
copyButton.setOnClickListener { copyPublicKey() }
|
||||
shareButton.setOnClickListener { sharePublicKey() }
|
||||
val isMasterDevice = (TextSecurePreferences.getMasterHexEncodedPublicKey(this) == null)
|
||||
linkedDevicesButtonTopSeparator.visibility = View.GONE
|
||||
linkedDevicesButton.visibility = View.GONE
|
||||
if (!isMasterDevice) {
|
||||
seedButtonTopSeparator.visibility = View.GONE
|
||||
seedButton.visibility = View.GONE
|
||||
}
|
||||
privacyButton.setOnClickListener { showPrivacySettings() }
|
||||
notificationsButton.setOnClickListener { showNotificationSettings() }
|
||||
chatsButton.setOnClickListener { showChatSettings() }
|
||||
// linkedDevicesButton.setOnClickListener { showLinkedDevices() }
|
||||
sendInvitationButton.setOnClickListener { sendInvitation() }
|
||||
seedButton.setOnClickListener { showSeed() }
|
||||
clearAllDataButton.setOnClickListener { clearAllData() }
|
||||
|
@ -204,7 +204,7 @@ class PublicChatPoller(private val context: Context, private val group: PublicCh
|
||||
}
|
||||
// If we got a message from our master device then make sure our mapping stays in sync
|
||||
val recipient = Recipient.from(context, Address.fromSerialized(message.senderPublicKey), false)
|
||||
if (recipient.isUserMasterDevice && message.profilePicture != null) {
|
||||
if (message.profilePicture != null) {
|
||||
val profileKey = message.profilePicture!!.profileKey
|
||||
val url = message.profilePicture!!.url
|
||||
if (recipient.profileKey == null || !MessageDigest.isEqual(recipient.profileKey, profileKey)) {
|
||||
|
@ -37,11 +37,7 @@ class MultiDeviceRemovalBottomSheet : BottomSheetDialogFragment() {
|
||||
}
|
||||
|
||||
private val explanation by lazy {
|
||||
if (TextSecurePreferences.getMasterHexEncodedPublicKey(requireContext()) != null) {
|
||||
"You’re seeing this because this is a secondary device in a multi-device setup. To improve reliability and stability, we’ve decided to temporarily disable Session’s multi-device functionality. Device linking has been disabled, and existing secondary clients will be erased on $removalDateDescription.\n\nTo read more about this change, visit the Session FAQ at getsession.org/faq."
|
||||
} else {
|
||||
"You’re seeing this because you have a secondary device linked to your Session ID. To improve reliability and stability, we’ve decided to temporarily disable Session’s multi-device functionality. Device linking has been disabled, and existing secondary clients will be erased on $removalDateDescription.\n\nTo read more about this change, visit the Session FAQ at getsession.org/faq"
|
||||
}
|
||||
"You’re seeing this because you have a secondary device linked to your Session ID. To improve reliability and stability, we’ve decided to temporarily disable Session’s multi-device functionality. Device linking has been disabled, and existing secondary clients will be erased on $removalDateDescription.\n\nTo read more about this change, visit the Session FAQ at getsession.org/faq"
|
||||
}
|
||||
|
||||
private val decoratedExplanation by lazy {
|
||||
|
@ -47,9 +47,8 @@ object SessionMetaProtocol {
|
||||
val displayName = content.senderDisplayName.orNull() ?: return
|
||||
if (displayName.isBlank()) { return }
|
||||
val userPublicKey = TextSecurePreferences.getLocalNumber(context)
|
||||
val userMasterPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(context)
|
||||
val sender = content.sender.toLowerCase()
|
||||
if (userMasterPublicKey == sender) {
|
||||
if (userPublicKey == sender) {
|
||||
// Update the user's local name if the message came from their master device
|
||||
TextSecurePreferences.setProfileName(context, displayName)
|
||||
}
|
||||
@ -67,8 +66,8 @@ object SessionMetaProtocol {
|
||||
database.setUnidentifiedAccessMode(recipient, Recipient.UnidentifiedAccessMode.UNKNOWN)
|
||||
val url = content.senderProfilePictureURL.or("")
|
||||
ApplicationContext.getInstance(context).jobManager.add(RetrieveProfileAvatarJob(recipient, url))
|
||||
val userMasterPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(context)
|
||||
if (userMasterPublicKey == content.sender) {
|
||||
val userPublicKey = TextSecurePreferences.getLocalNumber(context)
|
||||
if (userPublicKey == content.sender) {
|
||||
ApplicationContext.getInstance(context).updateOpenGroupProfilePicturesIfNeeded()
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class GroupDescription(context: Context, groupContext: SignalServiceProtos.Group
|
||||
private val groupContext: SignalServiceProtos.GroupContext?
|
||||
private val newMembers: MutableList<Recipient>
|
||||
private val removedMembers: MutableList<Recipient>
|
||||
private var wasCurrentUserRemoved: Boolean
|
||||
private var wasCurrentUserRemoved: Boolean = false
|
||||
private fun toRecipient(hexEncodedPublicKey: String): Recipient {
|
||||
val address = Address.fromSerialized(hexEncodedPublicKey)
|
||||
return Recipient.from(context, address, false)
|
||||
@ -74,7 +74,6 @@ class GroupDescription(context: Context, groupContext: SignalServiceProtos.Group
|
||||
this.groupContext = groupContext
|
||||
newMembers = LinkedList()
|
||||
removedMembers = LinkedList()
|
||||
wasCurrentUserRemoved = false
|
||||
if (groupContext != null) {
|
||||
val newMembers = groupContext.newMembersList
|
||||
for (member in newMembers) {
|
||||
@ -84,15 +83,7 @@ class GroupDescription(context: Context, groupContext: SignalServiceProtos.Group
|
||||
for (member in removedMembers) {
|
||||
this.removedMembers.add(toRecipient(member))
|
||||
}
|
||||
|
||||
// If we were the one that quit then we need to leave the group (only relevant for slave
|
||||
// devices in a multi device context)
|
||||
if (!removedMembers.isEmpty()) {
|
||||
val masterPublicKeyOrNull = TextSecurePreferences.getMasterHexEncodedPublicKey(context)
|
||||
val masterPublicKey = masterPublicKeyOrNull
|
||||
?: TextSecurePreferences.getLocalNumber(context)
|
||||
wasCurrentUserRemoved = removedMembers.contains(masterPublicKey)
|
||||
}
|
||||
wasCurrentUserRemoved = removedMembers.contains(TextSecurePreferences.getLocalNumber(context))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,10 +75,6 @@ class ProfilePictureView : RelativeLayout {
|
||||
if (recipient.isGroupRecipient && !isOpenGroupWithProfilePicture(recipient)) {
|
||||
val users = MentionsManager.shared.userPublicKeyCache[threadID]?.toMutableList() ?: mutableListOf()
|
||||
users.remove(TextSecurePreferences.getLocalNumber(context))
|
||||
val masterPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(context)
|
||||
if (masterPublicKey != null) {
|
||||
users.remove(masterPublicKey)
|
||||
}
|
||||
val randomUsers = users.sorted().toMutableList() // Sort to provide a level of stability
|
||||
if (users.count() == 1) {
|
||||
val userPublicKey = TextSecurePreferences.getLocalNumber(context)!!
|
||||
@ -159,13 +155,11 @@ class ProfilePictureView : RelativeLayout {
|
||||
imagesCached.add(publicKey)
|
||||
} else {
|
||||
val sizeInPX = resources.getDimensionPixelSize(sizeResId)
|
||||
val masterPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(context)
|
||||
val hepk = if (recipient.isLocalNumber && masterPublicKey != null) masterPublicKey else publicKey
|
||||
glide.clear(imageView)
|
||||
glide.load(AvatarPlaceholderGenerator.generate(
|
||||
context,
|
||||
sizeInPX,
|
||||
hepk,
|
||||
publicKey,
|
||||
displayName
|
||||
)).diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop().into(imageView)
|
||||
imagesCached.add(publicKey)
|
||||
|
@ -326,10 +326,7 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
||||
|
||||
private static Drawable getPlaceholderDrawable(Context context, Recipient recipient) {
|
||||
String publicKey = recipient.getAddress().serialize();
|
||||
String hepk = (recipient.isLocalNumber() && publicKey == null)
|
||||
? TextSecurePreferences.getMasterHexEncodedPublicKey(context)
|
||||
: publicKey;
|
||||
String displayName = recipient.getName();
|
||||
return AvatarPlaceholderGenerator.generate(context, 128, hepk, displayName);
|
||||
return AvatarPlaceholderGenerator.generate(context, 128, publicKey, displayName);
|
||||
}
|
||||
}
|
||||
|
@ -211,8 +211,7 @@ public class MessageSender {
|
||||
private static boolean isLocalSelfSend(@NonNull Context context, @NonNull Recipient recipient, boolean forceSms) {
|
||||
return recipient.isLocalNumber() &&
|
||||
!forceSms &&
|
||||
TextSecurePreferences.isPushRegistered(context) &&
|
||||
!TextSecurePreferences.isMultiDevice(context);
|
||||
TextSecurePreferences.isPushRegistered(context);
|
||||
}
|
||||
|
||||
private static void sendLocalMediaSelf(Context context, long messageId) {
|
||||
|
@ -268,11 +268,6 @@ public class Recipient implements RecipientModifiedListener {
|
||||
return isLocalNumber;
|
||||
}
|
||||
|
||||
public boolean isUserMasterDevice() {
|
||||
String userMasterDevice = TextSecurePreferences.getMasterHexEncodedPublicKey(context);
|
||||
return userMasterDevice != null && userMasterDevice.equals(getAddress().serialize());
|
||||
}
|
||||
|
||||
public synchronized @Nullable Uri getContactUri() {
|
||||
return this.contactUri;
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ object TextSecurePreferences {
|
||||
const val MEDIA_DOWNLOAD_ROAMING_PREF = "pref_media_download_roaming"
|
||||
|
||||
const val SYSTEM_EMOJI_PREF = "pref_system_emoji"
|
||||
private const val MULTI_DEVICE_PROVISIONED_PREF = "pref_multi_device"
|
||||
const val DIRECT_CAPTURE_CAMERA_ID = "pref_direct_capture_camera_id"
|
||||
const val PROFILE_KEY_PREF = "pref_profile_key"
|
||||
const val PROFILE_NAME_PREF = "pref_profile_name"
|
||||
@ -129,20 +128,9 @@ object TextSecurePreferences {
|
||||
private const val LAST_FCM_TOKEN_UPLOAD_TIME = "pref_last_fcm_token_upload_time_2"
|
||||
|
||||
// region Multi Device
|
||||
private const val IS_USING_MULTI_DEVICE = "pref_is_using_multi_device"
|
||||
private const val LAST_CONFIGURATION_SYNC_TIME = "pref_last_configuration_sync_time"
|
||||
private const val CONFIGURATION_SYNCED = "pref_configuration_synced"
|
||||
|
||||
@JvmStatic
|
||||
fun isUsingMultiDevice(context: Context): Boolean {
|
||||
return getBooleanPreference(context, IS_USING_MULTI_DEVICE, false)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setIsUsingMultiDevice(context: Context, value: Boolean) {
|
||||
setBooleanPreference(context, IS_USING_MULTI_DEVICE, value)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getLastConfigurationSyncTime(context: Context): Long {
|
||||
return getLongPreference(context, LAST_CONFIGURATION_SYNC_TIME, 0)
|
||||
@ -417,11 +405,6 @@ object TextSecurePreferences {
|
||||
return getIntegerPreference(context, DIRECT_CAPTURE_CAMERA_ID, Camera.CameraInfo.CAMERA_FACING_FRONT)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isMultiDevice(context: Context): Boolean {
|
||||
return getBooleanPreference(context, MULTI_DEVICE_PROVISIONED_PREF, false)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getNotificationPrivacy(context: Context): NotificationPrivacyPreference {
|
||||
return NotificationPrivacyPreference(getStringPreference(context, NOTIFICATION_PRIVACY_PREF, "all"))
|
||||
@ -876,13 +859,6 @@ object TextSecurePreferences {
|
||||
|
||||
// region Loki
|
||||
@JvmStatic
|
||||
fun getMasterHexEncodedPublicKey(context: Context): String? {
|
||||
return getStringPreference(context, "master_hex_encoded_public_key", null)
|
||||
}
|
||||
|
||||
fun setMasterHexEncodedPublicKey(context: Context, masterHexEncodedPublicKey: String) {
|
||||
setStringPreference(context, "master_hex_encoded_public_key", masterHexEncodedPublicKey.toLowerCase())
|
||||
}
|
||||
|
||||
fun getHasViewedSeed(context: Context): Boolean {
|
||||
return getBooleanPreference(context, "has_viewed_seed", false)
|
||||
@ -892,23 +868,6 @@ object TextSecurePreferences {
|
||||
setBooleanPreference(context, "has_viewed_seed", hasViewedSeed)
|
||||
}
|
||||
|
||||
fun setWasUnlinked(context: Context, value: Boolean) {
|
||||
// We do it this way so that it gets persisted in storage straight away
|
||||
getDefaultSharedPreferences(context).edit().putBoolean("database_reset_unpair", value).commit()
|
||||
}
|
||||
|
||||
fun getWasUnlinked(context: Context): Boolean {
|
||||
return getBooleanPreference(context, "database_reset_unpair", false)
|
||||
}
|
||||
|
||||
fun setNeedsIsRevokedSlaveDeviceCheck(context: Context, value: Boolean) {
|
||||
setBooleanPreference(context, "needs_revocation", value)
|
||||
}
|
||||
|
||||
fun getNeedsIsRevokedSlaveDeviceCheck(context: Context): Boolean {
|
||||
return getBooleanPreference(context, "needs_revocation", false)
|
||||
}
|
||||
|
||||
fun setRestorationTime(context: Context, time: Long) {
|
||||
setLongPreference(context, "restoration_time", time)
|
||||
}
|
||||
|
@ -115,7 +115,6 @@ public class SignalServiceMessageSender {
|
||||
|
||||
private final AtomicReference<Optional<SignalServiceMessagePipe>> pipe;
|
||||
private final AtomicReference<Optional<SignalServiceMessagePipe>> unidentifiedPipe;
|
||||
private final AtomicBoolean isMultiDevice;
|
||||
|
||||
// Loki
|
||||
private final String userPublicKey;
|
||||
@ -143,7 +142,6 @@ public class SignalServiceMessageSender {
|
||||
String user, String password,
|
||||
SignalProtocolStore store,
|
||||
String userAgent,
|
||||
boolean isMultiDevice,
|
||||
Optional<SignalServiceMessagePipe> pipe,
|
||||
Optional<SignalServiceMessagePipe> unidentifiedPipe,
|
||||
Optional<EventListener> eventListener,
|
||||
@ -158,14 +156,13 @@ public class SignalServiceMessageSender {
|
||||
LokiOpenGroupDatabaseProtocol openGroupDatabase,
|
||||
Broadcaster broadcaster)
|
||||
{
|
||||
this(urls, new StaticCredentialsProvider(user, password, null), store, userAgent, isMultiDevice, pipe, unidentifiedPipe, eventListener, userPublicKey, apiDatabase, threadDatabase, messageDatabase, preKeyBundleDatabase, sessionProtocolImpl, sessionResetImpl, userDatabase, openGroupDatabase, broadcaster);
|
||||
this(urls, new StaticCredentialsProvider(user, password, null), store, userAgent, pipe, unidentifiedPipe, eventListener, userPublicKey, apiDatabase, threadDatabase, messageDatabase, preKeyBundleDatabase, sessionProtocolImpl, sessionResetImpl, userDatabase, openGroupDatabase, broadcaster);
|
||||
}
|
||||
|
||||
public SignalServiceMessageSender(SignalServiceConfiguration urls,
|
||||
CredentialsProvider credentialsProvider,
|
||||
SignalProtocolStore store,
|
||||
String userAgent,
|
||||
boolean isMultiDevice,
|
||||
Optional<SignalServiceMessagePipe> pipe,
|
||||
Optional<SignalServiceMessagePipe> unidentifiedPipe,
|
||||
Optional<EventListener> eventListener,
|
||||
@ -185,7 +182,6 @@ public class SignalServiceMessageSender {
|
||||
this.localAddress = new SignalServiceAddress(credentialsProvider.getUser());
|
||||
this.pipe = new AtomicReference<>(pipe);
|
||||
this.unidentifiedPipe = new AtomicReference<>(unidentifiedPipe);
|
||||
this.isMultiDevice = new AtomicBoolean(isMultiDevice);
|
||||
this.eventListener = eventListener;
|
||||
this.userPublicKey = userPublicKey;
|
||||
this.apiDatabase = apiDatabase;
|
||||
@ -328,10 +324,6 @@ public class SignalServiceMessageSender {
|
||||
this.unidentifiedPipe.set(Optional.fromNullable(unidentifiedPipe));
|
||||
}
|
||||
|
||||
public void setIsMultiDevice(boolean isMultiDevice) {
|
||||
this.isMultiDevice.set(isMultiDevice);
|
||||
}
|
||||
|
||||
public SignalServiceAttachmentPointer uploadAttachment(SignalServiceAttachmentStream attachment, boolean usePadding, @Nullable SignalServiceAddress recipient)
|
||||
throws IOException
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user