Skip to content
Snippets Groups Projects
LogViewController.m 1.36 KiB
Newer Older
EthanRDoesMC's avatar
EthanRDoesMC committed
//
//  LogViewController.m
//  xchighlight
//
//  Created by EthanRDoesMC on 3/18/21.
//

#import "LogViewController.h"
#import <Foundation/Foundation.h>
#import "NSTask.h"
EthanRDoesMC's avatar
EthanRDoesMC committed
#import "BLMautrixTask.h"
EthanRDoesMC's avatar
EthanRDoesMC committed

@interface LogViewController ()
@property (strong, nonatomic) IBOutlet UITextView *logField;
EthanRDoesMC's avatar
EthanRDoesMC committed
@property (nonatomic, strong) NSTask* task;
EthanRDoesMC's avatar
EthanRDoesMC committed
@end

@implementation LogViewController

- (void)viewDidLoad {
    [super viewDidLoad];
EthanRDoesMC's avatar
EthanRDoesMC committed
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:[BLMautrixTask sharedTask] action:@selector(sendPing)];
    [BLMautrixTask sharedTask];
    [self updateLog];
EthanRDoesMC's avatar
EthanRDoesMC committed
    // Do any additional setup after loading the view from its nib.
EthanRDoesMC's avatar
EthanRDoesMC committed
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateLog) name:@"BLMautrixLogUpdated" object:nil];
}
EthanRDoesMC's avatar
EthanRDoesMC committed

EthanRDoesMC's avatar
EthanRDoesMC committed
-(void)updateLog {
    [self.logField setText:[[BLMautrixTask sharedTask] outputString]];
    [self.logField scrollRangeToVisible: NSMakeRange(_logField.text.length, 0)];
EthanRDoesMC's avatar
EthanRDoesMC committed
}

/*
#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