-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update README, add purchase restoring functionality
- Loading branch information
Pavel Tikhonenko
committed
Oct 10, 2021
1 parent
b3e8695
commit 8513ad8
Showing
5 changed files
with
77 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Pavel Tikhonenko on 10.10.2021. | ||
// | ||
|
||
import Foundation | ||
import StoreKit | ||
|
||
typealias RenewalState = Product.SubscriptionInfo.RenewalState | ||
|
||
public extension Product | ||
{ | ||
var isEligibleForIntroOffer: Bool | ||
{ | ||
get async | ||
{ | ||
await subscription?.isEligibleForIntroOffer ?? false | ||
} | ||
} | ||
|
||
var hasActiveSubscription: Bool | ||
{ | ||
get async | ||
{ | ||
await (try? subscription?.status.first?.state == RenewalState.subscribed) ?? false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.