expo-gliph-player 1.3.16 → 1.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@ RCT_EXPORT_MODULE(RNGliphPlayer)
22
22
  if (self = [super init]) {
23
23
  __weak GliphPlayerModule *weakSelf = self;
24
24
  _player = [[GliphAudioPlayer alloc] initWithEventEmitter:^(NSString *event, NSDictionary *data) {
25
- [weakSelf sendEventWithName:event body:data];
25
+ [weakSelf safeSendEventWithName:event body:data];
26
26
  }];
27
27
  }
28
28
  return self;
@@ -62,6 +62,13 @@ RCT_EXPORT_MODULE(RNGliphPlayer)
62
62
  - (void)startObserving { _hasListeners = YES; }
63
63
  - (void)stopObserving { _hasListeners = NO; }
64
64
 
65
+ - (void)safeSendEventWithName:(NSString *)eventName body:(id)body {
66
+ if (!_hasListeners) {
67
+ return;
68
+ }
69
+ [self sendEventWithName:eventName body:body];
70
+ }
71
+
65
72
  RCT_EXPORT_METHOD(setupPlayer:(NSDictionary *)options
66
73
  resolve:(RCTPromiseResolveBlock)resolve
67
74
  reject:(RCTPromiseRejectBlock)reject) {
@@ -246,8 +253,6 @@ RCT_EXPORT_METHOD(updateOptions:(NSDictionary *)options
246
253
  [_player updateOptions:options resolve:resolve reject:reject];
247
254
  }
248
255
 
249
- // ── New Architecture (TurboModule) ────────────────────────────────────────────
250
-
251
256
  #ifdef RCT_NEW_ARCH_ENABLED
252
257
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
253
258
  (const facebook::react::ObjCTurboModule::InitParams &)params {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Aleksey Ostrikov",
5
5
  "email": "alex303606@gmail.com"
6
6
  },
7
- "version": "1.3.16",
7
+ "version": "1.3.17",
8
8
  "description": "Fixed version of react-native-gliph-player with Expo compatibility",
9
9
  "main": "app.plugin.js",
10
10
  "module": "lib/module/index.js",