commit | author | age
|
bad748
|
1 |
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. |
W |
2 |
// |
|
3 |
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, |
|
4 |
// copy, modify, and distribute this software in source code or binary form for use |
|
5 |
// in connection with the web services and APIs provided by Facebook. |
|
6 |
// |
|
7 |
// As with any software that integrates with the Facebook platform, your use of |
|
8 |
// this software is subject to the Facebook Developer Principles and Policies |
|
9 |
// [http://developers.facebook.com/policy/]. This copyright notice shall be |
|
10 |
// included in all copies or substantial portions of the software. |
|
11 |
// |
|
12 |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
13 |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
|
14 |
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
|
15 |
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
|
16 |
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|
17 |
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
18 |
|
|
19 |
#import <Foundation/Foundation.h> |
|
20 |
|
e81c27
|
21 |
NS_ASSUME_NONNULL_BEGIN |
H |
22 |
|
9febd9
|
23 |
/** |
W |
24 |
Class to contain common utility methods. |
bad748
|
25 |
*/ |
e81c27
|
26 |
NS_SWIFT_NAME(Utility) |
bad748
|
27 |
@interface FBSDKUtility : NSObject |
W |
28 |
|
13e53a
|
29 |
- (instancetype)init NS_UNAVAILABLE; |
H |
30 |
+ (instancetype)new NS_UNAVAILABLE; |
|
31 |
|
9febd9
|
32 |
/** |
W |
33 |
Parses a query string into a dictionary. |
13e53a
|
34 |
@param queryString The query string value. |
H |
35 |
@return A dictionary with the key/value pairs. |
bad748
|
36 |
*/ |
e81c27
|
37 |
+ (NSDictionary<NSString *, NSString *> *)dictionaryWithQueryString:(NSString *)queryString |
H |
38 |
NS_SWIFT_NAME(dictionary(withQuery:)); |
bad748
|
39 |
|
9febd9
|
40 |
/** |
W |
41 |
Constructs a query string from a dictionary. |
13e53a
|
42 |
@param dictionary The dictionary with key/value pairs for the query string. |
H |
43 |
@param errorRef If an error occurs, upon return contains an NSError object that describes the problem. |
|
44 |
@return Query string representation of the parameters. |
bad748
|
45 |
*/ |
e81c27
|
46 |
+ (NSString *)queryStringWithDictionary:(NSDictionary<NSString *, id> *)dictionary |
H |
47 |
error:(NSError **)errorRef |
|
48 |
NS_SWIFT_NAME(query(from:)) |
|
49 |
__attribute__((swift_error(nonnull_error))); |
bad748
|
50 |
|
9febd9
|
51 |
/** |
W |
52 |
Decodes a value from an URL. |
13e53a
|
53 |
@param value The value to decode. |
H |
54 |
@return The decoded value. |
bad748
|
55 |
*/ |
e81c27
|
56 |
+ (NSString *)URLDecode:(NSString *)value |
H |
57 |
NS_SWIFT_NAME(decode(urlString:)); |
bad748
|
58 |
|
9febd9
|
59 |
/** |
W |
60 |
Encodes a value for an URL. |
13e53a
|
61 |
@param value The value to encode. |
H |
62 |
@return The encoded value. |
bad748
|
63 |
*/ |
e81c27
|
64 |
+ (NSString *)URLEncode:(NSString *)value |
H |
65 |
NS_SWIFT_NAME(encode(urlString:)); |
bad748
|
66 |
|
9f077b
|
67 |
/** |
H |
68 |
Creates a timer using Grand Central Dispatch. |
13e53a
|
69 |
@param interval The interval to fire the timer, in seconds. |
H |
70 |
@param block The code block to execute when timer is fired. |
|
71 |
@return The dispatch handle. |
9f077b
|
72 |
*/ |
H |
73 |
+ (dispatch_source_t)startGCDTimerWithInterval:(double)interval block:(dispatch_block_t)block; |
|
74 |
|
|
75 |
/** |
|
76 |
Stop a timer that was started by startGCDTimerWithInterval. |
13e53a
|
77 |
@param timer The dispatch handle received from startGCDTimerWithInterval. |
9f077b
|
78 |
*/ |
H |
79 |
+ (void)stopGCDTimer:(dispatch_source_t)timer; |
|
80 |
|
13e53a
|
81 |
/** |
H |
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 |
*/ |
e81c27
|
86 |
+ (nullable NSString *)SHA256Hash:(nullable NSObject *)input |
H |
87 |
NS_SWIFT_NAME(sha256Hash(_:)); |
13e53a
|
88 |
|
bad748
|
89 |
@end |
e81c27
|
90 |
|
H |
91 |
NS_ASSUME_NONNULL_END |