Skip to content

Ir/feature/web2app #221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
1fce436
Extract compose, add consumer proguard rules
ianrumac Sep 6, 2024
74b3eb6
Add compose to deploy script
ianrumac Sep 16, 2024
e53a414
Downgrade minSDK to version 22
ianrumac Sep 19, 2024
77be256
Add purchase and basic restore method
ianrumac Oct 14, 2024
4bc33cd
Extract interfaces properly for transaction code, add tests
ianrumac Oct 24, 2024
57fd610
Update tests
ianrumac Oct 24, 2024
cffc2e6
Wrap purchase methods into Result
ianrumac Oct 24, 2024
014c275
Clear up after rebase, fix transaction tracking and add source to event
ianrumac Nov 11, 2024
4556cd6
Downgrade minSDK to version 22
ianrumac Sep 19, 2024
dd1dcfd
Clear up after rebase, fix transaction tracking and add source to event
ianrumac Nov 11, 2024
250b132
Add observer mode to the purchases
ianrumac Nov 11, 2024
1fe02ec
Fix base64 handling
ianrumac Nov 16, 2024
4049ba6
Remove deprecated naming and cleanup the code
ianrumac Dec 12, 2024
c7bdd0d
Minor fixes
ianrumac Dec 13, 2024
23a8071
Fix UI tests and build issues after rebase
ianrumac Dec 13, 2024
06da3f6
Censor error-tracking
ianrumac Dec 13, 2024
420a442
Downgrade minSDK to version 22
ianrumac Sep 19, 2024
7cb0bdc
Clear up after rebase, fix transaction tracking and add source to event
ianrumac Nov 11, 2024
c1fe3ef
Migrate to entitlements from subscriptions
ianrumac Nov 25, 2024
bb6da25
Improve tests, fix issues with not observing when PC is not defined
ianrumac Nov 29, 2024
96b93c3
Fix tests for entitlements, fix CEL ignoring evaluation
ianrumac Dec 2, 2024
e04fe2c
Update how billing flow and observations work, minor entitlement refa…
ianrumac Dec 9, 2024
ee68e39
Fix entitlement bugs, update testing suite, cleanup some code
ianrumac Dec 12, 2024
631019c
Add sync version of methods, update KDoc and hide internals
ianrumac Sep 30, 2024
f1ff5ab
Change active entitlements to list
ianrumac Dec 13, 2024
0df3434
Fix issues after rebase, update notifications to include subtitle
ianrumac Dec 16, 2024
e0b431c
Bump version
ianrumac Dec 16, 2024
aae7027
Remove JS evaluator
ianrumac Dec 16, 2024
4f3a8ea
Fix issue with RuleEvaluator name change
ianrumac Dec 16, 2024
224caf4
Move back to release
ianrumac Dec 16, 2024
4209961
Add purchase token & fix minor issues with entitlements
ianrumac Dec 18, 2024
f5d321b
Add activeProducts to device template
ianrumac Dec 18, 2024
03b5b4e
Minor fixes to observer mode billing listening, adds to DeviceTemplate
ianrumac Dec 18, 2024
2352116
Improve documentation on entitlements, purchase and observer
ianrumac Dec 18, 2024
b6bf255
Add activeEntitlementsObject to device template
ianrumac Dec 18, 2024
c8b9d21
Fix testing utils
ianrumac Dec 18, 2024
4c4183a
Update changelog
ianrumac Dec 18, 2024
b1c79a3
Fix tests and add more debug logging
ianrumac Dec 19, 2024
2f17d3d
Add PaywallBuilder to replace getPaywallView with clearer API
ianrumac Dec 27, 2024
57a552b
Add callback version of 2.0 methods
ianrumac Dec 27, 2024
240d89a
Update changelog, ensure webview method safety
ianrumac Jan 10, 2025
9a6ed6f
Add more examples
ianrumac Dec 18, 2024
73b9d06
Update example activities to match examples properly
ianrumac Jan 11, 2025
22f140e
Add more UI tests
ianrumac Jan 11, 2025
85e4ee9
Update methods for paywall builder
ianrumac Jan 11, 2025
c62ce8e
Update tests, add new screenshots
ianrumac Jan 14, 2025
3a2c343
Create pixel snapshot screenshot tests
ianrumac Jan 14, 2025
74a824f
Change entitlements API to subscriptionStatus
ianrumac Jan 27, 2025
7e122ef
Change delegate naming
ianrumac Jan 28, 2025
3be19ba
Bump version
ianrumac Jan 28, 2025
420f8e9
Migrate to Placement naming
ianrumac Jan 30, 2025
fcf965f
Update naming to match iOS
ianrumac Feb 6, 2025
ed4a070
Extract interfaces properly for transaction code, add tests
ianrumac Oct 24, 2024
e597932
Remove deprecated naming and cleanup the code
ianrumac Dec 12, 2024
2b714df
Migrate to entitlements from subscriptions
ianrumac Nov 25, 2024
aa6d5ab
Add purchase token & fix minor issues with entitlements
ianrumac Dec 18, 2024
1149ec6
Add PaywallBuilder to replace getPaywallView with clearer API
ianrumac Dec 27, 2024
f98997a
Prepare basics for web2app
ianrumac Jan 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 10 additions & 2 deletions .github/workflows/build+test+deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,15 @@ jobs:
GPG_SIGNING_KEY_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSPHRASE }}
GPG_SIGNING_KEY_ID: ${{ secrets.GPG_SIGNING_KEY_ID }}
run: |
./gradlew publish \
./gradlew :superwall:publish \
-Paws_access_key_id=$AWS_ACCESS_KEY_ID \
-Paws_secret_access_key=$AWS_SECRET_ACCESS_KEY \
-PsonatypeUsername=$SONATYPE_USERNAME \
-PsonatypePassword=$SONATYPE_PASSWORD \
-Pgpg_signing_key_passphrase=$GPG_SIGNING_KEY_PASSPHRASE \
-Pgpg_signing_key_id=$GPG_SIGNING_KEY_ID

