commit | author | age
|
655e66
|
1 |
/* |
H |
2 |
* Copyright (C) 2017 Twitter, Inc. |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
* |
|
16 |
*/ |
a0a843
|
17 |
|
H |
18 |
#import <UIKit/UIKit.h> |
|
19 |
|
|
20 |
NS_ASSUME_NONNULL_BEGIN |
|
21 |
|
|
22 |
/** |
|
23 |
* Possible values for the <i>result</i> parameter of the completionHandler property. |
|
24 |
*/ |
|
25 |
typedef NS_ENUM(NSInteger, TWTRComposerResult) { |
|
26 |
/** |
|
27 |
* The composer is dismissed without sending the Tweet (i.e. the user selects Cancel, or the account is unavailable). |
|
28 |
*/ |
|
29 |
TWTRComposerResultCancelled, |
|
30 |
|
|
31 |
/** |
|
32 |
* The composer is dismissed and the message is being sent in the background, after the user selects Done. |
|
33 |
*/ |
|
34 |
TWTRComposerResultDone |
|
35 |
}; |
|
36 |
|
|
37 |
/** |
|
38 |
* Completion block called when the user finishes composing a Tweet. |
|
39 |
*/ |
|
40 |
typedef void (^TWTRComposerCompletion)(TWTRComposerResult result); |
|
41 |
|
|
42 |
/** |
|
43 |
* The TWTRComposer class presents a view to the user to compose a Tweet. |
|
44 |
*/ |
|
45 |
@interface TWTRComposer : NSObject |
|
46 |
|
|
47 |
/** |
|
48 |
* Sets the initial text for the Tweet composition prior to showing it. |
|
49 |
* |
|
50 |
* @param text The text to tweet. |
|
51 |
* |
|
52 |
* @return This will return NO if the receiver has already been presented (and therefore cannot be changed). |
|
53 |
*/ |
|
54 |
- (BOOL)setText:(nullable NSString *)text; |
|
55 |
|
|
56 |
/** |
|
57 |
* Sets an image attachment. |
|
58 |
* |
|
59 |
* @param image The image to attach. |
|
60 |
* |
|
61 |
* @return This will return NO if the receiver has already been presented (and therefore cannot be changed). |
|
62 |
*/ |
|
63 |
- (BOOL)setImage:(nullable UIImage *)image; |
|
64 |
|
|
65 |
/** |
|
66 |
* Adds a URL to the contents of the Tweet message. |
|
67 |
* |
|
68 |
* @param url The URL. |
|
69 |
* |
|
70 |
* @return This will return NO if the receiver has already been presented (and therefore cannot be changed). |
|
71 |
*/ |
|
72 |
- (BOOL)setURL:(nullable NSURL *)url; |
|
73 |
|
|
74 |
/** |
|
75 |
* Presents the composer, with an optional completion handler from the specified view controller. |
|
76 |
* @param fromController The controller in which to present the composer from. |
|
77 |
* @param completion completion The completion handler, which has a single parameter indicating whether the user finished or cancelled the Tweet composition. |
|
78 |
*/ |
655e66
|
79 |
- (void)showFromViewController:(UIViewController *)fromController completion:(nullable TWTRComposerCompletion)completion; |
a0a843
|
80 |
|
H |
81 |
@end |
|
82 |
|
|
83 |
NS_ASSUME_NONNULL_END |