react-native-tpstreams 0.2.12 → 0.2.14
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/{Tpstreams.podspec → TPStreamsRNPlayerView.podspec} +7 -2
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerDelegate.java +78 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/TPStreamsRNPlayerViewManagerInterface.java +31 -0
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
- package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec-generated.cpp +22 -0
- package/android/app/build/generated/source/codegen/jni/TPStreamsPlayerViewSpec.h +24 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.cpp +22 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.h +24 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.cpp +98 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h +75 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.cpp +30 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/Props.h +32 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.cpp +17 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h +32 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.cpp +16 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/States.h +29 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI-generated.cpp +17 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/TPStreamsPlayerViewSpec/TPStreamsPlayerViewSpecJSI.h +19 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/tpstreams/TPStreamsRNPlayerView.kt +4 -0
- package/android/src/main/java/com/tpstreams/TPStreamsRNPlayerViewManager.kt +5 -0
- package/ios/TPStreamsDownloadModule.mm +7 -0
- package/ios/TPStreamsDownloadModule.swift +13 -0
- package/ios/TPStreamsModule.mm +7 -0
- package/ios/TPStreamsModule.swift +17 -0
- package/ios/TPStreamsRNPlayerView.h +14 -0
- package/ios/TPStreamsRNPlayerView.mm +52 -0
- package/ios/TPStreamsRNPlayerViewManager.mm +18 -0
- package/package.json +2 -2
- package/ios/TpstreamsView.h +0 -14
- package/ios/TpstreamsView.mm +0 -71
- package/ios/TpstreamsViewManager.mm +0 -19
|
@@ -3,7 +3,7 @@ require "json"
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
4
|
|
|
5
5
|
Pod::Spec.new do |s|
|
|
6
|
-
s.name = "
|
|
6
|
+
s.name = "TPStreamsRNPlayerView"
|
|
7
7
|
s.version = package["version"]
|
|
8
8
|
s.summary = package["description"]
|
|
9
9
|
s.homepage = package["homepage"]
|
|
@@ -13,8 +13,13 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.platforms = { :ios => min_ios_version_supported }
|
|
14
14
|
s.source = { :git => "https://github.com/testpress/react-native-tpstreams.git", :tag => "#{s.version}" }
|
|
15
15
|
|
|
16
|
-
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
|
|
17
17
|
s.private_header_files = "ios/**/*.h"
|
|
18
|
+
|
|
19
|
+
s.swift_version = '5.0'
|
|
20
|
+
|
|
21
|
+
# Ensure the module is not built as a framework to avoid bridging header conflicts
|
|
22
|
+
s.static_framework = true
|
|
18
23
|
|
|
19
24
|
install_modules_dependencies(s)
|
|
20
25
|
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
15
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
16
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
17
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
18
|
+
|
|
19
|
+
public class TPStreamsRNPlayerViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & TPStreamsRNPlayerViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
20
|
+
public TPStreamsRNPlayerViewManagerDelegate(U viewManager) {
|
|
21
|
+
super(viewManager);
|
|
22
|
+
}
|
|
23
|
+
@Override
|
|
24
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
25
|
+
switch (propName) {
|
|
26
|
+
case "videoId":
|
|
27
|
+
mViewManager.setVideoId(view, value == null ? null : (String) value);
|
|
28
|
+
break;
|
|
29
|
+
case "accessToken":
|
|
30
|
+
mViewManager.setAccessToken(view, value == null ? null : (String) value);
|
|
31
|
+
break;
|
|
32
|
+
case "shouldAutoPlay":
|
|
33
|
+
mViewManager.setShouldAutoPlay(view, value == null ? false : (boolean) value);
|
|
34
|
+
break;
|
|
35
|
+
case "startAt":
|
|
36
|
+
mViewManager.setStartAt(view, value == null ? 0f : ((Double) value).doubleValue());
|
|
37
|
+
break;
|
|
38
|
+
case "enableDownload":
|
|
39
|
+
mViewManager.setEnableDownload(view, value == null ? false : (boolean) value);
|
|
40
|
+
break;
|
|
41
|
+
case "showDefaultCaptions":
|
|
42
|
+
mViewManager.setShowDefaultCaptions(view, value == null ? false : (boolean) value);
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
super.setProperty(view, propName, value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Override
|
|
50
|
+
public void receiveCommand(T view, String commandName, @Nullable ReadableArray args) {
|
|
51
|
+
switch (commandName) {
|
|
52
|
+
case "play":
|
|
53
|
+
mViewManager.play(view);
|
|
54
|
+
break;
|
|
55
|
+
case "pause":
|
|
56
|
+
mViewManager.pause(view);
|
|
57
|
+
break;
|
|
58
|
+
case "seekTo":
|
|
59
|
+
mViewManager.seekTo(view, args.getDouble(0));
|
|
60
|
+
break;
|
|
61
|
+
case "setPlaybackSpeed":
|
|
62
|
+
mViewManager.setPlaybackSpeed(view, (float) args.getDouble(0));
|
|
63
|
+
break;
|
|
64
|
+
case "getCurrentPosition":
|
|
65
|
+
mViewManager.getCurrentPosition(view);
|
|
66
|
+
break;
|
|
67
|
+
case "getDuration":
|
|
68
|
+
mViewManager.getDuration(view);
|
|
69
|
+
break;
|
|
70
|
+
case "isPlaying":
|
|
71
|
+
mViewManager.isPlaying(view);
|
|
72
|
+
break;
|
|
73
|
+
case "getPlaybackSpeed":
|
|
74
|
+
mViewManager.getPlaybackSpeed(view);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
|
|
15
|
+
|
|
16
|
+
public interface TPStreamsRNPlayerViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
|
|
17
|
+
void setVideoId(T view, @Nullable String value);
|
|
18
|
+
void setAccessToken(T view, @Nullable String value);
|
|
19
|
+
void setShouldAutoPlay(T view, boolean value);
|
|
20
|
+
void setStartAt(T view, double value);
|
|
21
|
+
void setEnableDownload(T view, boolean value);
|
|
22
|
+
void setShowDefaultCaptions(T view, boolean value);
|
|
23
|
+
void play(T view);
|
|
24
|
+
void pause(T view);
|
|
25
|
+
void seekTo(T view, double positionMs);
|
|
26
|
+
void setPlaybackSpeed(T view, float speed);
|
|
27
|
+
void getCurrentPosition(T view);
|
|
28
|
+
void getDuration(T view);
|
|
29
|
+
void isPlaying(T view);
|
|
30
|
+
void getPlaybackSpeed(T view);
|
|
31
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/TPStreamsPlayerViewSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_TPStreamsPlayerViewSpec
|
|
13
|
+
OBJECT
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_TPStreamsPlayerViewSpec PUBLIC . react/renderer/components/TPStreamsPlayerViewSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_TPStreamsPlayerViewSpec
|
|
21
|
+
fbjni
|
|
22
|
+
jsi
|
|
23
|
+
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
+
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
+
reactnative
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_options(
|
|
29
|
+
react_codegen_TPStreamsPlayerViewSpec
|
|
30
|
+
PRIVATE
|
|
31
|
+
-DLOG_TAG=\"ReactNative\"
|
|
32
|
+
-fexceptions
|
|
33
|
+
-frtti
|
|
34
|
+
-std=c++20
|
|
35
|
+
-Wall
|
|
36
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "TPStreamsPlayerViewSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
std::shared_ptr<TurboModule> TPStreamsPlayerViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
18
|
+
|
|
19
|
+
return nullptr;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
+
#include <ReactCommon/TurboModule.h>
|
|
15
|
+
#include <jsi/jsi.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
JSI_EXPORT
|
|
22
|
+
std::shared_ptr<TurboModule> TPStreamsPlayerViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.h>
|
|
12
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
void TPStreamsPlayerViewSpec_registerComponentDescriptorsFromCodegen(
|
|
18
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
+
registry->add(concreteComponentDescriptorProvider<TPStreamsRNPlayerViewComponentDescriptor>());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h>
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
using TPStreamsRNPlayerViewComponentDescriptor = ConcreteComponentDescriptor<TPStreamsRNPlayerViewShadowNode>;
|
|
20
|
+
|
|
21
|
+
void TPStreamsPlayerViewSpec_registerComponentDescriptorsFromCodegen(
|
|
22
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h>
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
void TPStreamsRNPlayerViewEventEmitter::onCurrentPosition(OnCurrentPosition $event) const {
|
|
17
|
+
dispatchEvent("currentPosition", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
18
|
+
auto $payload = jsi::Object(runtime);
|
|
19
|
+
$payload.setProperty(runtime, "position", $event.position);
|
|
20
|
+
return $payload;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
void TPStreamsRNPlayerViewEventEmitter::onDuration(OnDuration $event) const {
|
|
26
|
+
dispatchEvent("duration", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
27
|
+
auto $payload = jsi::Object(runtime);
|
|
28
|
+
$payload.setProperty(runtime, "duration", $event.duration);
|
|
29
|
+
return $payload;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
void TPStreamsRNPlayerViewEventEmitter::onIsPlaying(OnIsPlaying $event) const {
|
|
35
|
+
dispatchEvent("isPlaying", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
36
|
+
auto $payload = jsi::Object(runtime);
|
|
37
|
+
$payload.setProperty(runtime, "isPlaying", $event.isPlaying);
|
|
38
|
+
return $payload;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
void TPStreamsRNPlayerViewEventEmitter::onPlaybackSpeed(OnPlaybackSpeed $event) const {
|
|
44
|
+
dispatchEvent("playbackSpeed", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
45
|
+
auto $payload = jsi::Object(runtime);
|
|
46
|
+
$payload.setProperty(runtime, "speed", $event.speed);
|
|
47
|
+
return $payload;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
void TPStreamsRNPlayerViewEventEmitter::onPlayerStateChanged(OnPlayerStateChanged $event) const {
|
|
53
|
+
dispatchEvent("playerStateChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
54
|
+
auto $payload = jsi::Object(runtime);
|
|
55
|
+
$payload.setProperty(runtime, "playbackState", $event.playbackState);
|
|
56
|
+
return $payload;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
void TPStreamsRNPlayerViewEventEmitter::onIsPlayingChanged(OnIsPlayingChanged $event) const {
|
|
62
|
+
dispatchEvent("isPlayingChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
63
|
+
auto $payload = jsi::Object(runtime);
|
|
64
|
+
$payload.setProperty(runtime, "isPlaying", $event.isPlaying);
|
|
65
|
+
return $payload;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
void TPStreamsRNPlayerViewEventEmitter::onPlaybackSpeedChanged(OnPlaybackSpeedChanged $event) const {
|
|
71
|
+
dispatchEvent("playbackSpeedChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
72
|
+
auto $payload = jsi::Object(runtime);
|
|
73
|
+
$payload.setProperty(runtime, "speed", $event.speed);
|
|
74
|
+
return $payload;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
void TPStreamsRNPlayerViewEventEmitter::onIsLoadingChanged(OnIsLoadingChanged $event) const {
|
|
80
|
+
dispatchEvent("isLoadingChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
81
|
+
auto $payload = jsi::Object(runtime);
|
|
82
|
+
$payload.setProperty(runtime, "isLoading", $event.isLoading);
|
|
83
|
+
return $payload;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
void TPStreamsRNPlayerViewEventEmitter::onError(OnError $event) const {
|
|
89
|
+
dispatchEvent("error", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
90
|
+
auto $payload = jsi::Object(runtime);
|
|
91
|
+
$payload.setProperty(runtime, "message", $event.message);
|
|
92
|
+
$payload.setProperty(runtime, "code", $event.code);
|
|
93
|
+
$payload.setProperty(runtime, "details", $event.details);
|
|
94
|
+
return $payload;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
class TPStreamsRNPlayerViewEventEmitter : public ViewEventEmitter {
|
|
17
|
+
public:
|
|
18
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
19
|
+
|
|
20
|
+
struct OnCurrentPosition {
|
|
21
|
+
double position;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
struct OnDuration {
|
|
25
|
+
double duration;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
struct OnIsPlaying {
|
|
29
|
+
bool isPlaying;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
struct OnPlaybackSpeed {
|
|
33
|
+
Float speed;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
struct OnPlayerStateChanged {
|
|
37
|
+
int playbackState;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
struct OnIsPlayingChanged {
|
|
41
|
+
bool isPlaying;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
struct OnPlaybackSpeedChanged {
|
|
45
|
+
double speed;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
struct OnIsLoadingChanged {
|
|
49
|
+
bool isLoading;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
struct OnError {
|
|
53
|
+
std::string message;
|
|
54
|
+
int code;
|
|
55
|
+
std::string details;
|
|
56
|
+
};
|
|
57
|
+
void onCurrentPosition(OnCurrentPosition value) const;
|
|
58
|
+
|
|
59
|
+
void onDuration(OnDuration value) const;
|
|
60
|
+
|
|
61
|
+
void onIsPlaying(OnIsPlaying value) const;
|
|
62
|
+
|
|
63
|
+
void onPlaybackSpeed(OnPlaybackSpeed value) const;
|
|
64
|
+
|
|
65
|
+
void onPlayerStateChanged(OnPlayerStateChanged value) const;
|
|
66
|
+
|
|
67
|
+
void onIsPlayingChanged(OnIsPlayingChanged value) const;
|
|
68
|
+
|
|
69
|
+
void onPlaybackSpeedChanged(OnPlaybackSpeedChanged value) const;
|
|
70
|
+
|
|
71
|
+
void onIsLoadingChanged(OnIsLoadingChanged value) const;
|
|
72
|
+
|
|
73
|
+
void onError(OnError value) const;
|
|
74
|
+
};
|
|
75
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/Props.h>
|
|
12
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
13
|
+
#include <react/renderer/core/propsConversions.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
TPStreamsRNPlayerViewProps::TPStreamsRNPlayerViewProps(
|
|
18
|
+
const PropsParserContext &context,
|
|
19
|
+
const TPStreamsRNPlayerViewProps &sourceProps,
|
|
20
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
21
|
+
|
|
22
|
+
videoId(convertRawProp(context, rawProps, "videoId", sourceProps.videoId, {})),
|
|
23
|
+
accessToken(convertRawProp(context, rawProps, "accessToken", sourceProps.accessToken, {})),
|
|
24
|
+
shouldAutoPlay(convertRawProp(context, rawProps, "shouldAutoPlay", sourceProps.shouldAutoPlay, {false})),
|
|
25
|
+
startAt(convertRawProp(context, rawProps, "startAt", sourceProps.startAt, {0.0})),
|
|
26
|
+
enableDownload(convertRawProp(context, rawProps, "enableDownload", sourceProps.enableDownload, {false})),
|
|
27
|
+
showDefaultCaptions(convertRawProp(context, rawProps, "showDefaultCaptions", sourceProps.showDefaultCaptions, {false}))
|
|
28
|
+
{}
|
|
29
|
+
|
|
30
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
13
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
class TPStreamsRNPlayerViewProps final : public ViewProps {
|
|
18
|
+
public:
|
|
19
|
+
TPStreamsRNPlayerViewProps() = default;
|
|
20
|
+
TPStreamsRNPlayerViewProps(const PropsParserContext& context, const TPStreamsRNPlayerViewProps &sourceProps, const RawProps &rawProps);
|
|
21
|
+
|
|
22
|
+
#pragma mark - Props
|
|
23
|
+
|
|
24
|
+
std::string videoId{};
|
|
25
|
+
std::string accessToken{};
|
|
26
|
+
bool shouldAutoPlay{false};
|
|
27
|
+
double startAt{0.0};
|
|
28
|
+
bool enableDownload{false};
|
|
29
|
+
bool showDefaultCaptions{false};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/ShadowNodes.h>
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
extern const char TPStreamsRNPlayerViewComponentName[] = "TPStreamsRNPlayerView";
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h>
|
|
14
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/Props.h>
|
|
15
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/States.h>
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <jsi/jsi.h>
|
|
18
|
+
|
|
19
|
+
namespace facebook::react {
|
|
20
|
+
|
|
21
|
+
JSI_EXPORT extern const char TPStreamsRNPlayerViewComponentName[];
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* `ShadowNode` for <TPStreamsRNPlayerView> component.
|
|
25
|
+
*/
|
|
26
|
+
using TPStreamsRNPlayerViewShadowNode = ConcreteViewShadowNode<
|
|
27
|
+
TPStreamsRNPlayerViewComponentName,
|
|
28
|
+
TPStreamsRNPlayerViewProps,
|
|
29
|
+
TPStreamsRNPlayerViewEventEmitter,
|
|
30
|
+
TPStreamsRNPlayerViewState>;
|
|
31
|
+
|
|
32
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateStateCpp.js
|
|
9
|
+
*/
|
|
10
|
+
#include <react/renderer/components/TPStreamsPlayerViewSpec/States.h>
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateStateH.js
|
|
8
|
+
*/
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#ifdef ANDROID
|
|
12
|
+
#include <folly/dynamic.h>
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
class TPStreamsRNPlayerViewState {
|
|
18
|
+
public:
|
|
19
|
+
TPStreamsRNPlayerViewState() = default;
|
|
20
|
+
|
|
21
|
+
#ifdef ANDROID
|
|
22
|
+
TPStreamsRNPlayerViewState(TPStreamsRNPlayerViewState const &previousState, folly::dynamic data){};
|
|
23
|
+
folly::dynamic getDynamic() const {
|
|
24
|
+
return {};
|
|
25
|
+
};
|
|
26
|
+
#endif
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "TPStreamsPlayerViewSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
} // namespace facebook::react
|
package/android/build.gradle
CHANGED
|
@@ -82,7 +82,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
82
82
|
dependencies {
|
|
83
83
|
implementation "com.facebook.react:react-android"
|
|
84
84
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
85
|
-
implementation 'com.github.testpress:TPStreamsAndroidPlayer:1.0.
|
|
85
|
+
implementation 'com.github.testpress:TPStreamsAndroidPlayer:1.0.7'
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
react {
|
|
@@ -178,6 +178,10 @@ class TPStreamsRNPlayerView(context: ThemedReactContext) : FrameLayout(context)
|
|
|
178
178
|
|
|
179
179
|
override fun onDetachedFromWindow() {
|
|
180
180
|
super.onDetachedFromWindow()
|
|
181
|
+
player?.pause()
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
fun releasePlayer() {
|
|
181
185
|
try {
|
|
182
186
|
player?.release()
|
|
183
187
|
} catch (e: Exception) {
|
|
@@ -119,4 +119,9 @@ class TPStreamsRNPlayerViewManager : SimpleViewManager<TPStreamsRNPlayerView>(),
|
|
|
119
119
|
super.onAfterUpdateTransaction(view)
|
|
120
120
|
view.tryCreatePlayer()
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
override fun onDropViewInstance(view: TPStreamsRNPlayerView) {
|
|
124
|
+
super.onDropViewInstance(view)
|
|
125
|
+
view.releasePlayer()
|
|
126
|
+
}
|
|
122
127
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
|
|
4
|
+
@objc(TPStreamsDownload)
|
|
5
|
+
class TPStreamsDownloadModule: NSObject {
|
|
6
|
+
|
|
7
|
+
@objc
|
|
8
|
+
static func requiresMainQueueSetup() -> Bool {
|
|
9
|
+
return false
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Download functionality will be implemented in future commits
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
|
|
4
|
+
@objc(TPStreams)
|
|
5
|
+
class TPStreamsModule: NSObject {
|
|
6
|
+
|
|
7
|
+
@objc
|
|
8
|
+
static func requiresMainQueueSetup() -> Bool {
|
|
9
|
+
return false
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@objc
|
|
13
|
+
func initialize(_ organizationId: String) {
|
|
14
|
+
// Basic initialization - will be implemented in future commits
|
|
15
|
+
print("TPStreams initialized with organization ID: \(organizationId)")
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#import <React/RCTViewComponentView.h>
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
3
|
+
|
|
4
|
+
#ifndef TPStreamsRNPlayerViewNativeComponent_h
|
|
5
|
+
#define TPStreamsRNPlayerViewNativeComponent_h
|
|
6
|
+
|
|
7
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
8
|
+
|
|
9
|
+
@interface TPStreamsRNPlayerView : RCTViewComponentView
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_END
|
|
13
|
+
|
|
14
|
+
#endif /* TPStreamsRNPlayerViewNativeComponent_h */
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#import "TPStreamsRNPlayerView.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/TPStreamsPlayerViewSpec/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/TPStreamsPlayerViewSpec/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/TPStreamsPlayerViewSpec/Props.h>
|
|
6
|
+
#import <react/renderer/components/TPStreamsPlayerViewSpec/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
9
|
+
|
|
10
|
+
using namespace facebook::react;
|
|
11
|
+
|
|
12
|
+
@interface TPStreamsRNPlayerView () <RCTTPStreamsRNPlayerViewViewProtocol>
|
|
13
|
+
@end
|
|
14
|
+
|
|
15
|
+
@implementation TPStreamsRNPlayerView {
|
|
16
|
+
UIView * _view;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
20
|
+
{
|
|
21
|
+
return concreteComponentDescriptorProvider<TPStreamsRNPlayerViewComponentDescriptor>();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
25
|
+
{
|
|
26
|
+
if (self = [super initWithFrame:frame]) {
|
|
27
|
+
static const auto defaultProps = std::make_shared<const TPStreamsRNPlayerViewProps>();
|
|
28
|
+
_props = defaultProps;
|
|
29
|
+
|
|
30
|
+
_view = [[UIView alloc] init];
|
|
31
|
+
self.contentView = _view;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return self;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
38
|
+
{
|
|
39
|
+
const auto &oldViewProps = *std::static_pointer_cast<TPStreamsRNPlayerViewProps const>(_props);
|
|
40
|
+
const auto &newViewProps = *std::static_pointer_cast<TPStreamsRNPlayerViewProps const>(props);
|
|
41
|
+
|
|
42
|
+
// Process props update here when needed
|
|
43
|
+
|
|
44
|
+
[super updateProps:props oldProps:oldProps];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
Class<RCTComponentViewProtocol> TPStreamsRNPlayerViewCls(void)
|
|
48
|
+
{
|
|
49
|
+
return TPStreamsRNPlayerView.class;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#import <React/RCTViewManager.h>
|
|
2
|
+
#import <React/RCTUIManager.h>
|
|
3
|
+
#import "RCTBridge.h"
|
|
4
|
+
#import "TPStreamsRNPlayerView.h"
|
|
5
|
+
|
|
6
|
+
@interface TPStreamsRNPlayerViewManager : RCTViewManager
|
|
7
|
+
@end
|
|
8
|
+
|
|
9
|
+
@implementation TPStreamsRNPlayerViewManager
|
|
10
|
+
|
|
11
|
+
RCT_EXPORT_MODULE(TPStreamsRNPlayerView)
|
|
12
|
+
|
|
13
|
+
- (UIView *)view
|
|
14
|
+
{
|
|
15
|
+
return [TPStreamsRNPlayerView new];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tpstreams",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "Video component for TPStreams",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
},
|
|
158
158
|
"ios": {
|
|
159
159
|
"componentProvider": {
|
|
160
|
-
"TPStreamsPlayerView": "
|
|
160
|
+
"TPStreamsPlayerView": "TPStreamsRNPlayerView"
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
},
|
package/ios/TpstreamsView.h
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#import <React/RCTViewComponentView.h>
|
|
2
|
-
#import <UIKit/UIKit.h>
|
|
3
|
-
|
|
4
|
-
#ifndef TpstreamsViewNativeComponent_h
|
|
5
|
-
#define TpstreamsViewNativeComponent_h
|
|
6
|
-
|
|
7
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
8
|
-
|
|
9
|
-
@interface TpstreamsView : RCTViewComponentView
|
|
10
|
-
@end
|
|
11
|
-
|
|
12
|
-
NS_ASSUME_NONNULL_END
|
|
13
|
-
|
|
14
|
-
#endif /* TpstreamsViewNativeComponent_h */
|
package/ios/TpstreamsView.mm
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
#import "TpstreamsView.h"
|
|
2
|
-
|
|
3
|
-
#import <react/renderer/components/TpstreamsViewSpec/ComponentDescriptors.h>
|
|
4
|
-
#import <react/renderer/components/TpstreamsViewSpec/EventEmitters.h>
|
|
5
|
-
#import <react/renderer/components/TpstreamsViewSpec/Props.h>
|
|
6
|
-
#import <react/renderer/components/TpstreamsViewSpec/RCTComponentViewHelpers.h>
|
|
7
|
-
|
|
8
|
-
#import "RCTFabricComponentsPlugins.h"
|
|
9
|
-
|
|
10
|
-
using namespace facebook::react;
|
|
11
|
-
|
|
12
|
-
@interface TpstreamsView () <RCTTpstreamsViewViewProtocol>
|
|
13
|
-
|
|
14
|
-
@end
|
|
15
|
-
|
|
16
|
-
@implementation TpstreamsView {
|
|
17
|
-
UIView * _view;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
21
|
-
{
|
|
22
|
-
return concreteComponentDescriptorProvider<TpstreamsViewComponentDescriptor>();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
- (instancetype)initWithFrame:(CGRect)frame
|
|
26
|
-
{
|
|
27
|
-
if (self = [super initWithFrame:frame]) {
|
|
28
|
-
static const auto defaultProps = std::make_shared<const TpstreamsViewProps>();
|
|
29
|
-
_props = defaultProps;
|
|
30
|
-
|
|
31
|
-
_view = [[UIView alloc] init];
|
|
32
|
-
|
|
33
|
-
self.contentView = _view;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return self;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
40
|
-
{
|
|
41
|
-
const auto &oldViewProps = *std::static_pointer_cast<TpstreamsViewProps const>(_props);
|
|
42
|
-
const auto &newViewProps = *std::static_pointer_cast<TpstreamsViewProps const>(props);
|
|
43
|
-
|
|
44
|
-
if (oldViewProps.color != newViewProps.color) {
|
|
45
|
-
NSString * colorToConvert = [[NSString alloc] initWithUTF8String: newViewProps.color.c_str()];
|
|
46
|
-
[_view setBackgroundColor:[self hexStringToColor:colorToConvert]];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
[super updateProps:props oldProps:oldProps];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
Class<RCTComponentViewProtocol> TpstreamsViewCls(void)
|
|
53
|
-
{
|
|
54
|
-
return TpstreamsView.class;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
- hexStringToColor:(NSString *)stringToConvert
|
|
58
|
-
{
|
|
59
|
-
NSString *noHashString = [stringToConvert stringByReplacingOccurrencesOfString:@"#" withString:@""];
|
|
60
|
-
NSScanner *stringScanner = [NSScanner scannerWithString:noHashString];
|
|
61
|
-
|
|
62
|
-
unsigned hex;
|
|
63
|
-
if (![stringScanner scanHexInt:&hex]) return nil;
|
|
64
|
-
int r = (hex >> 16) & 0xFF;
|
|
65
|
-
int g = (hex >> 8) & 0xFF;
|
|
66
|
-
int b = (hex) & 0xFF;
|
|
67
|
-
|
|
68
|
-
return [UIColor colorWithRed:r / 255.0f green:g / 255.0f blue:b / 255.0f alpha:1.0f];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#import <React/RCTViewManager.h>
|
|
2
|
-
#import <React/RCTUIManager.h>
|
|
3
|
-
#import "RCTBridge.h"
|
|
4
|
-
|
|
5
|
-
@interface TpstreamsViewManager : RCTViewManager
|
|
6
|
-
@end
|
|
7
|
-
|
|
8
|
-
@implementation TpstreamsViewManager
|
|
9
|
-
|
|
10
|
-
RCT_EXPORT_MODULE(TpstreamsView)
|
|
11
|
-
|
|
12
|
-
- (UIView *)view
|
|
13
|
-
{
|
|
14
|
-
return [[UIView alloc] init];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
RCT_EXPORT_VIEW_PROPERTY(color, NSString)
|
|
18
|
-
|
|
19
|
-
@end
|