Kebechet / Maui.RevenueCat.InAppBilling

MIT License
13 stars 6 forks source link

"Buy Me A Coffee"

Maui.RevenueCat.InAppBilling

NuGet Version NuGet Downloads

Credits

Usage

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();
}

Dummy classes

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:

Example of such dummy class: RevenueCatBillingWindows.cs

Exception behavior

Contributions

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.

License

This repository is licensed with the MIT license.