Upgrade ktlint and add twitter compose rules.

main
Alex Hart 2023-02-06 11:04:40 -04:00 zatwierdzone przez Greyson Parrelli
rodzic 52e9b31554
commit 605289aca4
174 zmienionych plików z 574 dodań i 373 usunięć

Wyświetl plik

@ -2,3 +2,4 @@ root = true
[*.kt]
indent_size = 2
twitter_compose_allowed_composition_locals=LocalExtendedColors

Wyświetl plik

@ -61,7 +61,7 @@ wire {
ktlint {
// Use a newer version to resolve https://github.com/JLLeitschuh/ktlint-gradle/issues/507
version = "0.43.2"
version = "0.47.1"
}
def canonicalVersionCode = 1213
@ -596,6 +596,7 @@ dependencies {
androidTestUtil testLibs.androidx.test.orchestrator
implementation project(':core-ui')
ktlintRuleset libs.ktlint.twitter.compose
}
def getLastCommitTimestamp() {

Wyświetl plik

@ -113,7 +113,7 @@ class ChangeNumberViewModelTest {
InstrumentationApplicationDependencyProvider.addMockWebRequestHandlers(
Get("/v1/devices") { MockResponse().success(MockProvider.primaryOnlyDeviceList) },
Put("/v1/accounts/number") { MockResponse().failure(500) },
Put("/v1/accounts/number") { MockResponse().failure(500) }
)
// WHEN

Wyświetl plik

@ -69,7 +69,7 @@ class ConversationItemPreviewer {
sentTimeMillis = System.currentTimeMillis(),
serverTimeMillis = System.currentTimeMillis(),
receivedTimeMillis = System.currentTimeMillis(),
attachments = PointerAttachment.forPointers(Optional.of(attachments)),
attachments = PointerAttachment.forPointers(Optional.of(attachments))
)
SignalDatabase.messages.insertSecureDecryptedMessageInbox(message, SignalDatabase.threads.getOrCreateThreadIdFor(other)).get()
@ -88,7 +88,7 @@ class ConversationItemPreviewer {
sentTimeMillis = System.currentTimeMillis(),
serverTimeMillis = System.currentTimeMillis(),
receivedTimeMillis = System.currentTimeMillis(),
attachments = PointerAttachment.forPointers(Optional.of(attachments)),
attachments = PointerAttachment.forPointers(Optional.of(attachments))
)
val insert = SignalDatabase.messages.insertSecureDecryptedMessageInbox(message, SignalDatabase.threads.getOrCreateThreadIdFor(other)).get()

Wyświetl plik

@ -128,7 +128,7 @@ class MmsTableTest_stories {
sentTimeMillis = 2,
serverTimeMillis = 2,
receivedTimeMillis = 2,
storyType = StoryType.STORY_WITH_REPLIES,
storyType = StoryType.STORY_WITH_REPLIES
),
-1L
).get().messageId
@ -160,7 +160,7 @@ class MmsTableTest_stories {
sentTimeMillis = System.currentTimeMillis(),
serverTimeMillis = 2,
receivedTimeMillis = 2,
storyType = StoryType.STORY_WITH_REPLIES,
storyType = StoryType.STORY_WITH_REPLIES
),
-1L
).get().messageId
@ -174,7 +174,7 @@ class MmsTableTest_stories {
sentTimeMillis = System.currentTimeMillis(),
serverTimeMillis = 2,
receivedTimeMillis = 2,
storyType = StoryType.STORY_WITH_REPLIES,
storyType = StoryType.STORY_WITH_REPLIES
),
-1L
).get().messageId
@ -219,7 +219,7 @@ class MmsTableTest_stories {
sentTimeMillis = 200,
serverTimeMillis = 2,
receivedTimeMillis = 2,
storyType = StoryType.STORY_WITH_REPLIES,
storyType = StoryType.STORY_WITH_REPLIES
),
-1L
)

Wyświetl plik

