-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSendMessageController.m
66 lines (53 loc) · 1.89 KB
/
SendMessageController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// SendMessageController.m
// brooklyn
//
// Created by EthanRDoesMC on 1/5/21.
//
#import "SendMessageController.h"
#import "IMCore.h"
@interface SendMessageController ()
@property (strong, nonatomic) IBOutlet UITextField *textField;
@end
@implementation SendMessageController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
//_textField.placeholder = self.chat.serviceDisplayName;
}
-(id)initWithConversation:(CKConversation *)chat {
self.chat = chat;
return [super init];
}
- (IBAction)sendTyping:(id)sender {
[self.chat setLocalUserIsTyping:true];
}
//- (IBAction)sendMessage:(UITextField *)sender {
// [self.chat setLocalUserIsTyping:false];
// if (sender.hasText) {
// CKComposition * composition = [[CKComposition alloc] initWithText:sender.text subject:nil];
// [self.chat sendMessage:composition newComposition:true];
// }
// [self dismissViewControllerAnimated:YES completion:nil];
//}
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
[self.chat.chat setLocalUserIsTyping:true];
return YES;
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
[self.chat setLocalUserIsTyping:false];
CKComposition * composition = [[CKComposition alloc] initWithText:[[NSAttributedString alloc] initWithString:textField.text] subject:nil];
[self.chat.chat sendMessage:[self.chat messageWithComposition:composition]];
[textField resignFirstResponder];
[self.navigationController popViewControllerAnimated:YES];
return YES;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end