Skip to content

Commit

Permalink
Fix lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ianrumac committed Feb 19, 2025
1 parent 4618f7e commit 3ff1589
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/com/superwall/superapp/MainApplication.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.superwall.superapp

import android.annotation.SuppressLint
import android.app.Activity
import android.os.StrictMode
import android.os.StrictMode.ThreadPolicy
Expand Down Expand Up @@ -36,6 +37,7 @@ class MainApplication :
SuperwallDelegate {
var activity: WeakReference<Activity>? = null

@SuppressLint("NewApi")
override fun onCreate() {
super.onCreate()
StrictMode.setThreadPolicy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class UITestInfo(
object : SuperwallDelegate {
override fun handleSuperwallPlacement(eventInfo: SuperwallPlacementInfo) {
Log.e(
"\n!! SuperwallDelegate !! \n",
"\n!!SuperwallDelegate!!\n",
"\tEvent name:" + eventInfo.placement.rawName + "" +
",\n\tParams:" + eventInfo.params + "\n",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import com.superwall.sdk.delegate.PurchaseResult
import com.superwall.sdk.delegate.RestorationResult
import com.superwall.sdk.delegate.subscription_controller.PurchaseController
import com.superwall.sdk.models.entitlements.Entitlement
import com.superwall.sdk.models.entitlements.EntitlementStatus
import com.superwall.sdk.models.entitlements.SubscriptionStatus
import kotlinx.coroutines.CompletableDeferred

suspend fun Purchases.awaitProducts(productIds: List<String>): List<StoreProduct> {
Expand Down Expand Up @@ -125,16 +125,16 @@ class RevenueCatPurchaseController(
// Refetch the customer info on load
Purchases.sharedInstance.getCustomerInfoWith {
if (hasAnyActiveEntitlements(it)) {
setEntitlementStatus(
EntitlementStatus.Active(
setSubscriptionStatus(
SubscriptionStatus.Active(
it.entitlements.active
.map {
Entitlement(it.key, Entitlement.Type.SERVICE_LEVEL)
}.toSet(),
),
)
} else {
setEntitlementStatus(EntitlementStatus.Inactive)
setSubscriptionStatus(SubscriptionStatus.Inactive)
}
}
}
Expand All @@ -144,16 +144,16 @@ class RevenueCatPurchaseController(
*/
override fun onReceived(customerInfo: CustomerInfo) {
if (hasAnyActiveEntitlements(customerInfo)) {
setEntitlementStatus(
EntitlementStatus.Active(
setSubscriptionStatus(
SubscriptionStatus.Active(
customerInfo.entitlements.active
.map {
Entitlement(it.key, Entitlement.Type.SERVICE_LEVEL)
}.toSet(),
),
)
} else {
setEntitlementStatus(EntitlementStatus.Inactive)
setSubscriptionStatus(SubscriptionStatus.Inactive)
}
}

Expand Down Expand Up @@ -288,9 +288,9 @@ class RevenueCatPurchaseController(
return entitlements.isNotEmpty()
}

private fun setEntitlementStatus(entitlementStatus: EntitlementStatus) {
private fun setSubscriptionStatus(subscriptionStatus: SubscriptionStatus) {
if (Superwall.initialized) {
Superwall.instance.setEntitlementStatus(entitlementStatus)
Superwall.instance.setSubscriptionStatus(subscriptionStatus)
}
}
}

0 comments on commit 3ff1589

Please sign in to comment.