Skip to content

Commit

Permalink
RevenueCat integration to Blink 15
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Cabanero committed Dec 18, 2021
2 parents 2060997 + f979a67 commit 90f40d0
Show file tree
Hide file tree
Showing 17 changed files with 627 additions and 49 deletions.
78 changes: 65 additions & 13 deletions Blink.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@
BD81522027387D1F002BB169 /* Certificates.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD81521C27387D1F002BB169 /* Certificates.swift */; };
BD81522D2739A91D002BB169 /* BlinkLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD9EA20A271F62ED00874007 /* BlinkLogging.swift */; };
BD81522E2739A91D002BB169 /* Publisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD9EA20C271F664D00874007 /* Publisher.swift */; };
BD815235273D7A09002BB169 /* Purchases in Frameworks */ = {isa = PBXBuildFile; productRef = BD815234273D7A09002BB169 /* Purchases */; };
BD81523F273DB964002BB169 /* CompatibilityAccessManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD81523C273DB964002BB169 /* CompatibilityAccessManager.swift */; };
BD815240273DB964002BB169 /* SubscriptionNag.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD81523D273DB964002BB169 /* SubscriptionNag.swift */; };
BD815241273DB964002BB169 /* Purchases.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD81523E273DB964002BB169 /* Purchases.swift */; };
BD815243273DBEDE002BB169 /* UserModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD815242273DBEDE002BB169 /* UserModel.swift */; };
BD81524A273EFA1A002BB169 /* SubscriptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD815249273EFA1A002BB169 /* SubscriptionsView.swift */; };
BD8152542743FF84002BB169 /* skstore.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD8152532743FF84002BB169 /* skstore.swift */; };
BD896F7B26CEAD37004313E6 /* FileTranslatorCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD896F7A26CEAD37004313E6 /* FileTranslatorCache.swift */; };
BD896F8926CFDB17004313E6 /* Atomics in Frameworks */ = {isa = PBXBuildFile; productRef = BD896F8826CFDB17004313E6 /* Atomics */; };
Expand Down Expand Up @@ -759,6 +765,11 @@
BD67FC9A2732D4D300C1EE75 /* BackgroundTaskMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundTaskMonitor.swift; sourceTree = "<group>"; };
BD7810A42640C36100114700 /* NWConnection+WriterTo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NWConnection+WriterTo.swift"; sourceTree = "<group>"; };
BD81521C27387D1F002BB169 /* Certificates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Certificates.swift; sourceTree = "<group>"; };
BD81523C273DB964002BB169 /* CompatibilityAccessManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompatibilityAccessManager.swift; sourceTree = "<group>"; };
BD81523D273DB964002BB169 /* SubscriptionNag.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionNag.swift; sourceTree = "<group>"; };
BD81523E273DB964002BB169 /* Purchases.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Purchases.swift; sourceTree = "<group>"; };
BD815242273DBEDE002BB169 /* UserModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserModel.swift; sourceTree = "<group>"; };
BD815249273EFA1A002BB169 /* SubscriptionsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionsView.swift; sourceTree = "<group>"; };
BD8152532743FF84002BB169 /* skstore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = skstore.swift; sourceTree = "<group>"; };
BD896F7A26CEAD37004313E6 /* FileTranslatorCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileTranslatorCache.swift; sourceTree = "<group>"; };
BD8BBF0825F819970084705F /* SEKeyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SEKeyTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1179,6 +1190,7 @@
07FABBC425C9AECF00E1CC2C /* BlinkFiles.framework in Frameworks */,
0732F1291D06324200AB5438 /* libcurses.tbd in Frameworks */,
D2F64CA925CAA92700F2225D /* curl_ios_static.framework in Frameworks */,
BD815235273D7A09002BB169 /* Purchases in Frameworks */,
0732F1271D06323A00AB5438 /* libz.tbd in Frameworks */,
D2F64CB125CAAAD100F2225D /* ssh_cmd.xcframework in Frameworks */,
07FAB90F25C8E94E00E1CC2C /* ArgumentParser in Frameworks */,
Expand All @@ -1197,6 +1209,7 @@
0716B5231CFFAB9300268B5B /* Blink */ = {
isa = PBXGroup;
children = (
BD81523B273DB964002BB169 /* Subscriptions */,
BD9EA1ED2719D28800874007 /* Migrator */,
D215AC282335218E00E164C3 /* WebKit */,
D265FBC7231904B50017EAC4 /* Foundation */,
Expand Down Expand Up @@ -1524,6 +1537,25 @@
path = Security;
sourceTree = "<group>";
};
BD81523B273DB964002BB169 /* Subscriptions */ = {
isa = PBXGroup;
children = (
BD81523C273DB964002BB169 /* CompatibilityAccessManager.swift */,
BD81523D273DB964002BB169 /* SubscriptionNag.swift */,
BD81523E273DB964002BB169 /* Purchases.swift */,
BD815242273DBEDE002BB169 /* UserModel.swift */,
);
path = Subscriptions;
sourceTree = "<group>";
};
BD815248273EFA1A002BB169 /* Subscriptions */ = {
isa = PBXGroup;
children = (
BD815249273EFA1A002BB169 /* SubscriptionsView.swift */,
);
path = Subscriptions;
sourceTree = "<group>";
};
BD8D898025DC535600E55D9E /* keys */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1709,6 +1741,7 @@
C9B2E0141D6B612300B89F69 /* ViewControllers */ = {
isa = PBXGroup;
children = (
BD815248273EFA1A002BB169 /* Subscriptions */,
D2B0BD172720311B00485854 /* Gestures */,
803B99CB2582865500DC99C8 /* Notifications */,
B7A4876A1DC7C6F4007BA809 /* Settings */,
Expand Down Expand Up @@ -2340,6 +2373,7 @@
07FAB90E25C8E94E00E1CC2C /* ArgumentParser */,
D2B9E21D268084E40084B2C4 /* Machines */,
D2B9E221268085050084B2C4 /* BuildCLI */,
BD815234273D7A09002BB169 /* Purchases */,
);
productName = Blink;
productReference = EA0BA18B1C0CC57B00719C1A /* Blink.app */;
Expand Down Expand Up @@ -2405,7 +2439,6 @@
};
EA0BA18A1C0CC57B00719C1A = {
CreatedOnToolsVersion = 7.1.1;
DevelopmentTeam = "$(TEAM_ID)";
LastSwiftMigration = 0830;
ProvisioningStyle = Automatic;
SystemCapabilities = {
Expand Down Expand Up @@ -2448,6 +2481,7 @@
mainGroup = EA0BA1821C0CC57B00719C1A;
packageReferences = (
BD896F8726CFDB17004313E6 /* XCRemoteSwiftPackageReference "swift-atomics" */,
BD815233273D7A09002BB169 /* XCRemoteSwiftPackageReference "purchases-ios" */,
);
productRefGroup = EA0BA18C1C0CC57B00719C1A /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -2863,6 +2897,7 @@
07F670731D05EEE200C0A53C /* MoshSession.m in Sources */,
07F670721D05EEE200C0A53C /* MCPSession.m in Sources */,
D23742CA21106ADF00366359 /* bench.m in Sources */,
BD81524A273EFA1A002BB169 /* SubscriptionsView.swift in Sources */,
D2673735265BD77B002036FF /* BuildCLIConfig.swift in Sources */,
D240806120BC8DF800F30099 /* tool_main.c in Sources */,
B7D6A6291E2D43A800EDF7B0 /* BKSmartKeysConfigViewController.m in Sources */,
Expand Down Expand Up @@ -2905,11 +2940,13 @@
D259479C269C671F008B5305 /* MoshPredictionPickerView.swift in Sources */,
07FAB8F025C8E6C500E1CC2C /* Helpers.swift in Sources */,
C989E5561D6CC4A1003E0079 /* BKAppearanceViewController.m in Sources */,
BD815241273DB964002BB169 /* Purchases.swift in Sources */,
D2D8DD9823C8506900BFF223 /* LockView.swift in Sources */,
B7A487691DC7C48D007BA809 /* UIDevice+DeviceName.m in Sources */,
D2C2441D238E44AB0082C69C /* DefaultRow.swift in Sources */,
D241CBDC23040734003D64A5 /* KBKeyViewVertical2.swift in Sources */,
D2C24423238E44AB0082C69C /* KBWebView.swift in Sources */,
BD815240273DB964002BB169 /* SubscriptionNag.swift in Sources */,
BD9EA1FE271A148700874007 /* Migrator.swift in Sources */,
D2C24417238E44AB0082C69C /* KeyConfig.swift in Sources */,
D28F301A21AD8A6B00E5259F /* DeviceInfo.m in Sources */,
Expand Down Expand Up @@ -2963,6 +3000,7 @@
D2BC514D2355C3AE0034FDD4 /* History.swift in Sources */,
D23EA9592604CB4C00BCF1FF /* FixedTextField.swift in Sources */,
D2C24437239104250082C69C /* ShortcutsConfigView.swift in Sources */,
BD81523F273DB964002BB169 /* CompatibilityAccessManager.swift in Sources */,
07E3AEB01D8F6758007BC086 /* BKFeedbackViewController.m in Sources */,
B7D450361DD3A87200CE0DBE /* BKiCloudSyncHandler.m in Sources */,
D248E67622DDDF130057FE67 /* UIStateRestorable.swift in Sources */,
Expand Down Expand Up @@ -2990,6 +3028,7 @@
D2887A5622DC676F00701BD5 /* SpaceController.swift in Sources */,
D2AC6749220303D900177BC5 /* openurl.m in Sources */,
D2CB353B23339D5C00088765 /* UIView+Touches.swift in Sources */,
BD815243273DBEDE002BB169 /* UserModel.swift in Sources */,
D2887A5E22DCA6D500701BD5 /* SceneDelegate.swift in Sources */,
D2C2441F238E44AB0082C69C /* Row.swift in Sources */,
D21DEE51260E1DCF00D8E640 /* KeyPickerView.swift in Sources */,
Expand Down Expand Up @@ -3206,7 +3245,7 @@
MARKETING_VERSION = 14.0.5;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.carloscabanero.SSH;
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).SSH";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
Expand Down Expand Up @@ -3251,7 +3290,7 @@
);
MARKETING_VERSION = 14.0.5;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.carloscabanero.SSH;
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).SSH";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -3368,7 +3407,7 @@
MARKETING_VERSION = 14.0.5;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.carloscabanero.BlinkFiles;
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).BlinkFiles";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
Expand Down Expand Up @@ -3415,7 +3454,7 @@
);
MARKETING_VERSION = 14.0.5;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.carloscabanero.BlinkFiles;
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).BlinkFiles";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
Expand Down Expand Up @@ -3534,7 +3573,7 @@
MARKETING_VERSION = 14.0.5;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = Com.CarlosCabanero.BlinkShell.BlinkFileProvider;
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).BlinkShellFileProvider";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = NO;
Expand Down Expand Up @@ -3575,7 +3614,7 @@
);
MARKETING_VERSION = 14.0.5;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = Com.CarlosCabanero.BlinkShell.BlinkFileProvider;
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).BlinkShellFileProvider";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = NO;
Expand Down Expand Up @@ -3621,7 +3660,7 @@
MARKETING_VERSION = 14.0.5;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = Com.CarlosCabanero.BlinkShell.BlinkFileProviderUI;
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).BlinkFileProviderUI";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
Expand Down Expand Up @@ -3663,7 +3702,7 @@
);
MARKETING_VERSION = 14.0.5;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = Com.CarlosCabanero.BlinkShell.BlinkFileProviderUI;
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).BlinkFileProviderUI";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -3884,7 +3923,7 @@
MARKETING_VERSION = 14.0.5;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = Com.CarlosCabanero.BlinkShell.BlinkConfig;
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).BlinkConfig";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
Expand Down Expand Up @@ -3933,7 +3972,7 @@
);
MARKETING_VERSION = 14.0.5;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = Com.CarlosCabanero.BlinkShell.BlinkConfig;
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).BlinkConfig";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
Expand Down Expand Up @@ -4178,7 +4217,7 @@
MARKETING_VERSION = 14.0.5;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = Com.CarlosCabanero.BlinkShell.BlinkIntents;
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).BlinkShellIntents";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
Expand Down Expand Up @@ -4218,7 +4257,7 @@
);
MARKETING_VERSION = 14.0.5;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = Com.CarlosCabanero.BlinkShell.BlinkIntents;
PRODUCT_BUNDLE_IDENTIFIER = "$(BUNDLE_ID).BlinkShellIntents";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
Expand Down Expand Up @@ -4552,6 +4591,14 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
BD815233273D7A09002BB169 /* XCRemoteSwiftPackageReference "purchases-ios" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/RevenueCat/purchases-ios.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 3.0.0;
};
};
BD896F8726CFDB17004313E6 /* XCRemoteSwiftPackageReference "swift-atomics" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/apple/swift-atomics.git";
Expand All @@ -4567,6 +4614,11 @@
isa = XCSwiftPackageProductDependency;
productName = ArgumentParser;
};
BD815234273D7A09002BB169 /* Purchases */ = {
isa = XCSwiftPackageProductDependency;
package = BD815233273D7A09002BB169 /* XCRemoteSwiftPackageReference "purchases-ios" */;
productName = Purchases;
};
BD896F8826CFDB17004313E6 /* Atomics */ = {
isa = XCSwiftPackageProductDependency;
package = BD896F8726CFDB17004313E6 /* XCRemoteSwiftPackageReference "swift-atomics" */;
Expand Down
4 changes: 4 additions & 0 deletions Blink/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[self _loadProfileVars];
[[UIView appearance] setTintColor:[UIColor blinkTint]];

#if !BLINK_LEGACY
[SubscriptionNag.shared start];
#endif

signal(SIGPIPE, __on_pipebroken_signal);

dispatch_queue_t bgQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
Expand Down
3 changes: 1 addition & 2 deletions Blink/Blink.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>group.Com.CarlosCabanero.BlinkShell</string>
<string>group.$(GROUP_ID)</string>
</array>
<key>com.apple.security.device.bluetooth</key>
<true/>
Expand All @@ -42,7 +42,6 @@
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)$(KEYCHAIN_ID1)</string>
<string>$(AppIdentifierPrefix)$(KEYCHAIN_ID2)</string>
</array>
</dict>
</plist>
4 changes: 3 additions & 1 deletion Blink/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<array>
<string>ssh</string>
<string>blinkshell</string>
<string>blinkv14</string>
<string>blinkv15</string>
</array>
</dict>
</array>
Expand Down Expand Up @@ -138,6 +138,8 @@
<string>com.blink.cmdline</string>
<string>com.blink.session</string>
</array>
<key>RevCatPublicKey</key>
<string>$REVCAT_PUBKEY</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand Down
17 changes: 14 additions & 3 deletions Blink/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,16 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
Handles the `ssh://` URL schemes and x-callback-url for devices that are running iOS 13 or higher.
*/
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
#if BLINK_LEGACY
if let blinkUrlScheme = URLContexts.first(where: { $0.url.scheme == "blinkv14"})?.url {
_handleReceiptUrlScheme(with: blinkUrlScheme, calledReceivedBy: "test")
} else if let sshUrlScheme = URLContexts.first(where: { $0.url.scheme == "ssh" })?.url {
_handleReceiptUrlScheme(with: blinkUrlScheme)
}
#else
if let migrationTokenUrl = URLContexts.first(where: { $0.url.scheme == "blinkv15"})?.url {
_handleMigrationTokenUrl(with: migrationTokenUrl)
}
#endif
if let sshUrlScheme = URLContexts.first(where: { $0.url.scheme == "ssh" })?.url {
_handleSshUrlScheme(with: sshUrlScheme)
} else if let xCallbackUrl = URLContexts.first(where: { $0.url.scheme == "blinkshell" })?.url {
_handleXcallbackUrl(with: xCallbackUrl)
Expand Down Expand Up @@ -350,8 +357,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

// MARK: Manage the `scene(_:openURLContexts:)` actions
extension SceneDelegate {
private func _handleMigrationTokenUrl(with migrationTokenUrl: URL) {
print("Received \(migrationTokenUrl)")
}

// blinkv14:validatereceipt?OriginalUserId
private func _handleReceiptUrlScheme(with blinkReceiptUrl: URL, calledReceivedBy: String) {
private func _handleReceiptUrlScheme(with blinkReceiptUrl: URL) {
// TODO: Ignore it did not come from our Blink 15 AppID

// Start receipt exchange function.
Expand Down
Loading

0 comments on commit 90f40d0

Please sign in to comment.