Skip to content

Commit

Permalink
Merge pull request #153 from superwall/develop
Browse files Browse the repository at this point in the history
1.2.2
  • Loading branch information
ianrumac authored Aug 16, 2024
2 parents 38ecca8 + 559315a commit 0b926fa
Show file tree
Hide file tree
Showing 57 changed files with 2,265 additions and 603 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

The changelog for `Superwall`. Also see the [releases](https://github.com/superwall/Superwall-Android/releases) on GitHub.

## 1.2.2

### Enhancements

- Adds support for multiple paywall URLs, in case one CDN provider fails.
- `ActivityEncapsulatable` now uses a WeakReference instead of a reference
- SW-2900: Adds Superwall.instance.localeIdentifier as a convenience variable that you can use to dynamically update the locale used for evaluating rules and getting localized paywalls.
- SW-2919: Adds a `custom_placement` event that you can attach to any element in the paywall with a dictionary of parameters. When the element is tapped, the event will be tracked. The name of the placement can be used to trigger a paywall and its params used in audience filters.
- Adds support for bottom sheet presentation style (DRAWER), no animation style and default animation.
- Adds `build_id` and `cache_key` to `PaywallInfo`.
- SW-2917: Tracks a `config_attributes` event after calling `Superwall.configure`, which contains info about the configuration of the SDK. This gets tracked whenever you set the delegate.
- Adds in device attributes tracking after setting the interface style override.
- To comply with new Google Play Billing requirements we now avoid setting empty `offerToken` for one-time purchases

## 1.2.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MockPaywallViewDelegate : PaywallViewCallback {
) {
paywallViewFinished?.invoke(paywall, result, shouldDismiss)
if (shouldDismiss) {
paywall.encapsulatingActivity?.finish()
paywall.encapsulatingActivity?.get()?.finish()
}
}

Expand Down
2 changes: 1 addition & 1 deletion superwall/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id("signing")
}

version = "1.2.1"
version = "1.2.2"

android {
compileSdk = 34
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.superwall.sdk.analytics.internal

import android.util.Log
import androidx.test.platform.app.InstrumentationRegistry
import com.superwall.sdk.Superwall
import com.superwall.sdk.analytics.internal.trackable.InternalSuperwallEvent
import com.superwall.sdk.identity.IdentityInfo
import com.superwall.sdk.network.Network
import com.superwall.sdk.network.device.DeviceHelper
import com.superwall.sdk.storage.LastPaywallView
import com.superwall.sdk.storage.Storage
import com.superwall.sdk.storage.TotalPaywallViews
import io.mockk.every
import io.mockk.mockk
import io.mockk.spyk
import kotlinx.coroutines.test.runTest
import org.junit.Test

class TrackingLogicTest {
val store =
mockk<Storage> {
every { apiKey } returns "pk_test_1234"
every { didTrackFirstSession } returns true
every { didTrackFirstSeen } returns true
every { get(LastPaywallView) } returns null
every { get(TotalPaywallViews) } returns 0
}
val network = mockk<Network>()

@Test
fun should_clean_up_attributes() =
runTest {
val ctx = InstrumentationRegistry.getInstrumentation().context
Superwall.configure(ctx, "pk_test_1234", null, null, null, null)
val deviceHelper =
spyk(
DeviceHelper(
ctx,
storage = store,
network = network,
factory =
object : DeviceHelper.Factory {
override suspend fun makeIdentityInfo(): IdentityInfo = IdentityInfo("aliasId", "appUserId")

override fun makeLocaleIdentifier(): String? = "en-US"
},
),
) {
every { appVersion } returns "123"
}
val attributes = deviceHelper.getTemplateDevice()
val event = InternalSuperwallEvent.DeviceAttributes(HashMap(attributes))
val res = TrackingLogic.processParameters(event, "appSessionId")
Log.e("res", res.toString())
assert(res.eventParams.isEmpty())
}
}
Loading

0 comments on commit 0b926fa

Please sign in to comment.