@byteplus/react-native-live-pull 1.3.0-rc.1 → 1.3.0-rc.2
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.
- package/ios/VeLivePullSDK.m +26 -28
- package/package.json +1 -1
package/ios/VeLivePullSDK.m
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
// Created by ByteDance on 2024/4/10.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
#import <UIKit/UIKit.h>
|
|
9
8
|
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <UIKit/UIKit.h>
|
|
10
10
|
|
|
11
11
|
#import <TTSDKFramework/TTSDKFramework.h>
|
|
12
12
|
|
|
13
|
-
#import "VolcApiEngine/VolcEventObserver.h"
|
|
14
13
|
#import "VeLivePullSDK.h"
|
|
14
|
+
#import "VolcApiEngine/VolcEventObserver.h"
|
|
15
15
|
|
|
16
16
|
#define EVENT_NAME @"VolcLive:onEvent"
|
|
17
17
|
|
|
@@ -21,51 +21,48 @@
|
|
|
21
21
|
|
|
22
22
|
static RCTVolcLiveModule *instance = nil;
|
|
23
23
|
|
|
24
|
-
@implementation RCTVolcLiveModule
|
|
25
|
-
{
|
|
24
|
+
@implementation RCTVolcLiveModule {
|
|
26
25
|
bool hasListeners;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
+ (instancetype)shareInstance {
|
|
30
|
-
|
|
29
|
+
return instance;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
+ (BOOL)requiresMainQueueSetup {
|
|
34
|
-
|
|
33
|
+
return YES;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
+ (void)_unsedForKeepOnly {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
36
|
+
// + (void)_unsedForKeepOnly {
|
|
37
|
+
// Protocol *unused = @protocol(VeLivePlayerObserver);
|
|
38
|
+
// NSLog(@"Loaded Protocol: %p", unused);
|
|
39
|
+
// }
|
|
41
40
|
|
|
42
41
|
- (dispatch_queue_t)methodQueue {
|
|
43
|
-
|
|
42
|
+
return dispatch_get_main_queue();
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
- (instancetype)init {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
self = [super init];
|
|
47
|
+
if (self != nil) {
|
|
48
|
+
self.volcApiEngine = nil;
|
|
49
|
+
instance = self;
|
|
50
|
+
}
|
|
51
|
+
return instance;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
- (NSArray<NSString *> *)supportedEvents {
|
|
56
|
-
|
|
55
|
+
return @[ EVENT_NAME ];
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
- (void)onEvent:(NSString *)eventName data:(id)eventData
|
|
60
|
-
{
|
|
61
|
-
NSDictionary * dic = @{ @"event": eventName, @"data": eventData };
|
|
58
|
+
- (void)onEvent:(NSString *)eventName data:(id)eventData {
|
|
59
|
+
NSDictionary *dic = @{@"event" : eventName, @"data" : eventData};
|
|
62
60
|
[self sendEventWithName:EVENT_NAME body:dic];
|
|
63
61
|
}
|
|
64
62
|
|
|
65
63
|
RCT_EXPORT_MODULE();
|
|
66
64
|
|
|
67
|
-
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(newApiEngine)
|
|
68
|
-
{
|
|
65
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(newApiEngine) {
|
|
69
66
|
if (self.volcApiEngine == nil) {
|
|
70
67
|
self.volcApiEngine = [[VolcApiEngine alloc] init];
|
|
71
68
|
[self.volcApiEngine setObserver:self];
|
|
@@ -73,18 +70,19 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(newApiEngine)
|
|
|
73
70
|
return nil;
|
|
74
71
|
}
|
|
75
72
|
|
|
76
|
-
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(callApiSync
|
|
77
|
-
{
|
|
73
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(callApiSync
|
|
74
|
+
: (nonnull NSDictionary *)args) {
|
|
78
75
|
[self newApiEngine];
|
|
79
76
|
return [instance.volcApiEngine callApi:args];
|
|
80
77
|
}
|
|
81
78
|
|
|
82
|
-
RCT_EXPORT_METHOD(callApi
|
|
83
|
-
|
|
79
|
+
RCT_EXPORT_METHOD(callApi
|
|
80
|
+
: (nonnull NSDictionary *)args callback
|
|
81
|
+
: (RCTResponseSenderBlock)callback) {
|
|
84
82
|
[self newApiEngine];
|
|
85
83
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
86
84
|
id _val = [self.volcApiEngine callApi:args];
|
|
87
|
-
callback(@[_val]);
|
|
85
|
+
callback(@[ _val ]);
|
|
88
86
|
});
|
|
89
87
|
}
|
|
90
88
|
|