Fix critical issues

This commit is contained in:
Niels Andriesse 2019-11-15 16:24:58 +11:00
parent 463aaf0fb8
commit 30df89ea58
7 changed files with 13 additions and 16 deletions

View File

@ -1572,7 +1572,7 @@
<!-- Conversation list activity --> <!-- Conversation list activity -->
<string name="activity_conversation_list_empty_state_message">Looks like you don\'t have any conversations yet. Get started by messaging a friend.</string> <string name="activity_conversation_list_empty_state_message">Looks like you don\'t have any conversations yet. Get started by messaging a friend.</string>
<!-- Settings activity --> <!-- Settings activity -->
<string name="activity_settings_secondary_device_tag">This is a secondary device</string> <string name="activity_settings_secondary_device_tag">Secondary device</string>
<string name="activity_settings_public_key_copied_message">Copied to clipboard</string> <string name="activity_settings_public_key_copied_message">Copied to clipboard</string>
<string name="activity_settings_share_public_key_button_title">Share Public Key</string> <string name="activity_settings_share_public_key_button_title">Share Public Key</string>
<string name="activity_settings_show_qr_code_button_title">Show QR Code</string> <string name="activity_settings_show_qr_code_button_title">Show QR Code</string>

View File

@ -126,7 +126,7 @@ import static nl.komponents.kovenant.android.KovenantAndroid.stopKovenant;
public class ApplicationContext extends MultiDexApplication implements DependencyInjector, DefaultLifecycleObserver, LokiP2PAPIDelegate { public class ApplicationContext extends MultiDexApplication implements DependencyInjector, DefaultLifecycleObserver, LokiP2PAPIDelegate {
private static final String TAG = ApplicationContext.class.getSimpleName(); private static final String TAG = ApplicationContext.class.getSimpleName();
private final static int OK_HTTP_CACHE_SIZE = 10 * 1024 * 1024; // 10MB private final static int OK_HTTP_CACHE_SIZE = 10 * 1024 * 1024; // 10 MB
private ExpiringMessageManager expiringMessageManager; private ExpiringMessageManager expiringMessageManager;
private TypingStatusRepository typingStatusRepository; private TypingStatusRepository typingStatusRepository;

View File

@ -29,7 +29,6 @@ object FriendRequestHandler {
DatabaseFactory.getLokiThreadDatabase(context).setFriendRequestStatus(threadId, threadFriendStatus) DatabaseFactory.getLokiThreadDatabase(context).setFriendRequestStatus(threadId, threadFriendStatus)
} }
// Update message status // Update message status
if (messageId >= 0) { if (messageId >= 0) {
val messageDatabase = DatabaseFactory.getLokiMessageDatabase(context) val messageDatabase = DatabaseFactory.getLokiMessageDatabase(context)

View File

@ -146,7 +146,6 @@ class LokiPublicChatPoller(private val context: Context, private val group: Loki
PushDecryptJob(context).handleTextMessage(serviceContent, serviceDataMessage, Optional.absent(), Optional.of(message.serverID)) PushDecryptJob(context).handleTextMessage(serviceContent, serviceDataMessage, Optional.absent(), Optional.of(message.serverID))
} }
} }
fun processOutgoingMessage(message: LokiPublicChatMessage) { fun processOutgoingMessage(message: LokiPublicChatMessage) {
val messageServerID = message.serverID ?: return val messageServerID = message.serverID ?: return
val isDuplicate = DatabaseFactory.getLokiMessageDatabase(context).getMessageID(messageServerID) != null val isDuplicate = DatabaseFactory.getLokiMessageDatabase(context).getMessageID(messageServerID) != null
@ -162,7 +161,6 @@ class LokiPublicChatPoller(private val context: Context, private val group: Loki
PushDecryptJob(context).handleSynchronizeSentTextMessage(transcript) PushDecryptJob(context).handleSynchronizeSentTextMessage(transcript)
} }
} }
api.getMessages(group.channel, group.server).successBackground { messages -> api.getMessages(group.channel, group.server).successBackground { messages ->
if (messages.isNotEmpty()) { if (messages.isNotEmpty()) {
val ourDevices = LokiStorageAPI.shared.getAllDevicePublicKeys(userHexEncodedPublicKey).get(setOf()) val ourDevices = LokiStorageAPI.shared.getAllDevicePublicKeys(userHexEncodedPublicKey).get(setOf())

View File

@ -68,7 +68,7 @@ class NewConversationActivity : PassphraseRequiredActionBarActivity(), ScanListe
fun startNewConversationIfPossible(hexEncodedPublicKey: String) { fun startNewConversationIfPossible(hexEncodedPublicKey: String) {
if (!PublicKeyValidation.isValid(hexEncodedPublicKey)) { return Toast.makeText(this, R.string.fragment_new_conversation_invalid_public_key_message, Toast.LENGTH_SHORT).show() } if (!PublicKeyValidation.isValid(hexEncodedPublicKey)) { return Toast.makeText(this, R.string.fragment_new_conversation_invalid_public_key_message, Toast.LENGTH_SHORT).show() }
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(this) val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(this)
// If we try to contact our master then redirect to note to self // If we try to contact our master device then redirect to note to self
val contactPublicKey = if (TextSecurePreferences.getMasterHexEncodedPublicKey(this) == hexEncodedPublicKey) userHexEncodedPublicKey else hexEncodedPublicKey val contactPublicKey = if (TextSecurePreferences.getMasterHexEncodedPublicKey(this) == hexEncodedPublicKey) userHexEncodedPublicKey else hexEncodedPublicKey
val contact = Recipient.from(this, Address.fromSerialized(contactPublicKey), true) val contact = Recipient.from(this, Address.fromSerialized(contactPublicKey), true)
val intent = Intent(this, ConversationActivity::class.java) val intent = Intent(this, ConversationActivity::class.java)

View File

@ -15,10 +15,10 @@ import java.io.IOException
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
class PushBackgroundMessageSendJob private constructor( class PushBackgroundMessageSendJob private constructor(
parameters: Parameters, parameters: Parameters,
private val recipient: String, private val recipient: String,
private val messageBody: String?, private val messageBody: String?,
private val friendRequest: Boolean private val friendRequest: Boolean
) : BaseJob(parameters) { ) : BaseJob(parameters) {
companion object { companion object {
const val KEY = "PushBackgroundMessageSendJob" const val KEY = "PushBackgroundMessageSendJob"

View File

@ -14,12 +14,12 @@ import java.util.concurrent.TimeUnit
import javax.inject.Inject import javax.inject.Inject
class PushMessageSyncSendJob private constructor( class PushMessageSyncSendJob private constructor(
parameters: Parameters, parameters: Parameters,
private val messageID: Long, private val messageID: Long,
private val recipient: Address, private val recipient: Address,
private val timestamp: Long, private val timestamp: Long,
private val message: ByteArray, private val message: ByteArray,
private val ttl: Int private val ttl: Int
) : BaseJob(parameters), InjectableType { ) : BaseJob(parameters), InjectableType {
companion object { companion object {