Newer
Older
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
67
//
// BLNewChatViewController.m
// brooklyn
//
// Created by EthanRDoesMC on 12/31/20.
//
#import "BLNewChatViewController.h"
#import "ChatKit.h"
@interface BLNewChatViewController ()
@property (strong, nonatomic) IBOutlet UILabel *logLabel;
@property (strong, nonatomic) IBOutlet UITextField *textField;
@end
@implementation BLNewChatViewController
-(void)loadView {
[super loadView];
self.navigationItem.title = @"Create";
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
[self doAThing:textField.text];
[textField resignFirstResponder];
return YES;
}
-(void)doAThing:(NSString *)tf {
_logLabel.text = @"called doathing";
[BrooklynBridge riseAndShineIMDaemon];
_logLabel.text = @"daemon called";
if (![tf isEqual:@""]) {
_logLabel.text = tf;
//CKEntity *newEntity = [CKEntity copyEntityForAddressString:textField.text];
// CKIMComposeRecipient * rec = [[CKRecipientGenerator sharedRecipientGenerator] recipientWithAddress:tf];
IMHandle * handle = [[[IMAccountController sharedInstance] __ck_defaultAccountForService:nil] __ck_handlesFromAddressStrings:@[ tf ]][0];
_logLabel.text = handle.description;
IMChat * chat = [[IMChatRegistry sharedInstance] _ck_chatForHandles: @[ handle ] createIfNecessary:YES];
_logLabel.text = IMChat.description;
CKConversation * newconvo = [[CKConversation alloc] initWithChat:chat];
_logLabel.text = newconvo.description;
//[textField resignFirstResponder];
[chat loadMessagesBeforeDate:[NSDate date] limit:100 loadImmediately:YES];
CKTranscriptController * tc = [[CKTranscriptController alloc] init];
_logLabel.text = tc.description;
[tc setConversation:newconvo];
[self.navigationController pushViewController:tc animated: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