Integrate new in-app purchases
- Share iOS bundle identifier with macOS - Remove unused macOS donations (reuse iOS if needed) - Add platform-specific "Full version" - Skip fetching of legacy providers IAP
This commit is contained in:
parent
dd3cac40c6
commit
21e9f5c8cc
|
@ -108,7 +108,6 @@
|
||||||
0E520381259F593B00CBAB56 /* NSTextView+Search.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E569F94259F41690022DFB8 /* NSTextView+Search.swift */; };
|
0E520381259F593B00CBAB56 /* NSTextView+Search.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E569F94259F41690022DFB8 /* NSTextView+Search.swift */; };
|
||||||
0E520382259F593B00CBAB56 /* SwiftGen+Scenes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E569F9D259F41690022DFB8 /* SwiftGen+Scenes.swift */; };
|
0E520382259F593B00CBAB56 /* SwiftGen+Scenes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E569F9D259F41690022DFB8 /* SwiftGen+Scenes.swift */; };
|
||||||
0E520383259F593B00CBAB56 /* SwiftGen+Assets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E569F98259F41690022DFB8 /* SwiftGen+Assets.swift */; };
|
0E520383259F593B00CBAB56 /* SwiftGen+Assets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E569F98259F41690022DFB8 /* SwiftGen+Assets.swift */; };
|
||||||
0E520384259F593B00CBAB56 /* Donation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E569F99259F41690022DFB8 /* Donation.swift */; };
|
|
||||||
0E520385259F593B00CBAB56 /* Credits.html in Resources */ = {isa = PBXBuildFile; fileRef = 0E569FA4259F41690022DFB8 /* Credits.html */; };
|
0E520385259F593B00CBAB56 /* Credits.html in Resources */ = {isa = PBXBuildFile; fileRef = 0E569FA4259F41690022DFB8 /* Credits.html */; };
|
||||||
0E520386259F593B00CBAB56 /* ProductManager+App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E569F9E259F41690022DFB8 /* ProductManager+App.swift */; };
|
0E520386259F593B00CBAB56 /* ProductManager+App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E569F9E259F41690022DFB8 /* ProductManager+App.swift */; };
|
||||||
0E520387259F593B00CBAB56 /* TextInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E569F97259F41690022DFB8 /* TextInputViewController.swift */; };
|
0E520387259F593B00CBAB56 /* TextInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E569F97259F41690022DFB8 /* TextInputViewController.swift */; };
|
||||||
|
@ -472,7 +471,6 @@
|
||||||
0E569F94259F41690022DFB8 /* NSTextView+Search.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSTextView+Search.swift"; sourceTree = "<group>"; };
|
0E569F94259F41690022DFB8 /* NSTextView+Search.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSTextView+Search.swift"; sourceTree = "<group>"; };
|
||||||
0E569F97259F41690022DFB8 /* TextInputViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextInputViewController.swift; sourceTree = "<group>"; };
|
0E569F97259F41690022DFB8 /* TextInputViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextInputViewController.swift; sourceTree = "<group>"; };
|
||||||
0E569F98259F41690022DFB8 /* SwiftGen+Assets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SwiftGen+Assets.swift"; sourceTree = "<group>"; };
|
0E569F98259F41690022DFB8 /* SwiftGen+Assets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SwiftGen+Assets.swift"; sourceTree = "<group>"; };
|
||||||
0E569F99259F41690022DFB8 /* Donation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Donation.swift; sourceTree = "<group>"; };
|
|
||||||
0E569F9A259F41690022DFB8 /* Theme+Views.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Theme+Views.swift"; sourceTree = "<group>"; };
|
0E569F9A259F41690022DFB8 /* Theme+Views.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Theme+Views.swift"; sourceTree = "<group>"; };
|
||||||
0E569F9C259F41690022DFB8 /* SwiftGen+Strings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SwiftGen+Strings.swift"; sourceTree = "<group>"; };
|
0E569F9C259F41690022DFB8 /* SwiftGen+Strings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SwiftGen+Strings.swift"; sourceTree = "<group>"; };
|
||||||
0E569F9D259F41690022DFB8 /* SwiftGen+Scenes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SwiftGen+Scenes.swift"; sourceTree = "<group>"; };
|
0E569F9D259F41690022DFB8 /* SwiftGen+Scenes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SwiftGen+Scenes.swift"; sourceTree = "<group>"; };
|
||||||
|
@ -874,7 +872,6 @@
|
||||||
children = (
|
children = (
|
||||||
0E569FA4259F41690022DFB8 /* Credits.html */,
|
0E569FA4259F41690022DFB8 /* Credits.html */,
|
||||||
0E569FA3259F41690022DFB8 /* AppConstants+App.swift */,
|
0E569FA3259F41690022DFB8 /* AppConstants+App.swift */,
|
||||||
0E569F99259F41690022DFB8 /* Donation.swift */,
|
|
||||||
0E569F93259F41690022DFB8 /* HostImporter.swift */,
|
0E569F93259F41690022DFB8 /* HostImporter.swift */,
|
||||||
0E569F8F259F41690022DFB8 /* IssueReporter.swift */,
|
0E569F8F259F41690022DFB8 /* IssueReporter.swift */,
|
||||||
0E569FA6259F41690022DFB8 /* Macros.swift */,
|
0E569FA6259F41690022DFB8 /* Macros.swift */,
|
||||||
|
@ -1915,7 +1912,6 @@
|
||||||
0E520380259F593B00CBAB56 /* AppConstants+App.swift in Sources */,
|
0E520380259F593B00CBAB56 /* AppConstants+App.swift in Sources */,
|
||||||
0E52037B259F593B00CBAB56 /* IssueReporter.swift in Sources */,
|
0E52037B259F593B00CBAB56 /* IssueReporter.swift in Sources */,
|
||||||
0E520335259F58F500CBAB56 /* HostServiceView.swift in Sources */,
|
0E520335259F58F500CBAB56 /* HostServiceView.swift in Sources */,
|
||||||
0E520384259F593B00CBAB56 /* Donation.swift in Sources */,
|
|
||||||
0E520333259F58F500CBAB56 /* OrganizerProfileTableView.swift in Sources */,
|
0E520333259F58F500CBAB56 /* OrganizerProfileTableView.swift in Sources */,
|
||||||
0E52037F259F593B00CBAB56 /* Theme+Views.swift in Sources */,
|
0E52037F259F593B00CBAB56 /* Theme+Views.swift in Sources */,
|
||||||
0E520386259F593B00CBAB56 /* ProductManager+App.swift in Sources */,
|
0E520386259F593B00CBAB56 /* ProductManager+App.swift in Sources */,
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
//
|
|
||||||
// InApp.swift
|
|
||||||
// Passepartout
|
|
||||||
//
|
|
||||||
// Created by Davide De Rosa on 8/16/19.
|
|
||||||
// Copyright (c) 2021 Davide De Rosa. All rights reserved.
|
|
||||||
//
|
|
||||||
// https://github.com/passepartoutvpn
|
|
||||||
//
|
|
||||||
// This file is part of Passepartout.
|
|
||||||
//
|
|
||||||
// Passepartout is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Passepartout is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
enum Donation: String {
|
|
||||||
case tiny = "com.algoritmico.macos.Passepartout.donations.Tiny"
|
|
||||||
|
|
||||||
case small = "com.algoritmico.macos.Passepartout.donations.Small"
|
|
||||||
|
|
||||||
case medium = "com.algoritmico.macos.Passepartout.donations.Medium"
|
|
||||||
|
|
||||||
case big = "com.algoritmico.macos.Passepartout.donations.Big"
|
|
||||||
|
|
||||||
case huge = "com.algoritmico.macos.Passepartout.donations.Huge"
|
|
||||||
|
|
||||||
case maxi = "com.algoritmico.macos.Passepartout.donations.Maxi"
|
|
||||||
|
|
||||||
static let all: [Donation] = [
|
|
||||||
.tiny,
|
|
||||||
.small,
|
|
||||||
.medium,
|
|
||||||
.big,
|
|
||||||
.huge,
|
|
||||||
.maxi
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -27,11 +27,7 @@ import Foundation
|
||||||
import StoreKit
|
import StoreKit
|
||||||
|
|
||||||
public struct Product: RawRepresentable, Equatable, Hashable {
|
public struct Product: RawRepresentable, Equatable, Hashable {
|
||||||
#if os(iOS)
|
|
||||||
private static let bundleSubdomain = "ios"
|
private static let bundleSubdomain = "ios"
|
||||||
#else
|
|
||||||
private static let bundleSubdomain = "macos"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private static let bundle = "com.algoritmico.\(bundleSubdomain).Passepartout"
|
private static let bundle = "com.algoritmico.\(bundleSubdomain).Passepartout"
|
||||||
|
|
||||||
|
@ -70,25 +66,23 @@ public struct Product: RawRepresentable, Equatable, Hashable {
|
||||||
|
|
||||||
// MARK: Features
|
// MARK: Features
|
||||||
|
|
||||||
#if os(iOS)
|
|
||||||
public static let trustedNetworks = Product(featureId: "trusted_networks")
|
public static let trustedNetworks = Product(featureId: "trusted_networks")
|
||||||
|
|
||||||
public static let siriShortcuts = Product(featureId: "siri")
|
public static let siriShortcuts = Product(featureId: "siri")
|
||||||
#endif
|
|
||||||
|
|
||||||
public static let fullVersion = Product(featureId: "full_version")
|
public static let fullVersion_iOS = Product(featureId: "full_version")
|
||||||
|
|
||||||
|
public static let fullVersion_macOS = Product(featureId: "full_mac_version")
|
||||||
|
|
||||||
|
public static let fullVersion = Product(featureId: "full_multi_version")
|
||||||
|
|
||||||
#if os(iOS)
|
|
||||||
public static let allFeatures: [Product] = [
|
public static let allFeatures: [Product] = [
|
||||||
.trustedNetworks,
|
.trustedNetworks,
|
||||||
.siriShortcuts,
|
.siriShortcuts,
|
||||||
|
.fullVersion_iOS,
|
||||||
|
.fullVersion_macOS,
|
||||||
.fullVersion
|
.fullVersion
|
||||||
]
|
]
|
||||||
#else
|
|
||||||
public static let allFeatures: [Product] = [
|
|
||||||
.fullVersion
|
|
||||||
]
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private init(featureId: String) {
|
private init(featureId: String) {
|
||||||
self.init(rawValue: "\(Product.featuresBundle).\(featureId)")!
|
self.init(rawValue: "\(Product.featuresBundle).\(featureId)")!
|
||||||
|
@ -96,11 +90,11 @@ public struct Product: RawRepresentable, Equatable, Hashable {
|
||||||
|
|
||||||
// MARK: Providers
|
// MARK: Providers
|
||||||
|
|
||||||
public static var allProviders: [Product] {
|
// public static var allProviders: [Product] {
|
||||||
return InfrastructureFactory.shared.allMetadata.map {
|
// return InfrastructureFactory.shared.allMetadata.map {
|
||||||
return Product(providerMetadata: $0)
|
// return Product(providerMetadata: $0)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
fileprivate init(providerMetadata: Infrastructure.Metadata) {
|
fileprivate init(providerMetadata: Infrastructure.Metadata) {
|
||||||
self.init(rawValue: "\(Product.providersBundle).\(providerMetadata.inApp ?? providerMetadata.name)")!
|
self.init(rawValue: "\(Product.providersBundle).\(providerMetadata.inApp ?? providerMetadata.name)")!
|
||||||
|
@ -109,7 +103,7 @@ public struct Product: RawRepresentable, Equatable, Hashable {
|
||||||
// MARK: All
|
// MARK: All
|
||||||
|
|
||||||
public static var all: [Product] {
|
public static var all: [Product] {
|
||||||
return allDonations + allFeatures + allProviders
|
return allDonations + allFeatures// + allProviders
|
||||||
}
|
}
|
||||||
|
|
||||||
public var isDonation: Bool {
|
public var isDonation: Bool {
|
||||||
|
|
|
@ -151,11 +151,11 @@ public class ProductManager: NSObject {
|
||||||
|
|
||||||
public func isFullVersion() -> Bool {
|
public func isFullVersion() -> Bool {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
if isBeta && cfg.isBetaFullVersion {
|
if (isBeta && cfg.isBetaFullVersion) || purchasedFeatures.contains(.fullVersion_iOS) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if cfg.isBetaFullVersion {
|
if cfg.isBetaFullVersion || purchasedFeatures.contains(.fullVersion_macOS) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue