fix: Re-install FP plugins on bundle reload (#684)
This commit is contained in:
parent
d96c5863c9
commit
b72176fae9
@ -18,6 +18,4 @@ typedef id (^FrameProcessorPlugin) (Frame* frame, NSArray<id>* arguments);
|
|||||||
+ (NSMutableDictionary<NSString*, FrameProcessorPlugin>*)frameProcessorPlugins;
|
+ (NSMutableDictionary<NSString*, FrameProcessorPlugin>*)frameProcessorPlugins;
|
||||||
+ (void) addFrameProcessorPlugin:(NSString*)name callback:(FrameProcessorPlugin)callback;
|
+ (void) addFrameProcessorPlugin:(NSString*)name callback:(FrameProcessorPlugin)callback;
|
||||||
|
|
||||||
+ (void) markInvalid;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -19,15 +19,7 @@
|
|||||||
return plugins;
|
return plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL _isValid = YES;
|
|
||||||
+ (void) markInvalid {
|
|
||||||
_isValid = NO;
|
|
||||||
[[FrameProcessorPluginRegistry frameProcessorPlugins] removeAllObjects];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void) addFrameProcessorPlugin:(NSString*)name callback:(FrameProcessorPlugin)callback {
|
+ (void) addFrameProcessorPlugin:(NSString*)name callback:(FrameProcessorPlugin)callback {
|
||||||
NSAssert(_isValid, @"Tried to add Frame Processor Plugin but Frame Processor Registry has already registered all plugins!");
|
|
||||||
|
|
||||||
BOOL alreadyExists = [[FrameProcessorPluginRegistry frameProcessorPlugins] valueForKey:name] != nil;
|
BOOL alreadyExists = [[FrameProcessorPluginRegistry frameProcessorPlugins] valueForKey:name] != nil;
|
||||||
NSAssert(!alreadyExists, @"Tried to two Frame Processor Plugins with the same name! Either choose unique names, or remove the unused plugin.");
|
NSAssert(!alreadyExists, @"Tried to two Frame Processor Plugins with the same name! Either choose unique names, or remove the unused plugin.");
|
||||||
|
|
||||||
|
@ -107,8 +107,6 @@ __attribute__((objc_runtime_name("_TtC12VisionCamera10CameraView")))
|
|||||||
function));
|
function));
|
||||||
}
|
}
|
||||||
|
|
||||||
[FrameProcessorPluginRegistry markInvalid];
|
|
||||||
|
|
||||||
NSLog(@"FrameProcessorBindings: Frame Processor plugins installed!");
|
NSLog(@"FrameProcessorBindings: Frame Processor plugins installed!");
|
||||||
#else
|
#else
|
||||||
NSLog(@"Reanimated not found, Frame Processors are disabled.");
|
NSLog(@"Reanimated not found, Frame Processors are disabled.");
|
||||||
|
Loading…
Reference in New Issue
Block a user