Skip to content

Commit 68a7891

Browse files
Add backupsSubscriberData, use to set optimizeOnDeviceStorage
1 parent 89f4e76 commit 68a7891

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+387
-293
lines changed

src/main/kotlin/tests/AccountDataTestCase.kt

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,24 @@ object AccountDataTestCase : TestCase("account_data") {
4040
color = someEnum(AccountData.UsernameLink.Color::class.java, excluding = AccountData.UsernameLink.Color.UNKNOWN)
4141
)
4242
}.nullable()
43-
4443
val usernameLink = some(usernameLinkGenerator)
4544
val username = some(Generators.usernames())
4645

46+
val backupsSubscriberDataGenerator: Generator<AccountData.IAPSubscriberData?> = Generators.permutation<AccountData.IAPSubscriberData?> {
47+
val (purchaseToken, originalTransactionId) = oneOf(
48+
Generators.nonEmptyStrings() as Generator<Any?>,
49+
Generators.longs(lower = 1) as Generator<Any?>
50+
)
51+
52+
frames += AccountData.IAPSubscriberData(
53+
subscriberId = someBytes(32).toByteString(),
54+
purchaseToken = someOneOf(purchaseToken),
55+
originalTransactionId = someOneOf(originalTransactionId)
56+
)
57+
}.nullable()
58+
val backupsSubscriberData = some(backupsSubscriberDataGenerator)
59+
val optimizeOnDeviceStorage = someBoolean()
60+
4761
frames += Frame(
4862
account = AccountData(
4963
profileKey = someBytes(32).toByteString(),
@@ -64,14 +78,6 @@ object AccountDataTestCase : TestCase("account_data") {
6478
manuallyCancelled = someBoolean()
6579
)
6680
},
67-
// TODO Currently in flux, unclear if this is even needed anymore
68-
// backupsSubscriberData = someNullablePermutation {
69-
// frames += AccountData.SubscriberData(
70-
// subscriberId = someBytes(32).toByteString(),
71-
// currencyCode = some(Generators.list("USD", "EUR", "GBP")),
72-
// manuallyCancelled = someBoolean()
73-
// )
74-
// },
7581
accountSettings = AccountData.AccountSettings(
7682
readReceipts = someBoolean(),
7783
sealedSenderIndicators = someBoolean(),
@@ -118,8 +124,14 @@ object AccountDataTestCase : TestCase("account_data") {
118124
)
119125
)
120126
),
121-
optimizeOnDeviceStorage = someBoolean()
122-
)
127+
// This setting is only available if we are subscribed to Backups.
128+
optimizeOnDeviceStorage = if (backupsSubscriberData != null) {
129+
optimizeOnDeviceStorage
130+
} else {
131+
false
132+
}
133+
),
134+
backupsSubscriberData = backupsSubscriberData
123135
)
124136
)
125137

-4 Bytes
Binary file not shown.

