commit | author | age
|
2e29a3
|
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 |
|
|
72 |
/** |
|
73 |
Registers a transient object so that it will not be deallocated until unregistered |
|
74 |
@param object The transient object |
|
75 |
*/ |
|
76 |
- (void)registerTransientObject:(id)object; |
|
77 |
|
|
78 |
/** |
|
79 |
Unregisters a transient object that was previously registered with registerTransientObject: |
|
80 |
@param object The transient object |
|
81 |
*/ |
|
82 |
- (void)unregisterTransientObject:(__weak id)object; |
|
83 |
|
|
84 |
- (void)checkRegisteredCanOpenURLScheme:(NSString *)urlScheme; |
|
85 |
|
|
86 |
/** |
|
87 |
Validates that the right URL schemes are registered, throws an NSException if not. |
|
88 |
*/ |
|
89 |
- (void)validateURLSchemes; |
|
90 |
|
|
91 |
/** |
|
92 |
add data processing options to the dictionary. |
|
93 |
*/ |
|
94 |
- (void)extendDictionaryWithDataProcessingOptions:(NSMutableDictionary<NSString *, NSString *> *)parameters; |
|
95 |
|
|
96 |
/** |
|
97 |
Converts NSData to a hexadecimal UTF8 String. |
|
98 |
*/ |
|
99 |
- (nullable NSString *)hexadecimalStringFromData:(NSData *)data; |
|
100 |
|
|
101 |
/** |
|
102 |
validates that the app ID is non-nil, throws an NSException if nil. |
|
103 |
*/ |
|
104 |
- (void)validateAppID; |
|
105 |
|
|
106 |
/** |
|
107 |
Validates that the client access token is non-nil, otherwise - throws an NSException otherwise. |
|
108 |
Returns the composed client access token. |
|
109 |
*/ |
|
110 |
- (NSString *)validateRequiredClientAccessToken; |
|
111 |
|
|
112 |
/** |
|
113 |
Extracts permissions from a response fetched from me/permissions |
|
114 |
@param responseObject the response |
|
115 |
@param grantedPermissions the set to add granted permissions to |
|
116 |
@param declinedPermissions the set to add declined permissions to. |
|
117 |
*/ |
|
118 |
- (void)extractPermissionsFromResponse:(NSDictionary<NSString *, id> *)responseObject |
|
119 |
grantedPermissions:(NSMutableSet<NSString *> *)grantedPermissions |
|
120 |
declinedPermissions:(NSMutableSet<NSString *> *)declinedPermissions |
|
121 |
expiredPermissions:(NSMutableSet<NSString *> *)expiredPermissions; |
|
122 |
|
|
123 |
/** |
|
124 |
validates that Facebook reserved URL schemes are not registered, throws an NSException if they are. |
|
125 |
*/ |
|
126 |
- (void)validateFacebookReservedURLSchemes; |
|
127 |
|
|
128 |
/** |
|
129 |
Parses an FB url's query params (and potentially fragment) into a dictionary. |
|
130 |
@param url The FB url. |
|
131 |
@return A dictionary with the key/value pairs. |
|
132 |
*/ |
|
133 |
- (NSDictionary<NSString *, id> *)parametersFromFBURL:(NSURL *)url; |
|
134 |
|
|
135 |
@end |
|
136 |
|
|
137 |
NS_ASSUME_NONNULL_END |