Merge branch 'dev' of https://github.com/oxen-io/session-android into fix-open-group-spam

This commit is contained in:
Ryan ZHAO 2021-05-20 14:08:53 +10:00
commit 1b52d89059
12 changed files with 35 additions and 132 deletions

View File

@ -75,7 +75,6 @@ dependencies {
annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.2' annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.2'
kapt 'com.squareup.dagger:dagger-compiler:1.2.2' kapt 'com.squareup.dagger:dagger-compiler:1.2.2'
implementation 'mobi.upod:time-duration-picker:1.1.3' implementation 'mobi.upod:time-duration-picker:1.1.3'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.google.zxing:core:3.2.1' implementation 'com.google.zxing:core:3.2.1'
implementation ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') { implementation ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
@ -106,8 +105,8 @@ dependencies {
implementation project(":libsession") implementation project(":libsession")
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1" implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1"
implementation "org.whispersystems:curve25519-java:$curve25519Version" implementation "org.whispersystems:curve25519-java:$curve25519Version"
implementation "com.goterl.lazycode:lazysodium-android:4.2.0@aar" implementation 'com.goterl:lazysodium-android:5.0.2@aar'
implementation "net.java.dev.jna:jna:5.5.0@aar" implementation "net.java.dev.jna:jna:5.8.0@aar"
implementation "com.google.protobuf:protobuf-java:$protobufVersion" implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion" implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion" implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"

View File

@ -55,7 +55,6 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
ConversationClickListener, ConversationClickListener,
SeedReminderViewDelegate, SeedReminderViewDelegate,
NewConversationButtonSetViewDelegate { NewConversationButtonSetViewDelegate {
private lateinit var glide: GlideRequests private lateinit var glide: GlideRequests
private var broadcastReceiver: BroadcastReceiver? = null private var broadcastReceiver: BroadcastReceiver? = null
@ -173,7 +172,6 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
if (hasViewedSeed) { if (hasViewedSeed) {
seedReminderView.visibility = View.GONE seedReminderView.visibility = View.GONE
} }
showFileServerInstabilityNotificationIfNeeded()
if (TextSecurePreferences.getConfigurationMessageSynced(this)) { if (TextSecurePreferences.getConfigurationMessageSynced(this)) {
lifecycleScope.launch(Dispatchers.IO) { lifecycleScope.launch(Dispatchers.IO) {
MultiDeviceProtocol.syncConfigurationIfNeeded(this@HomeActivity) MultiDeviceProtocol.syncConfigurationIfNeeded(this@HomeActivity)
@ -181,13 +179,6 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
} }
} }
private fun showFileServerInstabilityNotificationIfNeeded() {
val hasSeenNotification = TextSecurePreferences.hasSeenFileServerInstabilityNotification(this)
if (hasSeenNotification) { return }
FileServerDialog().show(supportFragmentManager, "File Server Dialog")
TextSecurePreferences.setHasSeenFileServerInstabilityNotification(this)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
if (resultCode == CreateClosedGroupActivity.closedGroupCreatedResultCode) { if (resultCode == CreateClosedGroupActivity.closedGroupCreatedResultCode) {
@ -356,8 +347,10 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
apiDB.removeLastDeletionServerID(v2OpenGroup.room, v2OpenGroup.server) apiDB.removeLastDeletionServerID(v2OpenGroup.room, v2OpenGroup.server)
OpenGroupManager.delete(v2OpenGroup.server, v2OpenGroup.room, this@HomeActivity) OpenGroupManager.delete(v2OpenGroup.server, v2OpenGroup.room, this@HomeActivity)
} else { } else {
ThreadUtils.queue {
threadDB.deleteConversation(threadID) threadDB.deleteConversation(threadID)
} }
}
// Update the badge count // Update the badge count
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context) ApplicationContext.getInstance(context).messageNotifier.updateNotification(context)
// Notify the user // Notify the user

View File

@ -15,15 +15,15 @@ import android.text.style.ClickableSpan
import android.text.style.StyleSpan import android.text.style.StyleSpan
import android.view.View import android.view.View
import android.widget.Toast import android.widget.Toast
import com.goterl.lazycode.lazysodium.utils.KeyPair import com.goterl.lazysodium.utils.KeyPair
import kotlinx.android.synthetic.main.activity_register.* import kotlinx.android.synthetic.main.activity_register.*
import network.loki.messenger.R import network.loki.messenger.R
import org.session.libsession.utilities.KeyPairUtilities
import org.session.libsession.utilities.TextSecurePreferences import org.session.libsession.utilities.TextSecurePreferences
import org.session.libsignal.crypto.ecc.ECKeyPair import org.session.libsignal.crypto.ecc.ECKeyPair
import org.session.libsignal.utilities.KeyHelper import org.session.libsignal.utilities.KeyHelper
import org.session.libsignal.utilities.hexEncodedPublicKey import org.session.libsignal.utilities.hexEncodedPublicKey
import org.thoughtcrime.securesms.BaseActionBarActivity import org.thoughtcrime.securesms.BaseActionBarActivity
import org.session.libsession.utilities.KeyPairUtilities
import org.thoughtcrime.securesms.loki.utilities.push import org.thoughtcrime.securesms.loki.utilities.push
import org.thoughtcrime.securesms.loki.utilities.setUpActionBarSessionLogo import org.thoughtcrime.securesms.loki.utilities.setUpActionBarSessionLogo
import java.util.* import java.util.*

View File

@ -1,33 +0,0 @@
package org.thoughtcrime.securesms.loki.dialogs
import android.app.Dialog
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import kotlinx.android.synthetic.main.dialog_file_server.view.*
import kotlinx.android.synthetic.main.dialog_seed.view.*
import network.loki.messenger.R
import org.session.libsession.utilities.IdentityKeyUtil
import org.thoughtcrime.securesms.loki.utilities.MnemonicUtilities
import org.session.libsignal.crypto.MnemonicCodec
import org.session.libsignal.utilities.hexEncodedPrivateKey
class FileServerDialog : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val builder = AlertDialog.Builder(requireContext())
val contentView = LayoutInflater.from(requireContext()).inflate(R.layout.dialog_file_server, null)
contentView.okButton.setOnClickListener { dismiss() }
builder.setView(contentView)
val result = builder.create()
result.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
return result
}
}

View File

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/default_dialog_background_inset"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingLeft="32dp"
android:paddingTop="@dimen/medium_spacing"
android:paddingRight="32dp"
android:paddingBottom="@dimen/medium_spacing">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Session"
android:textColor="@color/text"
android:textStyle="bold"
android:textAlignment="center"
android:textSize="@dimen/medium_font_size" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/large_spacing"
android:text="We're upgrading the way files are stored. File transfer may be unstable for the next 24-48 hours."
android:textColor="@color/text"
android:textSize="@dimen/small_font_size"
android:textAlignment="center"
android:alpha="0.6" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/large_spacing"
android:orientation="horizontal">
<Button
style="@style/Widget.Session.Button.Dialog.Unimportant"
android:id="@+id/okButton"
android:layout_width="0dp"
android:layout_height="@dimen/small_button_height"
android:layout_weight="1"
android:text="@string/ok" />
</LinearLayout>
</LinearLayout>

View File

@ -40,15 +40,9 @@ allprojects {
} }
} }
maven { maven {
url 'https://dl.bintray.com/amulyakhare/maven' url "https://repo1.maven.org/maven2/com/goterl/lazysodium-android"
content { content {
includeGroupByRegex "com\\.amulyakhare.*" includeGroupByRegex "com\\.goterl.*"
}
}
maven {
url "https://dl.bintray.com/terl/lazysodium-maven"
content {
includeGroupByRegex "com\\.goterl\\.lazycode.*"
} }
} }
jcenter() jcenter()

