Firstly register package installer in your MauiProgram.cs
builder.Services.AddRevenueCatBilling();
then in App.xaml.cs
inject IRevenueCatBilling
:
public partial class App : Application {
private readonly IRevenueCatBilling _revenueCat;
public App(IRevenueCatBilling revenueCat) {
InitializeComponent();
_revenueCat = revenueCat;
}
}
and also override there method OnStart()
to call _revenueCat.Initialize
with your revenueCat apiKey (this key is platform dependant).
protected override void OnStart() {
var revenueCatApiKey = string.Empty;
#if __ANDROID__
revenueCatApiKey = "<AndroidRevenueCatKeyHere>";
#elif __IOS__
revenueCatApiKey = "<iOSRevenueCatKeyHere>";
#endif
_revenueCat.Initialize(revenueCatApiKey);
base.OnStart();
}
So that you dont have to specify platform for this package and it's calls, also Windows and MacCatalyst are added with dummy implementations. When you call one of their methods you will always get:
true
for bool returnsnew List<>
for collectionsstring.Empty
for string valuesExample of such dummy class: RevenueCatBillingWindows.cs
PurchaseResult
or it will return default value of that type.Feel free to create an issue or pull request. In case you would like to do massive changes in the package please firstly discuss them in the issue because otherwise there is high chance that such big PR would be rejected.
This repository is licensed with the MIT license.