Skip to content

Add optional RevenueCat Pro subscription with Firebase Auth - #534

Merged
apps4av merged 15 commits into
masterfrom
add-revenuecat-pro
Jun 8, 2026
Merged

Add optional RevenueCat Pro subscription with Firebase Auth#534
apps4av merged 15 commits into
masterfrom
add-revenuecat-pro

Conversation

@apps4av

@apps4av apps4av commented May 25, 2026

Copy link
Copy Markdown
Owner

Mirrors avarex's Pro Services flow on Avare:

  • AvareApplication initializes Firebase and RevenueCat, and syncs any cached Firebase user identity into RevenueCat on startup.
  • New ProActivity hosts the Avarex-style "sign in / register, then subscribe" flow via FirebaseUI Auth (email provider) and the RevenueCat PaywallActivityLauncher, gated by the "Pro" entitlement.
  • MainActivity shows a soft startup dialog (UseCountDialog) that Continue-gates non-subscribers for one second per launch (capped at 30) and offers a Subscribe path into ProActivity. Subscribers skip the dialog entirely.
  • ProServicesPreference adds a permanent "Pro Subscription" entry in Settings that opens ProActivity at any time.

RevenueCat and Firebase are both treated as optional: missing API key, google-services config, or network are swallowed so the app keeps working for non-subscribers. minSdk bumped to 24 to satisfy the RevenueCat Paywalls UI library.

apps4av and others added 15 commits May 25, 2026 11:34
Mirrors avarex's Pro Services flow on Avare:
- AvareApplication initializes Firebase and RevenueCat, and syncs any
  cached Firebase user identity into RevenueCat on startup.
- New ProActivity hosts the Avarex-style "sign in / register, then
  subscribe" flow via FirebaseUI Auth (email provider) and the
  RevenueCat PaywallActivityLauncher, gated by the "Pro" entitlement.
- MainActivity shows a soft startup dialog (UseCountDialog) that
  Continue-gates non-subscribers for one second per launch (capped at
  30) and offers a Subscribe path into ProActivity. Subscribers skip
  the dialog entirely.
- ProServicesPreference adds a permanent "Pro Subscription" entry in
  Settings that opens ProActivity at any time.

RevenueCat and Firebase are both treated as optional: missing API key,
google-services config, or network are swallowed so the app keeps
working for non-subscribers. minSdk bumped to 24 to satisfy the
RevenueCat Paywalls UI library.

Co-authored-by: Cursor <cursoragent@cursor.com>
…gned DataStore native lib

Google Play's pre-launch lab reported on 16 KB page-size devices:
  java.lang.NoClassDefFoundError: Failed resolution of:
      Landroidx/datastore/DataStoreFile;

Two underlying causes:

1. AGP 8.1.1 (Java-only app, no Kotlin plugin) strips top-level Kotlin
   extension classes like androidx.datastore.DataStoreFile from the APK.
   Fixed in AGP 8.4.0+. Bumps the committed project build toolchain to
   AGP 8.13.2 / Gradle 8.13 to match the local development setup and
   pull in the AGP 8.5+ 16 KB-aligned packaging defaults.
   See firebase/firebase-android-sdk#7169.

2. androidx.datastore-core ships libdatastore_shared_counter.so whose
   RELRO segment is 4 KB-aligned, so it fails to load on 16 KB-page
   Android devices. The native lib is only needed for multi-process
   DataStore, which neither Avare nor RevenueCat use. Exclude it from
   the APK so DataStore falls back to its JVM file-lock path.
   See https://issuetracker.google.com/issues/476745201.

Co-authored-by: Cursor <cursoragent@cursor.com>
Remove the startup countdown dialog (UseCountDialog) and its supporting
preference counter / strings. Replace it with a per-category download
gate in ChartsDownloadActivity: free users may download at most one
chart per category, with the Databases and Weather/TFRs categories
always exempt. When the selection exceeds the limit and the user does
not own the RevenueCat "Pro" entitlement, a Subscribe / Cancel dialog
is shown before any download starts. A per-batch authorization flag
ensures the dialog only fires once per user-initiated batch and not on
each recursive continuation in the download handler.

Co-authored-by: Cursor <cursoragent@cursor.com>
The previous gate counted checked items at batch start, which let free
users download multiple charts in the same category as long as they
were all checked together. Replace it with a per-chart gate keyed off
the live on-disk state: a chart is allowed when it is in an exempt
category (Databases, Weather/TFRs), when it is an update of a chart
already on disk, or when no other chart in its category is on disk.

ChartsDownloadActivity now peeks the next checked chart, runs the
gate, and either starts the download, skips the chart (uncheck +
single warning dialog per batch), or queries RevenueCat for the
entitlement (cached for the rest of the batch). After each successful
download the next iteration re-evaluates against the updated on-disk
state, so checking two new sectionals downloads the first and blocks
the second.

Wording on the Paid dialog/preference reflects "one chart per category
on the device" rather than "one per batch".

Co-authored-by: Cursor <cursoragent@cursor.com>
@apps4av
apps4av merged commit 9464b9a into master Jun 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant