Skip to content

Commit 0f5ec1b

Browse files
committed
Address review comments: drain IAP callbacks on failure, drop no-op gradle excludes, prune unused strings
1 parent 7a8bf2a commit 0f5ec1b

4 files changed

Lines changed: 17 additions & 14 deletions

File tree

data/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,11 @@ dependencies {
163163
addToFlavors(googleFlavors, dependencies.googlePlayServicesAuth) {
164164
exclude module: 'guava-jdk5'
165165
exclude module: 'httpclient'
166-
exclude module: 'googlehttpclient'
167166
exclude group: "com.google.http-client", module: "google-http-client"
168167
}
169168
addToFlavors(googleFlavors, dependencies.googleApiServicesDrive) {
170169
exclude module: 'guava-jdk5'
171170
exclude module: 'httpclient'
172-
exclude module: 'googlehttpclient'
173171
exclude group: "com.google.http-client", module: "google-http-client"
174172
}
175173
addToFlavors(googleFlavors + ['accrescent'], dependencies.googleApiClientAndroid) {

presentation/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ dependencies {
219219
addToFlavors(googleFlavors, dependencies.googleApiServicesDrive) {
220220
exclude module: 'guava-jdk5'
221221
exclude module: 'httpclient'
222-
exclude module: 'googlehttpclient'
223222
exclude group: "com.google.http-client", module: "google-http-client"
224223
}
225224
addToFlavors(googleFlavors, dependencies.googleApiClientAndroid) {

presentation/src/main/res/values/strings.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@
101101
<string name="screen_welcome_trial_button" translatable="false">@string/screen_license_check_trial_price</string>
102102
<string name="next">Next</string>
103103
<string name="back">Back</string>
104-
<string name="screen_settings_license_unlock_prompt">Unlock write access</string>
105-
<string name="screen_settings_license_unlock_summary">Tap to enter your license key.</string>
106-
<string name="screen_settings_license_unlocked_iap">Write access is unlocked</string>
107104

108105
<!-- # clouds -->
109106

@@ -545,7 +542,7 @@
545542
<string name="dialog_biometric_auth_key_invalidated_neutral_button" translatable="false">@string/dialog_unable_to_share_positive_button</string>
546543

547544
<string name="dialog_enter_license_title">Provide a valid license</string>
548-
<string name="dialog_enter_license_content">A license can be purchased on <a href="https://cryptomator.org/android/">https://cryptomator.org/android/</a> or enter your existing Android License Key</string>
545+
<string name="dialog_enter_license_content">Purchase a license at <a href="https://cryptomator.org/android/">https://cryptomator.org/android/</a> or enter your existing Android license key.</string>
549546
<string name="dialog_enter_license_not_valid_content">The provided license isn\'t valid. Make sure you entered it correctly.</string>
550547
<string name="dialog_enter_license_not_valid_content_desktop_supporter_certificate">The provided key is a desktop supporter certificate. Please enter a valid license.</string>
551548
<string name="dialog_enter_license_no_content">No license provided. Please enter a valid license.</string>

presentation/src/playstoreiap/java/org/cryptomator/presentation/service/IapBillingService.kt

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,15 @@ class IapBillingService : Service(), PurchasesUpdatedListener {
5555
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
5656
Timber.tag("IapBillingService").d("Billing setup successful")
5757
queryExistingPurchases()
58-
synchronized(pendingProductDetailsCallbacks) {
59-
if (pendingProductDetailsCallbacks.isNotEmpty()) {
60-
val callbacks = ArrayList(pendingProductDetailsCallbacks)
61-
pendingProductDetailsCallbacks.clear()
62-
queryProductDetails { products ->
63-
callbacks.forEach { it(products) }
64-
}
58+
val callbacks = drainPendingProductDetailsCallbacks()
59+
if (callbacks.isNotEmpty()) {
60+
queryProductDetails { products ->
61+
callbacks.forEach { it(products) }
6562
}
6663
}
6764
} else {
6865
Timber.tag("IapBillingService").e("Billing setup not successful, error: %d", billingResult.responseCode)
66+
drainPendingProductDetailsCallbacks().forEach { it(emptyList()) }
6967
}
7068
}
7169

@@ -75,6 +73,17 @@ class IapBillingService : Service(), PurchasesUpdatedListener {
7573
})
7674
}
7775

76+
private fun drainPendingProductDetailsCallbacks(): List<(List<ProductInfo>) -> Unit> {
77+
synchronized(pendingProductDetailsCallbacks) {
78+
if (pendingProductDetailsCallbacks.isEmpty()) {
79+
return emptyList()
80+
}
81+
val snapshot = ArrayList(pendingProductDetailsCallbacks)
82+
pendingProductDetailsCallbacks.clear()
83+
return snapshot
84+
}
85+
}
86+
7887
override fun onCreate() {
7988
super.onCreate()
8089
Timber.tag("IapBillingService").d("Service created")

0 commit comments

Comments
 (0)