Back to Diary

Fixed critical subscription bug and shipped v1.2.2 to both app stores

ImplementationBug FixTestingDevOps
10 sessions2 commits#subscription #revenuecat #ios #android #app-store #in-app-purchase

Development Diary - January 16, 2026

📋Daily Summary

Major milestone day for ToonNotes monetization. Successfully submitted v1.2.2 to both App Store and Google Play, then configured the complete in-app purchase system with RevenueCat. Discovered and fixed a critical bug where Pro subscriptions were granting 100 coins repeatedly due to timestamp mismatches between device and server time.


🕐Work Sessions

Session 1: Early Morning Build Fixes (2:55 AM - 3:09 AM)

Focus: EAS Build Error Resolution

Activities:

  • Debugged Metro bundler failing to resolve react-native-css-interop/jsx-runtime
  • Identified missing explicit dependency for NativeWind's transitive dependency
  • Added react-native-css-interop to package.json to fix EAS build environment

Key Issue: NativeWind v4 requires react-native-css-interop but pnpm's module resolution differs in EAS clean installs.


Session 2: App Store Submission (5:47 AM - 7:11 AM)

Focus: v1.2.2 Release to App Stores

Activities:

  • Submitted iOS build 1.2.2 (12) to App Store via TestFlight
  • Reviewed key changes from v1.2.1: NativeWind fix, dependency updates
  • Configured Android release for Google Play submission
  • Ran interactive Play Store setup

Milestone: First coordinated release to both iOS and Android stores!


Session 3: RevenueCat & IAP Configuration (8:02 AM - 3:30 PM)

Focus: In-App Purchase System Setup

Activities:

  • Created App Store Connect subscription group "ToonNotes Pro"
  • Configured Pro Monthly subscription at $4.99/month
  • Set up 3 consumable coin packs:
    • Starter Pack: 3 coins @ $0.99
    • Popular Pack: 12 coins @ $2.99
    • Best Value Pack: 32 coins @ $5.99
  • Connected RevenueCat to App Store Connect API
  • Imported products and created entitlements
  • Set up StoreKit configuration file for testing
  • Created sandbox tester account

Testing: Successfully tested purchases in iOS Simulator after signing configuration fix.


Session 4: Critical Bug Discovery & Fix (3:30 PM - 11:37 PM)

Focus: Subscription Coin Grant Bug

The Bug: After subscribing to Pro, users were receiving 100 coins repeatedly, accumulating 1,419 coins instead of just 100.

Root Cause Analysis:

  • latestPurchaseDate (RevenueCat server time) vs lastCoinGrantDate (device time) mismatch
  • 29-second difference caused repeated coin grants on every CustomerInfo update
  • The checkAndGrantRenewalCoins() kept firing because server timestamp was always newer

Solution Implemented:

  1. Updated grantMonthlyCoins() to accept optional grantDate parameter
  2. Pass RevenueCat's latestPurchaseDate instead of Date.now()
  3. Added mutex lock to prevent race conditions
  4. Added subscription expiration validation
  5. Wrote comprehensive unit tests (910 lines)

🏷️Categorized Work

Implementation

  • Complete RevenueCat integration with App Store Connect
  • StoreKit configuration file for local testing
  • Subscription and consumable product setup

Bug Fix

  • Fixed duplicate coin grant on Pro subscription
  • Added mutex to prevent race conditions in subscription processing
  • Added expiration check to validate subscription status

Testing

  • Created sandbox tester account
  • Added comprehensive subscription service unit tests
  • Verified purchase flow in iOS Simulator

DevOps

  • Submitted v1.2.2 to App Store (TestFlight)
  • Configured Google Play release
  • Fixed EAS build dependency resolution

📸Screenshots

No screenshots captured for this session.


💡Insights & Learnings

Learning: Server timestamps (RevenueCat) and device timestamps (Date.now()) can differ by seconds, causing comparison logic to fail. Always use the authoritative timestamp from the source of truth.

Decision: Implemented mutex pattern for subscription processing to handle rapid CustomerInfo updates safely.

Learning: EAS build environments do clean installs - transitive dependencies that work locally may fail in CI. Always explicitly declare dependencies that your code directly references.


📊Statistics

🕐
10
Sessions
📝
2
Commits
📁
5
Files Changed
927
Lines Added
46
Lines Deleted
🏷️
Implementation
Primary Category

🎯Tomorrow's Focus

  • Monitor TestFlight and Google Play review status
  • Test full purchase flow on physical devices
  • Verify subscription renewal handling works correctly
  • Consider adding analytics events for purchase funnel

Generated with ToonNotes Development Diary