Upgrade ktlint and add twitter compose rules.

This commit is contained in:
Alex Hart
2023-02-06 11:04:40 -04:00
committed by Greyson Parrelli
parent 52e9b31554
commit 605289aca4
174 changed files with 574 additions and 373 deletions

View File

@@ -17,7 +17,7 @@ import java.io.IOException
*/
class SignalBackupAgent : BackupAgent() {
private val items: List<AndroidBackupItem> = listOf(
KbsAuthTokens,
KbsAuthTokens
)
override fun onBackup(oldState: ParcelFileDescriptor?, data: BackupDataOutput, newState: ParcelFileDescriptor) {

View File

@@ -21,7 +21,7 @@ sealed class Avatar(
data class Text(
val text: String,
val color: Avatars.ColorPair,
override val databaseId: DatabaseId,
override val databaseId: DatabaseId
) : Avatar(databaseId) {
override fun withDatabaseId(databaseId: DatabaseId): Avatar {
return copy(databaseId = databaseId)
@@ -35,7 +35,7 @@ sealed class Avatar(
data class Vector(
val key: String,
val color: Avatars.ColorPair,
override val databaseId: DatabaseId,
override val databaseId: DatabaseId
) : Avatar(databaseId) {
override fun withDatabaseId(databaseId: DatabaseId): Avatar {
return copy(databaseId = databaseId)

View File

@@ -74,7 +74,7 @@ object Avatars {
"avatar_sunset" to DefaultAvatar(R.drawable.ic_avatar_sunset, "A120"),
"avatar_surfboard" to DefaultAvatar(R.drawable.ic_avatar_surfboard, "A110"),
"avatar_soccerball" to DefaultAvatar(R.drawable.ic_avatar_soccerball, "A130"),
"avatar_football" to DefaultAvatar(R.drawable.ic_avatar_football, "A220"),
"avatar_football" to DefaultAvatar(R.drawable.ic_avatar_football, "A220")
)
@DrawableRes

View File

@@ -87,8 +87,9 @@ class AvatarPickerFragment : Fragment(R.layout.avatar_picker_fragment) {
val selectedPosition = items.indexOfFirst { it.isSelected }
adapter.submitList(items) {
if (selectedPosition > -1)
if (selectedPosition > -1) {
recycler.smoothScrollToPosition(selectedPosition)
}
}
}

View File

@@ -5,7 +5,7 @@ import org.thoughtcrime.securesms.avatar.AvatarColorItem
import org.thoughtcrime.securesms.avatar.Avatars
data class TextAvatarCreationState(
val currentAvatar: Avatar.Text,
val currentAvatar: Avatar.Text
) {
fun colors(): List<AvatarColorItem> = Avatars.colors.map { AvatarColorItem(it, currentAvatar.color == it) }
}

View File

@@ -5,7 +5,7 @@ import org.thoughtcrime.securesms.avatar.AvatarColorItem
import org.thoughtcrime.securesms.avatar.Avatars
data class VectorAvatarCreationState(
val currentAvatar: Avatar.Vector,
val currentAvatar: Avatar.Vector
) {
fun colors(): List<AvatarColorItem> = Avatars.colors.map { AvatarColorItem(it, currentAvatar.color == it) }
}

View File

@@ -31,7 +31,8 @@ object ExpiredGiftSheetConfiguration {
textPref(
title = DSLSettingsText.from(
stringId = R.string.ExpiredGiftSheetConfiguration__your_badge_has_expired,
DSLSettingsText.CenterModifier, DSLSettingsText.TitleLargeModifier
DSLSettingsText.CenterModifier,
DSLSettingsText.TitleLargeModifier
)
)

View File

@@ -117,7 +117,7 @@ class GiftFlowViewModel(
private fun getLoadState(
oldState: GiftFlowState,
giftPrices: Map<Currency, FiatMoney>? = null,
giftBadge: Badge? = null,
giftBadge: Badge? = null
): GiftFlowState.Stage {
if (oldState.stage != GiftFlowState.Stage.INIT) {
return oldState.stage

View File

@@ -123,7 +123,8 @@ class ViewReceivedGiftBottomSheet : DSLSettingsBottomSheetFragment() {
}
errorDialog = DonationErrorDialogs.show(
requireContext(), throwable,
requireContext(),
throwable,
object : DonationErrorDialogs.DialogCallback() {
override fun onDialogDismissed() {
findNavController().popBackStack()
@@ -158,7 +159,8 @@ class ViewReceivedGiftBottomSheet : DSLSettingsBottomSheetFragment() {
noPadTextPref(
title = DSLSettingsText.from(
charSequence = requireContext().getString(R.string.ViewReceivedGiftBottomSheet__s_made_a_donation_for_you, state.recipient.getShortDisplayName(requireContext())),
DSLSettingsText.CenterModifier, DSLSettingsText.TitleLargeModifier
DSLSettingsText.CenterModifier,
DSLSettingsText.TitleLargeModifier
)
)

View File

@@ -66,7 +66,8 @@ class ViewSentGiftBottomSheet : DSLSettingsBottomSheetFragment() {
noPadTextPref(
title = DSLSettingsText.from(
stringId = R.string.ViewSentGiftBottomSheet__thanks_for_your_support,
DSLSettingsText.CenterModifier, DSLSettingsText.TitleLargeModifier
DSLSettingsText.CenterModifier,
DSLSettingsText.TitleLargeModifier
)
)

View File

@@ -133,7 +133,7 @@ data class Badge(
.downsample(DownsampleStrategy.NONE)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.transform(
BadgeSpriteTransformation(BadgeSpriteTransformation.Size.BADGE_64, model.badge.imageDensity, ThemeUtil.isDarkTheme(context)),
BadgeSpriteTransformation(BadgeSpriteTransformation.Size.BADGE_64, model.badge.imageDensity, ThemeUtil.isDarkTheme(context))
)
.into(badge)

View File

@@ -11,5 +11,5 @@ data class ActionItem @JvmOverloads constructor(
@DrawableRes val iconRes: Int,
val title: CharSequence,
@ColorRes val tintRes: Int = R.color.signal_colorOnSurface,
val action: Runnable,
val action: Runnable
)

View File

@@ -65,7 +65,7 @@ class ContextMenuList(recyclerView: RecyclerView, onItemClick: () -> Unit) {
private class ItemViewHolder(
itemView: View,
private val onItemClick: () -> Unit,
private val onItemClick: () -> Unit
) : MappingViewHolder<DisplayItem>(itemView) {
val icon: ImageView = itemView.findViewById(R.id.signal_context_menu_item_icon)
val title: TextView = itemView.findViewById(R.id.signal_context_menu_item_title)

View File

@@ -36,7 +36,7 @@ class SignalContextMenu private constructor(
private val contextMenuList = ContextMenuList(
recyclerView = contentView.findViewById(R.id.signal_context_menu_list),
onItemClick = { dismiss() },
onItemClick = { dismiss() }
)
init {

View File

@@ -211,6 +211,7 @@ class SegmentedProgressBar : View, ViewPager.OnPageChangeListener, View.OnTouchL
corners[6] = radius.toFloat()
corners[7] = radius.toFloat()
}
segments.lastIndex -> {
corners.indices.forEach { corners[it] = 0f }
corners[2] = radius.toFloat()
@@ -227,6 +228,7 @@ class SegmentedProgressBar : View, ViewPager.OnPageChangeListener, View.OnTouchL
path.addRoundRect(rectangle, corners, Path.Direction.CW)
canvas?.drawPath(path, drawingComponents.second[drawingIndex])
}
else -> canvas?.drawRect(
rectangle,
drawingComponents.second[drawingIndex]
@@ -325,12 +327,14 @@ class SegmentedProgressBar : View, ViewPager.OnPageChangeListener, View.OnTouchL
segments.mapIndexed { index, segment ->
if (offset > 0) {
if (index < nextSegmentIndex) segment.animationState =
Segment.AnimationState.ANIMATED
if (index < nextSegmentIndex) {
segment.animationState = Segment.AnimationState.ANIMATED
}
} else if (offset < 0) {
if (index > nextSegmentIndex - 1) segment.animationState =
Segment.AnimationState.IDLE
} else if (offset == 0) {
if (index > nextSegmentIndex - 1) {
segment.animationState = Segment.AnimationState.IDLE
}
} else {
if (index == nextSegmentIndex) segment.animationState = Segment.AnimationState.IDLE
}
}

View File

@@ -38,7 +38,6 @@ fun SegmentedProgressBar.getDrawingComponents(
segment: Segment,
segmentIndex: Int
): Pair<MutableList<RectF>, MutableList<Paint>> {
val rectangles = mutableListOf<RectF>()
val paints = mutableListOf<Paint>()
val segmentWidth = segmentWidth

View File

@@ -32,7 +32,7 @@ sealed class DSLSettingsIcon {
@ColorRes private val iconTintId: Int,
@DrawableRes private val backgroundId: Int,
@ColorRes private val backgroundTint: Int,
@Px private val insetPx: Int,
@Px private val insetPx: Int
) : DSLSettingsIcon() {
override fun resolve(context: Context): Drawable {
return LayerDrawable(

View File

@@ -46,7 +46,6 @@ class AppSettingsFragment : DSLSettingsFragment(R.string.text_secure_normal__men
private fun getConfiguration(state: AppSettingsState): DSLConfiguration {
return configure {
customPref(
BioPreference(state.self) {
findNavController().safeNavigate(R.id.action_appSettingsFragment_to_manageProfileActivity)

View File

@@ -59,7 +59,6 @@ class AccountSettingsFragment : DSLSettingsFragment(R.string.AccountSettingsFrag
private fun getConfiguration(state: AccountSettingsState): DSLConfiguration {
return configure {
sectionHeaderPref(R.string.preferences_app_protection__signal_pin)
@Suppress("DEPRECATION")

View File

@@ -161,7 +161,9 @@ class ChangeNumberEnterPhoneNumberFragment : LoggingFragment(R.layout.fragment_c
ContinueStatus.CAN_CONTINUE -> findNavController().safeNavigate(R.id.action_enterPhoneNumberChangeFragment_to_changePhoneNumberConfirmFragment)
ContinueStatus.INVALID_NUMBER -> {
Dialogs.showAlertDialog(
context, getString(R.string.RegistrationActivity_invalid_number), String.format(getString(R.string.RegistrationActivity_the_number_you_specified_s_is_invalid), viewModel.number.e164Number)
context,
getString(R.string.RegistrationActivity_invalid_number),
String.format(getString(R.string.RegistrationActivity_the_number_you_specified_s_is_invalid), viewModel.number.e164Number)
)
}
ContinueStatus.OLD_NUMBER_DOESNT_MATCH -> {

View File

@@ -44,7 +44,6 @@ class ChatsSettingsFragment : DSLSettingsFragment(R.string.preferences_chats__ch
private fun getConfiguration(state: ChatsSettingsState): DSLConfiguration {
return configure {
if (!state.useAsDefaultSmsApp) {
when (state.smsExportState) {
SmsExportState.FETCHING -> Unit

View File

@@ -60,7 +60,6 @@ class SmsSettingsFragment : DSLSettingsFragment(R.string.preferences__sms_mms) {
private fun getConfiguration(state: SmsSettingsState): DSLConfiguration {
return configure {
if (state.useAsDefaultSmsApp) {
customPref(
OutlinedLearnMore.Model(

View File

@@ -108,7 +108,6 @@ class NotificationsSettingsFragment : DSLSettingsFragment(R.string.preferences__
}
)
} else {
clickPref(
title = DSLSettingsText.from(R.string.preferences__sound),
summary = DSLSettingsText.from(getRingtoneSummary(state.messageNotificationsState.sound)),

View File

@@ -41,7 +41,6 @@ class NotificationProfileSelectionFragment : DSLSettingsBottomSheetFragment() {
val activeProfile: NotificationProfile? = NotificationProfiles.getActiveProfile(state.notificationProfiles)
return configure {
state.notificationProfiles.sortedDescending().forEach { profile ->
customPref(
NotificationProfileSelection.Entry(

View File

@@ -148,7 +148,7 @@ class EditNotificationProfileFragment : DSLSettingsFragment(layoutId = R.layout.
NotificationProfileNamePreset.Model("\uD83D\uDE34", R.string.EditNotificationProfileFragment__sleep, onClick),
NotificationProfileNamePreset.Model("\uD83D\uDE97", R.string.EditNotificationProfileFragment__driving, onClick),
NotificationProfileNamePreset.Model("\uD83D\uDE0A", R.string.EditNotificationProfileFragment__downtime, onClick),
NotificationProfileNamePreset.Model("\uD83D\uDCA1", R.string.EditNotificationProfileFragment__focus, onClick),
NotificationProfileNamePreset.Model("\uD83D\uDCA1", R.string.EditNotificationProfileFragment__focus, onClick)
)
)
}

View File

@@ -41,7 +41,7 @@ private val DAY_TO_STARTING_LETTER: Map<DayOfWeek, Int> = mapOf(
DayOfWeek.WEDNESDAY to R.string.EditNotificationProfileSchedule__wednesday_first_letter,
DayOfWeek.THURSDAY to R.string.EditNotificationProfileSchedule__thursday_first_letter,
DayOfWeek.FRIDAY to R.string.EditNotificationProfileSchedule__friday_first_letter,
DayOfWeek.SATURDAY to R.string.EditNotificationProfileSchedule__saturday_first_letter,
DayOfWeek.SATURDAY to R.string.EditNotificationProfileSchedule__saturday_first_letter
)
/**

View File

@@ -95,7 +95,6 @@ class NotificationProfileDetailsFragment : DSLSettingsFragment() {
val (profile: NotificationProfile, recipients: List<Recipient>, isOn: Boolean, expanded: Boolean) = state
return configure {
customPref(
NotificationProfilePreference.Model(
title = DSLSettingsText.from(profile.name),

View File

@@ -263,7 +263,8 @@ class PrivacySettingsFragment : DSLSettingsFragment(R.string.preferences__privac
val timeoutMinutes = max(TimeUnit.MILLISECONDS.toMinutes(duration).toInt(), 1)
viewModel.setObsoletePasswordTimeout(timeoutMinutes)
},
0, TimeDurationPicker.HH_MM
0,
TimeDurationPicker.HH_MM
).show()
}
)
@@ -297,7 +298,8 @@ class PrivacySettingsFragment : DSLSettingsFragment(R.string.preferences__privac
val timeoutSeconds = TimeUnit.MILLISECONDS.toSeconds(duration)
viewModel.setScreenLockTimeout(timeoutSeconds)
},
0, TimeDurationPicker.HH_MM
0,
TimeDurationPicker.HH_MM
).show()
}
)
@@ -328,7 +330,7 @@ class PrivacySettingsFragment : DSLSettingsFragment(R.string.preferences__privac
)
textPref(
summary = DSLSettingsText.from(incognitoSummary),
summary = DSLSettingsText.from(incognitoSummary)
)
dividerPref()

View File

@@ -107,7 +107,6 @@ class AdvancedPrivacySettingsFragment : DSLSettingsFragment(R.string.preferences
private fun getConfiguration(state: AdvancedPrivacySettingsState): DSLConfiguration {
return configure {
switchPref(
title = DSLSettingsText.from(R.string.preferences__signal_messages_and_calls),
summary = DSLSettingsText.from(getPushToggleSummary(state.isPushEnabled)),

View File

@@ -24,5 +24,5 @@ enum class CensorshipCircumventionState(val available: Boolean) {
AVAILABLE_AUTOMATICALLY_ENABLED(true),
/** The setting is generically available */
AVAILABLE(true),
AVAILABLE(true)
}

View File

@@ -7,7 +7,7 @@ data class ExpireTimerSettingsState(
val userSetTimer: Int? = null,
val saveState: ProcessState<Int> = ProcessState.Idle(),
val isGroupCreate: Boolean = false,
val isForRecipient: Boolean = isGroupCreate,
val isForRecipient: Boolean = isGroupCreate
) {
val currentTimer: Int
get() = userSetTimer ?: initialTimer

View File

@@ -108,7 +108,7 @@ data class Boost(
val isCustomAmountFocused: Boolean,
val isCustomAmountTooSmall: Boolean,
val onCustomAmountChanged: (String) -> Unit,
val onCustomAmountFocusChanged: (Boolean) -> Unit,
val onCustomAmountFocusChanged: (Boolean) -> Unit
) : PreferenceModel<SelectionModel>(isEnabled = isEnabled) {
override fun areItemsTheSame(newItem: SelectionModel): Boolean = true
@@ -156,7 +156,8 @@ data class Boost(
error.text = context.getString(
R.string.Boost__the_minimum_amount_you_can_donate_is_s,
FiatMoneyUtil.format(
context.resources, model.minimumAmount,
context.resources,
model.minimumAmount,
FiatMoneyUtil.formatOptions().trimZerosAfterDecimal()
)
)
@@ -253,7 +254,6 @@ data class Boost(
dstart: Int,
dend: Int
): CharSequence? {
val result = dest.subSequence(0, dstart).toString() + source.toString() + dest.subSequence(dend, dest.length)
val resultWithoutCurrencyPrefix = StringUtil.stripBidiIndicator(result.removePrefix(symbol).removeSuffix(symbol).trim())

View File

@@ -247,7 +247,8 @@ class DonateToSignalViewModel(
selectableCurrencyCodes = availableCurrencies.map(Currency::getCurrencyCode),
isCustomAmountFocused = false,
customAmount = FiatMoney(
BigDecimal.ZERO, currency
BigDecimal.ZERO,
currency
)
)
)

View File

@@ -247,7 +247,8 @@ class DonationCheckoutDelegate(
Log.d(TAG, "Displaying donation error dialog.", true)
errorDialog = DonationErrorDialogs.show(
fragment!!.requireContext(), throwable,
fragment!!.requireContext(),
throwable,
object : DonationErrorDialogs.DialogCallback() {
var tryCCAgain = false

View File

@@ -8,7 +8,7 @@ import androidx.activity.OnBackPressedCallback
*/
class DonationWebViewOnBackPressedCallback(
private val dismissAllowingStateLoss: () -> Unit,
private val webView: WebView,
private val webView: WebView
) : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
if (webView.canGoBack()) {

View File

@@ -19,7 +19,6 @@ class YourInformationIsPrivateBottomSheet : DSLSettingsBottomSheetFragment() {
private fun getConfiguration(): DSLConfiguration {
return configure {
space(10.dp)
noPadTextPref(

View File

@@ -97,14 +97,16 @@ class DonationErrorParams<V> private constructor(
return when (declinedError.declineCode) {
is StripeDeclineCode.Known -> when (declinedError.declineCode.code) {
StripeDeclineCode.Code.APPROVE_WITH_ID -> getStripeDeclineCodePositiveActionParams(
context, callback,
context,
callback,
when (declinedError.method) {
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__verify_your_card_details_are_correct_and_try_again
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__verify_your_payment_method_is_up_to_date_in_google_pay_and_try_again
}
)
StripeDeclineCode.Code.CALL_ISSUER -> getStripeDeclineCodePositiveActionParams(
context, callback,
context,
callback,
when (declinedError.method) {
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__verify_your_card_details_are_correct_and_try_again_if_the_problem_continues
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__verify_your_payment_method_is_up_to_date_in_google_pay_and_try_again_if_the_problem
@@ -112,21 +114,24 @@ class DonationErrorParams<V> private constructor(
)
StripeDeclineCode.Code.CARD_NOT_SUPPORTED -> getLearnMoreParams(context, callback, R.string.DeclineCode__your_card_does_not_support_this_type_of_purchase)
StripeDeclineCode.Code.EXPIRED_CARD -> getStripeDeclineCodePositiveActionParams(
context, callback,
context,
callback,
when (declinedError.method) {
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__your_card_has_expired_verify_your_card_details
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__your_card_has_expired
}
)
StripeDeclineCode.Code.INCORRECT_NUMBER -> getStripeDeclineCodePositiveActionParams(
context, callback,
context,
callback,
when (declinedError.method) {
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__your_card_number_is_incorrect_verify_your_card_details
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__your_card_number_is_incorrect
}
)
StripeDeclineCode.Code.INCORRECT_CVC -> getStripeDeclineCodePositiveActionParams(
context, callback,
context,
callback,
when (declinedError.method) {
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__your_cards_cvc_number_is_incorrect_verify_your_card_details
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__your_cards_cvc_number_is_incorrect
@@ -134,28 +139,32 @@ class DonationErrorParams<V> private constructor(
)
StripeDeclineCode.Code.INSUFFICIENT_FUNDS -> getLearnMoreParams(context, callback, R.string.DeclineCode__your_card_does_not_have_sufficient_funds)
StripeDeclineCode.Code.INVALID_CVC -> getStripeDeclineCodePositiveActionParams(
context, callback,
context,
callback,
when (declinedError.method) {
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__your_cards_cvc_number_is_incorrect_verify_your_card_details
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__your_cards_cvc_number_is_incorrect
}
)
StripeDeclineCode.Code.INVALID_EXPIRY_MONTH -> getStripeDeclineCodePositiveActionParams(
context, callback,
context,
callback,
when (declinedError.method) {
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__the_expiration_month_on_your_card_is_incorrect
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__the_expiration_month
}
)
StripeDeclineCode.Code.INVALID_EXPIRY_YEAR -> getStripeDeclineCodePositiveActionParams(
context, callback,
context,
callback,
when (declinedError.method) {
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__the_expiration_year_on_your_card_is_incorrect
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__the_expiration_year
}
)
StripeDeclineCode.Code.INVALID_NUMBER -> getStripeDeclineCodePositiveActionParams(
context, callback,
context,
callback,
when (declinedError.method) {
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__your_card_number_is_incorrect_verify_your_card_details
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__your_card_number_is_incorrect

View File

@@ -105,7 +105,8 @@ class ManageDonationsFragment :
noPadTextPref(
title = DSLSettingsText.from(
R.string.DonateToSignalFragment__privacy_over_profit,
DSLSettingsText.CenterModifier, DSLSettingsText.TitleLargeModifier
DSLSettingsText.CenterModifier,
DSLSettingsText.TitleLargeModifier
)
)

View File

@@ -74,7 +74,7 @@ class ThanksForYourSupportBottomSheetDialogFragment : FixedRoundedCornerBottomSh
.append(
SpanUtil.clickable(
getString(R.string.SubscribeThanksForYourSupportBottomSheetDialogFragment__become_a_montly_sustainer),
ContextCompat.getColor(requireContext(), R.color.signal_accent_primary),
ContextCompat.getColor(requireContext(), R.color.signal_accent_primary)
) {
requireActivity().finish()
requireActivity().startActivity(AppSettingsActivity.subscriptions(requireContext()))

View File

@@ -18,7 +18,6 @@ abstract class SettingsWrapperFragment : Fragment(R.layout.settings_wrapper_frag
private set
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
toolbar = view.findViewById(R.id.toolbar)
toolbar.setNavigationOnClickListener {

View File

@@ -55,7 +55,7 @@ class ConversationSettingsActivity : DSLSettingsActivity(), ConversationSettings
ActivityOptionsCompat.makeSceneTransitionAnimation(
context,
avatar,
"avatar",
"avatar"
).toBundle()
} else {
null

View File

@@ -561,7 +561,6 @@ class ConversationSettingsFragment : DSLSettingsFragment(
}
if (recipientSettingsState.selfHasGroups && !state.recipient.isReleaseNotes) {
dividerPref()
val groupsInCommonCount = recipientSettingsState.allGroupsInCommon.size

View File

@@ -20,7 +20,7 @@ data class ConversationSettingsState(
val sharedMediaIds: List<Long> = listOf(),
val displayInternalRecipientDetails: Boolean = false,
private val sharedMediaLoaded: Boolean = false,
private val specificSettingsState: SpecificSettingsState,
private val specificSettingsState: SpecificSettingsState
) {
val isLoaded: Boolean = recipient != Recipient.UNKNOWN && sharedMediaLoaded && specificSettingsState.isLoaded

View File

@@ -34,7 +34,7 @@ import java.util.Optional
sealed class ConversationSettingsViewModel(
private val repository: ConversationSettingsRepository,
specificSettingsState: SpecificSettingsState,
specificSettingsState: SpecificSettingsState
) : ViewModel() {
private val openedMediaCursors = HashSet<Cursor>()
@@ -407,7 +407,6 @@ sealed class ConversationSettingsViewModel(
override fun onAddToGroup() {
repository.getGroupCapacity(groupId) { capacityResult ->
if (capacityResult.getRemainingCapacity() > 0) {
internalEvents.onNext(
ConversationSettingsEvent.AddMembersToGroup(
groupId,
@@ -480,7 +479,7 @@ sealed class ConversationSettingsViewModel(
class Factory(
private val recipientId: RecipientId? = null,
private val groupId: GroupId? = null,
private val repository: ConversationSettingsRepository,
private val repository: ConversationSettingsRepository
) : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {

View File

@@ -278,7 +278,7 @@ class InternalConversationSettingsFragment : DSLSettingsFragment(
", ",
colorize("ChangeNumber", capabilities.changeNumberCapability),
", ",
colorize("Stories", capabilities.storiesCapability),
colorize("Stories", capabilities.storiesCapability)
)
} else {
"Recipient not found!"

View File

@@ -48,7 +48,6 @@ class PermissionsSettingsFragment : DSLSettingsFragment(
private fun getConfiguration(state: PermissionsSettingsState): DSLConfiguration {
return configure {
radioListPref(
title = DSLSettingsText.from(R.string.PermissionsSettingsFragment__add_members),
isEnabled = state.selfCanEditSettings,

View File

@@ -34,7 +34,7 @@ object BioTextPreference {
}
class RecipientModel(
private val recipient: Recipient,
private val recipient: Recipient
) : BioTextPreferenceModel<RecipientModel>() {
override fun getHeadlineText(context: Context): CharSequence {

View File

@@ -16,7 +16,7 @@ object InternalPreference {
class Model(
private val recipient: Recipient,
val onInternalDetailsClicked: () -> Unit,
val onInternalDetailsClicked: () -> Unit
) : PreferenceModel<Model>() {
override fun areItemsTheSame(newItem: Model): Boolean {

View File

@@ -48,7 +48,6 @@ class SoundsAndNotificationsSettingsFragment : DSLSettingsFragment(
private fun getConfiguration(state: SoundsAndNotificationsSettingsState): DSLConfiguration {
return configure {
val muteSummary = if (state.muteUntil > 0) {
state.muteUntil.formatMutedUntil(requireContext())
} else {

View File

@@ -74,7 +74,6 @@ class CustomNotificationsSettingsFragment : DSLSettingsFragment(R.string.CustomN
private fun getConfiguration(state: CustomNotificationsSettingsState): DSLConfiguration {
return configure {
sectionHeaderPref(R.string.CustomNotificationsDialogFragment__messages)
if (NotificationChannels.supported()) {

View File

@@ -14,5 +14,5 @@ data class CustomNotificationsSettingsState(
val messageSound: Uri? = null,
val callVibrateState: RecipientTable.VibrateState = RecipientTable.VibrateState.DEFAULT,
val callSound: Uri? = null,
val showCallingOptions: Boolean = false,
val showCallingOptions: Boolean = false
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package org.thoughtcrime.securesms.components.settings
import androidx.annotation.CallSuper
@@ -212,7 +214,7 @@ abstract class PreferenceModel<T : PreferenceModel<T>>(
open val summary: DSLSettingsText? = null,
open val icon: DSLSettingsIcon? = null,
open val iconEnd: DSLSettingsIcon? = null,
open val isEnabled: Boolean = true,
open val isEnabled: Boolean = true
) : MappingModel<T> {
override fun areItemsTheSame(newItem: T): Boolean {
return when {

View File

@@ -16,7 +16,7 @@ import org.thoughtcrime.securesms.util.adapter.mapping.MappingViewHolder
* A Text without any padding, allowing for exact padding to be handed in at runtime.
*/
data class Text(
val text: DSLSettingsText,
val text: DSLSettingsText
) {
companion object {

View File

@@ -186,7 +186,6 @@ data class CallParticipantsState(
webRtcViewModel: WebRtcViewModel,
enableVideo: Boolean
): CallParticipantsState {
var newShowVideoForOutgoing: Boolean = oldState.showVideoForOutgoing
if (enableVideo) {
newShowVideoForOutgoing = webRtcViewModel.state == WebRtcViewModel.State.CALL_OUTGOING
@@ -281,7 +280,6 @@ data class CallParticipantsState(
isViewingFocusedParticipant: Boolean = oldState.isViewingFocusedParticipant,
isExpanded: Boolean = oldState.localRenderState == WebRtcLocalRenderState.EXPANDED
): WebRtcLocalRenderState {
val displayLocal: Boolean = (numberOfRemoteParticipants == 0 || !isInPip) && (isNonIdleGroupCall || localParticipant.isVideoEnabled)
var localRenderState: WebRtcLocalRenderState = WebRtcLocalRenderState.GONE

View File

@@ -54,7 +54,7 @@ abstract class ComposeBottomSheetDialogFragment : FixedRoundedCornerBottomSheetD
* ```
*/
@Composable
fun Handle() {
protected fun Handle() {
Box(
modifier = Modifier
.size(width = 48.dp, height = 22.dp)

View File

@@ -49,7 +49,7 @@ class ContactSearchMediator(
private val callbacks: Callbacks = SimpleCallbacks(),
performSafetyNumberChecks: Boolean = true,
adapterFactory: AdapterFactory = DefaultAdapterFactory,
arbitraryRepository: ArbitraryRepository? = null,
arbitraryRepository: ArbitraryRepository? = null
) {
private val queryDebouncer = Debouncer(300, TimeUnit.MILLISECONDS)

View File

@@ -15,7 +15,9 @@ data class GroupsInCommon(
1 -> context.getString(R.string.MessageRequestProfileView_member_of_one_group, names[0])
2 -> context.getString(R.string.MessageRequestProfileView_member_of_two_groups, names[0], names[1])
else -> context.getString(
R.string.MessageRequestProfileView_member_of_many_groups, names[0], names[1],
R.string.MessageRequestProfileView_member_of_many_groups,
names[0],
names[1],
context.resources.getQuantityString(R.plurals.MessageRequestProfileView_member_of_d_additional_groups, total - 2, total - 2)
)
}

View File

@@ -18,14 +18,14 @@ import org.thoughtcrime.securesms.components.menu.ContextMenuList
class ConversationContextMenu(private val anchor: View, items: List<ActionItem>) : PopupWindow(
LayoutInflater.from(anchor.context).inflate(R.layout.signal_context_menu, null),
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
) {
val context: Context = anchor.context
private val contextMenuList = ContextMenuList(
recyclerView = contentView.findViewById(R.id.signal_context_menu_list),
onItemClick = { dismiss() },
onItemClick = { dismiss() }
)
init {

View File

@@ -3,8 +3,10 @@ package org.thoughtcrime.securesms.conversation
enum class ConversationItemDisplayMode {
/** Normal rendering, used for normal bubbles in the conversation view */
STANDARD,
/** Smaller bubbles, often trimming text and shrinking images. Used for quote threads. */
CONDENSED,
/** Less length restrictions. Used to show more info in message details. */
DETAILED,
DETAILED
}

View File

@@ -20,7 +20,7 @@ object ConversationItemSelection {
conversationItem: ConversationItem,
list: RecyclerView,
messageRecord: MessageRecord,
videoBitmap: Bitmap?,
videoBitmap: Bitmap?
): Bitmap {
val isOutgoing = messageRecord.isOutgoing
val hasNoBubble = messageRecord.hasNoBubble(conversationItem.context)
@@ -30,7 +30,7 @@ object ConversationItemSelection {
list = list,
videoBitmap = videoBitmap,
drawConversationItem = !isOutgoing || hasNoBubble,
hasReaction = messageRecord.reactions.isNotEmpty(),
hasReaction = messageRecord.reactions.isNotEmpty()
)
}
@@ -39,7 +39,7 @@ object ConversationItemSelection {
list: RecyclerView,
videoBitmap: Bitmap?,
drawConversationItem: Boolean,
hasReaction: Boolean,
hasReaction: Boolean
): Bitmap {
val bodyBubble = conversationItem.bodyBubble
val reactionsView = conversationItem.reactionsView

View File

@@ -83,7 +83,7 @@ class ScheduleMessageTimePickerBottomSheet : FixedRoundedCornerBottomSheetDialog
text = getString(
R.string.ScheduleMessageTimePickerBottomSheet__timezone_disclaimer,
zoneOffsetFormatter.format(zonedDateTime),
zoneNameFormatter.format(zonedDateTime),
zoneNameFormatter.format(zonedDateTime)
)
}

View File

@@ -17,5 +17,5 @@ data class SelectedConversationModel(
val bubbleWidth: Int,
val audioUri: Uri? = null,
val isOutgoing: Boolean,
val focusedView: View?,
val focusedView: View?
)

View File

@@ -50,12 +50,14 @@ object ChatColorsPalette {
@JvmField
val TAUPE = ChatColors.forColor(
ChatColors.Id.BuiltIn, 0xFF8F616A.toInt()
ChatColors.Id.BuiltIn,
0xFF8F616A.toInt()
)
@JvmField
val STEEL = ChatColors.forColor(
ChatColors.Id.BuiltIn, 0xFF71717F.toInt()
ChatColors.Id.BuiltIn,
0xFF71717F.toInt()
)
// endregion
@@ -128,7 +130,8 @@ object ChatColorsPalette {
ChatColors.LinearGradient(
180f,
intArrayOf(
0xFF6281D5.toInt(), 0xFF974460.toInt()
0xFF6281D5.toInt(),
0xFF974460.toInt()
),
floatArrayOf(0f, 1f)
)
@@ -216,7 +219,7 @@ object ChatColorsPalette {
NameColor(lightColor = 0xFF5E6E0C.toInt(), darkColor = 0xFF8FAA09.toInt()),
NameColor(lightColor = 0xFF077288.toInt(), darkColor = 0xFF00AED1.toInt()),
NameColor(lightColor = 0xFFC20AA3.toInt(), darkColor = 0xFFF75FDD.toInt()),
NameColor(lightColor = 0xFF2D761E.toInt(), darkColor = 0xFF43B42D.toInt()),
NameColor(lightColor = 0xFF2D761E.toInt(), darkColor = 0xFF43B42D.toInt())
)
}

View File

@@ -137,11 +137,19 @@ class RecyclerViewColorizer(private val recyclerView: RecyclerView) {
outOfBoundsPaint.color = color
canvas.drawRect(
0f, -parent.height.toFloat(), parent.width.toFloat(), 0f, outOfBoundsPaint
0f,
-parent.height.toFloat(),
parent.width.toFloat(),
0f,
outOfBoundsPaint
)
canvas.drawRect(
0f, parent.height.toFloat(), parent.width.toFloat(), parent.height * 2f, outOfBoundsPaint
0f,
parent.height.toFloat(),
parent.width.toFloat(),
parent.height * 2f,
outOfBoundsPaint
)
}
}

View File

@@ -189,7 +189,7 @@ class CustomChatColorCreatorPageFragment :
state.degrees,
intArrayOf(topEdgeColor.getColor(), bottomEdgeColor.getColor()),
floatArrayOf(0f, 1f)
),
)
)
preview.setChatColors(chatColor)
gradientTool.setSelectedEdge(state.selectedEdge)
@@ -255,14 +255,15 @@ class CustomChatColorCreatorPageFragment :
return listOf(0f, 1f).map {
ColorUtils.HSLToColor(
floatArrayOf(
hue, it, level
hue,
it,
level
)
)
}.toIntArray()
}
private fun calculateLightness(hue: Float, valueFor60To80: Float = 0.3f): Float {
val point1 = PointF()
val point2 = PointF()

View File

@@ -149,7 +149,6 @@ class CustomChatColorGradientToolView @JvmOverloads constructor(
}
override fun onTouchEvent(event: MotionEvent): Boolean {
if (event.action == MotionEvent.ACTION_CANCEL || event.action == MotionEvent.ACTION_UP) {
listener?.onGestureFinished()
} else if (event.action == MotionEvent.ACTION_DOWN) {
@@ -293,7 +292,6 @@ class CustomChatColorGradientToolView @JvmOverloads constructor(
distanceX: Float,
distanceY: Float
): Boolean {
val a = PointF(e2.getX(activePointerId) - center.x, e2.getY(activePointerId) - center.y)
val b = PointF(center.x, 0f)
val dot = a.dotProduct(b)

View File

@@ -17,7 +17,7 @@ data class DraftState(
val bodyRangesDraft: DraftTable.Draft? = null,
val quoteDraft: DraftTable.Draft? = null,
val locationDraft: DraftTable.Draft? = null,
val voiceNoteDraft: DraftTable.Draft? = null,
val voiceNoteDraft: DraftTable.Draft? = null
) {
fun copyAndClearDrafts(threadId: Long = this.threadId): DraftState {
@@ -41,7 +41,7 @@ data class DraftState(
bodyRangesDraft = drafts.getDraftOfType(DraftTable.Draft.BODY_RANGES),
quoteDraft = drafts.getDraftOfType(DraftTable.Draft.QUOTE),
locationDraft = drafts.getDraftOfType(DraftTable.Draft.LOCATION),
voiceNoteDraft = drafts.getDraftOfType(DraftTable.Draft.VOICE_NOTE),
voiceNoteDraft = drafts.getDraftOfType(DraftTable.Draft.VOICE_NOTE)
)
}
}

View File

@@ -100,7 +100,7 @@ class MultiselectForwardViewModel(
private val storySendRequirements: Stories.MediaTransform.SendRequirements,
private val records: List<MultiShareArgs>,
private val isSelectionOnly: Boolean,
private val repository: MultiselectForwardRepository,
private val repository: MultiselectForwardRepository
) : ViewModelProvider.Factory {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
return requireNotNull(modelClass.cast(MultiselectForwardViewModel(storySendRequirements, records, isSelectionOnly, repository)))

View File

@@ -50,7 +50,8 @@ class DistributionListTables constructor(context: Context?, databaseHelper: Sign
fun insertInitialDistributionListAtCreationTime(db: net.zetetic.database.sqlcipher.SQLiteDatabase) {
val recipientId = db.insert(
RecipientTable.TABLE_NAME, null,
RecipientTable.TABLE_NAME,
null,
contentValuesOf(
RecipientTable.GROUP_TYPE to RecipientTable.GroupType.DISTRIBUTION_LIST.id,
RecipientTable.DISTRIBUTION_LIST_ID to DistributionListId.MY_STORY_ID,
@@ -59,7 +60,8 @@ class DistributionListTables constructor(context: Context?, databaseHelper: Sign
)
)
db.insert(
ListTable.TABLE_NAME, null,
ListTable.TABLE_NAME,
null,
contentValuesOf(
ListTable.ID to DistributionListId.MY_STORY_ID,
ListTable.NAME to DistributionId.MY_STORY.toString(),
@@ -549,7 +551,9 @@ class DistributionListTables constructor(context: Context?, databaseHelper: Sign
arrayOf(ListTable.RECIPIENT_ID),
"${ListTable.DISTRIBUTION_ID} = ?",
SqlUtil.buildArgs(distributionId.toString()),
null, null, null
null,
null,
null
)?.use { cursor ->
if (cursor.moveToFirst()) {
RecipientId.from(CursorUtil.requireLong(cursor, ListTable.RECIPIENT_ID))
@@ -565,7 +569,9 @@ class DistributionListTables constructor(context: Context?, databaseHelper: Sign
arrayOf(ListTable.RECIPIENT_ID),
"${ListTable.ID} = ?",
SqlUtil.buildArgs(distributionListId),
null, null, null
null,
null,
null
)?.use { cursor ->
if (cursor.moveToFirst()) {
RecipientId.from(CursorUtil.requireLong(cursor, ListTable.RECIPIENT_ID))

View File

@@ -129,7 +129,8 @@ class LocalMetricsDatabase private constructor(
try {
event.splits.forEach { split ->
db.insert(
TABLE_NAME, null,
TABLE_NAME,
null,
ContentValues().apply {
put(CREATED_AT, event.createdAt)
put(EVENT_ID, event.eventId)

View File

@@ -83,7 +83,7 @@ class MessageSendLogTables constructor(context: Context?, databaseHelper: Signal
/** Created for [deleteEntriesForRecipient] */
val CREATE_INDEXES = arrayOf(
"CREATE INDEX msl_payload_date_sent_index ON $TABLE_NAME ($DATE_SENT)",
"CREATE INDEX msl_payload_date_sent_index ON $TABLE_NAME ($DATE_SENT)"
)
val CREATE_TRIGGERS = arrayOf(

View File

@@ -1,9 +1,11 @@
@file:Suppress("ktlint:filename")
package org.thoughtcrime.securesms.database
import android.content.ContentValues
import android.content.Context
import android.database.Cursor
import net.zetetic.database.sqlcipher.SQLiteConstraintException
import android.database.sqlite.SQLiteConstraintException
import org.signal.core.util.SqlUtil
import org.signal.core.util.requireBoolean
import org.signal.core.util.requireInt

View File

@@ -33,6 +33,7 @@ data class PnpDataSet(
this.removeIf { it.id == toUpdate.id }
this += update(toUpdate)
}
/**
* Applies the set of operations and returns the resulting dataset.
* Important: This only occurs _in memory_. You must still apply the operations to disk to persist them.

View File

@@ -784,7 +784,9 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
return if (result.isNotEmpty()) {
result[0]
} else null
} else {
null
}
}
fun markNeedsSyncWithoutRefresh(recipientIds: Collection<RecipientId>) {
@@ -2574,7 +2576,7 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
val fullData = partialData.copy(
e164Record = partialData.byE164?.let { getRecord(it) },
pniSidRecord = partialData.byPniSid?.let { getRecord(it) },
aciSidRecord = partialData.byAciSid?.let { getRecord(it) },
aciSidRecord = partialData.byAciSid?.let { getRecord(it) }
)
check(fullData.commonId == null)
@@ -4032,7 +4034,7 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
storiesCapability = Recipient.Capability.deserialize(Bitmask.read(capabilities, Capabilities.STORIES, Capabilities.BIT_LENGTH).toInt()),
giftBadgesCapability = Recipient.Capability.deserialize(Bitmask.read(capabilities, Capabilities.GIFT_BADGES, Capabilities.BIT_LENGTH).toInt()),
pnpCapability = Recipient.Capability.deserialize(Bitmask.read(capabilities, Capabilities.PNP, Capabilities.BIT_LENGTH).toInt()),
paymentActivation = Recipient.Capability.deserialize(Bitmask.read(capabilities, Capabilities.PAYMENT_ACTIVATION, Capabilities.BIT_LENGTH).toInt()),
paymentActivation = Recipient.Capability.deserialize(Bitmask.read(capabilities, Capabilities.PAYMENT_ACTIVATION, Capabilities.BIT_LENGTH).toInt())
)
}
@@ -4551,6 +4553,6 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
val oldIds: Set<RecipientId>,
val changedNumberId: RecipientId?,
val operations: List<PnpOperation>,
val breadCrumbs: List<String>,
val breadCrumbs: List<String>
)
}

View File

@@ -31,7 +31,7 @@ class SearchTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
@Language("sql")
val CREATE_TABLE = arrayOf(
"CREATE VIRTUAL TABLE $FTS_TABLE_NAME USING fts5($BODY, $THREAD_ID UNINDEXED, content=${MessageTable.TABLE_NAME}, content_rowid=${MessageTable.ID})",
"CREATE VIRTUAL TABLE $FTS_TABLE_NAME USING fts5($BODY, $THREAD_ID UNINDEXED, content=${MessageTable.TABLE_NAME}, content_rowid=${MessageTable.ID})"
)
@Language("sql")

View File

@@ -50,7 +50,7 @@ class SenderKeySharedTable internal constructor(context: Context?, databaseHelpe
ADDRESS to address.name,
DEVICE to address.deviceId,
DISTRIBUTION_ID to distributionId.toString(),
TIMESTAMP to System.currentTimeMillis(),
TIMESTAMP to System.currentTimeMillis()
)
db.insertWithOnConflict(TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_REPLACE)
}

View File

@@ -60,7 +60,7 @@ class SenderKeyTable internal constructor(context: Context?, databaseHelper: Sig
DEVICE to address.deviceId,
DISTRIBUTION_ID to distributionId.toString(),
RECORD to record.serialize(),
CREATED_AT to System.currentTimeMillis(),
CREATED_AT to System.currentTimeMillis()
)
db.insertWithOnConflict(TABLE_NAME, null, insertValues, SQLiteDatabase.CONFLICT_REPLACE)
}

View File

@@ -59,7 +59,10 @@ class SqlCipherErrorHandler(private val databaseName: String) : DatabaseErrorHan
try {
SQLiteDatabase.openOrCreateDatabase(
databaseFile.absolutePath, DatabaseSecretProvider.getOrCreateDatabaseSecret(context).asString(), null, null,
databaseFile.absolutePath,
DatabaseSecretProvider.getOrCreateDatabaseSecret(context).asString(),
null,
null,
object : SQLiteDatabaseHook {
override fun preKey(connection: SQLiteConnection) {}
override fun postKey(connection: SQLiteConnection) {

View File

@@ -46,7 +46,7 @@ class StorySendTable(context: Context, databaseHelper: SignalDatabase) : Databas
val CREATE_INDEXS = arrayOf(
"CREATE INDEX story_sends_recipient_id_sent_timestamp_allows_replies_index ON $TABLE_NAME ($RECIPIENT_ID, $SENT_TIMESTAMP, $ALLOWS_REPLIES)",
"CREATE INDEX story_sends_message_id_distribution_id_index ON $TABLE_NAME ($MESSAGE_ID, $DISTRIBUTION_ID)",
"CREATE INDEX story_sends_message_id_distribution_id_index ON $TABLE_NAME ($MESSAGE_ID, $DISTRIBUTION_ID)"
)
}

View File

@@ -1766,11 +1766,13 @@ class ThreadTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
private fun getSnippetUri(cursor: Cursor?): Uri? {
return if (cursor!!.isNull(cursor.getColumnIndexOrThrow(SNIPPET_URI))) {
null
} else try {
Uri.parse(cursor.getString(cursor.getColumnIndexOrThrow(SNIPPET_URI)))
} catch (e: IllegalArgumentException) {
Log.w(TAG, e)
null
} else {
try {
Uri.parse(cursor.getString(cursor.getColumnIndexOrThrow(SNIPPET_URI)))
} catch (e: IllegalArgumentException) {
Log.w(TAG, e)
null
}
}
}
@@ -1780,17 +1782,39 @@ class ThreadTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
}
data class Extra(
@field:JsonProperty @param:JsonProperty("isRevealable") val isViewOnce: Boolean = false,
@field:JsonProperty @param:JsonProperty("isSticker") val isSticker: Boolean = false,
@field:JsonProperty @param:JsonProperty("stickerEmoji") val stickerEmoji: String? = null,
@field:JsonProperty @param:JsonProperty("isAlbum") val isAlbum: Boolean = false,
@field:JsonProperty @param:JsonProperty("isRemoteDelete") val isRemoteDelete: Boolean = false,
@field:JsonProperty @param:JsonProperty("isMessageRequestAccepted") val isMessageRequestAccepted: Boolean = true,
@field:JsonProperty @param:JsonProperty("isGv2Invite") val isGv2Invite: Boolean = false,
@field:JsonProperty @param:JsonProperty("groupAddedBy") val groupAddedBy: String? = null,
@field:JsonProperty @param:JsonProperty("individualRecipientId") private val individualRecipientId: String,
@field:JsonProperty @param:JsonProperty("bodyRanges") val bodyRanges: String? = null,
@field:JsonProperty @param:JsonProperty("isScheduled") val isScheduled: Boolean = false
@field:JsonProperty
@param:JsonProperty("isRevealable")
val isViewOnce: Boolean = false,
@field:JsonProperty
@param:JsonProperty("isSticker")
val isSticker: Boolean = false,
@field:JsonProperty
@param:JsonProperty("stickerEmoji")
val stickerEmoji: String? = null,
@field:JsonProperty
@param:JsonProperty("isAlbum")
val isAlbum: Boolean = false,
@field:JsonProperty
@param:JsonProperty("isRemoteDelete")
val isRemoteDelete: Boolean = false,
@field:JsonProperty
@param:JsonProperty("isMessageRequestAccepted")
val isMessageRequestAccepted: Boolean = true,
@field:JsonProperty
@param:JsonProperty("isGv2Invite")
val isGv2Invite: Boolean = false,
@field:JsonProperty
@param:JsonProperty("groupAddedBy")
val groupAddedBy: String? = null,
@field:JsonProperty
@param:JsonProperty("individualRecipientId")
private val individualRecipientId: String,
@field:JsonProperty
@param:JsonProperty("bodyRanges")
val bodyRanges: String? = null,
@field:JsonProperty
@param:JsonProperty("isScheduled")
val isScheduled: Boolean = false
) {
fun getIndividualRecipientId(): String {

View File

@@ -2441,7 +2441,8 @@ object V149_LegacyMigrations : SignalDatabaseMigration {
)
val recipientId = db.insert(
"recipient", null,
"recipient",
null,
contentValuesOf(
"distribution_list_id" to 1L,
"storage_service_key" to Base64.encodeBytes(StorageSyncHelper.generateKey()),
@@ -2451,7 +2452,8 @@ object V149_LegacyMigrations : SignalDatabaseMigration {
val listUUID = UUID.randomUUID().toString()
db.insert(
"distribution_list", null,
"distribution_list",
null,
contentValuesOf(
"_id" to 1L,
"name" to listUUID,

View File

@@ -56,7 +56,7 @@ class EmojiImageRequest(
class EmojiFileRequest(
version: Int,
density: String,
name: String,
name: String
) : EmojiRequest {
override val uri: String = "$BASE_STATIC_BUCKET_URI/$version/$density/$name"
}

View File

@@ -92,6 +92,7 @@ class WebRtcViewModel(state: WebRtcServiceState) {
val identityChangedParticipants: Set<RecipientId> = state.callInfoState.identityChangedRecipients
val remoteDevicesCount: OptionalLong = state.callInfoState.remoteDevicesCount
val participantLimit: Long? = state.callInfoState.participantLimit
@get:JvmName("shouldRingGroup")
val ringGroup: Boolean = state.getCallSetupState(state.callInfoState.activePeer?.callId).ringGroup
val ringerRecipient: Recipient = state.getCallSetupState(state.callInfoState.activePeer?.callId).ringerRecipient

View File

@@ -35,7 +35,7 @@ data class FontManifest(
@JsonProperty("chinese-traditional") val chineseTraditional: FontScript?,
@JsonProperty("chinese-simplified") val chineseSimplified: FontScript?,
val arabic: FontScript?,
val japanese: FontScript?,
val japanese: FontScript?
)
/**

View File

@@ -91,7 +91,9 @@ object Fonts {
}
val fontDownloadKey = FontDownloadKey(
version, supportedScript, font
version,
supportedScript,
font
)
val taskInProgress = taskCache[fontDownloadKey]

View File

@@ -33,6 +33,6 @@ object TypefaceHelper {
SEMI_BOLD(600),
BOLD(700),
EXTRA_BOLD(800),
BLACK(900),
BLACK(900)
}
}

View File

@@ -405,7 +405,7 @@ class RetrieveRemoteAnnouncementsJob private constructor(private val force: Bool
@JsonProperty val linkText: String?,
@JsonProperty val title: String,
@JsonProperty val body: String,
@JsonProperty val callToActionText: String?,
@JsonProperty val callToActionText: String?
)
data class TranslatedRemoteMegaphone(
@@ -414,7 +414,7 @@ class RetrieveRemoteAnnouncementsJob private constructor(private val force: Bool
@JsonProperty val title: String,
@JsonProperty val body: String,
@JsonProperty val primaryCtaText: String?,
@JsonProperty val secondaryCtaText: String?,
@JsonProperty val secondaryCtaText: String?
)
class Factory : Job.Factory<RetrieveRemoteAnnouncementsJob> {

View File

@@ -18,7 +18,7 @@ import org.thoughtcrime.securesms.util.adapter.mapping.MappingViewHolder
class KeyboardStickerListAdapter(
private val glideRequests: GlideRequests,
private val eventListener: EventListener?,
private val allowApngAnimation: Boolean,
private val allowApngAnimation: Boolean
) : MappingAdapter() {
init {

View File

@@ -59,10 +59,13 @@ internal class AccountValues internal constructor(store: KeyValueStore) : Signal
@VisibleForTesting
const val KEY_E164 = "account.e164"
@VisibleForTesting
const val KEY_ACI = "account.aci"
@VisibleForTesting
const val KEY_PNI = "account.pni"
@VisibleForTesting
const val KEY_IS_REGISTERED = "account.is_registered"
}
@@ -84,7 +87,7 @@ internal class AccountValues internal constructor(store: KeyValueStore) : Signal
KEY_ACI_IDENTITY_PUBLIC_KEY,
KEY_ACI_IDENTITY_PRIVATE_KEY,
KEY_PNI_IDENTITY_PUBLIC_KEY,
KEY_PNI_IDENTITY_PRIVATE_KEY,
KEY_PNI_IDENTITY_PRIVATE_KEY
)
}

View File

@@ -25,6 +25,7 @@ class PlainTextSharedPrefsDataStore(private val context: Context) {
*/
var smsMigrationIdOffset: Long
get() = sharedPrefs.getLong(SMS_MIGRATION_ID_OFFSET, -1)
@SuppressLint("ApplySharedPref")
set(value) {
sharedPrefs.edit().putLong(SMS_MIGRATION_ID_OFFSET, value).commit()

View File

@@ -29,7 +29,7 @@ class MediaPreviewV2Adapter(fragment: Fragment) : FragmentStateAdapter(fragment)
MediaPreviewFragment.DATA_CONTENT_TYPE to contentType,
MediaPreviewFragment.DATA_SIZE to attachment.size,
MediaPreviewFragment.AUTO_PLAY to attachment.isVideoGif,
MediaPreviewFragment.VIDEO_GIF to attachment.isVideoGif,
MediaPreviewFragment.VIDEO_GIF to attachment.isVideoGif
)
val fragment = if (MediaUtil.isVideo(contentType)) {
VideoMediaPreviewFragment()

View File

@@ -12,7 +12,7 @@ data class MediaPreviewV2State(
val allMediaInAlbumRail: Boolean = false,
val leftIsRecent: Boolean = false,
val albums: Map<Long, List<Media>> = mapOf(),
val messageBodies: Map<Long, SpannableString> = mapOf(),
val messageBodies: Map<Long, SpannableString> = mapOf()
) {
enum class LoadState { INIT, DATA_LOADED, MEDIA_READY }
}

View File

@@ -44,7 +44,7 @@ class MediaPreviewV2ViewModel : ViewModel() {
mediaRecords = result.records,
messageBodies = result.messageBodies,
albums = albums,
loadState = MediaPreviewV2State.LoadState.DATA_LOADED,
loadState = MediaPreviewV2State.LoadState.DATA_LOADED
)
} else {
oldState.copy(
@@ -52,7 +52,7 @@ class MediaPreviewV2ViewModel : ViewModel() {
mediaRecords = result.records.reversed(),
messageBodies = result.messageBodies,
albums = albums.mapValues { it.value.reversed() },
loadState = MediaPreviewV2State.LoadState.DATA_LOADED,
loadState = MediaPreviewV2State.LoadState.DATA_LOADED
)
}
}

View File

@@ -11,7 +11,7 @@ import org.thoughtcrime.securesms.components.emoji.EmojiTextView
class ExpandingCaptionView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
defStyleAttr: Int = 0
) : EmojiTextView(context, attrs, defStyleAttr) {
var expandedHeight = 0

View File

@@ -434,7 +434,7 @@ class MediaSelectionActivity :
@JvmStatic
fun editor(
context: Context,
media: List<Media>,
media: List<Media>
): Intent {
return buildIntent(
context = context,

View File

@@ -153,7 +153,9 @@ class MediaSelectionRepository(context: Context) {
}.map { media ->
Stories.MediaTransform.clipMediaToStoryDuration(media)
}.flatten()
} else emptyList()
} else {
emptyList()
}
uploadRepository.applyMediaUpdates(oldToNewMediaMap, singleRecipient)
uploadRepository.updateCaptions(updatedMedia)

View File

@@ -34,7 +34,8 @@ class MediaGalleryViewModel(bucketId: String?, bucketTitle: String?, private val
repository.getFolders { folders ->
store.update { state ->
state.copy(
bucketId = bucketId, bucketTitle = bucketTitle,
bucketId = bucketId,
bucketTitle = bucketTitle,
items = folders.map {
MediaGallerySelectableItem.FolderModel(it)
}
@@ -45,7 +46,8 @@ class MediaGalleryViewModel(bucketId: String?, bucketTitle: String?, private val
repository.getMedia(bucketId) { media ->
store.update { state ->
state.copy(
bucketId = bucketId, bucketTitle = bucketTitle,
bucketId = bucketId,
bucketTitle = bucketTitle,
items = media.map {
MediaGallerySelectableItem.FileModel(it, false, 0)
}

View File

@@ -214,7 +214,6 @@ class AddMessageDialogFragment : KeyboardEntryDialogFragment(R.layout.v2_media_a
if (!recipient.isPushV2Group) {
annotations
} else {
val validRecipientIds: Set<String> = recipient.participantIds
.map { id -> MentionAnnotation.idToMentionAnnotationValue(id) }
.toSet()

View File

@@ -85,7 +85,7 @@ class MediaReviewFragment : Fragment(R.layout.v2_media_review_fragment), Schedul
private lateinit var progressWrapper: TouchInterceptingFrameLayout
private val navigator = MediaSelectionNavigator(
toGallery = R.id.action_mediaReviewFragment_to_mediaGalleryFragment,
toGallery = R.id.action_mediaReviewFragment_to_mediaGalleryFragment
)
private var animatorSet: AnimatorSet? = null
@@ -502,24 +502,22 @@ class MediaReviewFragment : Fragment(R.layout.v2_media_review_fragment), Schedul
}
private fun computeSendButtonAnimators(state: MediaSelectionState): List<Animator> {
val slideIn = listOf(
MediaReviewAnimatorController.getSlideInAnimator(sendButton),
MediaReviewAnimatorController.getSlideInAnimator(sendButton)
)
return slideIn + if (state.isTouchEnabled) {
listOf(
MediaReviewAnimatorController.getFadeInAnimator(sendButton, state.canSend),
MediaReviewAnimatorController.getFadeInAnimator(sendButton, state.canSend)
)
} else {
listOf(
MediaReviewAnimatorController.getFadeOutAnimator(sendButton, state.canSend),
MediaReviewAnimatorController.getFadeOutAnimator(sendButton, state.canSend)
)
}
}
private fun computeSaveButtonAnimators(state: MediaSelectionState): List<Animator> {
val slideIn = listOf(
MediaReviewAnimatorController.getSlideInAnimator(saveButton)
)

View File

@@ -24,7 +24,8 @@ class ChooseStoryTypeBottomSheet : DSLSettingsBottomSheetFragment(
textPref(
title = DSLSettingsText.from(
stringId = R.string.ChooseStoryTypeBottomSheet__choose_your_story_type,
DSLSettingsText.CenterModifier, DSLSettingsText.TitleMediumModifier
DSLSettingsText.CenterModifier,
DSLSettingsText.TitleMediumModifier
)
)

Some files were not shown because too many files have changed in this diff Show More