commit | author | age
|
e0ec42
|
1 |
/* |
L |
2 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
|
3 |
* All rights reserved. |
|
4 |
* |
|
5 |
* This source code is licensed under the license found in the |
|
6 |
* LICENSE file in the root directory of this source tree. |
|
7 |
*/ |
|
8 |
|
|
9 |
#import <Foundation/Foundation.h> |
|
10 |
|
|
11 |
NS_ASSUME_NONNULL_BEGIN |
|
12 |
|
|
13 |
/** |
|
14 |
Internal type exposed to facilitate transition to Swift. |
|
15 |
API Subject to change or removal without warning. Do not use. |
|
16 |
|
|
17 |
@warning INTERNAL - DO NOT USE |
|
18 |
*/ |
|
19 |
NS_SWIFT_NAME(InternalUtilityProtocol) |
|
20 |
@protocol FBSDKInternalUtility |
|
21 |
|
|
22 |
#pragma mark - FB Apps Installed |
|
23 |
|
|
24 |
@property (nonatomic, readonly) BOOL isFacebookAppInstalled; |
|
25 |
|
|
26 |
/* |
|
27 |
Checks if the app is Unity. |
|
28 |
*/ |
|
29 |
@property (nonatomic, readonly) BOOL isUnity; |
|
30 |
|
|
31 |
/** |
|
32 |
Constructs an NSURL. |
|
33 |
@param scheme The scheme for the URL. |
|
34 |
@param host The host for the URL. |
|
35 |
@param path The path for the URL. |
|
36 |
@param queryParameters The query parameters for the URL. This will be converted into a query string. |
|
37 |
@param errorRef If an error occurs, upon return contains an NSError object that describes the problem. |
|
38 |
@return The URL. |
|
39 |
*/ |
|
40 |
- (nullable NSURL *)URLWithScheme:(NSString *)scheme |
|
41 |
host:(NSString *)host |
|
42 |
path:(NSString *)path |
|
43 |
queryParameters:(NSDictionary<NSString *, NSString *> *)queryParameters |
|
44 |
error:(NSError *__autoreleasing *)errorRef; |
|
45 |
|
|
46 |
/** |
|
47 |
Constructs an URL for the current app. |
|
48 |
@param host The host for the URL. |
|
49 |
@param path The path for the URL. |
|
50 |
@param queryParameters The query parameters for the URL. This will be converted into a query string. |
|
51 |
@param errorRef If an error occurs, upon return contains an NSError object that describes the problem. |
|
52 |
@return The app URL. |
|
53 |
*/ |
|
54 |
- (nullable NSURL *)appURLWithHost:(NSString *)host |
|
55 |
path:(NSString *)path |
|
56 |
queryParameters:(NSDictionary<NSString *, NSString *> *)queryParameters |
|
57 |
error:(NSError *__autoreleasing *)errorRef; |
|
58 |
|
|
59 |
/** |
|
60 |
Constructs a Facebook URL. |
|
61 |
@param hostPrefix The prefix for the host, such as 'm', 'graph', etc. |
|
62 |
@param path The path for the URL. This may or may not include a version. |
|
63 |
@param queryParameters The query parameters for the URL. This will be converted into a query string. |
|
64 |
@param errorRef If an error occurs, upon return contains an NSError object that describes the problem. |
|
65 |
@return The Facebook URL. |
|
66 |
*/ |
|
67 |
- (nullable NSURL *)facebookURLWithHostPrefix:(NSString *)hostPrefix |
|
68 |
path:(NSString *)path |
|
69 |
queryParameters:(NSDictionary<NSString *, NSString *> *)queryParameters |
|
70 |
error:(NSError *__autoreleasing *)errorRef |
|
71 |
NS_SWIFT_NAME(facebookURL(hostPrefix:path:queryParameters:)); |
|
72 |
|
|
73 |
/** |
|
74 |
Registers a transient object so that it will not be deallocated until unregistered |
|
75 |
@param object The transient object |
|
76 |
*/ |
|
77 |
- (void)registerTransientObject:(id)object; |
|
78 |
|
|
79 |
/** |
|
80 |
Unregisters a transient object that was previously registered with registerTransientObject: |
|
81 |
@param object The transient object |
|
82 |
*/ |
|
83 |
- (void)unregisterTransientObject:(__weak id)object; |
|
84 |
|
|
85 |
- (void)checkRegisteredCanOpenURLScheme:(NSString *)urlScheme; |
|
86 |
|
|
87 |
/// Validates that the right URL schemes are registered, throws an NSException if not. |
|
88 |
- (void)validateURLSchemes; |
|
89 |
|
|
90 |
/// add data processing options to the dictionary. |
|
91 |
- (void)extendDictionaryWithDataProcessingOptions:(NSMutableDictionary<NSString *, NSString *> *)parameters; |
|
92 |
|
|
93 |
/// Converts NSData to a hexadecimal UTF8 String. |
|
94 |
- (nullable NSString *)hexadecimalStringFromData:(NSData *)data; |
|
95 |
|
|
96 |
/// validates that the app ID is non-nil, throws an NSException if nil. |
|
97 |
- (void)validateAppID; |
|
98 |
|
|
99 |
/** |
|
100 |
Validates that the client access token is non-nil, otherwise - throws an NSException otherwise. |
|
101 |
Returns the composed client access token. |
|
102 |
*/ |
|
103 |
- (NSString *)validateRequiredClientAccessToken; |
|
104 |
|
|
105 |
/** |
|
106 |
Extracts permissions from a response fetched from me/permissions |
|
107 |
@param responseObject the response |
|
108 |
@param grantedPermissions the set to add granted permissions to |
|
109 |
@param declinedPermissions the set to add declined permissions to. |
|
110 |
*/ |
|
111 |
- (void)extractPermissionsFromResponse:(NSDictionary<NSString *, id> *)responseObject |
|
112 |
grantedPermissions:(NSMutableSet<NSString *> *)grantedPermissions |
|
113 |
declinedPermissions:(NSMutableSet<NSString *> *)declinedPermissions |
|
114 |
expiredPermissions:(NSMutableSet<NSString *> *)expiredPermissions; |
|
115 |
|
|
116 |
/// validates that Facebook reserved URL schemes are not registered, throws an NSException if they are. |
|
117 |
- (void)validateFacebookReservedURLSchemes; |
|
118 |
|
|
119 |
/** |
|
120 |
Parses an FB url's query params (and potentially fragment) into a dictionary. |
|
121 |
@param url The FB url. |
|
122 |
@return A dictionary with the key/value pairs. |
|
123 |
*/ |
|
124 |
- (NSDictionary<NSString *, id> *)parametersFromFBURL:(NSURL *)url; |
|
125 |
|
|
126 |
/** |
|
127 |
Returns bundle for returning localized strings |
|
128 |
|
|
129 |
We assume a convention of a bundle named FBSDKStrings.bundle, otherwise we |
|
130 |
return the main bundle. |
|
131 |
*/ |
|
132 |
@property (nonatomic, readonly, strong) NSBundle *bundleForStrings; |
|
133 |
|
|
134 |
/// Returns currently displayed top view controller. |
|
135 |
- (nullable UIViewController *)topMostViewController; |
|
136 |
|
|
137 |
@end |
|
138 |
|
|
139 |
NS_ASSUME_NONNULL_END |