iOS typo fix

This commit is contained in:
pengfei.zhou 2021-08-24 10:32:32 +08:00 committed by osborn
parent e0d76d218d
commit 04cfbf49d8

View File

@ -23,24 +23,24 @@
@interface DoricNotificationPlugin ()
@property(nonatomic, strong) NSMutableDictionary<NSString *, id> *observers;
@property (nonatomic, strong) dispatch_queue_t syncQuene;
@property(nonatomic, strong) dispatch_queue_t syncQueue;
@end
@implementation DoricNotificationPlugin
- (NSDictionary *)observers {
- (NSMutableDictionary<NSString *, id> *)observers {
if (!_observers) {
_observers = [NSMutableDictionary new];
}
return _observers;
}
- (dispatch_queue_t)syncQuene {
if (!_syncQuene) {
_syncQuene = dispatch_queue_create("pub.doric.plugin.notification", DISPATCH_QUEUE_CONCURRENT);
- (dispatch_queue_t)syncQueue {
if (!_syncQueue) {
_syncQueue = dispatch_queue_create("pub.doric.plugin.notification", DISPATCH_QUEUE_CONCURRENT);
}
return _syncQuene;
return _syncQueue;
}
- (void)publish:(NSDictionary *)dic withPromise:(DoricPromise *)promise {
@ -80,18 +80,17 @@ - (void)subscribe:(NSDictionary *)dic withPromise:(DoricPromise *)promise {
[currentPromise resolve:note.userInfo];
}];
dispatch_barrier_async(self.syncQuene, ^{
[self.observers setObject:observer forKey:callbackId];
dispatch_barrier_async(self.syncQueue, ^{
self.observers[callbackId] = observer;
});
[promise resolve:callbackId];
}
- (void)unsubscribe:(NSString *)subscribeId withPromise:(DoricPromise *)promise {
dispatch_barrier_async(self.syncQuene, ^{
id observer = [self.observers objectForKey:subscribeId];
dispatch_barrier_async(self.syncQueue, ^{
id observer = self.observers[subscribeId];
[[NSNotificationCenter defaultCenter] removeObserver:observer];
[self.observers removeObjectForKey:subscribeId];
[promise resolve:nil];
});
}