refact: use DoricSingleton to hold all static or singleton objects
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
// Created by jingpeng.wang on 2020/2/25.
|
||||
//
|
||||
#import <DoricCore/Doric.h>
|
||||
#import <DoricCore/DoricSingleton.h>
|
||||
#import <DoricCore/DoricNativeDriver.h>
|
||||
#import <DoricCore/DoricContextManager.h>
|
||||
|
||||
@@ -78,8 +79,8 @@ - (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
_callbacks = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory];
|
||||
_reloadingContexts = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory];
|
||||
[DoricNativeDriver.instance.registry registerMonitor:[DoricDevMonitor new]];
|
||||
DoricNativeDriver.instance.registry.globalPerformanceAnchorHook = [DoricDevPerformanceAnchorHook new];
|
||||
[DoricSingleton.instance.nativeDriver.registry registerMonitor:[DoricDevMonitor new]];
|
||||
DoricSingleton.instance.nativeDriver.registry.globalPerformanceAnchorHook = [DoricDevPerformanceAnchorHook new];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@@ -125,7 +125,7 @@ - (void)onClick {
|
||||
[alertController addAction:startDebugging];
|
||||
}
|
||||
}
|
||||
if ([DoricRegistry isEnableRenderSnapshot]) {
|
||||
if ([Doric isEnableRenderSnapshot]) {
|
||||
UIAlertAction *snapshot = [UIAlertAction actionWithTitle:@"Snapshot" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_) {
|
||||
DoricSnapshotView *doricSnapshotView = [[DoricSnapshotView alloc] initWithDoricContext:self.doricContext];
|
||||
doricSnapshotView.top = 50;
|
||||
@@ -135,7 +135,7 @@ - (void)onClick {
|
||||
[alertController addAction:snapshot];
|
||||
}
|
||||
|
||||
if ([DoricRegistry isEnablePerformance]) {
|
||||
if ([Doric isEnablePerformance]) {
|
||||
UIAlertAction *performanceAction = [UIAlertAction
|
||||
actionWithTitle:@"Performance"
|
||||
style:UIAlertActionStyleDefault
|
||||
@@ -290,11 +290,11 @@ - (void)viewDidLoad {
|
||||
}
|
||||
|
||||
- (void)onSnapshotSwitch {
|
||||
[DoricRegistry enableRenderSnapshot:self.switchSnapshot.isOn];
|
||||
[Doric enableRenderSnapshot:self.switchSnapshot.isOn];
|
||||
}
|
||||
|
||||
- (void)onPerformanceSwitch {
|
||||
[DoricRegistry enablePerformance:self.switchPerformance.isOn];
|
||||
[Doric enablePerformance:self.switchPerformance.isOn];
|
||||
}
|
||||
|
||||
- (void)disconnect {
|
||||
@@ -385,13 +385,13 @@ - (void)initHeaders {
|
||||
self.switchSnapshot.left = self.tvSnapshot.right + 20;
|
||||
self.switchSnapshot.top = self.tvConnection.bottom + 15;
|
||||
self.tvSnapshot.centerY = self.switchSnapshot.centerY;
|
||||
self.switchSnapshot.on = [DoricRegistry isEnableRenderSnapshot];
|
||||
self.switchSnapshot.on = [Doric isEnableRenderSnapshot];
|
||||
|
||||
self.tvPerformance.left = self.tvLabel.right + 20;
|
||||
self.switchPerformance.left = self.tvPerformance.right + 20;
|
||||
self.switchPerformance.top = self.switchSnapshot.bottom + 15;
|
||||
self.tvPerformance.centerY = self.switchPerformance.centerY;
|
||||
self.switchPerformance.on = [DoricRegistry isEnablePerformance];
|
||||
self.switchPerformance.on = [Doric isEnablePerformance];
|
||||
}
|
||||
|
||||
- (void)initList {
|
||||
|
Reference in New Issue
Block a user