{"id":16864976,"url":"https://github.com/nathanfallet/unlockpremium","last_synced_at":"2025-11-11T14:30:20.876Z","repository":{"id":42038535,"uuid":"481882879","full_name":"nathanfallet/UnlockPremium","owner":"nathanfallet","description":"A package to include a standard \"Unlock premium\" view in iOS and Android apps","archived":false,"fork":false,"pushed_at":"2023-05-08T17:32:06.000Z","size":148,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T19:24:26.749Z","etag":null,"topics":["android","iap","kotlin","kotlin-library","spm","swift"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nathanfallet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["NathanFallet"]}},"created_at":"2022-04-15T07:57:20.000Z","updated_at":"2024-10-05T04:37:37.000Z","dependencies_parsed_at":"2023-02-12T15:45:46.419Z","dependency_job_id":null,"html_url":"https://github.com/nathanfallet/UnlockPremium","commit_stats":null,"previous_names":["groupeminaste/unlockpremium"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanfallet%2FUnlockPremium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanfallet%2FUnlockPremium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanfallet%2FUnlockPremium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathanfallet%2FUnlockPremium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nathanfallet","download_url":"https://codeload.github.com/nathanfallet/UnlockPremium/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239593060,"owners_count":19664855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","iap","kotlin","kotlin-library","spm","swift"],"created_at":"2024-10-13T14:44:44.745Z","updated_at":"2025-11-11T14:30:20.834Z","avatar_url":"https://github.com/nathanfallet.png","language":"Kotlin","funding_links":["https://github.com/sponsors/NathanFallet"],"categories":[],"sub_categories":[],"readme":"# UnlockPremium\n\n[![License](https://img.shields.io/github/license/NathanFallet/UnlockPremium)](LICENSE)\n[![Issues](https://img.shields.io/github/issues/NathanFallet/UnlockPremium)]()\n[![Pull Requests](https://img.shields.io/github/issues-pr/NathanFallet/UnlockPremium)]()\n[![Code Size](https://img.shields.io/github/languages/code-size/NathanFallet/UnlockPremium)]()\n[![Translation status](http://weblate.groupe-minaste.org/widgets/unlockpremium/-/svg-badge.svg)](http://weblate.groupe-minaste.org/engage/unlockpremium/?utm_source=widget)\n\n## Installation\n\n### iOS\n\nAdd `https://github.com/NathanFallet/UnlockPremium.git` to your Swift Package configuration (or using the Xcode menu: `File` \u003e `Swift Packages` \u003e `Add Package Dependency`)\n\nDon't forget to add the `In-App Purchase` capability to your app (in `Signing \u0026 Capabilities`). This should automatically add the `StoreKit` framework to your app as well.\n\n### Android\n\nAdd the following to your `build.gradle` file:\n\n```groovy\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    implementation 'me.nathanfallet.unlockpremium:unlockpremium:1.0.0'\n}\n```\n\n## Usage\n\n### iOS\n\nSetup a configuration for the unlock view:\n\n```swift\nimport UnlockPremium\n\nextension UnlockPremiumConfig {\n\n    static func config() -\u003e UnlockPremiumConfig {\n        return UnlockPremiumConfig(\n            arguments: [\n                PremiumArgument(\n                    title: \"A feature name\",\n                    description: \"A feature description\",\n                    icon: \"app.fill\"\n                ),\n                // ...\n            ],\n            productIdentifier: \"myAppSKU.premiumPurchase\", // In-App Purchase `Product ID`\n            completionHandler: {\n                // Set your user as premium, for example:\n                UserService.shared.setUserPremium(to: true)\n            }\n        )\n    }\n\n}\n```\n\nThe `completionHandler` is the method called when the purchase completes successfully.\n\nThen, show the view where you want:\n\n```swift\n.sheet(isPresented: $viewModel.showPremium) {\n    UnlockPremiumView(configuration: .config(), isPresented: $viewModel.showPremium)\n}\n```\n\n### Android\n\nSetup a configuration for the unlock view:\n\n```kotlin\nval config = UnlockPremiumConfig(\n    listOf(\n        PremiumArgument(\n            \"A feature name\",\n            \"A feature description\",\n            R.drawable.ic_baseline_apps_24\n        ),\n        // ...\n    ),\n    \"myAppSKU.premiumPurchase\"\n)\n```\n\nCreate a request, and handle the response\n\n```kotlin\nprivate val unlockPremiumRequest = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { it -\u003e\n    it.data?.getBooleanExtra(UnlockPremiumActivity.EXTRAS.SUCCESS, false)?.let { success -\u003e\n        if (success) {\n            // Set your user as premium, for example:\n            UserService.getInstance(getApplication()).setUserPremium(true)\n        }\n    }\n}\n```\n\nThen, show the view where you want:\n\n```kotlin\nval intent = Intent(this, UnlockPremiumActivity::class.java)\nintent.putExtra(UnlockPremiumActivity.EXTRAS.CONFIGURATION, config)\nunlockPremiumRequest.launch(intent)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanfallet%2Funlockpremium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathanfallet%2Funlockpremium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanfallet%2Funlockpremium/lists"}