mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
commit
007e705cd9
@ -28,7 +28,7 @@ configurations.all {
|
|||||||
exclude module: "commons-logging"
|
exclude module: "commons-logging"
|
||||||
}
|
}
|
||||||
|
|
||||||
def canonicalVersionCode = 377
|
def canonicalVersionCode = 379
|
||||||
def canonicalVersionName = "1.19.0"
|
def canonicalVersionName = "1.19.0"
|
||||||
|
|
||||||
def postFixSize = 10
|
def postFixSize = 10
|
||||||
@ -261,7 +261,7 @@ dependencies {
|
|||||||
implementation 'androidx.fragment:fragment-ktx:1.5.3'
|
implementation 'androidx.fragment:fragment-ktx:1.5.3'
|
||||||
implementation "androidx.core:core-ktx:$coreVersion"
|
implementation "androidx.core:core-ktx:$coreVersion"
|
||||||
implementation "androidx.work:work-runtime-ktx:2.7.1"
|
implementation "androidx.work:work-runtime-ktx:2.7.1"
|
||||||
playImplementation ("com.google.firebase:firebase-messaging:18.0.0") {
|
playImplementation ("com.google.firebase:firebase-messaging:24.0.0") {
|
||||||
exclude group: 'com.google.firebase', module: 'firebase-core'
|
exclude group: 'com.google.firebase', module: 'firebase-core'
|
||||||
exclude group: 'com.google.firebase', module: 'firebase-analytics'
|
exclude group: 'com.google.firebase', module: 'firebase-analytics'
|
||||||
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
|
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
|
||||||
@ -388,7 +388,6 @@ dependencies {
|
|||||||
implementation "androidx.camera:camera-lifecycle:1.3.2"
|
implementation "androidx.camera:camera-lifecycle:1.3.2"
|
||||||
implementation "androidx.camera:camera-view:1.3.2"
|
implementation "androidx.camera:camera-view:1.3.2"
|
||||||
|
|
||||||
implementation 'com.google.firebase:firebase-core:21.1.1'
|
|
||||||
implementation "com.google.mlkit:barcode-scanning:17.2.0"
|
implementation "com.google.mlkit:barcode-scanning:17.2.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,12 +355,9 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
|
|
||||||
updateLegacyConfigView()
|
updateLegacyConfigView()
|
||||||
|
|
||||||
// TODO: remove this after enough updates that we can rely on ConfigBase.isNewConfigEnabled to always return true
|
// Sync config changes if there are any
|
||||||
// This will only run if we aren't using new configs, as they are schedule to sync when there are changes applied
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
if (textSecurePreferences.getConfigurationMessageSynced()) {
|
ConfigurationMessageUtilities.syncConfigurationIfNeeded(this@HomeActivity)
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
|
||||||
ConfigurationMessageUtilities.syncConfigurationIfNeeded(this@HomeActivity)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package org.thoughtcrime.securesms.messagerequests
|
package org.thoughtcrime.securesms.messagerequests
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.ColorStateList
|
|
||||||
import android.database.Cursor
|
import android.database.Cursor
|
||||||
|
import android.os.Build
|
||||||
import android.text.SpannableString
|
import android.text.SpannableString
|
||||||
import android.text.style.ForegroundColorSpan
|
import android.text.style.ForegroundColorSpan
|
||||||
import android.view.ContextThemeWrapper
|
import android.view.ContextThemeWrapper
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.PopupMenu
|
import android.widget.PopupMenu
|
||||||
|
import androidx.core.graphics.drawable.DrawableCompat
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.session.libsession.utilities.ThemeUtil
|
import org.session.libsession.utilities.ThemeUtil
|
||||||
@ -63,10 +64,17 @@ class MessageRequestsAdapter(
|
|||||||
val s = SpannableString(item.title)
|
val s = SpannableString(item.title)
|
||||||
val danger = ThemeUtil.getThemedColor(context, R.attr.danger)
|
val danger = ThemeUtil.getThemedColor(context, R.attr.danger)
|
||||||
s.setSpan(ForegroundColorSpan(danger), 0, s.length, 0)
|
s.setSpan(ForegroundColorSpan(danger), 0, s.length, 0)
|
||||||
item.iconTintList = ColorStateList.valueOf(danger)
|
item.icon?.let {
|
||||||
|
DrawableCompat.setTint(
|
||||||
|
it,
|
||||||
|
danger
|
||||||
|
)
|
||||||
|
}
|
||||||
item.title = s
|
item.title = s
|
||||||
}
|
}
|
||||||
popupMenu.setForceShowIcon(true)
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
popupMenu.setForceShowIcon(true)
|
||||||
|
}
|
||||||
popupMenu.show()
|
popupMenu.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import org.session.libsignal.utilities.KeyHelper
|
|||||||
import org.session.libsignal.utilities.hexEncodedPublicKey
|
import org.session.libsignal.utilities.hexEncodedPublicKey
|
||||||
import org.thoughtcrime.securesms.crypto.KeyPairUtilities
|
import org.thoughtcrime.securesms.crypto.KeyPairUtilities
|
||||||
import org.thoughtcrime.securesms.dependencies.ConfigFactory
|
import org.thoughtcrime.securesms.dependencies.ConfigFactory
|
||||||
|
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
||||||
import org.thoughtcrime.securesms.util.VersionDataFetcher
|
import org.thoughtcrime.securesms.util.VersionDataFetcher
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
@ -24,7 +25,6 @@ class CreateAccountManager @Inject constructor(
|
|||||||
|
|
||||||
fun createAccount(displayName: String) {
|
fun createAccount(displayName: String) {
|
||||||
prefs.setProfileName(displayName)
|
prefs.setProfileName(displayName)
|
||||||
configFactory.user?.setName(displayName)
|
|
||||||
|
|
||||||
// This is here to resolve a case where the app restarts before a user completes onboarding
|
// This is here to resolve a case where the app restarts before a user completes onboarding
|
||||||
// which can result in an invalid database state
|
// which can result in an invalid database state
|
||||||
@ -37,13 +37,16 @@ class CreateAccountManager @Inject constructor(
|
|||||||
val x25519KeyPair = keyPairGenerationResult.x25519KeyPair
|
val x25519KeyPair = keyPairGenerationResult.x25519KeyPair
|
||||||
|
|
||||||
KeyPairUtilities.store(application, seed, ed25519KeyPair, x25519KeyPair)
|
KeyPairUtilities.store(application, seed, ed25519KeyPair, x25519KeyPair)
|
||||||
configFactory.keyPairChanged()
|
|
||||||
val userHexEncodedPublicKey = x25519KeyPair.hexEncodedPublicKey
|
val userHexEncodedPublicKey = x25519KeyPair.hexEncodedPublicKey
|
||||||
val registrationID = KeyHelper.generateRegistrationId(false)
|
val registrationID = KeyHelper.generateRegistrationId(false)
|
||||||
prefs.setLocalRegistrationId(registrationID)
|
prefs.setLocalRegistrationId(registrationID)
|
||||||
prefs.setLocalNumber(userHexEncodedPublicKey)
|
prefs.setLocalNumber(userHexEncodedPublicKey)
|
||||||
prefs.setRestorationTime(0)
|
prefs.setRestorationTime(0)
|
||||||
|
|
||||||
|
// we'll rely on the config syncing in the homeActivity resume
|
||||||
|
configFactory.keyPairChanged()
|
||||||
|
configFactory.user?.setName(displayName)
|
||||||
|
|
||||||
versionDataFetcher.startTimedVersionCheck()
|
versionDataFetcher.startTimedVersionCheck()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -49,6 +49,7 @@ internal class PickDisplayNameViewModel(
|
|||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
if (loadFailed) {
|
if (loadFailed) {
|
||||||
prefs.setProfileName(displayName)
|
prefs.setProfileName(displayName)
|
||||||
|
// we'll rely on the config syncing in the homeActivity resume
|
||||||
configFactory.user?.setName(displayName)
|
configFactory.user?.setName(displayName)
|
||||||
|
|
||||||
_events.emit(Event.LoadAccountComplete)
|
_events.emit(Event.LoadAccountComplete)
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
package org.thoughtcrime.securesms.notifications
|
package org.thoughtcrime.securesms.notifications
|
||||||
|
|
||||||
import com.google.android.gms.tasks.Tasks
|
import com.google.firebase.messaging.FirebaseMessaging
|
||||||
import com.google.firebase.iid.FirebaseInstanceId
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.isActive
|
import kotlinx.coroutines.isActive
|
||||||
|
import kotlinx.coroutines.tasks.await
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class FirebaseTokenFetcher @Inject constructor(): TokenFetcher {
|
class FirebaseTokenFetcher @Inject constructor(): TokenFetcher {
|
||||||
|
val TAG = "FirebaseTF"
|
||||||
|
|
||||||
override suspend fun fetch() = withContext(Dispatchers.IO) {
|
override suspend fun fetch() = withContext(Dispatchers.IO) {
|
||||||
FirebaseInstanceId.getInstance().instanceId
|
FirebaseMessaging.getInstance().token.await().takeIf { isActive } ?: throw Exception("Firebase token is null")
|
||||||
.also(Tasks::await)
|
|
||||||
.takeIf { isActive } // don't 'complete' task if we were canceled
|
|
||||||
?.run { result?.token ?: throw exception!! }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -39,7 +39,7 @@ class RetrieveProfileAvatarJob(private val profileAvatar: String?, val recipient
|
|||||||
|
|
||||||
override suspend fun execute(dispatcherName: String) {
|
override suspend fun execute(dispatcherName: String) {
|
||||||
val delegate = delegate ?: return Log.w(TAG, "RetrieveProfileAvatarJob has no delegate method to work with!")
|
val delegate = delegate ?: return Log.w(TAG, "RetrieveProfileAvatarJob has no delegate method to work with!")
|
||||||
if (profileAvatar in errorUrls) return delegate.handleJobFailed(this, dispatcherName, Exception("Profile URL 404'd this app instance"))
|
if (profileAvatar != null && profileAvatar in errorUrls) return delegate.handleJobFailed(this, dispatcherName, Exception("Profile URL 404'd this app instance"))
|
||||||
val context = MessagingModuleConfiguration.shared.context
|
val context = MessagingModuleConfiguration.shared.context
|
||||||
val storage = MessagingModuleConfiguration.shared.storage
|
val storage = MessagingModuleConfiguration.shared.storage
|
||||||
val recipient = Recipient.from(context, recipientAddress, true)
|
val recipient = Recipient.from(context, recipientAddress, true)
|
||||||
|
Loading…
Reference in New Issue
Block a user