diff --git a/mobile/library/objective-c/Envoy.h b/mobile/library/objective-c/Envoy.h deleted file mode 100644 index 5ea32a1dc593..000000000000 --- a/mobile/library/objective-c/Envoy.h +++ /dev/null @@ -1,19 +0,0 @@ -#import - -@interface Envoy : NSObject - -/// Indicates whether this Envoy instance is currently active and running. -@property (nonatomic, readonly) BOOL isRunning; - -/// Indicates whether the Envoy instance is terminated. -@property (nonatomic, readonly) BOOL isTerminated; - -/// Create a new Envoy instance. The Envoy runner NSThread is started as part of instance -/// initialization with the configuration provided. -- (instancetype)initWithConfig:(NSString *)config; - -/// Create a new Envoy instance. The Envoy runner NSThread is started as part of instance -/// initialization with the configuration provided. -- (instancetype)initWithConfig:(NSString *)config logLevel:(NSString *)logLevel; - -@end diff --git a/mobile/library/objective-c/Envoy.mm b/mobile/library/objective-c/Envoy.mm deleted file mode 100644 index 78fa31a8fee7..000000000000 --- a/mobile/library/objective-c/Envoy.mm +++ /dev/null @@ -1,57 +0,0 @@ -#import "library/objective-c/Envoy.h" - -#import "library/common/main_interface.h" - -static NSString *const kConfig = @"config"; -static NSString *const kLogLevel = @"logLevel"; -static NSString *const kDefaultLogLevel = @"info"; - -@interface Envoy () -@property (nonatomic, strong) NSThread *runner; -@end - -@implementation Envoy - -@synthesize runner; - -- (instancetype)initWithConfig:(NSString *)config { - self = [self initWithConfig:config logLevel:kDefaultLogLevel]; - return self; -} - -- (instancetype)initWithConfig:(NSString *)config logLevel:(NSString *)logLevel { - self = [super init]; - if (self) { - NSDictionary *args = @{ - kConfig : config, - kLogLevel : logLevel, - }; - self.runner = [[NSThread alloc] initWithTarget:self selector:@selector(run:) object:args]; - [self.runner start]; - } - return self; -} - -- (BOOL)isRunning { - return self.runner.isExecuting; -} - -- (BOOL)isTerminated { - return self.runner.isFinished; -} - -#pragma mark private - -- (void)run:(NSDictionary *)args { - try { - run_engine([args[kConfig] UTF8String], [args[kLogLevel] UTF8String]); - } catch (NSException *e) { - NSLog(@"Envoy exception: %@", e); - NSDictionary *userInfo = @{@"exception" : e}; - [NSNotificationCenter.defaultCenter postNotificationName:@"EnvoyException" - object:self - userInfo:userInfo]; - } -} - -@end