View File

@ -14,7 +14,8 @@ android {
dependencies { dependencies {
implementation project(":libsignal") implementation project(":libsignal")
implementation "com.goterl.lazycode:lazysodium-android:4.2.0@aar" implementation 'com.goterl:lazysodium-android:5.0.2@aar'
implementation "net.java.dev.jna:jna:5.8.0@aar"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation 'androidx.core:core-ktx:1.3.2' implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.2.0'

View File

@ -1,11 +1,11 @@
package org.session.libsession.messaging.messages.visible package org.session.libsession.messaging.messages.visible
import com.goterl.lazycode.lazysodium.BuildConfig import com.goterl.lazysodium.BuildConfig
import org.session.libsession.messaging.MessagingModuleConfiguration import org.session.libsession.messaging.MessagingModuleConfiguration
import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachment import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachment
import org.session.libsession.messaging.sending_receiving.quotes.QuoteModel as SignalQuote
import org.session.libsignal.utilities.Log
import org.session.libsignal.protos.SignalServiceProtos import org.session.libsignal.protos.SignalServiceProtos
import org.session.libsignal.utilities.Log
import org.session.libsession.messaging.sending_receiving.quotes.QuoteModel as SignalQuote
class Quote() { class Quote() {
var timestamp: Long? = 0 var timestamp: Long? = 0

View File

@ -1,12 +1,12 @@
package org.session.libsession.messaging.messages.visible package org.session.libsession.messaging.messages.visible
import com.goterl.lazycode.lazysodium.BuildConfig import com.goterl.lazysodium.BuildConfig
import org.session.libsession.messaging.MessagingModuleConfiguration import org.session.libsession.messaging.MessagingModuleConfiguration
import org.session.libsession.messaging.messages.Message import org.session.libsession.messaging.messages.Message
import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachment import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachment
import org.session.libsession.utilities.Address import org.session.libsession.utilities.Address
import org.session.libsession.utilities.recipients.Recipient
import org.session.libsession.utilities.GroupUtil import org.session.libsession.utilities.GroupUtil
import org.session.libsession.utilities.recipients.Recipient
import org.session.libsignal.protos.SignalServiceProtos import org.session.libsignal.protos.SignalServiceProtos
import org.session.libsignal.utilities.Log import org.session.libsignal.utilities.Log
import org.session.libsession.messaging.sending_receiving.attachments.Attachment as SignalAttachment import org.session.libsession.messaging.sending_receiving.attachments.Attachment as SignalAttachment

View File

@ -1,15 +1,15 @@
package org.session.libsession.messaging.sending_receiving package org.session.libsession.messaging.sending_receiving
import android.util.Log import android.util.Log
import com.goterl.lazycode.lazysodium.LazySodiumAndroid import com.goterl.lazysodium.LazySodiumAndroid
import com.goterl.lazycode.lazysodium.SodiumAndroid import com.goterl.lazysodium.SodiumAndroid
import com.goterl.lazycode.lazysodium.interfaces.Box import com.goterl.lazysodium.interfaces.Box
import com.goterl.lazycode.lazysodium.interfaces.Sign import com.goterl.lazysodium.interfaces.Sign
import org.session.libsignal.crypto.ecc.ECKeyPair import org.session.libsignal.crypto.ecc.ECKeyPair
import org.session.libsignal.utilities.Hex
import org.session.libsignal.utilities.hexEncodedPublicKey import org.session.libsignal.utilities.hexEncodedPublicKey
import org.session.libsignal.utilities.removing05PrefixIfNeeded import org.session.libsignal.utilities.removing05PrefixIfNeeded
import org.session.libsignal.utilities.toHexString import org.session.libsignal.utilities.toHexString
import org.session.libsignal.utilities.Hex
object MessageDecrypter { object MessageDecrypter {

View File

@ -1,17 +1,15 @@
package org.session.libsession.messaging.sending_receiving package org.session.libsession.messaging.sending_receiving
import com.goterl.lazycode.lazysodium.LazySodiumAndroid import com.goterl.lazysodium.LazySodiumAndroid
import com.goterl.lazycode.lazysodium.SodiumAndroid import com.goterl.lazysodium.SodiumAndroid
import com.goterl.lazycode.lazysodium.interfaces.Box import com.goterl.lazysodium.interfaces.Box
import com.goterl.lazycode.lazysodium.interfaces.Sign import com.goterl.lazysodium.interfaces.Sign
import org.session.libsession.messaging.MessagingModuleConfiguration import org.session.libsession.messaging.MessagingModuleConfiguration
import org.session.libsession.messaging.sending_receiving.MessageSender.Error import org.session.libsession.messaging.sending_receiving.MessageSender.Error
import org.session.libsession.utilities.KeyPairUtilities import org.session.libsession.utilities.KeyPairUtilities
import org.session.libsignal.utilities.removing05PrefixIfNeeded
import org.session.libsignal.utilities.Hex import org.session.libsignal.utilities.Hex
import org.session.libsignal.utilities.Log import org.session.libsignal.utilities.Log
import org.session.libsignal.utilities.removing05PrefixIfNeeded
object MessageEncrypter { object MessageEncrypter {

View File

@ -1,15 +1,15 @@
package org.session.libsession.utilities package org.session.libsession.utilities
import android.content.Context import android.content.Context
import com.goterl.lazycode.lazysodium.LazySodiumAndroid import com.goterl.lazysodium.LazySodiumAndroid
import com.goterl.lazycode.lazysodium.SodiumAndroid import com.goterl.lazysodium.SodiumAndroid
import com.goterl.lazycode.lazysodium.utils.Key import com.goterl.lazysodium.utils.Key
import com.goterl.lazycode.lazysodium.utils.KeyPair import com.goterl.lazysodium.utils.KeyPair
import org.session.libsignal.utilities.Base64
import org.session.libsignal.utilities.Hex
import org.session.libsignal.crypto.ecc.DjbECPrivateKey import org.session.libsignal.crypto.ecc.DjbECPrivateKey
import org.session.libsignal.crypto.ecc.DjbECPublicKey import org.session.libsignal.crypto.ecc.DjbECPublicKey
import org.session.libsignal.crypto.ecc.ECKeyPair import org.session.libsignal.crypto.ecc.ECKeyPair
import org.session.libsignal.utilities.Base64
import org.session.libsignal.utilities.Hex
object KeyPairUtilities { object KeyPairUtilities {