forked from signalapp/Signal-Android
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix derivation of RRP in RefreshAttributesJob. Fix incorrect RRP bugs and reglock state with reregistering. Update translations and other static files. Bump version to 7.28.1 Fix large message size calculation to use bytes. Update translations and other static files. Bump version to 7.28.2 Fix bug with ellipsizing on media messages. Bump version to 7.28.3 Translate missing recipients into unknown recipients. Bump version to 7.28.4 Treat all groups updates as directionless for backupv2. Remove Mockito dependency from project. Resolves signalapp#13838 Fix gv1 updates in backupv2. Fix empty profile names during backupv2 export. Move from AssertJ to AssertK. Resolves signalapp#13841 Fix dangling call ringers. Isolated tests for RecurringInAppPaymentRepository. Add verification metadata for windows. Don't show linked device bottom sheets if you've seen them before. Add internal UI for importing backup with different credentials. Improve internal backup import UI tool. Implement initial support for IAP data. Upgrade to AGP 8.7.2 Upgrade to AGP 8.7.3 Isolated tests for OneTimeInAppPaymentRepository. Move some things to lib.versions.toml Add AAPT metadata for witness verification. Use more plugin aliases. Upgrade to kotlin 2.1.0 Update a bunch of libraries. Update compileSdk to 35. Add .kotlin to gitignore. Update more libraries. Ensure that the V262 database migration runs. Update our base themes to avoid crashing MaterialAlertDialog. Revert "Improve table display in Spinner." This reverts commit df96b05. Fix cutoff string in help section. Fix typo in sql query. Add trigger definitions to logs. Capitalize log section title. Fix small gap in call menu. Update string translation comments. Fix leaked refreshActiveSubscription disposable. Fix ability to share text stories. Fixes signalapp#13855 Resolves signalapp#13879 Initialize database error handler with application instance. Fix text overflow length calculation. Fix overflow handling in condensed mode. Ensure filter is not retriggered when formatting. Fixes signalapp#13876 Fix proximity sensor for voice notes. Ensure new manifest is saved after rotation. Inline and enable the SSRE2 config. Exclude unregistered group members from invalid collisions check. Fixes signalapp#13866 Stop in-chat notification sounds if notifications are disabled. Fix bug showing null string on empty search. Fixes signalapp#13854 Resolves signalapp#13878 Revert "Update our base themes to avoid crashing MaterialAlertDialog." This reverts commit 446c7d6. Add missing required material3 dialog theme attribute. Disable the SSRE2 capability for now. Fix benchmark build. Add loading state to toggle switch and enforce when changing call link admin settings. Update translations and other static files. Update baseline profile. Co-Authored-By: Greyson Parrelli <[email protected]>
- Loading branch information
1 parent
43eba96
commit a90fdbc
Showing
252 changed files
with
18,290 additions
and
12,783 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,4 @@ dev.keystore | |
maps.key | ||
/local/ | ||
kls_database.db | ||
.kotlin |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
201 changes: 201 additions & 0 deletions
201
...c/androidTest/java/org/thoughtcrime/securesms/database/InAppPaymentSubscriberTableTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
package org.thoughtcrime.securesms.database | ||
|
||
import android.database.sqlite.SQLiteConstraintException | ||
import org.junit.Assert.fail | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.signal.core.util.count | ||
import org.signal.core.util.deleteAll | ||
import org.signal.core.util.readToSingleInt | ||
import org.thoughtcrime.securesms.components.settings.app.subscription.InAppPaymentsRepository | ||
import org.thoughtcrime.securesms.database.model.InAppPaymentSubscriberRecord | ||
import org.thoughtcrime.securesms.database.model.databaseprotos.InAppPaymentData | ||
import org.thoughtcrime.securesms.testing.SignalActivityRule | ||
import org.thoughtcrime.securesms.testing.assertIs | ||
import org.whispersystems.signalservice.api.storage.IAPSubscriptionId | ||
import org.whispersystems.signalservice.api.subscriptions.SubscriberId | ||
import java.util.Currency | ||
|
||
class InAppPaymentSubscriberTableTest { | ||
@get:Rule | ||
val harness = SignalActivityRule() | ||
|
||
@Before | ||
fun setUp() { | ||
SignalDatabase.inAppPaymentSubscribers.writableDatabase.deleteAll(InAppPaymentTable.TABLE_NAME) | ||
} | ||
|
||
@Test(expected = SQLiteConstraintException::class) | ||
fun givenASubscriberWithCurrencyAndIAPData_whenITryToInsert_thenIExpectException() { | ||
val subscriber = InAppPaymentSubscriberRecord( | ||
subscriberId = SubscriberId.generate(), | ||
currency = Currency.getInstance("USD"), | ||
type = InAppPaymentSubscriberRecord.Type.DONATION, | ||
requiresCancel = false, | ||
paymentMethodType = InAppPaymentData.PaymentMethodType.CARD, | ||
iapSubscriptionId = IAPSubscriptionId.GooglePlayBillingPurchaseToken("testToken") | ||
) | ||
|
||
SignalDatabase.inAppPaymentSubscribers.insertOrReplace(subscriber) | ||
|
||
fail("Expected a thrown exception.") | ||
} | ||
|
||
@Test(expected = SQLiteConstraintException::class) | ||
fun givenADonorSubscriberWithGoogleIAPData_whenITryToInsert_thenIExpectException() { | ||
val subscriber = InAppPaymentSubscriberRecord( | ||
subscriberId = SubscriberId.generate(), | ||
currency = null, | ||
type = InAppPaymentSubscriberRecord.Type.DONATION, | ||
requiresCancel = false, | ||
paymentMethodType = InAppPaymentData.PaymentMethodType.CARD, | ||
iapSubscriptionId = IAPSubscriptionId.GooglePlayBillingPurchaseToken("testToken") | ||
) | ||
|
||
SignalDatabase.inAppPaymentSubscribers.insertOrReplace(subscriber) | ||
|
||
fail("Expected a thrown exception.") | ||
} | ||
|
||
@Test(expected = SQLiteConstraintException::class) | ||
fun givenADonorSubscriberWithAppleIAPData_whenITryToInsert_thenIExpectException() { | ||
val subscriber = InAppPaymentSubscriberRecord( | ||
subscriberId = SubscriberId.generate(), | ||
currency = null, | ||
type = InAppPaymentSubscriberRecord.Type.DONATION, | ||
requiresCancel = false, | ||
paymentMethodType = InAppPaymentData.PaymentMethodType.CARD, | ||
iapSubscriptionId = IAPSubscriptionId.AppleIAPOriginalTransactionId(1000L) | ||
) | ||
|
||
SignalDatabase.inAppPaymentSubscribers.insertOrReplace(subscriber) | ||
|
||
fail("Expected a thrown exception.") | ||
} | ||
|
||
@Test(expected = SQLiteConstraintException::class) | ||
fun givenADonorSubscriberWithoutCurrency_whenITryToInsert_thenIExpectException() { | ||
val subscriber = InAppPaymentSubscriberRecord( | ||
subscriberId = SubscriberId.generate(), | ||
currency = null, | ||
type = InAppPaymentSubscriberRecord.Type.DONATION, | ||
requiresCancel = false, | ||
paymentMethodType = InAppPaymentData.PaymentMethodType.CARD, | ||
iapSubscriptionId = null | ||
) | ||
|
||
SignalDatabase.inAppPaymentSubscribers.insertOrReplace(subscriber) | ||
|
||
fail("Expected a thrown exception.") | ||
} | ||
|
||
@Test | ||
fun givenADonorSubscriberWithCurrency_whenITryToInsert_thenIExpectSuccess() { | ||
val subscriber = InAppPaymentSubscriberRecord( | ||
subscriberId = SubscriberId.generate(), | ||
currency = Currency.getInstance("USD"), | ||
type = InAppPaymentSubscriberRecord.Type.DONATION, | ||
requiresCancel = false, | ||
paymentMethodType = InAppPaymentData.PaymentMethodType.CARD, | ||
iapSubscriptionId = null | ||
) | ||
|
||
SignalDatabase.inAppPaymentSubscribers.insertOrReplace(subscriber) | ||
} | ||
|
||
@Test(expected = SQLiteConstraintException::class) | ||
fun givenABackupSubscriberWithCurrency_whenITryToInsert_thenIExpectException() { | ||
val subscriber = InAppPaymentSubscriberRecord( | ||
subscriberId = SubscriberId.generate(), | ||
currency = Currency.getInstance("USD"), | ||
type = InAppPaymentSubscriberRecord.Type.BACKUP, | ||
requiresCancel = false, | ||
paymentMethodType = InAppPaymentData.PaymentMethodType.GOOGLE_PLAY_BILLING, | ||
iapSubscriptionId = null | ||
) | ||
|
||
SignalDatabase.inAppPaymentSubscribers.insertOrReplace(subscriber) | ||
|
||
fail("Expected a thrown exception.") | ||
} | ||
|
||
@Test(expected = SQLiteConstraintException::class) | ||
fun givenABackupSubscriberWithoutIAPData_whenITryToInsert_thenIExpectException() { | ||
val subscriber = InAppPaymentSubscriberRecord( | ||
subscriberId = SubscriberId.generate(), | ||
currency = null, | ||
type = InAppPaymentSubscriberRecord.Type.BACKUP, | ||
requiresCancel = false, | ||
paymentMethodType = InAppPaymentData.PaymentMethodType.GOOGLE_PLAY_BILLING, | ||
iapSubscriptionId = null | ||
) | ||
|
||
SignalDatabase.inAppPaymentSubscribers.insertOrReplace(subscriber) | ||
} | ||
|
||
@Test | ||
fun givenABackupSubscriberWithGoogleIAPData_whenITryToInsert_thenIExpectSuccess() { | ||
val subscriber = InAppPaymentSubscriberRecord( | ||
subscriberId = SubscriberId.generate(), | ||
currency = null, | ||
type = InAppPaymentSubscriberRecord.Type.BACKUP, | ||
requiresCancel = false, | ||
paymentMethodType = InAppPaymentData.PaymentMethodType.GOOGLE_PLAY_BILLING, | ||
iapSubscriptionId = IAPSubscriptionId.GooglePlayBillingPurchaseToken("testToken") | ||
) | ||
|
||
SignalDatabase.inAppPaymentSubscribers.insertOrReplace(subscriber) | ||
} | ||
|
||
@Test | ||
fun givenABackupSubscriberWithAppleIAPData_whenITryToInsert_thenIExpectSuccess() { | ||
val subscriber = InAppPaymentSubscriberRecord( | ||
subscriberId = SubscriberId.generate(), | ||
currency = null, | ||
type = InAppPaymentSubscriberRecord.Type.BACKUP, | ||
requiresCancel = false, | ||
paymentMethodType = InAppPaymentData.PaymentMethodType.GOOGLE_PLAY_BILLING, | ||
iapSubscriptionId = IAPSubscriptionId.AppleIAPOriginalTransactionId(1000L) | ||
) | ||
|
||
SignalDatabase.inAppPaymentSubscribers.insertOrReplace(subscriber) | ||
} | ||
|
||
@Test | ||
fun givenABackupSubscriberWithAppleIAPData_whenITryToInsertAGoogleSubscriber_thenIExpectSuccess() { | ||
val appleSubscriber = InAppPaymentSubscriberRecord( | ||
subscriberId = SubscriberId.generate(), | ||
currency = null, | ||
type = InAppPaymentSubscriberRecord.Type.BACKUP, | ||
requiresCancel = false, | ||
paymentMethodType = InAppPaymentData.PaymentMethodType.GOOGLE_PLAY_BILLING, | ||
iapSubscriptionId = IAPSubscriptionId.AppleIAPOriginalTransactionId(1000L) | ||
) | ||
|
||
SignalDatabase.inAppPaymentSubscribers.insertOrReplace(appleSubscriber) | ||
|
||
val googleSubscriber = InAppPaymentSubscriberRecord( | ||
subscriberId = SubscriberId.generate(), | ||
currency = null, | ||
type = InAppPaymentSubscriberRecord.Type.BACKUP, | ||
requiresCancel = false, | ||
paymentMethodType = InAppPaymentData.PaymentMethodType.GOOGLE_PLAY_BILLING, | ||
iapSubscriptionId = IAPSubscriptionId.GooglePlayBillingPurchaseToken("testToken") | ||
) | ||
|
||
SignalDatabase.inAppPaymentSubscribers.insertOrReplace(googleSubscriber) | ||
|
||
val subscriberCount = SignalDatabase.inAppPaymentSubscribers.readableDatabase.count() | ||
.from(InAppPaymentSubscriberTable.TABLE_NAME) | ||
.run() | ||
.readToSingleInt() | ||
|
||
subscriberCount assertIs 1 | ||
|
||
val subscriber = InAppPaymentsRepository.requireSubscriber(InAppPaymentSubscriberRecord.Type.BACKUP) | ||
subscriber.iapSubscriptionId?.originalTransactionId assertIs null | ||
subscriber.iapSubscriptionId?.purchaseToken assertIs "testToken" | ||
subscriber.subscriberId assertIs googleSubscriber.subscriberId | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.