test-cases/account_data_00.txtproto

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ Frame {
1414
customChatColors = [
1515
CustomChatColor {
1616
id = 1
17-
solid = -7820003
17+
solid = -7295395
1818
},
1919
CustomChatColor {
2020
id = 2
21-
solid = -1309265
21+
solid = -5112496
2222
},
2323
CustomChatColor {
2424
gradient = Gradient {
25-
angle = 159
25+
angle = 239
2626
colors = [
27-
-5726839,
28-
-4759389
27+
-577122,
28+
-6739874
2929
]
3030
positions = [
3131
0.0,
@@ -43,20 +43,19 @@ Frame {
4343
keepMutedChatsArchived = true
4444
linkPreviews = true
4545
notDiscoverableByPhoneNumber = true
46-
optimizeOnDeviceStorage = true
4746
phoneNumberSharingMode = PhoneNumberSharingMode.EVERYBODY
4847
preferContactAvatars = true
4948
readReceipts = true
5049
sealedSenderIndicators = true
5150
storiesDisabled = true
5251
storyViewReceiptsEnabled = true
5352
typingIndicators = true
54-
universalExpireTimerSeconds = 314441250
53+
universalExpireTimerSeconds = 6518363
5554
}
5655
avatarUrlPath = ""
5756
familyName = ""
5857
givenName = ""
59-
profileKey = <46d547630e64d7294f139f80950d8ea9f18dbe1090e3527a69f4f6360b7e939b>
58+
profileKey = <ba7d509eae665c54f4c8fe4c6906b3bc1dd6ad80d35172d511d6299d176b795a>
6059
svrPin = "1234"
6160
}
6261
}
48 Bytes
Binary file not shown.

test-cases/account_data_01.txtproto

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ Frame {
1414
customChatColors = [
1515
CustomChatColor {
1616
id = 1
17-
solid = -4506046
17+
solid = -6364780
1818
},
1919
CustomChatColor {
2020
id = 2
21-
solid = -298204
21+
solid = -8932443
2222
},
2323
CustomChatColor {
2424
gradient = Gradient {
25-
angle = 181
25+
angle = 335
2626
colors = [
27-
-12250776,
28-
-2367362
27+
-5320582,
28+
-10997243
2929
]
3030
positions = [
3131
0.0,
@@ -50,17 +50,21 @@ Frame {
5050
}
5151
}
5252
phoneNumberSharingMode = PhoneNumberSharingMode.NOBODY
53-
universalExpireTimerSeconds = 1776497293
53+
universalExpireTimerSeconds = 708390689
54+
}
55+
avatarUrlPath = "https://signal.org/CfVdHWJ"
56+
backupsSubscriberData = IAPSubscriberData {
57+
purchaseToken = "HLOokMZPmjwqTJ"
58+
subscriberId = <7ba7623758493e1bb0268c5da867e8b454754359d4337a3cc4f08757f22b6799>
5459
}
55-
avatarUrlPath = "https://signal.org/PMVYoUEqXx"
5660
donationSubscriberData = SubscriberData {
5761
currencyCode = "USD"
5862
manuallyCancelled = true
59-
subscriberId = <98749f3fd268ebfe4cb7634ea9ab33f68328b1520712b5adab5ce2a61c11f4a5>
63+
subscriberId = <0cc51a91522bafdb5ea278fda6c9d64b759ef2a75d430cc52c50e0151c6530fd>
6064
}
61-
familyName = "Gallegos"
62-
givenName = "Kristen"
63-
profileKey = <46d547630e64d7294f139f80950d8ea9f18dbe1090e3527a69f4f6360b7e939b>
65+
familyName = "Roberts"
66+
givenName = "Candice"
67+
profileKey = <ba7d509eae665c54f4c8fe4c6906b3bc1dd6ad80d35172d511d6299d176b795a>
6468
svrPin = "123456"
6569
username = "emery.8742"
6670
usernameLink = UsernameLink {
39 Bytes
Binary file not shown.

test-cases/account_data_02.txtproto

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ Frame {
1414
customChatColors = [
1515
CustomChatColor {
1616
id = 1
17-
solid = -6607516
17+
solid = -7668588
1818
},
1919
CustomChatColor {
2020
id = 2
21-
solid = -3877931
21+
solid = -5756433
2222
},
2323
CustomChatColor {
2424
gradient = Gradient {
25-
angle = 347
25+
angle = 165
2626
colors = [
27-
-1570527,
28-
-12481143
27+
-8820984,
28+
-792050
2929
]
3030
positions = [
3131
0.0,
@@ -64,16 +64,20 @@ Frame {
6464
storiesDisabled = true
6565
storyViewReceiptsEnabled = true
6666
typingIndicators = true
67-
universalExpireTimerSeconds = 844099452
67+
universalExpireTimerSeconds = 1049338212
68+
}
69+
avatarUrlPath = "https://signal.org/taPHwAvo"
70+
backupsSubscriberData = IAPSubscriberData {
71+
purchaseToken = "PMVYoUEqXx"
72+
subscriberId = <cd2f910df566824710636ce8af1b499244fc7b251b65c6d3f9de9f64c5fbf0ff>
6873
}
69-
avatarUrlPath = "https://signal.org/DXOZYcESWutf"
7074
donationSubscriberData = SubscriberData {
7175
currencyCode = "EUR"
72-
subscriberId = <36327e78d6bf0ffb1ec67707ad43f2d167963887aa1d063c8db57633fa5483f3>
76+
subscriberId = <0e366ee6b4982ddc1b1b12d3edc997f4505b2d0c464633445cb1f9a68a644847>
7377
}
74-
familyName = "Kramer"
75-
givenName = "Janelle"
76-
profileKey = <46d547630e64d7294f139f80950d8ea9f18dbe1090e3527a69f4f6360b7e939b>
78+
familyName = "Hyde"
79+
givenName = "Evan"
80+
profileKey = <ba7d509eae665c54f4c8fe4c6906b3bc1dd6ad80d35172d511d6299d176b795a>
7781
svrPin = "abcdefg"
7882
username = "sabrina.06"
7983
usernameLink = UsernameLink {
38 Bytes
Binary file not shown.

test-cases/account_data_03.txtproto

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ Frame {
1414
customChatColors = [
1515
CustomChatColor {
1616
id = 1
17-
solid = -7820003
17+
solid = -7295395
1818
},
1919
CustomChatColor {
2020
id = 2
21-
solid = -1309265
21+
solid = -5112496
2222
},
2323
CustomChatColor {
2424
gradient = Gradient {
25-
angle = 159
25+
angle = 239
2626
colors = [
27-
-5726839,
28-
-4759389
27+
-577122,
28+
-6739874
2929
]
3030
positions = [
3131
0.0,
@@ -52,17 +52,20 @@ Frame {
5252
}
5353
}
5454
phoneNumberSharingMode = PhoneNumberSharingMode.NOBODY
55-
universalExpireTimerSeconds = 314441250
55+
universalExpireTimerSeconds = 6518363
5656
}
5757
avatarUrlPath = ""
58+
backupsSubscriberData = IAPSubscriberData {
59+
subscriberId = <1a96e707c00259c7264eb5417dfb20d9de3b2c342e2771dbc69f3f56cf981fd6>
60+
}
5861
donationSubscriberData = SubscriberData {
5962
currencyCode = "GBP"
6063
manuallyCancelled = true
61-
subscriberId = <af4b15d212e5d730c3c226dc221e8fec3522a5e4cd2f910df566824710636ce8>
64+
subscriberId = <ea8e9fff77a691f7effe2df539419f38d11a00b7a2c95354552e30c89a57440e>
6265
}
63-
familyName = "Woods"
64-
givenName = "Mavis"
65-
profileKey = <46d547630e64d7294f139f80950d8ea9f18dbe1090e3527a69f4f6360b7e939b>
66+
familyName = "Snow"
67+
givenName = "Jasmine"
68+
profileKey = <ba7d509eae665c54f4c8fe4c6906b3bc1dd6ad80d35172d511d6299d176b795a>
6669
svrPin = "안녕하세요, 세계"
6770
username = "ryan.8012"
6871
usernameLink = UsernameLink {
43 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)