Skip to content

Commit

Permalink
Revenuecat subscription implementation using KMPRevenueCat (#11)
Browse files Browse the repository at this point in the history
* implementation of KMPRevenueCat for subscription
  • Loading branch information
mirzemehdi authored Feb 22, 2024
1 parent 23b7a3e commit 68a4775
Show file tree
Hide file tree
Showing 34 changed files with 506 additions and 71 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_debug_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
runs-on: macos-latest
env:
API_KEY: ${{ secrets.API_KEY }}
REVENUECAT_API_KEY_ANDROID: ${{ secrets.REVENUECAT_API_KEY_ANDROID }}
REVENUECAT_API_KEY_IOS: ${{ secrets.REVENUECAT_API_KEY_IOS }}

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish-playstore-appstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
env:
github_token: ${{ secrets.GITHUB_TOKEN }}
API_KEY: ${{ secrets.API_KEY }}
REVENUECAT_API_KEY_ANDROID: ${{ secrets.REVENUECAT_API_KEY_ANDROID }}
REVENUECAT_API_KEY_IOS: ${{ secrets.REVENUECAT_API_KEY_IOS }}


steps:
Expand Down
2 changes: 1 addition & 1 deletion androidApp/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/orange" />

<meta-data android:name="com.google.android.play.billingclient.version" android:value="6.0.1" />
<meta-data android:name="com.google.android.play.billingclient.version" android:value="6.1.0" />
</application>

</manifest>
2 changes: 1 addition & 1 deletion distribution/whatsnew/whatsnew-en-US
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Authentication with Google, Apple, Github is added.
Subscription Premium is added for premium features.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ android.useAndroidX=true
android.targetSdk=34
android.compileSdk=34
android.minSdk=24
android.versionCode=17
android.versionName=2.2.0
android.versionCode=18
android.versionName=2.3.0


6 changes: 6 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ firebaseCrashlytics = "2.9.9"
kmpNotifier = "0.3.0"
kmpAuth = "1.1.0"
coil = "3.0.0-alpha03"
kmpRevenueCat="0.0.6"



Expand Down Expand Up @@ -79,6 +80,11 @@ kmpAuth-uihelper = { group = "io.github.mirzemehdi", name = "kmpauth-uihelper",
coil-compose = { group = "io.coil-kt.coil3", name = "coil-compose", version.ref = "coil" }
coil-ktor = { group = "io.coil-kt.coil3", name = "coil-network-ktor", version.ref = "coil" }

# KMPRevenuecat - Subscription lib
kmprevenuecat-purchases = { group = "io.github.mirzemehdi", name = "kmprevenuecat-purchases", version.ref = "kmpRevenueCat" }
kmprevenuecat-purchases-ui = { group = "io.github.mirzemehdi", name = "kmprevenuecat-purchases-ui", version.ref = "kmpRevenueCat" }



[bundles]
voyager = ["voyager-navigator", "voyager-tabNavigator", "voyager-transitions"]
Expand Down
80 changes: 80 additions & 0 deletions iosApp/FindTravelNow StoreKit.storekit
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"identifier" : "69C00004",
"nonRenewingSubscriptions" : [

],
"products" : [
{
"displayPrice" : "0.99",
"familyShareable" : false,
"internalID" : "770F93F8",
"localizations" : [
{
"description" : "",
"displayName" : "",
"locale" : "en_US"
}
],
"productID" : "lifetime_premium_v2",
"referenceName" : "lifetime_premium_v2",
"type" : "NonConsumable"
}
],
"settings" : {
"_failTransactionsEnabled" : false,
"_storeKitErrors" : [
{
"current" : null,
"enabled" : false,
"name" : "Load Products"
},
{
"current" : null,
"enabled" : false,
"name" : "Purchase"
},
{
"current" : null,
"enabled" : false,
"name" : "Verification"
},
{
"current" : null,
"enabled" : false,
"name" : "App Store Sync"
},
{
"current" : null,
"enabled" : false,
"name" : "Subscription Status"
},
{
"current" : null,
"enabled" : false,
"name" : "App Transaction"
},
{
"current" : null,
"enabled" : false,
"name" : "Manage Subscriptions Sheet"
},
{
"current" : null,
"enabled" : false,
"name" : "Refund Request Sheet"
},
{
"current" : null,
"enabled" : false,
"name" : "Offer Code Redeem Sheet"
}
]
},
"subscriptionGroups" : [

],
"version" : {
"major" : 3,
"minor" : 0
}
}
2 changes: 1 addition & 1 deletion iosApp/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
shared: 45f487984c6fbabf19d6b4eb91ffb5129a2bfc20

PODFILE CHECKSUM: eae97542391f0ffa4310330e32cfe71726dbe5ec
PODFILE CHECKSUM: 0a20442581fb5fc64112ac1d7a63be54e50e4662

COCOAPODS: 1.14.3
2 changes: 1 addition & 1 deletion iosApp/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added iosApp/StoreKitTestCertificate.cer
Binary file not shown.
63 changes: 47 additions & 16 deletions iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,27 @@
A6886A9B2AFBF140000FC219 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = A6886A9A2AFBF140000FC219 /* GoogleService-Info.plist */; };
A689DB122AF5F91200EC7353 /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = A689DB112AF5F91200EC7353 /* FirebaseAnalytics */; };
A68EBF9F2AF5ACA30038BFFD /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = A68EBF9E2AF5ACA30038BFFD /* FirebaseCrashlytics */; };
A6BD7BF22B86F6940052C214 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A6BD7BF12B86F6940052C214 /* StoreKit.framework */; };
A6D548BA2B0ECD9A0060761F /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = A6D548B92B0ECD9A0060761F /* FirebaseMessaging */; };
A6DB22392B85B77B0086C4D3 /* RevenueCat in Frameworks */ = {isa = PBXBuildFile; productRef = A6DB22382B85B77B0086C4D3 /* RevenueCat */; };
A6DB223B2B85B77B0086C4D3 /* RevenueCatUI in Frameworks */ = {isa = PBXBuildFile; productRef = A6DB223A2B85B77B0086C4D3 /* RevenueCatUI */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
034C794B9477822EA66F43DC /* Pods-iosApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.release.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.release.xcconfig"; sourceTree = "<group>"; };
058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
1C775BE0B2EC6251EEB5DDB2 /* libPods-iosApp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-iosApp.a"; sourceTree = BUILT_PRODUCTS_DIR; };
2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = "<group>"; };
7555FF7B242A565900829871 /* FindTravelNow.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FindTravelNow.app; sourceTree = BUILT_PRODUCTS_DIR; };
7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A0A10663FE7537E54A8D6A37 /* Pods-iosApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.debug.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.debug.xcconfig"; sourceTree = "<group>"; };
A621B42A2AF4899C00D87165 /* iosAppRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = iosAppRelease.entitlements; sourceTree = "<group>"; };
A6886A9A2AFBF140000FC219 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../iosApp/GoogleService-Info.plist"; sourceTree = "<group>"; };
A6BD7BF12B86F6940052C214 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
A6D548B82B0ECD840060761F /* iosApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = iosApp.entitlements; sourceTree = "<group>"; };
AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
AEC633E835AD47E2894F710A /* Pods-iosApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.release.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.release.xcconfig"; sourceTree = "<group>"; };
B27AACAA71233EC440B04D5C /* Pods-iosApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.debug.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -49,14 +53,17 @@
files = (
A648BF9C2B5D48CC00896CA6 /* FirebaseAnalyticsSwift in Frameworks */,
A648BF9E2B5D48CC00896CA6 /* FirebaseAnalyticsWithoutAdIdSupport in Frameworks */,
A6DB223B2B85B77B0086C4D3 /* RevenueCatUI in Frameworks */,
A648BF982B5D48CC00896CA6 /* FirebaseAnalytics in Frameworks */,
A648BF942B5D48AA00896CA6 /* GoogleSignIn in Frameworks */,
A6D548BA2B0ECD9A0060761F /* FirebaseMessaging in Frameworks */,
A689DB122AF5F91200EC7353 /* FirebaseAnalytics in Frameworks */,
A648BF962B5D48AA00896CA6 /* GoogleSignInSwift in Frameworks */,
A648BFA22B5D49FD00896CA6 /* FirebaseAuth in Frameworks */,
A68EBF9F2AF5ACA30038BFFD /* FirebaseCrashlytics in Frameworks */,
A6DB22392B85B77B0086C4D3 /* RevenueCat in Frameworks */,
769F3BF91D39AE2AF514DB56 /* libPods-iosApp.a in Frameworks */,
A6BD7BF22B86F6940052C214 /* StoreKit.framework in Frameworks */,
A648BF9A2B5D48CC00896CA6 /* FirebaseAnalyticsOnDeviceConversion in Frameworks */,
A648BFA02B5D48CC00896CA6 /* FirebaseAppCheck in Frameworks */,
);
Expand All @@ -76,28 +83,20 @@
42799AB246E5F90AF97AA0EF /* Frameworks */ = {
isa = PBXGroup;
children = (
A6BD7BF12B86F6940052C214 /* StoreKit.framework */,
1C775BE0B2EC6251EEB5DDB2 /* libPods-iosApp.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
5BDE45FF738E720B07260B4E /* Pods */ = {
isa = PBXGroup;
children = (
A0A10663FE7537E54A8D6A37 /* Pods-iosApp.debug.xcconfig */,
034C794B9477822EA66F43DC /* Pods-iosApp.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
7555FF72242A565900829871 = {
isa = PBXGroup;
children = (
AB1DB47929225F7C00F7AF9C /* Configuration */,
7555FF7D242A565900829871 /* iosApp */,
7555FF7C242A565900829871 /* Products */,
42799AB246E5F90AF97AA0EF /* Frameworks */,
5BDE45FF738E720B07260B4E /* Pods */,
A75D105B3C54BB927D9736BE /* Pods */,
);
sourceTree = "<group>";
};
Expand All @@ -124,6 +123,15 @@
path = iosApp;
sourceTree = "<group>";
};
A75D105B3C54BB927D9736BE /* Pods */ = {
isa = PBXGroup;
children = (
B27AACAA71233EC440B04D5C /* Pods-iosApp.debug.xcconfig */,
AEC633E835AD47E2894F710A /* Pods-iosApp.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
AB1DB47929225F7C00F7AF9C /* Configuration */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -164,6 +172,8 @@
A648BF9D2B5D48CC00896CA6 /* FirebaseAnalyticsWithoutAdIdSupport */,
A648BF9F2B5D48CC00896CA6 /* FirebaseAppCheck */,
A648BFA12B5D49FD00896CA6 /* FirebaseAuth */,
A6DB22382B85B77B0086C4D3 /* RevenueCat */,
A6DB223A2B85B77B0086C4D3 /* RevenueCatUI */,
);
productName = iosApp;
productReference = 7555FF7B242A565900829871 /* FindTravelNow.app */;
Expand Down Expand Up @@ -196,6 +206,7 @@
packageReferences = (
A68EBF792AF5AC5A0038BFFD /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
A648BF922B5D48AA00896CA6 /* XCRemoteSwiftPackageReference "GoogleSignIn-iOS" */,
A6DB22372B85B77B0086C4D3 /* XCRemoteSwiftPackageReference "purchases-ios" */,
);
productRefGroup = 7555FF7C242A565900829871 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -434,10 +445,11 @@
};
7555FFA6242A565B00829871 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = A0A10663FE7537E54A8D6A37 /* Pods-iosApp.debug.xcconfig */;
baseConfigurationReference = B27AACAA71233EC440B04D5C /* Pods-iosApp.debug.xcconfig */;
buildSettings = {
APP_NAME = FindTravelNow;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
"ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME[sdk=*]" = AccentColor;
BUNDLE_ID = com.measify.findtravelnow;
CODE_SIGN_ENTITLEMENTS = iosApp/iosApp.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
Expand All @@ -454,7 +466,7 @@
INFOPLIST_FILE = iosApp/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = FindTravelNow;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.travel";
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -477,10 +489,11 @@
};
7555FFA7242A565B00829871 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 034C794B9477822EA66F43DC /* Pods-iosApp.release.xcconfig */;
baseConfigurationReference = AEC633E835AD47E2894F710A /* Pods-iosApp.release.xcconfig */;
buildSettings = {
APP_NAME = FindTravelNow;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
"ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME[sdk=*]" = AccentColor;
BUNDLE_ID = com.measify.findtravelnow;
CODE_SIGN_ENTITLEMENTS = iosApp/iosAppRelease.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
Expand All @@ -497,7 +510,7 @@
INFOPLIST_FILE = iosApp/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = FindTravelNow;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.travel";
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -558,6 +571,14 @@
minimumVersion = 10.17.0;
};
};
A6DB22372B85B77B0086C4D3 /* XCRemoteSwiftPackageReference "purchases-ios" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/RevenueCat/purchases-ios";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 4.36.3;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand Down Expand Up @@ -611,6 +632,16 @@
package = A68EBF792AF5AC5A0038BFFD /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseMessaging;
};
A6DB22382B85B77B0086C4D3 /* RevenueCat */ = {
isa = XCSwiftPackageProductDependency;
package = A6DB22372B85B77B0086C4D3 /* XCRemoteSwiftPackageReference "purchases-ios" */;
productName = RevenueCat;
};
A6DB223A2B85B77B0086C4D3 /* RevenueCatUI */ = {
isa = XCSwiftPackageProductDependency;
package = A6DB22372B85B77B0086C4D3 /* XCRemoteSwiftPackageReference "purchases-ios" */;
productName = RevenueCatUI;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 7555FF73242A565900829871 /* Project object */;
Expand Down
6 changes: 6 additions & 0 deletions iosApp/iosApp.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@
"version" : "2.3.1"
}
},
{
"identity" : "purchases-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/RevenueCat/purchases-ios",
"state" : {
"revision" : "c598bfa60672881933d8945584cc327acd6f018a",
"version" : "4.36.3"
}
},
{
"identity" : "swift-protobuf",
"kind" : "remoteSourceControl",
Expand Down
Binary file not shown.
Loading

0 comments on commit 68a4775

Please sign in to comment.