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