A package to include a standard Unlock premium view in iOS and Android apps

Overview

UnlockPremium

License Issues Pull Requests Code Size Translation status

Installation

iOS

Add https://github.com/GroupeMINASTE/UnlockPremium.git to your Swift Package configuration (or using the Xcode menu: File > Swift Packages > Add Package Dependency)

Don't forget to add the In-App Purchase capability to your app (in Signing & Capabilities). This should automatically add the StoreKit framework to your app as well.

Android

Add the following to your build.gradle file:

repositories {
    mavenCentral()
}

dependencies {
    implementation 'me.nathanfallet.unlockpremium:unlockpremium:1.0.0'
}

Usage

iOS

Setup a configuration for the unlock view:

import UnlockPremium

extension UnlockPremiumConfig {

    static func config() -> UnlockPremiumConfig {
        return UnlockPremiumConfig(
            arguments: [
                PremiumArgument(
                    title: "A feature name",
                    description: "A feature description",
                    icon: "app.fill"
                ),
                // ...
            ],
            productIdentifier: "myAppSKU.premiumPurchase", // In-App Purchase `Product ID`
            completionHandler: {
                // Set your user as premium, for example:
                UserService.shared.setUserPremium(to: true)
            }
        )
    }

}

The completionHandler is the method called when the purchase completes successfully.

Then, show the view where you want:

.sheet(isPresented: $viewModel.showPremium) {
    UnlockPremiumView(configuration: .config(), isPresented: $viewModel.showPremium)
}

Android

Setup a configuration for the unlock view:

val config = UnlockPremiumConfig(
    listOf(
        PremiumArgument(
            "A feature name",
            "A feature description",
            R.drawable.ic_baseline_apps_24
        ),
        // ...
    ),
    "myAppSKU.premiumPurchase"
)

Create a request, and handle the response

private val unlockPremiumRequest = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { it ->
    it.data?.getBooleanExtra(UnlockPremiumActivity.EXTRAS.SUCCESS, false)?.let { success ->
        if (success) {
            // Set your user as premium, for example:
            UserService.getInstance(getApplication()).setUserPremium(true)
        }
    }
}

Then, show the view where you want:

val intent = Intent(this, UnlockPremiumActivity::class.java)
intent.putExtra(UnlockPremiumActivity.EXTRAS.CONFIGURATION, config)
unlockPremiumRequest.launch(intent)
You might also like...
An Animated Scrolling View for React Native applications, supported on both iOS and Android

react-native-focused-scroll An Animated Scrolling View for React Native applications, supported on both iOS and Android Preview react-native-focus-scr

An app to view libraries used in apps in your device.
An app to view libraries used in apps in your device.

An app to view libraries used in apps in your device.

Tonomy ID is the cross-platform mobile wallet (Android and iOS) for public and private EOSIO blockchains

Tonomy ID is the cross-platform mobile wallet (Android and iOS) for public and private EOSIO blockchains. This application allows you to sign transactions on the block chain, share your DID and Verifiable Credentials containing your identity with others in a consensual way and log into web2 and web3 applications. If you lose your phone several mechanisms exist to allow you to recover your account without trusting anyone with custody of your private keys.

sample codebase for E2E testing with Jest, Appium and WebDriverIO for Android and iOS

E2E testing for React Native with Jest, Appium and WebDriverIO (iOS and Android) In this repo you will find a sample project to showcase how to do E2E

The official repo for Blokada for Android and iOS.

Blokada 5 Blokada 5 is the next generation of the well known open source mobile ad blocker and privacy app. Want to try it out? Click here to download

Initiate immediate phone call for React Native on iOS and Android.

react-native-immediate-call-library Initiate immediate phone call for React Native on iOS and Android. Getting started Using npm: npm install react-na

📲💬 react-native-fontext is a lightweight library to integrate fonts in your React Native application that works seamlessly in android and iOS devices.
📲💬 react-native-fontext is a lightweight library to integrate fonts in your React Native application that works seamlessly in android and iOS devices.

React Native Fontext react-native-fontext is a lightweight library to integrate fonts in your React Native application that works seamlessly in androi

🚀 React Native Segmented Control, Pure Javascript for iOS and Android
🚀 React Native Segmented Control, Pure Javascript for iOS and Android

Installation Add the dependency: npm i react-native-segmented-control-2 Peer Dependencies Zero Dependency 🥳 Usage Import import SegmentedControl from

Comments
Releases(1.0.1)
Owner
Groupe MINASTE
French non-profit organization founded by @PlugNPush, @NathanFallet and @JohnPoliakov. We create apps and services to serve the planet. Made in France
Groupe MINASTE
LeeCo is an awesome app for (including unlock) problems, solutions, discuss(from leetcode) and comments.

LeeCo LeeCo is an awesome app for algorithem problems(including unlock), solutions, discuss(from leetcode) and comments. #中文文档 README-ZH.md #Download

Nightonke 487 Nov 25, 2022
Android common lib demo, include ImageCache, HttpCache, DropDownListView, DownloadManager, install apk silent and so on, you can find description

android-demo 关于我,欢迎关注 微博:Trinea 主页:trinea.cn 邮箱:trinea.cn#gmail.com 微信:codek2 依赖:trinea-android-common android-auto-scroll-view-pager viewpager-indica

Trinea 1.1k Dec 30, 2022
Techbee e.U. 62 Jan 31, 2023
Android Package Inspector - dynamic analysis with api hooks, start unexported activities and more. (Xposed Module)

Inspeckage - Android Package Inspector Inspeckage is a tool developed to offer dynamic analysis of Android applications. By applying hooks to function

acpm 2.5k Jan 8, 2023
🌄 Photo editor using native modules for iOS and Android. Inherit from 2 available libraries, Brightroom (iOS) and PhotoEditor (Android)

React Native Photo Editor (RNPE) ?? Image editor using native modules for iOS and Android. Inherit from 2 available libraries, Brightroom (iOS) and Ph

Baron Ha. 242 Dec 28, 2022
Ankiconnect Android allows you to utilize the standard Anki mining workflow on Android devices like phones and eReaders

Ankiconnect Android Ankiconnect Android allows you to utilize the standard Anki mining workflow on Android devices like phones and eReaders. Create An

Kamron Bhavnagri 29 Dec 28, 2022
A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

Ionic Ionic is an open source app development toolkit for building modern, fast, top-quality cross-platform native and Progressive Web Apps from a sin

Ionic 48.4k Jan 3, 2023
Kotlin Spring Boot on GCP App Engine Standard

Kotlin Spring Boot on GCP App Engine Standard Deploy locally git clone https://github.com/mvladoi/sinch-task.git cd springboot mvn spring-boot:run 7

Vladoi Marian 0 Nov 29, 2021
A 2020s compatible React Native keyboard avoiding view for Android and iOS that just works.

react-native-keyboard-shift Example Snack coming soon Until then: Clone this repo: git clone https://github.com/FullStackCraft/react-native-keyboard-s

Full Stack Craft 66 Aug 16, 2022
⚡️ A supercharged native Web View for iOS and Android ⚡️

⚡️ A supercharged native Web View for iOS and Android ⚡️ Ionic Portals is a supercharged native Web View component for iOS and Android that lets you a

Ionic 46 Dec 27, 2022