@ -296,7 +296,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
PnpChangeSet(
id = PnpIdResolver.PnpNoopId(result.id),
operations = linkedSetOf(
PnpOperation.SetE164(result.id, E164_A),
PnpOperation.SetE164(result.id, E164_A)
)
),
result.changeSet
@ -407,7 +407,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
val result = applyAndAssert(
listOf(
Input(E164_A, null, null),
Input(null, PNI_A, null),
Input(null, PNI_A, null)
),
Update(E164_A, PNI_A, null),
Output(E164_A, PNI_A, null)
@ -432,7 +432,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
val result = applyAndAssert(
listOf(
Input(E164_A, null, null),
Input(null, PNI_A, null),
Input(null, PNI_A, null)
),
Update(E164_A, PNI_A, ACI_A),
Output(E164_A, PNI_A, ACI_A)
@ -461,7 +461,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
val result = applyAndAssert(
listOf(
Input(E164_A, null, null),
Input(E164_B, PNI_A, null),
Input(E164_B, PNI_A, null)
),
Update(E164_A, PNI_A, null),
Output(E164_A, PNI_A, null)
@ -475,7 +475,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
PnpOperation.SetPni(
recipientId = result.firstId,
pni = PNI_A
),
)
)
),
result.changeSet
@ -487,7 +487,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
val result = applyAndAssert(
listOf(
Input(E164_A, PNI_B, null),
Input(null, PNI_A, null),
Input(null, PNI_A, null)
),
Update(E164_A, PNI_A, null),
Output(E164_A, PNI_A, null)
@ -501,7 +501,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
PnpOperation.Merge(
primaryId = result.firstId,
secondaryId = result.secondId
),
)
)
),
result.changeSet
@ -513,7 +513,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
val result = applyAndAssert(
listOf(
Input(E164_A, PNI_B, null),
Input(E164_B, PNI_A, null),
Input(E164_B, PNI_A, null)
),
Update(E164_A, PNI_A, null),
Output(E164_A, PNI_A, null)
@ -536,7 +536,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
val result = applyAndAssert(
listOf(
Input(E164_A, PNI_B, null, pniSession = true),
Input(E164_B, PNI_A, null, pniSession = true),
Input(E164_B, PNI_A, null, pniSession = true)
),
Update(E164_A, PNI_A, null),
Output(E164_A, PNI_A, null)
@ -561,7 +561,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
val result = applyAndAssert(
listOf(
Input(E164_A, PNI_A, null),
Input(null, null, ACI_A),
Input(null, null, ACI_A)
),
Update(E164_A, PNI_A, ACI_A),
Output(E164_A, PNI_A, ACI_A)
@ -574,7 +574,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
PnpOperation.Merge(
primaryId = result.secondId,
secondaryId = result.firstId
),
)
)
),
result.changeSet
@ -586,7 +586,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
val result = applyAndAssert(
listOf(
Input(E164_B, PNI_A, null),
Input(null, null, ACI_A),
Input(null, null, ACI_A)
),
Update(E164_A, PNI_A, ACI_A),
Output(E164_A, PNI_A, ACI_A)
@ -599,11 +599,11 @@ class RecipientTableTest_processPnpTupleToChangeSet {
PnpOperation.RemovePni(result.firstId),
PnpOperation.SetPni(
recipientId = result.secondId,
pni = PNI_A,
pni = PNI_A
),
PnpOperation.SetE164(
recipientId = result.secondId,
e164 = E164_A,
e164 = E164_A
)
)
),
@ -616,7 +616,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
val result = applyAndAssert(
listOf(
Input(E164_B, PNI_A, null),
Input(E164_C, null, ACI_A),
Input(E164_C, null, ACI_A)
),
Update(E164_A, PNI_A, ACI_A),
Output(E164_A, PNI_A, ACI_A)
@ -629,11 +629,11 @@ class RecipientTableTest_processPnpTupleToChangeSet {
PnpOperation.RemovePni(result.firstId),
PnpOperation.SetPni(
recipientId = result.secondId,
pni = PNI_A,
pni = PNI_A
),
PnpOperation.SetE164(
recipientId = result.secondId,
e164 = E164_A,
e164 = E164_A
),
PnpOperation.ChangeNumberInsert(
recipientId = result.secondId,
@ -651,7 +651,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
val result = applyAndAssert(
listOf(
Input(E164_A, PNI_A, null),
Input(E164_B, PNI_B, ACI_A),
Input(E164_B, PNI_B, ACI_A)
),
Update(E164_A, PNI_A, ACI_A),
Output(E164_A, PNI_A, ACI_A)
@ -683,7 +683,7 @@ class RecipientTableTest_processPnpTupleToChangeSet {
val result = applyAndAssert(
listOf(
Input(E164_A, PNI_A, null),
Input(E164_B, null, ACI_A),
Input(E164_B, null, ACI_A)
),
Update(E164_A, PNI_A, ACI_A),
Output(E164_A, PNI_A, ACI_A)
@ -726,7 +726,8 @@ class RecipientTableTest_processPnpTupleToChangeSet {
private fun insertMockSessionFor(account: ServiceId, address: ServiceId) {
SignalDatabase.rawDatabase.insert(
SessionTable.TABLE_NAME, null,
SessionTable.TABLE_NAME,
null,
contentValuesOf(
SessionTable.ACCOUNT_ID to account.toString(),
SessionTable.ADDRESS to address.toString(),

Wyświetl plik

@ -65,17 +65,17 @@ class StorySendTableTest {
messageId1 = MmsHelper.insert(
recipient = distributionListRecipient1,
storyType = StoryType.STORY_WITHOUT_REPLIES,
storyType = StoryType.STORY_WITHOUT_REPLIES
)
messageId2 = MmsHelper.insert(
recipient = distributionListRecipient2,
storyType = StoryType.STORY_WITH_REPLIES,
storyType = StoryType.STORY_WITH_REPLIES
)
messageId3 = MmsHelper.insert(
recipient = distributionListRecipient3,
storyType = StoryType.STORY_WITHOUT_REPLIES,
storyType = StoryType.STORY_WITHOUT_REPLIES
)
recipients6to15 = recipients1to10.takeLast(5) + recipients11to20.take(5)

Wyświetl plik

@ -69,7 +69,7 @@ class PreKeysSyncJobTest {
Put("/v2/keys/signed?identity=pni") { r ->
pniSignedPreKey = r.parsedRequestBody()
MockResponse().success()
},
}
)
// WHEN
@ -107,7 +107,7 @@ class PreKeysSyncJobTest {
InstrumentationApplicationDependencyProvider.addMockWebRequestHandlers(
Get("/v2/keys?identity=aci") { MockResponse().success(PreKeyStatus(100)) },
Get("/v2/keys?identity=pni") { MockResponse().success(PreKeyStatus(100)) },
Get("/v2/keys?identity=pni") { MockResponse().success(PreKeyStatus(100)) }
)
// WHEN
@ -134,7 +134,7 @@ class PreKeysSyncJobTest {
InstrumentationApplicationDependencyProvider.addMockWebRequestHandlers(
Get("/v2/keys?identity=aci") { MockResponse().success(PreKeyStatus(100)) },
Put("/v2/keys/signed?identity=pni") { MockResponse().success() },
Put("/v2/keys/signed?identity=pni") { MockResponse().success() }
)
// WHEN
@ -173,7 +173,7 @@ class PreKeysSyncJobTest {
Put("/v2/keys/?identity=pni") { r ->
pniPreKeyStateRequest = r.parsedRequestBody()
MockResponse().success()
},
}
)
// WHEN

Wyświetl plik

@ -13,7 +13,7 @@ class RxTestSchedulerRule(
val ioTestScheduler: TestScheduler = defaultTestScheduler,
val computationTestScheduler: TestScheduler = defaultTestScheduler,
val singleTestScheduler: TestScheduler = defaultTestScheduler,
val newThreadTestScheduler: TestScheduler = defaultTestScheduler,
val newThreadTestScheduler: TestScheduler = defaultTestScheduler
) : ExternalResource() {
override fun before() {

Wyświetl plik

@ -21,7 +21,7 @@ class TestProtos private constructor() {
}
fun metadata(
address: AddressProto = address().build(),
address: AddressProto = address().build()
): MetadataProto.Builder {
return MetadataProto.newBuilder()
.setAddress(address)

Wyświetl plik

@ -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) {

Wyświetl plik

@ -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)

Wyświetl plik

@ -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

Wyświetl plik

@ -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)
}
}
}

Wyświetl plik

@ -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) }
}

Wyświetl plik

@ -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) }
}

Wyświetl plik

@ -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
)
)

Wyświetl plik

@ -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

Wyświetl plik

@ -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
)
)