./gradlew :superwall-compose:publish \
-Paws_access_key_id=$AWS_ACCESS_KEY_ID \
-Paws_secret_access_key=$AWS_SECRET_ACCESS_KEY \
-PsonatypeUsername=$SONATYPE_USERNAME \
Expand Down Expand Up @@ -143,7 +151,7 @@ jobs:
GPG_SIGNING_KEY_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSPHRASE }}
GPG_SIGNING_KEY_ID: ${{ secrets.GPG_SIGNING_KEY_ID }}
run: |
./gradlew publish \
./gradlew :superwall:publish \
-Paws_access_key_id=$AWS_ACCESS_KEY_ID \
-Paws_secret_access_key=$AWS_SECRET_ACCESS_KEY \
-PsonatypeUsername=$SONATYPE_USERNAME \
Expand Down
69 changes: 69 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,75 @@

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

# 2.0.0-beta.4

## Breaking changes
- `SuperwallEvents.entitlementStatusDidChange` has been renamed to `SuperwallEvents.subscriptionStatusDidChange`
- `SuperwallDelegate.entitlementStatusDidChange` has been renamed to `SuperwallEvents.entitlementStatusDidChange`
- `TriggerResult.NoRuleMatch` and `TriggerResult.EventNotFound` have been renamed to `TriggerResult.NoAudienceMatch` and `TriggerResult.PlacementNotFound`
- `PresentationResult.NoRuleMatch` and `PresentationResult.EventNotFound` have been renamed to `PresentationResult.NoAudienceMatch` and `PresentationResult.PlacementNotFound`

## 2.0.0-beta.3

### Breaking changes

- `SuperwallEvent` has been renamed to `SuperwallPlacement`, belonging properties with `eventName` have been renamed to `placementName`
- `SuperwallEventInfo` has been renamed to `SuperwallPlacementInfo`
- `ComputedPropertyRequest.eventName` has been renamed to `ComputedPropertyRequest.placementName`
- `Superwall.instance.events` has been renamed to `Superwall.instance.placements`
- `LogScope.events` has been renamed to `LogScope.placements`
- `PaywallPresentationRequestStatusReason.EventNotFound` has been renamed to `PaywallPresentationRequestStatusReason.PlacementNotFound`
- `PaywallSkippedReason.EventNotFound` has been renamed to `PaywallSkippedReason.PlacementNotFound`
- `SuperwallDelegate.handleSuperwallEvent` method has been renamed to `SuperwallDelegate.handleSuperwallPlacement`

