kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix various compiler warnings.
rodzic
819c9f61dc
commit
c5b4f44ab8
|
@ -51,6 +51,7 @@ private class AudioRecorderFocusManager26(context: Context, changeListener: OnAu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
private class AudioRecorderFocusManagerLegacy(context: Context, val changeListener: OnAudioFocusChangeListener) : AudioRecorderFocusManager(context) {
|
private class AudioRecorderFocusManagerLegacy(context: Context, val changeListener: OnAudioFocusChangeListener) : AudioRecorderFocusManager(context) {
|
||||||
override fun requestAudioFocus(): Int {
|
override fun requestAudioFocus(): Int {
|
||||||
return audioManager.requestAudioFocus(changeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE)
|
return audioManager.requestAudioFocus(changeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE)
|
||||||
|
|
|
@ -30,6 +30,7 @@ class TextAvatarDrawable(
|
||||||
setBounds(0, 0, size, size)
|
setBounds(0, 0, size, size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
override fun draw(canvas: Canvas) {
|
override fun draw(canvas: Canvas) {
|
||||||
val width = bounds.width()
|
val width = bounds.width()
|
||||||
val textSize = Avatars.getTextSizeForLength(context, avatar.text, width * 0.8f, width * 0.45f)
|
val textSize = Avatars.getTextSizeForLength(context, avatar.text, width * 0.8f, width * 0.45f)
|
||||||
|
|
|
@ -31,6 +31,7 @@ class GiftFlowActivity : FragmentWrapperActivity(), DonationPaymentComponent {
|
||||||
return NavHostFragment.create(R.navigation.gift_flow)
|
return NavHostFragment.create(R.navigation.gift_flow)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
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)
|
||||||
googlePayResultPublisher.onNext(DonationPaymentComponent.GooglePayResult(requestCode, resultCode, data))
|
googlePayResultPublisher.onNext(DonationPaymentComponent.GooglePayResult(requestCode, resultCode, data))
|
||||||
|
|
|
@ -122,6 +122,7 @@ class AppSettingsActivity : DSLSettingsActivity(), DonationPaymentComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
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)
|
||||||
googlePayResultPublisher.onNext(DonationPaymentComponent.GooglePayResult(requestCode, resultCode, data))
|
googlePayResultPublisher.onNext(DonationPaymentComponent.GooglePayResult(requestCode, resultCode, data))
|
||||||
|
|
|
@ -344,7 +344,7 @@ class PrivacySettingsFragment : DSLSettingsFragment(R.string.preferences__privac
|
||||||
if (!ServiceUtil.getKeyguardManager(requireContext()).isKeyguardSecure) {
|
if (!ServiceUtil.getKeyguardManager(requireContext()).isKeyguardSecure) {
|
||||||
showGoToPhoneSettings()
|
showGoToPhoneSettings()
|
||||||
} else if (state.paymentLock) {
|
} else if (state.paymentLock) {
|
||||||
biometricAuth.authenticate(requireContext(), true) { biometricDeviceLockLauncher?.launch(getString(R.string.BiometricDeviceAuthentication__signal)) }
|
biometricAuth.authenticate(requireContext(), true) { biometricDeviceLockLauncher.launch(getString(R.string.BiometricDeviceAuthentication__signal)) }
|
||||||
} else {
|
} else {
|
||||||
viewModel.togglePaymentLock(true)
|
viewModel.togglePaymentLock(true)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ class OneTimeDonationRepository(private val donationsService: DonationsService)
|
||||||
companion object {
|
companion object {
|
||||||
private val TAG = Log.tag(OneTimeDonationRepository::class.java)
|
private val TAG = Log.tag(OneTimeDonationRepository::class.java)
|
||||||
|
|
||||||
fun <T> handleCreatePaymentIntentError(throwable: Throwable, badgeRecipient: RecipientId, paymentSourceType: PaymentSourceType): Single<T> {
|
fun <T : Any> handleCreatePaymentIntentError(throwable: Throwable, badgeRecipient: RecipientId, paymentSourceType: PaymentSourceType): Single<T> {
|
||||||
return if (throwable is DonationError) {
|
return if (throwable is DonationError) {
|
||||||
Single.error(throwable)
|
Single.error(throwable)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -23,6 +23,7 @@ class DonateToSignalActivity : FragmentWrapperActivity(), DonationPaymentCompone
|
||||||
return NavHostFragment.create(R.navigation.donate_to_signal, DonateToSignalFragmentArgs.Builder(DonateToSignalType.ONE_TIME).build().toBundle())
|
return NavHostFragment.create(R.navigation.donate_to_signal, DonateToSignalFragmentArgs.Builder(DonateToSignalType.ONE_TIME).build().toBundle())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
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)
|
||||||
googlePayResultPublisher.onNext(DonationPaymentComponent.GooglePayResult(requestCode, resultCode, data))
|
googlePayResultPublisher.onNext(DonationPaymentComponent.GooglePayResult(requestCode, resultCode, data))
|
||||||
|
|
|
@ -84,7 +84,7 @@ class CreditCardFragment : Fragment(R.layout.credit_card_fragment) {
|
||||||
|
|
||||||
binding.cardNumber.addTextChangedListener(CreditCardTextWatcher())
|
binding.cardNumber.addTextChangedListener(CreditCardTextWatcher())
|
||||||
|
|
||||||
binding.cardNumber.setOnFocusChangeListener { v, hasFocus ->
|
binding.cardNumber.setOnFocusChangeListener { _, hasFocus ->
|
||||||
viewModel.onNumberFocusChanged(hasFocus)
|
viewModel.onNumberFocusChanged(hasFocus)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class CreditCardFragment : Fragment(R.layout.credit_card_fragment) {
|
||||||
viewModel.onCodeChanged(it?.toString() ?: "")
|
viewModel.onCodeChanged(it?.toString() ?: "")
|
||||||
})
|
})
|
||||||
|
|
||||||
binding.cardCvv.setOnFocusChangeListener { v, hasFocus ->
|
binding.cardCvv.setOnFocusChangeListener { _, hasFocus ->
|
||||||
viewModel.onCodeFocusChanged(hasFocus)
|
viewModel.onCodeFocusChanged(hasFocus)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class CreditCardFragment : Fragment(R.layout.credit_card_fragment) {
|
||||||
|
|
||||||
binding.cardExpiry.addTextChangedListener(CreditCardExpirationTextWatcher())
|
binding.cardExpiry.addTextChangedListener(CreditCardExpirationTextWatcher())
|
||||||
|
|
||||||
binding.cardExpiry.setOnFocusChangeListener { v, hasFocus ->
|
binding.cardExpiry.setOnFocusChangeListener { _, hasFocus ->
|
||||||
viewModel.onExpirationFocusChanged(hasFocus)
|
viewModel.onExpirationFocusChanged(hasFocus)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ class ManageDonationsViewModel(
|
||||||
disposables += SubscriptionRedemptionJobWatcher.watch().subscribeBy { jobStateOptional ->
|
disposables += SubscriptionRedemptionJobWatcher.watch().subscribeBy { jobStateOptional ->
|
||||||
store.update { manageDonationsState ->
|
store.update { manageDonationsState ->
|
||||||
manageDonationsState.copy(
|
manageDonationsState.copy(
|
||||||
subscriptionRedemptionState = jobStateOptional.map { jobState ->
|
subscriptionRedemptionState = jobStateOptional.map { jobState: JobTracker.JobState ->
|
||||||
when (jobState) {
|
when (jobState) {
|
||||||
JobTracker.JobState.PENDING -> ManageDonationsState.SubscriptionRedemptionState.IN_PROGRESS
|
JobTracker.JobState.PENDING -> ManageDonationsState.SubscriptionRedemptionState.IN_PROGRESS
|
||||||
JobTracker.JobState.RUNNING -> ManageDonationsState.SubscriptionRedemptionState.IN_PROGRESS
|
JobTracker.JobState.RUNNING -> ManageDonationsState.SubscriptionRedemptionState.IN_PROGRESS
|
||||||
|
|
|
@ -57,6 +57,7 @@ open class ConversationActivity : PassphraseRequiredActivity(), ConversationPare
|
||||||
replaceFragment(intent!!)
|
replaceFragment(intent!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
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)
|
||||||
googlePayResultPublisher.onNext(DonationPaymentComponent.GooglePayResult(requestCode, resultCode, data))
|
googlePayResultPublisher.onNext(DonationPaymentComponent.GooglePayResult(requestCode, resultCode, data))
|
||||||
|
|
|
@ -29,6 +29,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import org.signal.core.util.logging.Log
|
import org.signal.core.util.logging.Log
|
||||||
import org.thoughtcrime.securesms.R
|
import org.thoughtcrime.securesms.R
|
||||||
|
import org.thoughtcrime.securesms.color.ViewColorSet
|
||||||
import org.thoughtcrime.securesms.components.ContactFilterView
|
import org.thoughtcrime.securesms.components.ContactFilterView
|
||||||
import org.thoughtcrime.securesms.components.TooltipPopup
|
import org.thoughtcrime.securesms.components.TooltipPopup
|
||||||
import org.thoughtcrime.securesms.components.WrapperDialogFragment
|
import org.thoughtcrime.securesms.components.WrapperDialogFragment
|
||||||
|
@ -146,11 +147,9 @@ class MultiselectForwardFragment :
|
||||||
val sendButton: AppCompatImageView = bottomBar.findViewById(R.id.share_confirm)
|
val sendButton: AppCompatImageView = bottomBar.findViewById(R.id.share_confirm)
|
||||||
val backgroundHelper: View = bottomBar.findViewById(R.id.background_helper)
|
val backgroundHelper: View = bottomBar.findViewById(R.id.background_helper)
|
||||||
|
|
||||||
val sendButtonColors = args.sendButtonColors
|
val sendButtonColors: ViewColorSet = args.sendButtonColors
|
||||||
if (sendButtonColors != null) {
|
|
||||||
sendButton.setColorFilter(sendButtonColors.foreground.resolve(requireContext()))
|
sendButton.setColorFilter(sendButtonColors.foreground.resolve(requireContext()))
|
||||||
ViewCompat.setBackgroundTintList(sendButton, ColorStateList.valueOf(sendButtonColors.background.resolve(requireContext())))
|
ViewCompat.setBackgroundTintList(sendButton, ColorStateList.valueOf(sendButtonColors.background.resolve(requireContext())))
|
||||||
}
|
|
||||||
|
|
||||||
FullscreenHelper.configureBottomBarLayout(requireActivity(), bottomBarSpacer, bottomBar)
|
FullscreenHelper.configureBottomBarLayout(requireActivity(), bottomBarSpacer, bottomBar)
|
||||||
|
|
||||||
|
|
|
@ -2186,7 +2186,7 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bulkUpdatedRegisteredStatus(registered: Map<RecipientId, ServiceId?>, unregistered: Collection<RecipientId>) {
|
fun bulkUpdatedRegisteredStatus(registered: Map<RecipientId, ServiceId?>, unregistered: Collection<RecipientId>) {
|
||||||
writableDatabase.withinTransaction { db ->
|
writableDatabase.withinTransaction {
|
||||||
val registeredWithServiceId: Set<RecipientId> = getRegisteredWithServiceIds()
|
val registeredWithServiceId: Set<RecipientId> = getRegisteredWithServiceIds()
|
||||||
val needsMarkRegistered: Map<RecipientId, ServiceId?> = registered - registeredWithServiceId
|
val needsMarkRegistered: Map<RecipientId, ServiceId?> = registered - registeredWithServiceId
|
||||||
|
|
||||||
|
@ -2855,7 +2855,7 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
|
||||||
operations += PnpOperation.ChangeNumberInsert(
|
operations += PnpOperation.ChangeNumberInsert(
|
||||||
recipientId = data.byAciSid,
|
recipientId = data.byAciSid,
|
||||||
oldE164 = data.aciSidRecord.e164,
|
oldE164 = data.aciSidRecord.e164,
|
||||||
newE164 = e164!!
|
newE164 = e164
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.signal.core.util.delete
|
||||||
import org.signal.core.util.logging.Log
|
import org.signal.core.util.logging.Log
|
||||||
import org.signal.core.util.or
|
import org.signal.core.util.or
|
||||||
import org.signal.core.util.readToList
|
import org.signal.core.util.readToList
|
||||||
|
import org.signal.core.util.readToSingleLong
|
||||||
import org.signal.core.util.requireBoolean
|
import org.signal.core.util.requireBoolean
|
||||||
import org.signal.core.util.requireInt
|
import org.signal.core.util.requireInt
|
||||||
import org.signal.core.util.requireLong
|
import org.signal.core.util.requireLong
|
||||||
|
@ -1072,13 +1073,7 @@ class ThreadTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
|
||||||
.from(TABLE_NAME)
|
.from(TABLE_NAME)
|
||||||
.where("$RECIPIENT_ID = ?", recipientId)
|
.where("$RECIPIENT_ID = ?", recipientId)
|
||||||
.run()
|
.run()
|
||||||
.use { cursor ->
|
.readToSingleLong(-1)
|
||||||
return if (cursor.moveToFirst()) {
|
|
||||||
cursor.requireLong(ID)
|
|
||||||
} else {
|
|
||||||
-1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getOrCreateValidThreadId(recipient: Recipient, candidateId: Long): Long {
|
fun getOrCreateValidThreadId(recipient: Recipient, candidateId: Long): Long {
|
||||||
|
|
|
@ -19,7 +19,7 @@ enum class StoryViewState {
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getForRecipientId(recipientId: RecipientId): Observable<StoryViewState> {
|
fun getForRecipientId(recipientId: RecipientId): Observable<StoryViewState> {
|
||||||
if (recipientId.equals(Recipient.self().id)) {
|
if (recipientId == Recipient.self().id) {
|
||||||
return Observable.fromCallable {
|
return Observable.fromCallable {
|
||||||
SignalDatabase.recipients.getDistributionListRecipientIds()
|
SignalDatabase.recipients.getDistributionListRecipientIds()
|
||||||
}.flatMap { ids ->
|
}.flatMap { ids ->
|
||||||
|
@ -27,7 +27,7 @@ enum class StoryViewState {
|
||||||
if (combined.isEmpty()) {
|
if (combined.isEmpty()) {
|
||||||
NONE
|
NONE
|
||||||
} else {
|
} else {
|
||||||
val results = combined.toList() as List<StoryViewState>
|
val results: List<StoryViewState> = combined.filterIsInstance<StoryViewState>()
|
||||||
when {
|
when {
|
||||||
results.any { it == UNVIEWED } -> UNVIEWED
|
results.any { it == UNVIEWED } -> UNVIEWED
|
||||||
results.any { it == VIEWED } -> VIEWED
|
results.any { it == VIEWED } -> VIEWED
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.thoughtcrime.securesms.exporter.flow
|
package org.thoughtcrime.securesms.exporter.flow
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import org.signal.smsexporter.BecomeSmsAppFailure
|
import org.signal.smsexporter.BecomeSmsAppFailure
|
||||||
|
@ -12,17 +12,20 @@ import org.thoughtcrime.securesms.databinding.SetSignalAsDefaultSmsAppFragmentBi
|
||||||
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
||||||
|
|
||||||
class SetSignalAsDefaultSmsAppFragment : Fragment(R.layout.set_signal_as_default_sms_app_fragment) {
|
class SetSignalAsDefaultSmsAppFragment : Fragment(R.layout.set_signal_as_default_sms_app_fragment) {
|
||||||
companion object {
|
|
||||||
private const val REQUEST_CODE = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
val binding = SetSignalAsDefaultSmsAppFragmentBinding.bind(view)
|
val binding = SetSignalAsDefaultSmsAppFragmentBinding.bind(view)
|
||||||
|
|
||||||
|
val smsDefaultLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
||||||
|
if (DefaultSmsHelper.isDefaultSms(requireContext())) {
|
||||||
|
navigateToExporter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
binding.continueButton.setOnClickListener {
|
binding.continueButton.setOnClickListener {
|
||||||
DefaultSmsHelper.becomeDefaultSms(requireContext()).either(
|
DefaultSmsHelper.becomeDefaultSms(requireContext()).either(
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
startActivityForResult(it, REQUEST_CODE)
|
smsDefaultLauncher.launch(it)
|
||||||
},
|
},
|
||||||
onFailure = {
|
onFailure = {
|
||||||
when (it) {
|
when (it) {
|
||||||
|
@ -34,12 +37,6 @@ class SetSignalAsDefaultSmsAppFragment : Fragment(R.layout.set_signal_as_default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
|
||||||
if (requestCode == REQUEST_CODE && DefaultSmsHelper.isDefaultSms(requireContext())) {
|
|
||||||
navigateToExporter()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun navigateToExporter() {
|
private fun navigateToExporter() {
|
||||||
findNavController().safeNavigate(SetSignalAsDefaultSmsAppFragmentDirections.actionSetSignalAsDefaultSmsAppFragmentToExportingSmsMessagesFragment())
|
findNavController().safeNavigate(SetSignalAsDefaultSmsAppFragmentDirections.actionSetSignalAsDefaultSmsAppFragmentToExportingSmsMessagesFragment())
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ class StickerSearchDialogFragment : DialogFragment(), KeyboardStickerListAdapter
|
||||||
list.adapter = adapter
|
list.adapter = adapter
|
||||||
list.addItemDecoration(InsetItemDecoration(StickerInsetSetter()))
|
list.addItemDecoration(InsetItemDecoration(StickerInsetSetter()))
|
||||||
|
|
||||||
val viewModel: StickerSearchViewModel = ViewModelProvider(this, StickerSearchViewModel.Factory(requireContext())).get(StickerSearchViewModel::class.java)
|
val viewModel: StickerSearchViewModel = ViewModelProvider(this, StickerSearchViewModel.Factory()).get(StickerSearchViewModel::class.java)
|
||||||
|
|
||||||
viewModel.searchResults.observe(viewLifecycleOwner) { stickers ->
|
viewModel.searchResults.observe(viewLifecycleOwner) { stickers ->
|
||||||
adapter.submitList(stickers)
|
adapter.submitList(stickers)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.thoughtcrime.securesms.keyboard.sticker
|
package org.thoughtcrime.securesms.keyboard.sticker
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
|
@ -20,7 +19,7 @@ class StickerSearchViewModel(private val searchRepository: StickerSearchReposito
|
||||||
searchQuery.postValue(query)
|
searchQuery.postValue(query)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Factory(context: Context) : ViewModelProvider.Factory {
|
class Factory : ViewModelProvider.Factory {
|
||||||
val repository = StickerSearchRepository()
|
val repository = StickerSearchRepository()
|
||||||
|
|
||||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||||
|
|
|
@ -310,7 +310,7 @@ internal class AccountValues internal constructor(store: KeyValueStore) : Signal
|
||||||
}
|
}
|
||||||
|
|
||||||
if (previous && !registered) {
|
if (previous && !registered) {
|
||||||
clearLocalCredentials(ApplicationDependencies.getApplication())
|
clearLocalCredentials()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ internal class AccountValues internal constructor(store: KeyValueStore) : Signal
|
||||||
val isLinkedDevice: Boolean
|
val isLinkedDevice: Boolean
|
||||||
get() = !isPrimaryDevice
|
get() = !isPrimaryDevice
|
||||||
|
|
||||||
private fun clearLocalCredentials(context: Context) {
|
private fun clearLocalCredentials() {
|
||||||
putString(KEY_SERVICE_PASSWORD, Util.getSecret(18))
|
putString(KEY_SERVICE_PASSWORD, Util.getSecret(18))
|
||||||
|
|
||||||
val newProfileKey = ProfileKeyUtil.createNew()
|
val newProfileKey = ProfileKeyUtil.createNew()
|
||||||
|
|
|
@ -70,6 +70,7 @@ private class BooleanValue(private val key: String, private val default: Boolean
|
||||||
|
|
||||||
private class StringValue<T : String?>(private val key: String, private val default: T, store: KeyValueStore) : SignalStoreValueDelegate<T>(store) {
|
private class StringValue<T : String?>(private val key: String, private val default: T, store: KeyValueStore) : SignalStoreValueDelegate<T>(store) {
|
||||||
override fun getValue(values: KeyValueStore): T {
|
override fun getValue(values: KeyValueStore): T {
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
return values.getString(key, default) as T
|
return values.getString(key, default) as T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ class MediaPreviewV2Fragment : Fragment(R.layout.fragment_media_preview_v2), Med
|
||||||
when (currentState.loadState) {
|
when (currentState.loadState) {
|
||||||
MediaPreviewV2State.LoadState.DATA_LOADED -> bindDataLoadedState(currentState)
|
MediaPreviewV2State.LoadState.DATA_LOADED -> bindDataLoadedState(currentState)
|
||||||
MediaPreviewV2State.LoadState.MEDIA_READY -> bindMediaReadyState(currentState)
|
MediaPreviewV2State.LoadState.MEDIA_READY -> bindMediaReadyState(currentState)
|
||||||
else -> null
|
else -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ data class NotificationConversation(
|
||||||
return notificationItems.any { it.isNewNotification }
|
return notificationItems.any { it.isNewNotification }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getChannelId(context: Context): String {
|
fun getChannelId(): String {
|
||||||
return if (isOnlyContactJoinedEvent) {
|
return if (isOnlyContactJoinedEvent) {
|
||||||
NotificationChannels.getInstance().JOIN_EVENTS
|
NotificationChannels.getInstance().JOIN_EVENTS
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -188,7 +188,7 @@ object NotificationFactory {
|
||||||
setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
||||||
setGroup(DefaultMessageNotifier.NOTIFICATION_GROUP)
|
setGroup(DefaultMessageNotifier.NOTIFICATION_GROUP)
|
||||||
setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN)
|
setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN)
|
||||||
setChannelId(conversation.getChannelId(context))
|
setChannelId(conversation.getChannelId())
|
||||||
setContentTitle(conversation.getContentTitle(context))
|
setContentTitle(conversation.getContentTitle(context))
|
||||||
setLargeIcon(conversation.getContactLargeIcon(context).toLargeBitmap(context))
|
setLargeIcon(conversation.getContactLargeIcon(context).toLargeBitmap(context))
|
||||||
addPerson(conversation.recipient)
|
addPerson(conversation.recipient)
|
||||||
|
@ -221,7 +221,7 @@ object NotificationFactory {
|
||||||
|
|
||||||
val notificationId: Int = if (Build.VERSION.SDK_INT < 24) NotificationIds.MESSAGE_SUMMARY else conversation.notificationId
|
val notificationId: Int = if (Build.VERSION.SDK_INT < 24) NotificationIds.MESSAGE_SUMMARY else conversation.notificationId
|
||||||
|
|
||||||
NotificationManagerCompat.from(context).safelyNotify(context, conversation.recipient, notificationId, builder.build())
|
NotificationManagerCompat.from(context).safelyNotify(conversation.recipient, notificationId, builder.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun notifySummary(context: Context, state: NotificationState) {
|
private fun notifySummary(context: Context, state: NotificationState) {
|
||||||
|
@ -257,7 +257,7 @@ object NotificationFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(TAG, "showing summary notification")
|
Log.d(TAG, "showing summary notification")
|
||||||
NotificationManagerCompat.from(context).safelyNotify(context, null, NotificationIds.MESSAGE_SUMMARY, builder.build())
|
NotificationManagerCompat.from(context).safelyNotify(null, NotificationIds.MESSAGE_SUMMARY, builder.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun notifyInThread(context: Context, recipient: Recipient, lastAudibleNotification: Long) {
|
private fun notifyInThread(context: Context, recipient: Recipient, lastAudibleNotification: Long) {
|
||||||
|
@ -326,7 +326,7 @@ object NotificationFactory {
|
||||||
setChannelId(NotificationChannels.getInstance().FAILURES)
|
setChannelId(NotificationChannels.getInstance().FAILURES)
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationManagerCompat.from(context).safelyNotify(context, recipient, NotificationIds.getNotificationIdForMessageDeliveryFailed(thread), builder.build())
|
NotificationManagerCompat.from(context).safelyNotify(recipient, NotificationIds.getNotificationIdForMessageDeliveryFailed(thread), builder.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun notifyProofRequired(context: Context, recipient: Recipient, thread: ConversationId, visibleThread: ConversationId?) {
|
fun notifyProofRequired(context: Context, recipient: Recipient, thread: ConversationId, visibleThread: ConversationId?) {
|
||||||
|
@ -356,7 +356,7 @@ object NotificationFactory {
|
||||||
setChannelId(NotificationChannels.getInstance().FAILURES)
|
setChannelId(NotificationChannels.getInstance().FAILURES)
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationManagerCompat.from(context).safelyNotify(context, recipient, NotificationIds.getNotificationIdForMessageDeliveryFailed(thread), builder.build())
|
NotificationManagerCompat.from(context).safelyNotify(recipient, NotificationIds.getNotificationIdForMessageDeliveryFailed(thread), builder.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -379,7 +379,7 @@ object NotificationFactory {
|
||||||
setColor(ContextCompat.getColor(context, R.color.core_ultramarine))
|
setColor(ContextCompat.getColor(context, R.color.core_ultramarine))
|
||||||
setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
||||||
setGroup(DefaultMessageNotifier.NOTIFICATION_GROUP)
|
setGroup(DefaultMessageNotifier.NOTIFICATION_GROUP)
|
||||||
setChannelId(conversation.getChannelId(context))
|
setChannelId(conversation.getChannelId())
|
||||||
setContentTitle(conversation.getContentTitle(context))
|
setContentTitle(conversation.getContentTitle(context))
|
||||||
setLargeIcon(conversation.getContactLargeIcon(context).toLargeBitmap(context))
|
setLargeIcon(conversation.getContactLargeIcon(context).toLargeBitmap(context))
|
||||||
addPerson(conversation.recipient)
|
addPerson(conversation.recipient)
|
||||||
|
@ -390,10 +390,10 @@ object NotificationFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(TAG, "Posting Notification for requested bubble")
|
Log.d(TAG, "Posting Notification for requested bubble")
|
||||||
NotificationManagerCompat.from(context).safelyNotify(context, recipient, conversation.notificationId, builder.build())
|
NotificationManagerCompat.from(context).safelyNotify(recipient, conversation.notificationId, builder.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun NotificationManagerCompat.safelyNotify(context: Context, threadRecipient: Recipient?, notificationId: Int, notification: Notification) {
|
private fun NotificationManagerCompat.safelyNotify(threadRecipient: Recipient?, notificationId: Int, notification: Notification) {
|
||||||
try {
|
try {
|
||||||
notify(notificationId, notification)
|
notify(notificationId, notification)
|
||||||
Log.internal().i(TAG, "Posted notification: $notification")
|
Log.internal().i(TAG, "Posted notification: $notification")
|
||||||
|
|
|
@ -231,9 +231,6 @@ class ImageEditorHudV2 @JvmOverloads constructor(
|
||||||
isAvatarEdit = true
|
isAvatarEdit = true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setColorPalette(colors: Set<Int>) {
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getActiveColor(): Int {
|
fun getActiveColor(): Int {
|
||||||
return if (currentMode == Mode.HIGHLIGHT) {
|
return if (currentMode == Mode.HIGHLIGHT) {
|
||||||
withHighlighterAlpha(drawSeekBar.getColor())
|
withHighlighterAlpha(drawSeekBar.getColor())
|
||||||
|
|
|
@ -105,7 +105,7 @@ class StoriesLandingRepository(context: Context) {
|
||||||
Observable.just(emptyList())
|
Observable.just(emptyList())
|
||||||
} else {
|
} else {
|
||||||
Observable.combineLatest(observables) {
|
Observable.combineLatest(observables) {
|
||||||
it.toList() as List<StoriesLandingItemData>
|
it.filterIsInstance<StoriesLandingItemData>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.subscribeOn(Schedulers.io())
|
}.subscribeOn(Schedulers.io())
|
||||||
|
|
|
@ -158,7 +158,7 @@ open class StoryViewerPageRepository(context: Context, private val storyViewStat
|
||||||
if (posts.isEmpty()) {
|
if (posts.isEmpty()) {
|
||||||
Observable.just(emptyList())
|
Observable.just(emptyList())
|
||||||
} else {
|
} else {
|
||||||
Observable.combineLatest(posts) { it.toList() as List<StoryPost> }
|
Observable.combineLatest(posts) { it.filterIsInstance<StoryPost>() }
|
||||||
}
|
}
|
||||||
}.observeOn(Schedulers.io())
|
}.observeOn(Schedulers.io())
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ class SpinnerApplicationContext : ApplicationContext() {
|
||||||
"E164" to (SignalStore.account().e164 ?: "none"),
|
"E164" to (SignalStore.account().e164 ?: "none"),
|
||||||
"ACI" to (SignalStore.account().aci?.toString() ?: "none"),
|
"ACI" to (SignalStore.account().aci?.toString() ?: "none"),
|
||||||
"PNI" to (SignalStore.account().pni?.toString() ?: "none"),
|
"PNI" to (SignalStore.account().pni?.toString() ?: "none"),
|
||||||
Spinner.KEY_ENVIRONMENT to BuildConfig.FLAVOR_environment.toUpperCase(Locale.US)
|
Spinner.KEY_ENVIRONMENT to BuildConfig.FLAVOR_environment.uppercase(Locale.US)
|
||||||
),
|
),
|
||||||
linkedMapOf(
|
linkedMapOf(
|
||||||
"signal" to DatabaseConfig(
|
"signal" to DatabaseConfig(
|
||||||
|
|
Ładowanie…
Reference in New Issue