theta-client-react-native 1.0.0
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/LICENSE +21 -0
- package/README.ja.md +64 -0
- package/README.md +66 -0
- package/android/build.gradle +149 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/Converter.kt +557 -0
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkModule.kt +774 -0
- package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkPackage.kt +17 -0
- package/ios/ThetaClientReactNative.h +28 -0
- package/ios/ThetaClientReactNative.mm +2105 -0
- package/ios/ThetaClientReactNative.xcodeproj/project.pbxproj +325 -0
- package/lib/commonjs/index.js +1061 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/index.js +1023 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/index.d.ts +975 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +154 -0
- package/src/index.tsx +1265 -0
- package/theta-client-react-native.podspec +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 RICOH360
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
## React Native プロジェクト作成手順
|
|
2
|
+
|
|
3
|
+
### 事前準備
|
|
4
|
+
|
|
5
|
+
* theta-client がビルド済み
|
|
6
|
+
例
|
|
7
|
+
```shell
|
|
8
|
+
$ gradle publishToMavenLocal podPublishXCFramework
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
* theta-clientのディレクトリを環境変数THETA_CLIENTに設定していること
|
|
12
|
+
例
|
|
13
|
+
```shell
|
|
14
|
+
$ export THETA_CLIENT=<ルートディレクトリ>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
* react-native 用ラッパーがビルド済み
|
|
18
|
+
例
|
|
19
|
+
```shell
|
|
20
|
+
$ cd react-native
|
|
21
|
+
$ sh ./mkpackage.sh
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
* react-nativeの環境をインストール済みであること
|
|
25
|
+
|
|
26
|
+
### プロジェクトの作成
|
|
27
|
+
|
|
28
|
+
* react-native-cliを使ってプロジェクトを作成後、theta-clientを追加する
|
|
29
|
+
例
|
|
30
|
+
```shell
|
|
31
|
+
$ npx react-native init YourProject --template react-native-template-typescript
|
|
32
|
+
$ cd YourProject
|
|
33
|
+
$ yarn add $THETA_CLIENT/react-native/package
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
* android設定
|
|
37
|
+
|
|
38
|
+
* YourProject/android/build.gradle
|
|
39
|
+
* `minSdkVersion`を26以上に設定する
|
|
40
|
+
|
|
41
|
+
* iOS設定
|
|
42
|
+
* YourProject/ios/Podfile
|
|
43
|
+
* `platform :ios` のバージョンを'15.0'以上に設定する
|
|
44
|
+
* theta-client のpodを追加する
|
|
45
|
+
```
|
|
46
|
+
pod "THETAClient", :path => ENV["THETA_CLIENT"] + "/kotlin-multiplatform/build/cocoapods/publish/debug"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
* ビルドと実行
|
|
50
|
+
|
|
51
|
+
Debug用のビルドと実行は以下の通りです。
|
|
52
|
+
```
|
|
53
|
+
$ cd YourProject
|
|
54
|
+
$ yarn install
|
|
55
|
+
$ yarn run android
|
|
56
|
+
|
|
57
|
+
OR
|
|
58
|
+
|
|
59
|
+
$ yarn run ios
|
|
60
|
+
```
|
|
61
|
+
※bundlerはmetroで以下のように別端末で事前に実行しておいても構いません。
|
|
62
|
+
```
|
|
63
|
+
$ yarn start
|
|
64
|
+
```
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
## How to create React Native project
|
|
2
|
+
|
|
3
|
+
### Prerequisite
|
|
4
|
+
|
|
5
|
+
* Build theta-client.
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
$ gradle publishToMavenLocal podPublishXCFramework
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
* Set the directory of theta-client to environment variable `THETA_CLIENT`.
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
$ export THETA_CLIENT=<path to theta-client>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
* Build react-native wrapper
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
$ cd react-native
|
|
21
|
+
$ sh ./mkpackage.sh
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
* Install react-native
|
|
26
|
+
|
|
27
|
+
### Creating a project
|
|
28
|
+
|
|
29
|
+
* Create a project using `react-native-cli`, then add theta-client.
|
|
30
|
+
|
|
31
|
+
```shell
|
|
32
|
+
$ npx react-native init YourProject --template react-native-template-typescript
|
|
33
|
+
$ cd YourProject
|
|
34
|
+
$ yarn add $THETA_CLIENT/react-native/package
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
* Settings on android
|
|
38
|
+
|
|
39
|
+
* YourProject/android/build.gradle
|
|
40
|
+
* set `minSdkVersion` to 26 or later.
|
|
41
|
+
|
|
42
|
+
* Settings on iOS
|
|
43
|
+
* YourProject/ios/Podfile
|
|
44
|
+
* Set `platform :ios` to '15.0' or later.
|
|
45
|
+
* Add pod of theta-client.
|
|
46
|
+
```
|
|
47
|
+
pod "THETAClient", :path => ENV["THETA_CLIENT"] + "/kotlin-multiplatform/build/cocoapods/publish/debug"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
* Building and execution
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
$ cd YourProject
|
|
54
|
+
$ yarn install
|
|
55
|
+
$ yarn run android
|
|
56
|
+
|
|
57
|
+
OR
|
|
58
|
+
|
|
59
|
+
$ yarn run ios
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
You can execute metro bundler on other terminal in advance.
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
$ yarn start
|
|
66
|
+
```
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
+
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['ThetaClientReactNative_kotlinVersion']
|
|
4
|
+
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath 'com.android.tools.build:gradle:7.3.1'
|
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def isNewArchitectureEnabled() {
|
|
18
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
apply plugin: 'com.android.library'
|
|
22
|
+
apply plugin: 'kotlin-android'
|
|
23
|
+
|
|
24
|
+
if (isNewArchitectureEnabled()) {
|
|
25
|
+
apply plugin: 'com.facebook.react'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
def getExtOrDefault(name) {
|
|
29
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ThetaClientReactNative_' + name]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
def getExtOrIntegerDefault(name) {
|
|
33
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ThetaClientReactNative_' + name]).toInteger()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
android {
|
|
37
|
+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
|
38
|
+
|
|
39
|
+
defaultConfig {
|
|
40
|
+
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
|
|
41
|
+
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
42
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
43
|
+
}
|
|
44
|
+
buildTypes {
|
|
45
|
+
release {
|
|
46
|
+
minifyEnabled false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
lintOptions {
|
|
51
|
+
disable 'GradleCompatible'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
compileOptions {
|
|
55
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
56
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
repositories {
|
|
62
|
+
mavenCentral()
|
|
63
|
+
google()
|
|
64
|
+
|
|
65
|
+
def found = false
|
|
66
|
+
def defaultDir = null
|
|
67
|
+
def androidSourcesName = 'React Native sources'
|
|
68
|
+
|
|
69
|
+
if (rootProject.ext.has('reactNativeAndroidRoot')) {
|
|
70
|
+
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
|
|
71
|
+
} else {
|
|
72
|
+
defaultDir = new File(
|
|
73
|
+
projectDir,
|
|
74
|
+
'/../../../node_modules/react-native/android'
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (defaultDir.exists()) {
|
|
79
|
+
maven {
|
|
80
|
+
url defaultDir.toString()
|
|
81
|
+
name androidSourcesName
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
|
|
85
|
+
found = true
|
|
86
|
+
} else {
|
|
87
|
+
def parentDir = rootProject.projectDir
|
|
88
|
+
|
|
89
|
+
1.upto(5, {
|
|
90
|
+
if (found) return true
|
|
91
|
+
parentDir = parentDir.parentFile
|
|
92
|
+
|
|
93
|
+
def androidSourcesDir = new File(
|
|
94
|
+
parentDir,
|
|
95
|
+
'node_modules/react-native'
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
def androidPrebuiltBinaryDir = new File(
|
|
99
|
+
parentDir,
|
|
100
|
+
'node_modules/react-native/android'
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
if (androidPrebuiltBinaryDir.exists()) {
|
|
104
|
+
maven {
|
|
105
|
+
url androidPrebuiltBinaryDir.toString()
|
|
106
|
+
name androidSourcesName
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
|
110
|
+
found = true
|
|
111
|
+
} else if (androidSourcesDir.exists()) {
|
|
112
|
+
maven {
|
|
113
|
+
url androidSourcesDir.toString()
|
|
114
|
+
name androidSourcesName
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
|
118
|
+
found = true
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!found) {
|
|
124
|
+
throw new GradleException(
|
|
125
|
+
"${project.name}: unable to locate React Native android sources. " +
|
|
126
|
+
"Ensure you have you installed React Native as a dependency in your project and try again."
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
132
|
+
|
|
133
|
+
dependencies {
|
|
134
|
+
//noinspection GradleDynamicVersion
|
|
135
|
+
implementation "com.facebook.react:react-native:+"
|
|
136
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
137
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4-native-mt"
|
|
138
|
+
implementation "com.ricoh360.thetaclient:theta-client:1.0.0"
|
|
139
|
+
|
|
140
|
+
// From node_modules
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (isNewArchitectureEnabled()) {
|
|
144
|
+
react {
|
|
145
|
+
jsRootDir = file("../src/")
|
|
146
|
+
libraryName = "ThetaClientReactNative"
|
|
147
|
+
codegenJavaPackageName = "com.ricoh360.thetaclientreactnative"
|
|
148
|
+
}
|
|
149
|
+
}
|