## 2.0.0-beta.2

### Breaking Changes

- API Changes:
- Migration of `setEntitlementStatus` to `setSubscriptionStatus`
- Exposing `Superwall.instance.entitlementsStatus`
- Migration of `SuperwallDelegate.entitlementStatusDidChange` to `SuperwallDelegate.subscriptionStatusDidChange`

## 2.0.0-beta.1

## Enhancements

- Add `PaywallBuilder` class as an alternative to existing `getPaywallView` method. This provides a cleaner API and an ability to change purchase loading bar and shimmer view.
- Add callback versions of new 2.0 methods
- Ensure safety of static webview calls that are known to fail randomly due to Webview's internal issues


## 2.0.0-Alpha.1

### Breaking Changes

- `SuperwallPaywallActivity` and `PaywallView` have been moved into `com.superwall.sdk.paywall.view` package from `com.superwall.sdk.paywall.vc` package.
- Removes `PaywallComposable` and Jetpack Compose support from the main SDK artifact in favor of `Superwall-Compose` module for Jetpack Compose support:
- You can find it at `com.superwall.sdk:superwall-compose:2.0.0-alpha`
- Usage remains the same as before, but now you need to include the `superwall-compose` module in your project.
- Removed methods previously marked as Deprecated
- Removes `SubscriptionStatus`, together with belonging update methods and `subscriptionStatusDidChange` callback.
- These are replaced with `EntitlementStatus` and `entitlementStatusDidChange` callback. You can find more details on this migration in our docs.

### Enhancements
- Adds `purchase` method to `Superwall` you can use to purchase products without having to resort on paywalls. To purchase a product you can pass it in one of the following objects:
- Google Play's `ProductDetails`
- Superwall's `StoreProduct` object
- Or a string containing the product identifier, i.e. `Superwall.instance.purchase("product_id:base_plan:offer")`

- Adds `restorePurchases` method to `Superwall` you can use to handle restoring purchases
- Adds `getProducts` method to `Superwall` you can use to retrieve a list of `ProductDetails` given the product ID, i.e. i.e. `Superwall.instance.purchase("product_id:base_plan:offer")`

- Adds support for observing purchases done outside of Superwall paywalls. You can now observe purchases done outside of Superwall paywalls by setting the `shouldObservePurchases` option to true and either:
- Manually by calling `Superwall.instance.observe(PurchasingObserverState)` or utility methods `Superwall.instance.observePurchaseStart/observePurchaseError/observePurchaseResult`
- Automatically by replacing `launchBillingFlow` with `launchBillingFlowWithSuperwall`. This will automatically observe purchases done outside of Superwall paywalls.
- Adds consumer proguard rules to enable consumer minification
- Reduces minSDK to 22
- Adds `purchaseToken` to purchase events
- `Superwall.instance` now provides blocking or callback based version of multiple calls, suffixed with `*Sync`
- Improves preloading performance and reduces impact on the main thread

## 1.5.5

## Fixes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The preferred installation method is with [Gradle](https://superwall.com/docs/in