Wyświetl plik

@ -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
)
)

Wyświetl plik

@ -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)

Wyświetl plik

@ -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
)

Wyświetl plik

@ -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)

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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
}
}

Wyświetl plik

@ -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

Wyświetl plik

@ -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(

Wyświetl plik

@ -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)

Wyświetl plik

@ -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")

Wyświetl plik

@ -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 -> {

Wyświetl plik

@ -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

Wyświetl plik

@ -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(

Wyświetl plik

@ -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)),

Wyświetl plik

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

Wyświetl plik

@ -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)
)
)
}

Wyświetl plik

@ -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
)
/**

Wyświetl plik

@ -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),

Wyświetl plik

@ -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()

Wyświetl plik

@ -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)),

Wyświetl plik

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

Wyświetl plik

@ -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

Wyświetl plik

@ -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())

Wyświetl plik

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

Wyświetl plik

@ -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

Wyświetl plik

@ -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()) {

Wyświetl plik

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

Wyświetl plik

@ -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

Wyświetl plik

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

Wyświetl plik

@ -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()))

Wyświetl plik

@ -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 {

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -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

Wyświetl plik

@ -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 {

Wyświetl plik

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

Wyświetl plik

@ -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,

Wyświetl plik

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

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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()) {

Wyświetl plik

@ -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
)

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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

Wyświetl plik

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

Wyświetl plik

@ -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)

Wyświetl plik

@ -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)
)
}

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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
}

Wyświetl plik

@ -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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -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())
)
}

Wyświetl plik

@ -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
)
}
}

Wyświetl plik

@ -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()

Wyświetl plik

@ -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)

Wyświetl plik

@ -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)
)
}
}

Wyświetl plik

@ -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)))

Wyświetl plik

@ -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))

Wyświetl plik

@ -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)

Wyświetl plik

@ -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(

Wyświetl plik

@ -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

Wyświetl plik

@ -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.

Wyświetl plik

@ -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>
)
}

Wyświetl plik

@ -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")

Wyświetl plik

@ -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)
}

Wyświetl plik

@ -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)
}

Wyświetl plik

@ -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) {

Wyświetl plik

@ -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)"
)
}

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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,

Wyświetl plik

@ -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"
}

Wyświetl plik

@ -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

Wyświetl plik

@ -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?
)
/**

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -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> {

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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
)
}

Wyświetl plik

@ -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()

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