mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 02:58:45 +00:00
Update ktlint to 1.5.0.
This commit is contained in:
@@ -78,7 +78,7 @@ wire {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ktlint {
|
ktlint {
|
||||||
version.set("1.2.1")
|
version.set("1.5.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|||||||
@@ -162,7 +162,9 @@ class DatabaseAttachment : Attachment {
|
|||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
return other != null &&
|
return other != null &&
|
||||||
other is DatabaseAttachment && other.attachmentId == attachmentId && other.uri == uri
|
other is DatabaseAttachment &&
|
||||||
|
other.attachmentId == attachmentId &&
|
||||||
|
other.uri == uri
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
|
|||||||
@@ -48,22 +48,19 @@ class SystemEmojiDrawable(emoji: CharSequence) : Drawable() {
|
|||||||
companion object {
|
companion object {
|
||||||
private val textPaint: TextPaint = TextPaint()
|
private val textPaint: TextPaint = TextPaint()
|
||||||
|
|
||||||
private fun getStaticLayout(emoji: CharSequence): StaticLayout =
|
private fun getStaticLayout(emoji: CharSequence): StaticLayout = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
StaticLayout.Builder.obtain(emoji, 0, emoji.length, textPaint, Int.MAX_VALUE).build()
|
StaticLayout.Builder.obtain(emoji, 0, emoji.length, textPaint, Int.MAX_VALUE).build()
|
||||||
} else {
|
} else {
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
StaticLayout(emoji, textPaint, Int.MAX_VALUE, Layout.Alignment.ALIGN_NORMAL, 0f, 0f, true)
|
StaticLayout(emoji, textPaint, Int.MAX_VALUE, Layout.Alignment.ALIGN_NORMAL, 0f, 0f, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getProcessedEmoji(emoji: CharSequence): CharSequence =
|
private fun getProcessedEmoji(emoji: CharSequence): CharSequence = try {
|
||||||
try {
|
|
||||||
EmojiCompat.get().process(emoji) ?: emoji
|
EmojiCompat.get().process(emoji) ?: emoji
|
||||||
} catch (e: IllegalStateException) {
|
} catch (e: IllegalStateException) {
|
||||||
emoji
|
emoji
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun StaticLayout.getBounds(): RectF =
|
private fun StaticLayout.getBounds(): RectF = RectF(getLineLeft(0), 0f, getLineRight(0), getLineDescent(0) - getLineAscent(0).toFloat())
|
||||||
RectF(getLineLeft(0), 0f, getLineRight(0), getLineDescent(0) - getLineAscent(0).toFloat())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,14 +36,11 @@ sealed class DSLSettingsText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun from(@StringRes stringId: Int, @ColorInt textColor: Int): DSLSettingsText =
|
fun from(@StringRes stringId: Int, @ColorInt textColor: Int): DSLSettingsText = FromResource(stringId, listOf(ColorModifier(textColor)))
|
||||||
FromResource(stringId, listOf(ColorModifier(textColor)))
|
|
||||||
|
|
||||||
fun from(@StringRes stringId: Int, vararg modifiers: Modifier): DSLSettingsText =
|
fun from(@StringRes stringId: Int, vararg modifiers: Modifier): DSLSettingsText = FromResource(stringId, modifiers.toList())
|
||||||
FromResource(stringId, modifiers.toList())
|
|
||||||
|
|
||||||
fun from(charSequence: CharSequence, vararg modifiers: Modifier): DSLSettingsText =
|
fun from(charSequence: CharSequence, vararg modifiers: Modifier): DSLSettingsText = FromCharSequence(charSequence, modifiers.toList())
|
||||||
FromCharSequence(charSequence, modifiers.toList())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Modifier {
|
interface Modifier {
|
||||||
|
|||||||
@@ -267,7 +267,8 @@ class BackupStateObserver(
|
|||||||
Log.d(TAG, "[getNetworkBackupState][subscriptionStateMismatchDetected] No purchase found in Google Play Billing: $purchaseResult")
|
Log.d(TAG, "[getNetworkBackupState][subscriptionStateMismatchDetected] No purchase found in Google Play Billing: $purchaseResult")
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
} || SignalStore.backup.backupTierInternalOverride == MessageBackupTier.PAID
|
} ||
|
||||||
|
SignalStore.backup.backupTierInternalOverride == MessageBackupTier.PAID
|
||||||
|
|
||||||
Log.d(TAG, "[getNetworkBackupState][subscriptionStateMismatchDetected] googlePlayBillingSubscriptionIsActiveAndWillRenew: $googlePlayBillingSubscriptionIsActiveAndWillRenew")
|
Log.d(TAG, "[getNetworkBackupState][subscriptionStateMismatchDetected] googlePlayBillingSubscriptionIsActiveAndWillRenew: $googlePlayBillingSubscriptionIsActiveAndWillRenew")
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,7 @@ class ChangeNumberRepository(
|
|||||||
return accountManager.whoAmI
|
return accountManager.whoAmI
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun ensureDecryptionsDrained(timeout: Duration = 15.seconds) =
|
suspend fun ensureDecryptionsDrained(timeout: Duration = 15.seconds) = withTimeoutOrNull(timeout) {
|
||||||
withTimeoutOrNull(timeout) {
|
|
||||||
suspendCancellableCoroutine {
|
suspendCancellableCoroutine {
|
||||||
val drainedListener = object : Runnable {
|
val drainedListener = object : Runnable {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
|||||||
@@ -140,7 +140,8 @@ class NotificationsSettingsViewModel(private val sharedPreferences: SharedPrefer
|
|||||||
)
|
)
|
||||||
|
|
||||||
private fun canEnableNotifications(): Boolean {
|
private fun canEnableNotifications(): Boolean {
|
||||||
val areNotificationsDisabledBySystem = Build.VERSION.SDK_INT >= 26 && (
|
val areNotificationsDisabledBySystem = Build.VERSION.SDK_INT >= 26 &&
|
||||||
|
(
|
||||||
!NotificationChannels.getInstance().isMessageChannelEnabled ||
|
!NotificationChannels.getInstance().isMessageChannelEnabled ||
|
||||||
!NotificationChannels.getInstance().isMessagesChannelGroupEnabled ||
|
!NotificationChannels.getInstance().isMessagesChannelGroupEnabled ||
|
||||||
!NotificationChannels.getInstance().areNotificationsEnabled()
|
!NotificationChannels.getInstance().areNotificationsEnabled()
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ object InAppDonations {
|
|||||||
InAppPaymentType.ONE_TIME_GIFT -> true
|
InAppPaymentType.ONE_TIME_GIFT -> true
|
||||||
InAppPaymentType.RECURRING_DONATION -> true
|
InAppPaymentType.RECURRING_DONATION -> true
|
||||||
InAppPaymentType.RECURRING_BACKUP -> false
|
InAppPaymentType.RECURRING_BACKUP -> false
|
||||||
} && !LocaleRemoteConfig.isPayPalDisabled()
|
} &&
|
||||||
|
!LocaleRemoteConfig.isPayPalDisabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -178,12 +178,10 @@ class ChatColors(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun forGradient(id: Id, linearGradient: LinearGradient): ChatColors =
|
fun forGradient(id: Id, linearGradient: LinearGradient): ChatColors = ChatColors(id, linearGradient, null)
|
||||||
ChatColors(id, linearGradient, null)
|
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun forColor(id: Id, @ColorInt color: Int): ChatColors =
|
fun forColor(id: Id, @ColorInt color: Int): ChatColors = ChatColors(id, null, color)
|
||||||
ChatColors(id, null, color)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class Id(val longValue: Long) : Parcelable {
|
sealed class Id(val longValue: Long) : Parcelable {
|
||||||
|
|||||||
@@ -423,7 +423,8 @@ object SvrRepository {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
newToken = newToken || if (Svr3Migration.shouldWriteToSvr2) {
|
newToken = newToken ||
|
||||||
|
if (Svr3Migration.shouldWriteToSvr2) {
|
||||||
val credentials: AuthCredentials = svr2.authorization()
|
val credentials: AuthCredentials = svr2.authorization()
|
||||||
SignalStore.svr.appendSvr2AuthTokenToList(credentials.asBasic())
|
SignalStore.svr.appendSvr2AuthTokenToList(credentials.asBasic())
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -110,8 +110,7 @@ object RegistrationRepository {
|
|||||||
/**
|
/**
|
||||||
* Retrieve the FCM token from the Firebase service.
|
* Retrieve the FCM token from the Firebase service.
|
||||||
*/
|
*/
|
||||||
suspend fun getFcmToken(context: Context): String? =
|
suspend fun getFcmToken(context: Context): String? = withContext(Dispatchers.Default) {
|
||||||
withContext(Dispatchers.Default) {
|
|
||||||
FcmUtil.getToken(context).orElse(null)
|
FcmUtil.getToken(context).orElse(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,8 +146,7 @@ object RegistrationRepository {
|
|||||||
* Queries, and creates if needed, the local profile key.
|
* Queries, and creates if needed, the local profile key.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
suspend fun getProfileKey(e164: String): ProfileKey =
|
suspend fun getProfileKey(e164: String): ProfileKey = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
// TODO [regv2]: make creation more explicit instead of hiding it in this getter
|
// TODO [regv2]: make creation more explicit instead of hiding it in this getter
|
||||||
val recipientTable = SignalDatabase.recipients
|
val recipientTable = SignalDatabase.recipients
|
||||||
val recipient = recipientTable.getByE164(e164)
|
val recipient = recipientTable.getByE164(e164)
|
||||||
@@ -168,8 +166,7 @@ object RegistrationRepository {
|
|||||||
* Takes a server response from a successful registration and persists the relevant data.
|
* Takes a server response from a successful registration and persists the relevant data.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
suspend fun registerAccountLocally(context: Context, data: LocalRegistrationMetadata) =
|
suspend fun registerAccountLocally(context: Context, data: LocalRegistrationMetadata) = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
Log.v(TAG, "registerAccountLocally()")
|
Log.v(TAG, "registerAccountLocally()")
|
||||||
if (data.linkedDeviceInfo != null) {
|
if (data.linkedDeviceInfo != null) {
|
||||||
SignalStore.account.deviceId = data.linkedDeviceInfo.deviceId
|
SignalStore.account.deviceId = data.linkedDeviceInfo.deviceId
|
||||||
@@ -299,8 +296,7 @@ object RegistrationRepository {
|
|||||||
return PinHashUtil.verifyLocalPinHash(pinHash, pin)
|
return PinHashUtil.verifyLocalPinHash(pinHash, pin)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun fetchMasterKeyFromSvrRemote(pin: String, svr2Credentials: AuthCredentials?, svr3Credentials: Svr3Credentials?): MasterKey =
|
suspend fun fetchMasterKeyFromSvrRemote(pin: String, svr2Credentials: AuthCredentials?, svr3Credentials: Svr3Credentials?): MasterKey = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val credentialSet = SvrAuthCredentialSet(svr2Credentials = svr2Credentials, svr3Credentials = svr3Credentials)
|
val credentialSet = SvrAuthCredentialSet(svr2Credentials = svr2Credentials, svr3Credentials = svr3Credentials)
|
||||||
val masterKey = SvrRepository.restoreMasterKeyPreRegistration(credentialSet, pin)
|
val masterKey = SvrRepository.restoreMasterKeyPreRegistration(credentialSet, pin)
|
||||||
return@withContext masterKey
|
return@withContext masterKey
|
||||||
@@ -309,8 +305,7 @@ object RegistrationRepository {
|
|||||||
/**
|
/**
|
||||||
* Validates a session ID.
|
* Validates a session ID.
|
||||||
*/
|
*/
|
||||||
private suspend fun validateSession(context: Context, sessionId: String, e164: String, password: String): RegistrationSessionCheckResult =
|
private suspend fun validateSession(context: Context, sessionId: String, e164: String, password: String): RegistrationSessionCheckResult = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, e164, SignalServiceAddress.DEFAULT_DEVICE_ID, password).registrationApi
|
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, e164, SignalServiceAddress.DEFAULT_DEVICE_ID, password).registrationApi
|
||||||
Log.d(TAG, "Validating registration session with service.")
|
Log.d(TAG, "Validating registration session with service.")
|
||||||
val registrationSessionResult = api.getRegistrationSessionStatus(sessionId)
|
val registrationSessionResult = api.getRegistrationSessionStatus(sessionId)
|
||||||
@@ -320,8 +315,7 @@ object RegistrationRepository {
|
|||||||
/**
|
/**
|
||||||
* Initiates a new registration session on the service.
|
* Initiates a new registration session on the service.
|
||||||
*/
|
*/
|
||||||
suspend fun createSession(context: Context, e164: String, password: String, mcc: String?, mnc: String?): RegistrationSessionCreationResult =
|
suspend fun createSession(context: Context, e164: String, password: String, mcc: String?, mnc: String?): RegistrationSessionCreationResult = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
Log.d(TAG, "About to create a registration session…")
|
Log.d(TAG, "About to create a registration session…")
|
||||||
val fcmToken: String? = FcmUtil.getToken(context).orElse(null)
|
val fcmToken: String? = FcmUtil.getToken(context).orElse(null)
|
||||||
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, e164, SignalServiceAddress.DEFAULT_DEVICE_ID, password).registrationApi
|
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, e164, SignalServiceAddress.DEFAULT_DEVICE_ID, password).registrationApi
|
||||||
@@ -379,8 +373,7 @@ object RegistrationRepository {
|
|||||||
/**
|
/**
|
||||||
* Asks the service to send a verification code through one of our supported channels (SMS, phone call).
|
* Asks the service to send a verification code through one of our supported channels (SMS, phone call).
|
||||||
*/
|
*/
|
||||||
suspend fun requestSmsCode(context: Context, sessionId: String, e164: String, password: String, mode: E164VerificationMode): VerificationCodeRequestResult =
|
suspend fun requestSmsCode(context: Context, sessionId: String, e164: String, password: String, mode: E164VerificationMode): VerificationCodeRequestResult = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, e164, SignalServiceAddress.DEFAULT_DEVICE_ID, password).registrationApi
|
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, e164, SignalServiceAddress.DEFAULT_DEVICE_ID, password).registrationApi
|
||||||
|
|
||||||
val codeRequestResult = api.requestSmsVerificationCode(sessionId, Locale.getDefault(), mode.isSmsRetrieverSupported, mode.transport)
|
val codeRequestResult = api.requestSmsVerificationCode(sessionId, Locale.getDefault(), mode.isSmsRetrieverSupported, mode.transport)
|
||||||
@@ -391,8 +384,7 @@ object RegistrationRepository {
|
|||||||
/**
|
/**
|
||||||
* Submits the user-entered verification code to the service.
|
* Submits the user-entered verification code to the service.
|
||||||
*/
|
*/
|
||||||
suspend fun submitVerificationCode(context: Context, sessionId: String, registrationData: RegistrationData): VerificationCodeRequestResult =
|
suspend fun submitVerificationCode(context: Context, sessionId: String, registrationData: RegistrationData): VerificationCodeRequestResult = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, registrationData.e164, SignalServiceAddress.DEFAULT_DEVICE_ID, registrationData.password).registrationApi
|
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, registrationData.e164, SignalServiceAddress.DEFAULT_DEVICE_ID, registrationData.password).registrationApi
|
||||||
val result = api.verifyAccount(sessionId = sessionId, verificationCode = registrationData.code)
|
val result = api.verifyAccount(sessionId = sessionId, verificationCode = registrationData.code)
|
||||||
return@withContext VerificationCodeRequestResult.from(result)
|
return@withContext VerificationCodeRequestResult.from(result)
|
||||||
@@ -401,15 +393,13 @@ object RegistrationRepository {
|
|||||||
/**
|
/**
|
||||||
* Submits the solved captcha token to the service.
|
* Submits the solved captcha token to the service.
|
||||||
*/
|
*/
|
||||||
suspend fun submitCaptchaToken(context: Context, e164: String, password: String, sessionId: String, captchaToken: String): VerificationCodeRequestResult =
|
suspend fun submitCaptchaToken(context: Context, e164: String, password: String, sessionId: String, captchaToken: String): VerificationCodeRequestResult = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, e164, SignalServiceAddress.DEFAULT_DEVICE_ID, password).registrationApi
|
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, e164, SignalServiceAddress.DEFAULT_DEVICE_ID, password).registrationApi
|
||||||
val captchaSubmissionResult = api.submitCaptchaToken(sessionId = sessionId, captchaToken = captchaToken)
|
val captchaSubmissionResult = api.submitCaptchaToken(sessionId = sessionId, captchaToken = captchaToken)
|
||||||
return@withContext VerificationCodeRequestResult.from(captchaSubmissionResult)
|
return@withContext VerificationCodeRequestResult.from(captchaSubmissionResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun requestAndVerifyPushToken(context: Context, sessionId: String, e164: String, password: String) =
|
suspend fun requestAndVerifyPushToken(context: Context, sessionId: String, e164: String, password: String) = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val fcmToken = getFcmToken(context)
|
val fcmToken = getFcmToken(context)
|
||||||
val accountManager = AccountManagerFactory.getInstance().createUnauthenticated(context, e164, SignalServiceAddress.DEFAULT_DEVICE_ID, password)
|
val accountManager = AccountManagerFactory.getInstance().createUnauthenticated(context, e164, SignalServiceAddress.DEFAULT_DEVICE_ID, password)
|
||||||
val pushChallenge = PushChallengeRequest.getPushChallengeBlocking(accountManager, sessionId, Optional.ofNullable(fcmToken), PUSH_REQUEST_TIMEOUT).orElse(null)
|
val pushChallenge = PushChallengeRequest.getPushChallengeBlocking(accountManager, sessionId, Optional.ofNullable(fcmToken), PUSH_REQUEST_TIMEOUT).orElse(null)
|
||||||
@@ -420,8 +410,7 @@ object RegistrationRepository {
|
|||||||
/**
|
/**
|
||||||
* Submit the necessary assets as a verified account so that the user can actually use the service.
|
* Submit the necessary assets as a verified account so that the user can actually use the service.
|
||||||
*/
|
*/
|
||||||
suspend fun registerAccount(context: Context, sessionId: String?, registrationData: RegistrationData, pin: String? = null, masterKeyProducer: MasterKeyProducer? = null): RegisterAccountResult =
|
suspend fun registerAccount(context: Context, sessionId: String?, registrationData: RegistrationData, pin: String? = null, masterKeyProducer: MasterKeyProducer? = null): RegisterAccountResult = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
Log.v(TAG, "registerAccount()")
|
Log.v(TAG, "registerAccount()")
|
||||||
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, registrationData.e164, SignalServiceAddress.DEFAULT_DEVICE_ID, registrationData.password).registrationApi
|
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, registrationData.e164, SignalServiceAddress.DEFAULT_DEVICE_ID, registrationData.password).registrationApi
|
||||||
|
|
||||||
@@ -539,8 +528,7 @@ object RegistrationRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun createSessionAndBlockForPushChallenge(accountManager: RegistrationApi, fcmToken: String, mcc: String?, mnc: String?): NetworkResult<RegistrationSessionMetadataResponse> =
|
private suspend fun createSessionAndBlockForPushChallenge(accountManager: RegistrationApi, fcmToken: String, mcc: String?, mnc: String?): NetworkResult<RegistrationSessionMetadataResponse> = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
// TODO [regv2]: do not use event bus nor latch
|
// TODO [regv2]: do not use event bus nor latch
|
||||||
val subscriber = PushTokenChallengeSubscriber()
|
val subscriber = PushTokenChallengeSubscriber()
|
||||||
val eventBus = EventBus.getDefault()
|
val eventBus = EventBus.getDefault()
|
||||||
@@ -575,8 +563,7 @@ object RegistrationRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun hasValidSvrAuthCredentials(context: Context, e164: String, password: String): BackupAuthCheckResult =
|
suspend fun hasValidSvrAuthCredentials(context: Context, e164: String, password: String): BackupAuthCheckResult = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, e164, SignalServiceAddress.DEFAULT_DEVICE_ID, password).registrationApi
|
val api: RegistrationApi = AccountManagerFactory.getInstance().createUnauthenticated(context, e164, SignalServiceAddress.DEFAULT_DEVICE_ID, password).registrationApi
|
||||||
|
|
||||||
val svr3Result = SignalStore.svr.svr3AuthTokens
|
val svr3Result = SignalStore.svr.svr3AuthTokens
|
||||||
|
|||||||
@@ -102,7 +102,9 @@ class ContactRecordProcessor(
|
|||||||
if (!hasAci && !hasPni) {
|
if (!hasAci && !hasPni) {
|
||||||
Log.w(TAG, "Found a ContactRecord with neither an ACI nor a PNI -- marking as invalid.")
|
Log.w(TAG, "Found a ContactRecord with neither an ACI nor a PNI -- marking as invalid.")
|
||||||
return true
|
return true
|
||||||
} else if (selfAci != null && selfAci == remote.proto.signalAci ||
|
} else if (
|
||||||
|
selfAci != null &&
|
||||||
|
selfAci == remote.proto.signalAci ||
|
||||||
(selfPni != null && selfPni == remote.proto.signalPni) ||
|
(selfPni != null && selfPni == remote.proto.signalPni) ||
|
||||||
(selfE164 != null && remote.proto.e164.isNotBlank() && remote.proto.e164 == selfE164)
|
(selfE164 != null && remote.proto.e164.isNotBlank() && remote.proto.e164 == selfE164)
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -309,7 +309,8 @@ class FullSignalAudioManager(context: Context, eventListener: EventListener?) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
val needBluetoothAudioStart = signalBluetoothManager.state == SignalBluetoothManager.State.AVAILABLE &&
|
val needBluetoothAudioStart = signalBluetoothManager.state == SignalBluetoothManager.State.AVAILABLE &&
|
||||||
(userSelectedAudioDevice == AudioDevice.NONE || userSelectedAudioDevice == AudioDevice.BLUETOOTH || autoSwitchToBluetooth) && !androidAudioManager.isBluetoothScoOn
|
(userSelectedAudioDevice == AudioDevice.NONE || userSelectedAudioDevice == AudioDevice.BLUETOOTH || autoSwitchToBluetooth) &&
|
||||||
|
!androidAudioManager.isBluetoothScoOn
|
||||||
|
|
||||||
val needBluetoothAudioStop = (signalBluetoothManager.state == SignalBluetoothManager.State.CONNECTED || signalBluetoothManager.state == SignalBluetoothManager.State.CONNECTING) &&
|
val needBluetoothAudioStop = (signalBluetoothManager.state == SignalBluetoothManager.State.CONNECTED || signalBluetoothManager.state == SignalBluetoothManager.State.CONNECTING) &&
|
||||||
(userSelectedAudioDevice != AudioDevice.NONE && userSelectedAudioDevice != AudioDevice.BLUETOOTH)
|
(userSelectedAudioDevice != AudioDevice.NONE && userSelectedAudioDevice != AudioDevice.BLUETOOTH)
|
||||||
|
|||||||
@@ -171,8 +171,7 @@ class EmojiJsonParserTest {
|
|||||||
|
|
||||||
private fun uriFactory(sprite: String, format: String) = Uri.parse("file:///$sprite")
|
private fun uriFactory(sprite: String, format: String) = Uri.parse("file:///$sprite")
|
||||||
|
|
||||||
private fun EmojiPageModel.isSameAs(other: EmojiPageModel) =
|
private fun EmojiPageModel.isSameAs(other: EmojiPageModel) = this.javaClass == other.javaClass &&
|
||||||
this.javaClass == other.javaClass &&
|
|
||||||
this.emoji == other.emoji &&
|
this.emoji == other.emoji &&
|
||||||
this.iconAttr == other.iconAttr &&
|
this.iconAttr == other.iconAttr &&
|
||||||
this.spriteUri == other.spriteUri
|
this.spriteUri == other.spriteUri
|
||||||
|
|||||||
@@ -14,6 +14,5 @@ class GiphyMp4PlaybackControllerRangeComparatorTest {
|
|||||||
Assert.assertArrayEquals(expected, sorted)
|
Assert.assertArrayEquals(expected, sorted)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createComparator(start: Int, end: Int): GiphyMp4PlaybackController.RangeComparator =
|
private fun createComparator(start: Int, end: Int): GiphyMp4PlaybackController.RangeComparator = GiphyMp4PlaybackController.RangeComparator(start, end)
|
||||||
GiphyMp4PlaybackController.RangeComparator(start, end)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ktlint {
|
ktlint {
|
||||||
version.set("1.2.1")
|
version.set("1.5.0")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ kotlin {
|
|||||||
// NOTE: For now, in order to run ktlint on this project, you have to manually run ./gradlew :build-logic:tools:ktlintFormat
|
// NOTE: For now, in order to run ktlint on this project, you have to manually run ./gradlew :build-logic:tools:ktlintFormat
|
||||||
// Gotta figure out how to get it auto-included in the normal ./gradlew ktlintFormat
|
// Gotta figure out how to get it auto-included in the normal ./gradlew ktlintFormat
|
||||||
ktlint {
|
ktlint {
|
||||||
version.set("1.2.1")
|
version.set("1.5.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ object IconButtons {
|
|||||||
disabledContainerColor: Color = Color.Transparent,
|
disabledContainerColor: Color = Color.Transparent,
|
||||||
disabledContentColor: Color =
|
disabledContentColor: Color =
|
||||||
contentColor.copy(alpha = 0.38f)
|
contentColor.copy(alpha = 0.38f)
|
||||||
): IconButtonColors =
|
): IconButtonColors = IconButtonColors(
|
||||||
IconButtonColors(
|
|
||||||
containerColor = containerColor,
|
containerColor = containerColor,
|
||||||
contentColor = contentColor,
|
contentColor = contentColor,
|
||||||
disabledContainerColor = disabledContainerColor,
|
disabledContainerColor = disabledContainerColor,
|
||||||
@@ -56,8 +55,7 @@ object IconButtons {
|
|||||||
contentColor.copy(alpha = 0.38f),
|
contentColor.copy(alpha = 0.38f),
|
||||||
checkedContainerColor: Color = Color.Transparent,
|
checkedContainerColor: Color = Color.Transparent,
|
||||||
checkedContentColor: Color = MaterialTheme.colorScheme.primary
|
checkedContentColor: Color = MaterialTheme.colorScheme.primary
|
||||||
): IconToggleButtonColors =
|
): IconToggleButtonColors = IconToggleButtonColors(
|
||||||
IconToggleButtonColors(
|
|
||||||
containerColor = containerColor,
|
containerColor = containerColor,
|
||||||
contentColor = contentColor,
|
contentColor = contentColor,
|
||||||
disabledContainerColor = disabledContainerColor,
|
disabledContainerColor = disabledContainerColor,
|
||||||
|
|||||||
@@ -127,5 +127,4 @@ suspend fun AwaitPointerEventScope.awaitLongPressOrCancellation(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun PointerEvent.isPointerUp(pointerId: PointerId): Boolean =
|
private fun PointerEvent.isPointerUp(pointerId: PointerId): Boolean = changes.fastFirstOrNull { it.id == pointerId }?.pressed != true
|
||||||
changes.fastFirstOrNull { it.id == pointerId }?.pressed != true
|
|
||||||
|
|||||||
@@ -62,8 +62,7 @@ class ResultEventBus {
|
|||||||
/**
|
/**
|
||||||
* Provides a flow for the given resultKey.
|
* Provides a flow for the given resultKey.
|
||||||
*/
|
*/
|
||||||
inline fun <reified T> getResultFlow(resultKey: String = T::class.toString()) =
|
inline fun <reified T> getResultFlow(resultKey: String = T::class.toString()) = channelMap[resultKey]?.receiveAsFlow()
|
||||||
channelMap[resultKey]?.receiveAsFlow()
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a result into the channel associated with the given resultKey.
|
* Sends a result into the channel associated with the given resultKey.
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ fun setupWebView(
|
|||||||
webview.evaluateJavascript("editor.setValue($originalContent, -1);", null)
|
webview.evaluateJavascript("editor.setValue($originalContent, -1);", null)
|
||||||
}
|
}
|
||||||
|
|
||||||
copyButton.setOnClickListener { // In Signal app, use Util.writeTextToClipboard(context, value) instead
|
copyButton.setOnClickListener {
|
||||||
|
// In Signal app, use Util.writeTextToClipboard(context, value) instead
|
||||||
webview.evaluateJavascript("editor.getValue();") { value ->
|
webview.evaluateJavascript("editor.getValue();") { value ->
|
||||||
val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
val clip = ClipData.newPlainText(context.getString(R.string.app_name), value)
|
val clip = ClipData.newPlainText(context.getString(R.string.app_name), value)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ accompanist = "0.28.0"
|
|||||||
nanohttpd = "2.3.1"
|
nanohttpd = "2.3.1"
|
||||||
navigation-safe-args-gradle-plugin = "2.8.5"
|
navigation-safe-args-gradle-plugin = "2.8.5"
|
||||||
protobuf-gradle-plugin = "0.9.0"
|
protobuf-gradle-plugin = "0.9.0"
|
||||||
ktlint = "12.1.1"
|
ktlint = "14.0.1"
|
||||||
ui-test-junit4 = "1.9.4"
|
ui-test-junit4 = "1.9.4"
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -69,7 +69,7 @@ afterEvaluate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ktlint {
|
ktlint {
|
||||||
version.set("1.2.1")
|
version.set("1.5.0")
|
||||||
|
|
||||||
filter {
|
filter {
|
||||||
exclude { entry ->
|
exclude { entry ->
|
||||||
|
|||||||
Reference in New Issue
Block a user