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 |
|
e0ec42
|
13 |
/// Class to contain common utility methods. |
2e29a3
|
14 |
NS_SWIFT_NAME(Utility) |
L |
15 |
@interface FBSDKUtility : NSObject |
|
16 |
|
|
17 |
- (instancetype)init NS_UNAVAILABLE; |
|
18 |
+ (instancetype)new NS_UNAVAILABLE; |
|
19 |
|
|
20 |
/** |
e0ec42
|
21 |
Parses a query string into a dictionary. |
2e29a3
|
22 |
@param queryString The query string value. |
L |
23 |
@return A dictionary with the key/value pairs. |
|
24 |
*/ |
|
25 |
|
|
26 |
// UNCRUSTIFY_FORMAT_OFF |
|
27 |
+ (NSDictionary<NSString *, NSString *> *)dictionaryWithQueryString:(NSString *)queryString |
|
28 |
NS_SWIFT_NAME(dictionary(withQuery:)); |
|
29 |
// UNCRUSTIFY_FORMAT_ON |
|
30 |
|
|
31 |
/** |
e0ec42
|
32 |
Constructs a query string from a dictionary. |
2e29a3
|
33 |
@param dictionary The dictionary with key/value pairs for the query string. |
L |
34 |
@param errorRef If an error occurs, upon return contains an NSError object that describes the problem. |
|
35 |
@return Query string representation of the parameters. |
|
36 |
*/ |
|
37 |
|
|
38 |
// UNCRUSTIFY_FORMAT_OFF |
|
39 |
+ (NSString *)queryStringWithDictionary:(NSDictionary<NSString *, id> *)dictionary |
|
40 |
error:(NSError **)errorRef |
|
41 |
NS_SWIFT_NAME(query(from:)) |
|
42 |
__attribute__((swift_error(nonnull_error))); |
|
43 |
// UNCRUSTIFY_FORMAT_ON |
|
44 |
|
|
45 |
/** |
e0ec42
|
46 |
Decodes a value from an URL. |
2e29a3
|
47 |
@param value The value to decode. |
L |
48 |
@return The decoded value. |
|
49 |
*/ |
|
50 |
|
|
51 |
// UNCRUSTIFY_FORMAT_OFF |
|
52 |
+ (NSString *)URLDecode:(NSString *)value |
|
53 |
NS_SWIFT_NAME(decode(urlString:)); |
|
54 |
// UNCRUSTIFY_FORMAT_ON |
|
55 |
|
|
56 |
/** |
e0ec42
|
57 |
Encodes a value for an URL. |
2e29a3
|
58 |
@param value The value to encode. |
L |
59 |
@return The encoded value. |
|
60 |
*/ |
|
61 |
|
|
62 |
// UNCRUSTIFY_FORMAT_OFF |
|
63 |
+ (NSString *)URLEncode:(NSString *)value |
|
64 |
NS_SWIFT_NAME(encode(urlString:)); |
|
65 |
// UNCRUSTIFY_FORMAT_ON |
|
66 |
|
|
67 |
/** |
e0ec42
|
68 |
Creates a timer using Grand Central Dispatch. |
2e29a3
|
69 |
@param interval The interval to fire the timer, in seconds. |
L |
70 |
@param block The code block to execute when timer is fired. |
|
71 |
@return The dispatch handle. |
|
72 |
*/ |
|
73 |
+ (dispatch_source_t)startGCDTimerWithInterval:(double)interval block:(dispatch_block_t)block; |
|
74 |
|
|
75 |
/** |
|
76 |
Stop a timer that was started by startGCDTimerWithInterval. |
|
77 |
@param timer The dispatch handle received from startGCDTimerWithInterval. |
|
78 |
*/ |
|
79 |
+ (void)stopGCDTimer:(dispatch_source_t)timer; |
|
80 |
|
|
81 |
/** |
|
82 |
Get SHA256 hased string of NSString/NSData |
|
83 |
|
|
84 |
@param input The data that needs to be hashed, it could be NSString or NSData. |
|
85 |
*/ |
|
86 |
|
|
87 |
// UNCRUSTIFY_FORMAT_OFF |
|
88 |
+ (nullable NSString *)SHA256Hash:(NSObject *)input |
|
89 |
NS_SWIFT_NAME(sha256Hash(_:)); |
|
90 |
// UNCRUSTIFY_FORMAT_ON |
|
91 |
|
e0ec42
|
92 |
/// Returns the graphdomain stored in FBSDKAuthenticationToken |
L |
93 |
+ (nullable NSString *)getGraphDomainFromToken; |
2e29a3
|
94 |
|
L |
95 |
/** |
|
96 |
Internal Type exposed to facilitate transition to Swift. |
|
97 |
API Subject to change or removal without warning. Do not use. |
|
98 |
|
|
99 |
@warning INTERNAL - DO NOT USE |
|
100 |
*/ |
|
101 |
+ (NSURL *)unversionedFacebookURLWithHostPrefix:(NSString *)hostPrefix |
|
102 |
path:(NSString *)path |
|
103 |
queryParameters:(NSDictionary<NSString *, id> *)queryParameters |
|
104 |
error:(NSError *__autoreleasing *)errorRef; |
|
105 |
|
|
106 |
@end |
|
107 |
|
|
108 |
NS_ASSUME_NONNULL_END |