Skip to content

Commit bea5a8f

Browse files
authored
Merge branch 'master' into master
2 parents 596e7ed + a0f970f commit bea5a8f

File tree

9 files changed

+54
-13
lines changed

9 files changed

+54
-13
lines changed

Doc/android_cn_guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependencies {
2323
@Override
2424
public void onCreate() {
2525
...
26-
DoraemonKit.install(application
26+
DoraemonKit.install(application)
2727
2828
// H5任意门功能需要,非必须
2929
DoraemonKit.setWebDoorCallback(new WebDoorManager.WebDoorCallback() {
@@ -109,4 +109,4 @@ public void onCreate() {
109109
DoraemonKit.install(application, kits);
110110
...
111111
}
112-
```
112+
```

Doc/android_en_guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies {
1111
}
1212
```
1313

14-
Please use [the lastest release](android-ReleaseNotes.md)
14+
Please use [the latest release](android-ReleaseNotes.md)
1515

1616

1717

@@ -109,4 +109,4 @@ public void onCreate() {
109109
DoraemonKit.install(application, kits);
110110
...
111111
}
112-
```
112+
```
Binary file not shown.
Binary file not shown.

iOS/DoraemonKit/Src/Core/Manager/DoraemonManager.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ typedef void (^DoraemonH5DoorBlock)(NSString *);
1515

1616
- (void)install;
1717

18+
- (void)installWithCustomBlock:(void(^)())customBlock;
19+
1820
@property (nonatomic,strong) NSMutableArray *dataArray;
1921

2022
@property (nonatomic, copy) DoraemonH5DoorBlock h5DoorBlock;
2123

2224
- (void)addPluginWithTitle:(NSString *)title icon:(NSString *)iconName desc:(NSString *)desc pluginName:(NSString *)entryName atModule:(NSString *)moduleName;
2325

26+
- (void)removePluginWithPluginName:(NSString *)pluginName atModule:(NSString *)moduleName;
27+
2428
- (void)addStartPlugin:(NSString *)pluginName;
2529

2630
- (void)addH5DoorBlock:(void(^)(NSString *h5Url))block;

iOS/DoraemonKit/Src/Core/Manager/DoraemonManager.m

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ + (DoraemonManager *)shareInstance{
5555
}
5656

5757
- (void)install{
58+
[self installWithCustomBlock:^{
59+
//什么也没发生
60+
}];
61+
}
62+
63+
- (void)installWithCustomBlock:(void(^)())customBlock{
5864
for (int i=0; i<_startPlugins.count; i++) {
5965
NSString *pluginName = _startPlugins[i];
6066
Class pluginClass = NSClassFromString(pluginName);
@@ -63,8 +69,10 @@ - (void)install{
6369
[plugin pluginDidLoad];
6470
}
6571
}
66-
72+
6773
[self initData];
74+
customBlock();
75+
6876
[self initEntry];
6977

7078
//根据开关判断是否收集Crash日志
@@ -192,6 +200,10 @@ - (void)addPluginWithTitle:(NSString *)title icon:(NSString *)iconName desc:(NSS
192200
}
193201
}
194202

203+
- (void)removePluginWithPluginName:(NSString *)pluginName atModule:(NSString *)moduleName{
204+
[self unregisterPlugin:pluginName withModule:moduleName];
205+
}
206+
195207
- (void)registerPluginArray:(NSMutableArray*)array withModule:(NSString*)moduleName{
196208
if (!_dataArray){
197209
_dataArray = [[NSMutableArray alloc]init];
@@ -202,6 +214,27 @@ - (void)registerPluginArray:(NSMutableArray*)array withModule:(NSString*)moduleN
202214
[_dataArray addObject:dic];
203215
}
204216

217+
- (void)unregisterPlugin:(NSString*)pluginName withModule:(NSString*)moduleName{
218+
if (!_dataArray){
219+
return;
220+
}
221+
id object;
222+
for (object in _dataArray) {
223+
NSString *tempModuleName = [((NSMutableDictionary *)object) valueForKey:@"moduleName"];
224+
if ([tempModuleName isEqualToString:moduleName]) {
225+
NSMutableArray *tempPluginArray = [((NSMutableDictionary *)object) valueForKey:@"pluginArray"];
226+
id pluginObject;
227+
for (pluginObject in tempPluginArray) {
228+
NSString *tempPluginName = [((NSMutableDictionary *)pluginObject) valueForKey:@"pluginName"];
229+
if ([tempPluginName isEqualToString:pluginName]) {
230+
[tempPluginArray removeObject:pluginObject];
231+
return;
232+
}
233+
}
234+
}
235+
}
236+
}
237+
205238
- (void)hiddenDoraemon{
206239
_entryView.hidden = YES;
207240
}

iOS/DoraemonKitDemo/DoraemonKitDemo.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@
568568
GCC_PREFIX_HEADER = "DoraemonKitDemo/DoraemonKitDemo-PrefixHeader.pch";
569569
INFOPLIST_FILE = DoraemonKitDemo/Info.plist;
570570
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
571-
PRODUCT_BUNDLE_IDENTIFIER = yixiang.DoraemonKitDemoC;
571+
PRODUCT_BUNDLE_IDENTIFIER = yixiang.DoraemonKitDemoXXX;
572572
PRODUCT_NAME = "$(TARGET_NAME)";
573573
TARGETED_DEVICE_FAMILY = "1,2";
574574
};
@@ -586,7 +586,7 @@
586586
GCC_PREFIX_HEADER = "DoraemonKitDemo/DoraemonKitDemo-PrefixHeader.pch";
587587
INFOPLIST_FILE = DoraemonKitDemo/Info.plist;
588588
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
589-
PRODUCT_BUNDLE_IDENTIFIER = yixiang.DoraemonKitDemoC;
589+
PRODUCT_BUNDLE_IDENTIFIER = yixiang.DoraemonKitDemoXXX;
590590
PRODUCT_NAME = "$(TARGET_NAME)";
591591
TARGETED_DEVICE_FAMILY = "1,2";
592592
};

iOS/DoraemonKitDemo/DoraemonKitDemo/AppDelegate.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2727
}
2828
[[DoraemonManager shareInstance] addPluginWithTitle:@"测试插件" icon:@"doraemon_default" desc:@"测试插件" pluginName:@"TestPlugin" atModule:@"业务工具"];
2929
[[DoraemonManager shareInstance] addStartPlugin:@"StartPlugin"];
30+
[[DoraemonManager shareInstance] install];
3031
// [[DoraemonManager shareInstance] addH5DoorBlock:^(NSString *h5Url) {
3132
// NSLog(@"使用自带容器打开H5链接: %@",h5Url);
3233
// }];
33-
[[DoraemonManager shareInstance] install];
34-
34+
// 例子:移除 GPS Mock
35+
// [[DoraemonManager shareInstance] installWithCustomBlock:^{
36+
// [[DoraemonManager shareInstance] removePluginWithPluginName:@"DoraemonGPSPlugin" atModule:@"常用工具"];
37+
// }];
38+
3539
for (int i=0; i<10; i++) {
3640
// DDLogInfo(@"点击添加埋点22222");
3741
}

iOS/DoraemonLoadAnalyzeDemo/DoraemonLoadAnalyzeDemo.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,15 +430,15 @@
430430
buildSettings = {
431431
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
432432
CODE_SIGN_STYLE = Automatic;
433-
DEVELOPMENT_TEAM = 2M632FEG3H;
433+
DEVELOPMENT_TEAM = RSV7DQ57L7;
434434
INFOPLIST_FILE = DoraemonLoadAnalyzeDemo/Info.plist;
435435
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
436436
LD_RUNPATH_SEARCH_PATHS = (
437437
"$(inherited)",
438438
"@executable_path/Frameworks",
439439
);
440440
OTHER_LDFLAGS = "-ObjC";
441-
PRODUCT_BUNDLE_IDENTIFIER = com.javer.yi.DoraemonLoadAnalyzeDemo;
441+
PRODUCT_BUNDLE_IDENTIFIER = com.javer.yi.DoraemonLoadAnalyzeDemoXXXX;
442442
PRODUCT_NAME = "$(TARGET_NAME)";
443443
TARGETED_DEVICE_FAMILY = "1,2";
444444
};
@@ -449,15 +449,15 @@
449449
buildSettings = {
450450
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
451451
CODE_SIGN_STYLE = Automatic;
452-
DEVELOPMENT_TEAM = 2M632FEG3H;
452+
DEVELOPMENT_TEAM = RSV7DQ57L7;
453453
INFOPLIST_FILE = DoraemonLoadAnalyzeDemo/Info.plist;
454454
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
455455
LD_RUNPATH_SEARCH_PATHS = (
456456
"$(inherited)",
457457
"@executable_path/Frameworks",
458458
);
459459
OTHER_LDFLAGS = "-ObjC";
460-
PRODUCT_BUNDLE_IDENTIFIER = com.javer.yi.DoraemonLoadAnalyzeDemo;
460+
PRODUCT_BUNDLE_IDENTIFIER = com.javer.yi.DoraemonLoadAnalyzeDemoXXXX;
461461
PRODUCT_NAME = "$(TARGET_NAME)";
462462
TARGETED_DEVICE_FAMILY = "1,2";
463463
};

0 commit comments

Comments
 (0)