1 //
2 // TWTRTweetViewDelegate.h
3 //
4 // Copyright (c) 2015 Twitter. All rights reserved.
5 //
6
7 #import <UIKit/UIKit.h>
8
9 @class TWTRSession;
10 @class TWTRTweet;
11 @class TWTRTweetDetailViewController;
12 @class TWTRTweetView;
13 @class TWTRUser;
14 @protocol TWTRSessionStore;
15
16 NS_ASSUME_NONNULL_BEGIN
17
18 typedef void (^TWTRAuthenticationCompletionHandler)(id<TWTRSessionStore> sessionStore, NSString *userID);
19
20 /**
21 Delegate for `TWTRTweetView` to receive updates on the user interacting with this particular Tweet view.
22
23 // Create the tweet view
24 TWTRTweetView *tweetView = [[TWTRTweetView alloc] initWithTweet:tweet];
25 // Set the delegate
26 tweetView.delegate = self;
27 */
28 @protocol TWTRTweetViewDelegate <NSObject>
29
30 @optional
31
32 /**
33 * The tweet view image was tapped.
34 *
35 * @param tweetView The Tweet view that was tapped.
36 * @param image The exact UIImage data shown by the Tweet view.
37 * @param imageURL The full URL of the image being shown.
38 */
39 - (void)tweetView:(TWTRTweetView *)tweetView didTapImage:(UIImage *)image withURL:(NSURL *)imageURL;
40
41 /**
42 * The Tweet view video was tapped.
43 * If this method is not implemented a video player will be presented.
44 *
45 * @param tweetView The Tweet view that was tapped.
46 * @param videoURL The full URL of the video being shown.
47 */
48 - (void)tweetView:(TWTRTweetView *)tweetView didTapVideoWithURL:(NSURL *)videoURL;
49
50 /**
51 * A URL in the text of a tweet was tapped. Implement to show your own webview rather than opening Safari.
52 *
53 * @param tweetView The Tweet view that was tapped.
54 * @param url The URL that was tapped.
55 */
56 - (void)tweetView:(TWTRTweetView *)tweetView didTapURL:(NSURL *)url;
57
58 /**
59 * Called when the user's profile image is tapped.
60 * If this method is not implemented and the device is running on iOS 9+ we will deep link into the Twitter application.
61 *
62 * @param tweetView The Tweet view that was tapped.
63 * @param user The Twitter user.
64 */
65 - (void)tweetView:(TWTRTweetView *)tweetView didTapProfileImageForUser:(TWTRUser *)user;
66
67 /**
68 * Called when the Tweet is tapped and will present a detail view controller.
69 * If this method is not implemented the detail view controller will be presented modally with the inherited themes
70 * of the tweetView.
71 *
72 * If this method is implemented the return value will be used to determine how to proceed. If YES is returned the controller
73 * will be presented as if this method was not implemented. If NO is returned the controller will not be presented and it
74 * it is the developer's responsibility to show it. This allows the developer to push the detail view controller onto their
75 * own navigation stack, or present in a way that is appropriate for their particular use-case.
76 *
77 * @param tweetView The Tweet view showing this Tweet object.
78 * @param controller The Tweet detail view controller that should be displayed.
79 */
80 - (BOOL)tweetView:(TWTRTweetView *)tweetView shouldDisplayDetailViewController:(TWTRTweetDetailViewController *)controller;
81
82 @end
83
84 NS_ASSUME_NONNULL_END