-
Notifications
You must be signed in to change notification settings - Fork 576
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ParsePlatform/david.applinks
Initial version of iOS AppLinks.
- Loading branch information
Showing
25 changed files
with
2,600 additions
and
8 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,69 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "0500" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "8E9C3CE817DE9DE000427E62" | ||
BuildableName = "libBolts.a" | ||
BlueprintName = "Bolts" | ||
ReferencedContainer = "container:Bolts.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
buildConfiguration = "Debug"> | ||
<Testables> | ||
<TestableReference | ||
skipped = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "8E8C8EE817F23D1D00E3F1C7" | ||
BuildableName = "BoltsTests.xctest" | ||
BlueprintName = "BoltsTests" | ||
ReferencedContainer = "container:Bolts.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Debug" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
allowLocationSimulation = "YES"> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Release" | ||
debugDocumentVersioning = "YES"> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
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,69 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "0500" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "8EDDA62817E17DDC00655F8A" | ||
BuildableName = "libMacBolts.a" | ||
BlueprintName = "MacBolts" | ||
ReferencedContainer = "container:Bolts.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
buildConfiguration = "Debug"> | ||
<Testables> | ||
<TestableReference | ||
skipped = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "8E8C8F1817F241DA00E3F1C7" | ||
BuildableName = "MacBoltsTests.xctest" | ||
BlueprintName = "MacBoltsTests" | ||
ReferencedContainer = "container:Bolts.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Debug" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
allowLocationSimulation = "YES"> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Release" | ||
debugDocumentVersioning = "YES"> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
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,49 @@ | ||
/* | ||
* Copyright (c) 2014, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
/*! The version of the App Link protocol that this library supports */ | ||
FOUNDATION_EXPORT const NSUInteger BFAppLinkVersion; | ||
|
||
/*! | ||
Contains App Link metadata relevant for navigation on this device | ||
derived from the HTML at a given URL. | ||
*/ | ||
@interface BFAppLink : NSObject | ||
|
||
/*! | ||
Creates a BFAppLink with the given list of BFAppLinkTargets and target URL. | ||
Generally, this will only be used by implementers of the BFAppLinkResolving protocol, | ||
as these implementers will produce App Link metadata for a given URL. | ||
@param sourceURL the URL from which this App Link is derived | ||
@param targets an ordered list of BFAppLinkTargets for this platform derived | ||
from App Link metadata. | ||
@param webURL the fallback web URL, if any, for the app link. | ||
*/ | ||
+ (instancetype)appLinkWithSourceURL:(NSURL *)sourceURL | ||
targets:(NSArray *)targets | ||
webURL:(NSURL *)webURL; | ||
|
||
/*! The URL from which this BFAppLink was derived */ | ||
@property (copy, readonly) NSURL *sourceURL; | ||
|
||
/*! | ||
The ordered list of targets applicable to this platform that will be used | ||
for navigation. | ||
*/ | ||
@property (strong, readonly) NSArray *targets; | ||
|
||
/*! The fallback web URL to use if no targets are installed on this device. */ | ||
@property (copy, readonly) NSURL *webURL; | ||
|
||
@end |
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,32 @@ | ||
/* | ||
* Copyright (c) 2014, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
*/ | ||
|
||
#import "BFAppLink.h" | ||
|
||
NSString *const BFAppLinkDataParameterName = @"al_applink_data"; | ||
NSString *const BFAppLinkTargetKeyName = @"target_url"; | ||
NSString *const BFAppLinkUserAgentKeyName = @"user_agent"; | ||
NSString *const BFAppLinkExtrasKeyName = @"extras"; | ||
NSString *const BFAppLinkVersionKeyName = @"version"; | ||
const NSUInteger BFAppLinkVersion = 1; | ||
|
||
@implementation BFAppLink | ||
|
||
+ (instancetype)appLinkWithSourceURL:(NSURL *)sourceURL | ||
targets:(NSArray *)targets | ||
webURL:(NSURL *)webURL { | ||
BFAppLink *link = [[self alloc] init]; | ||
link->_sourceURL = sourceURL; | ||
link->_targets = [NSArray arrayWithArray:targets]; | ||
link->_webURL = webURL; | ||
return link; | ||
} | ||
|
||
@end |
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,93 @@ | ||
/* | ||
* Copyright (c) 2014, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import "BFAppLink.h" | ||
|
||
/*! | ||
The result of calling navigate on a BFAppLinkRequest | ||
*/ | ||
typedef NS_ENUM(NSInteger, BFAppLinkNavigationType) { | ||
/*! Indicates that the navigation failed and no app was opened */ | ||
BFAppLinkNavigationTypeFailure, | ||
/*! Indicates that the navigation succeeded by opening the URL in the browser */ | ||
BFAppLinkNavigationTypeBrowser, | ||
/*! Indicates that the navigation succeeded by opening the URL in an app on the device */ | ||
BFAppLinkNavigationTypeApp | ||
}; | ||
|
||
@protocol BFAppLinkResolving; | ||
@class BFTask; | ||
|
||
/*! | ||
Represents a pending request to navigate to an App Link. Most developers will | ||
simply use navigateToURLInBackground: to open a URL, but developers can build | ||
custom requests with additional navigation and app data attached to them by | ||
creating BFAppLinkRequests themselves. | ||
*/ | ||
@interface BFAppLinkNavigation : NSObject | ||
|
||
/*! | ||
The extras for the AppLinkRequest. This will generally contain application-specific | ||
data that should be passed along with the request, such as advertiser or affiliate IDs or | ||
other such metadata relevant on this device. | ||
*/ | ||
@property (readonly, strong) NSDictionary *extras; | ||
|
||
/*! | ||
The al_applink_data for the AppLinkRequest. This will generally contain data common to | ||
navigation attempts such as back-links, user agents, and other information that may be used | ||
in routing and handling an App Link request. | ||
*/ | ||
@property (readonly, strong) NSDictionary *appLinkData; | ||
|
||
/*! The AppLink to navigate to */ | ||
@property (readonly, strong) BFAppLink *appLink; | ||
|
||
/*! Creates an AppLinkRequest with the given link, app data, and app link data */ | ||
+ (instancetype)navigationWithAppLink:(BFAppLink *)appLink | ||
extras:(NSDictionary *)extras | ||
appLinkData:(NSDictionary *)appLinkData; | ||
|
||
/*! Performs the navigation */ | ||
- (BFAppLinkNavigationType)navigate:(NSError **)error; | ||
|
||
/*! Returns a BFAppLink for the given URL */ | ||
+ (BFTask *)resolveAppLinkInBackground:(NSURL *)destination; | ||
|
||
/*! Returns a BFAppLink for the given URL using the given App Link resolution strategy */ | ||
+ (BFTask *)resolveAppLinkInBackground:(NSURL *)destination resolver:(id<BFAppLinkResolving>)resolver; | ||
|
||
/*! Navigates to a BFAppLink and returns whether it opened in-app or in-browser */ | ||
+ (BFAppLinkNavigationType)navigateToAppLink:(BFAppLink *)link error:(NSError **)error; | ||
|
||
/*! Navigates to a URL (an asynchronous action) and returns a BFNavigationType */ | ||
+ (BFTask *)navigateToURLInBackground:(NSURL *)destination; | ||
|
||
/*! | ||
Navigates to a URL (an asynchronous action) using the given App Link resolution | ||
strategy and returns a BFNavigationType | ||
*/ | ||
+ (BFTask *)navigateToURLInBackground:(NSURL *)destination resolver:(id<BFAppLinkResolving>)resolver; | ||
|
||
/*! | ||
Gets the default resolver to be used for App Link resolution. If the developer has not set one explicitly, | ||
a basic, built-in resolver will be used. | ||
*/ | ||
+ (id<BFAppLinkResolving>)defaultResolver; | ||
|
||
/*! | ||
Sets the default resolver to be used for App Link resolution. Setting this to nil will revert the | ||
default resolver to the basic, built-in resolver provided by Bolts. | ||
*/ | ||
+ (void)setDefaultResolver:(id<BFAppLinkResolving>)resolver; | ||
|
||
@end |
Oops, something went wrong.