<!-- (2) Add these lines -->
<activity
android:name="com.superwall.sdk.paywall.vc.SuperwallPaywallActivity"
android:name="com.superwall.sdk.paywall.view.SuperwallPaywallActivity"
android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar"
android:configChanges="orientation|screenSize|keyboardHidden">
</activity>
Expand Down
13 changes: 9 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {

defaultConfig {
applicationId = "com.superwall.superapp"
minSdk = 26
minSdk = 22
targetSdk = 34
versionCode = 2
versionName = "1.0.0"
Expand Down Expand Up @@ -52,8 +52,10 @@ android {
composeOptions {
kotlinCompilerExtensionVersion = "1.5.0"
}
packagingOptions {
resources.excludes += "/META-INF/{AL2.0,LGPL2.1}"
packaging {
resources.excludes += "META-INF/{AL2.0,LGPL2.1}"
resources.excludes += "META-INF/LICENSE.md"
resources.excludes += "META-INF/LICENSE-notice.md"
}
}

Expand All @@ -80,6 +82,7 @@ dependencies {

// Superwall
implementation(project(":superwall"))
implementation(project(":superwall-compose"))

// Test
testImplementation(libs.junit)
Expand All @@ -96,10 +99,12 @@ dependencies {
androidTestImplementation(libs.ui.test.junit4)
androidTestImplementation(libs.uiautomator)
androidTestImplementation(libs.test.runner)
androidTestImplementation(libs.mockk.android)
androidTestImplementation(libs.mockk.core)
androidTestUtil(libs.orchestrator)

// Debug
debugImplementation(libs.leakcanary.android)
// debugImplementation(libs.leakcanary.android)
debugImplementation(libs.ui.tooling)
debugImplementation(libs.ui.test.manifest)
}
21 changes: 0 additions & 21 deletions app/proguard-rules.pro

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package com.example.superapp.test

import android.app.Application
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import com.dropbox.dropshots.Dropshots
import com.dropbox.dropshots.ThresholdValidator
import com.example.superapp.utils.CustomComparator
import com.example.superapp.utils.awaitUntilShimmerDisappears
import com.example.superapp.utils.awaitUntilWebviewAppears
import com.example.superapp.utils.clickButtonWith
import com.example.superapp.utils.delayFor
import com.example.superapp.utils.goBack
import com.example.superapp.utils.paywallPresentsFor
import com.example.superapp.utils.screenshotFlow
import com.superwall.sdk.Superwall
import com.superwall.sdk.config.options.SuperwallOptions
import com.superwall.superapp.Keys
import com.superwall.superapp.test.UITestHandler
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import kotlin.time.Duration.Companion.milliseconds

@RunWith(AndroidJUnit4::class)
class AlternativeSetupTest {
@get:Rule
val dropshots =
Dropshots(
resultValidator = ThresholdValidator(0.01f),
imageComparator = CustomComparator(),
)

@Test
fun test_paywall_displays_on_session_start() =
with(dropshots) {
Superwall.configure(
getInstrumentation().targetContext.applicationContext as Application,
Keys.SESSION_START_API_KEY,
options =
SuperwallOptions().apply {
paywalls.shouldPreload = false
},
)
paywallPresentsFor(UITestHandler.test50Info)
}

@Test
fun test_paywall_displays_on_app_install() =
with(dropshots) {
Superwall.configure(
getInstrumentation().targetContext.applicationContext as Application,
Keys.APP_INSTALL_API_KEY,
options =
SuperwallOptions().apply {
paywalls.shouldPreload = false
},
)
paywallPresentsFor(UITestHandler.test52Info)
}

@Test
fun test_paywall_displays_on_app_launch() =
with(dropshots) {
Superwall.configure(
getInstrumentation().targetContext.applicationContext as Application,
Keys.APP_LAUNCH_API_KEY,
options =
SuperwallOptions().apply {
paywalls.shouldPreload = false
},
)
paywallPresentsFor(UITestHandler.test53Info)
}
/*
@Test
fun test_paywall_displays_on_deep_link() =
with(dropshots) {
Superwall.configure(
getInstrumentation().targetContext.applicationContext as Application,
Keys.DEEP_LINK_OPEN_API_KEY,
options =
SuperwallOptions().apply {
paywalls.shouldPreload = false
},
)
paywallPresentsFor(UITestHandler.test57Info)
}

*/

@Test
fun test_paywall_displays_on_decline() =
with(dropshots) {
Superwall.configure(
getInstrumentation().targetContext.applicationContext as Application,
Keys.PAYWALL_DECLINE_API_KEY,
options =
SuperwallOptions().apply {
paywalls.shouldPreload = false
},
)
screenshotFlow(UITestHandler.test59Info) {
step("1") {
awaitUntilShimmerDisappears()
awaitUntilWebviewAppears()
delayFor(300.milliseconds)
}
step("decline_for_survey") {
goBack()
delayFor(300.milliseconds)
}
step("decline_paywall") {
clickButtonWith("Too expensive")
awaitUntilShimmerDisappears()
awaitUntilWebviewAppears()
delayFor(300.milliseconds)
}
}
}
}
Loading