theta-client-react-native 1.14.1 → 1.16.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.
Files changed (49) hide show
  1. package/android/build.gradle +2 -2
  2. package/android/src/main/java/com/ricoh360/thetaclientreactnative/Converter.kt +4 -0
  3. package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkModule.kt +68 -48
  4. package/ios/ThetaClientReactNative.swift +93 -63
  5. package/lib/commonjs/NativeThetaClientReactNative.js +31 -2
  6. package/lib/commonjs/NativeThetaClientReactNative.js.map +1 -1
  7. package/lib/commonjs/theta-repository/libs/convert-utils.js +19 -0
  8. package/lib/commonjs/theta-repository/libs/convert-utils.js.map +1 -1
  9. package/lib/commonjs/theta-repository/libs/index.js +11 -0
  10. package/lib/commonjs/theta-repository/libs/index.js.map +1 -1
  11. package/lib/commonjs/theta-repository/libs/type-guards.js +13 -0
  12. package/lib/commonjs/theta-repository/libs/type-guards.js.map +1 -0
  13. package/lib/commonjs/theta-repository/theta-repository.js +7 -0
  14. package/lib/commonjs/theta-repository/theta-repository.js.map +1 -1
  15. package/lib/commonjs/theta-repository/theta-web-api-error.js +62 -0
  16. package/lib/commonjs/theta-repository/theta-web-api-error.js.map +1 -0
  17. package/lib/module/NativeThetaClientReactNative.js +31 -2
  18. package/lib/module/NativeThetaClientReactNative.js.map +1 -1
  19. package/lib/module/theta-repository/libs/convert-utils.js +17 -0
  20. package/lib/module/theta-repository/libs/convert-utils.js.map +1 -1
  21. package/lib/module/theta-repository/libs/index.js +1 -0
  22. package/lib/module/theta-repository/libs/index.js.map +1 -1
  23. package/lib/module/theta-repository/libs/type-guards.js +7 -0
  24. package/lib/module/theta-repository/libs/type-guards.js.map +1 -0
  25. package/lib/module/theta-repository/theta-repository.js +1 -0
  26. package/lib/module/theta-repository/theta-repository.js.map +1 -1
  27. package/lib/module/theta-repository/theta-web-api-error.js +54 -0
  28. package/lib/module/theta-repository/theta-web-api-error.js.map +1 -0
  29. package/lib/typescript/NativeThetaClientReactNative.d.ts.map +1 -1
  30. package/lib/typescript/theta-repository/libs/convert-utils.d.ts +2 -0
  31. package/lib/typescript/theta-repository/libs/convert-utils.d.ts.map +1 -1
  32. package/lib/typescript/theta-repository/libs/index.d.ts +1 -0
  33. package/lib/typescript/theta-repository/libs/index.d.ts.map +1 -1
  34. package/lib/typescript/theta-repository/libs/type-guards.d.ts +5 -0
  35. package/lib/typescript/theta-repository/libs/type-guards.d.ts.map +1 -0
  36. package/lib/typescript/theta-repository/options/options.d.ts +2 -2
  37. package/lib/typescript/theta-repository/theta-repository.d.ts +1 -0
  38. package/lib/typescript/theta-repository/theta-repository.d.ts.map +1 -1
  39. package/lib/typescript/theta-repository/theta-web-api-error.d.ts +15 -0
  40. package/lib/typescript/theta-repository/theta-web-api-error.d.ts.map +1 -0
  41. package/package.json +1 -1
  42. package/src/NativeThetaClientReactNative.ts +50 -2
  43. package/src/theta-repository/libs/convert-utils.ts +19 -0
  44. package/src/theta-repository/libs/index.ts +1 -0
  45. package/src/theta-repository/libs/type-guards.ts +10 -0
  46. package/src/theta-repository/options/options.ts +2 -2
  47. package/src/theta-repository/theta-repository.ts +1 -0
  48. package/src/theta-repository/theta-web-api-error.ts +81 -0
  49. package/theta-client-react-native.podspec +1 -1
@@ -67,8 +67,8 @@ dependencies {
67
67
  // noinspection GradleDynamicVersion
68
68
  implementation "com.facebook.react:react-native:+"
69
69
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
70
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
71
- implementation "com.ricoh360.thetaclient:theta-client:1.14.1"
70
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0"
71
+ implementation "com.ricoh360.thetaclient:theta-client:1.16.0"
72
72
  }
73
73
 
74
74
  react {
@@ -590,6 +590,10 @@ fun <T> addOptionsValueToMap(options: Options, name: OptionNameEnum, objects: Wr
590
590
  objects.putInt(key, value)
591
591
  }
592
592
 
593
+ is Boolean -> {
594
+ objects.putBoolean(key, value)
595
+ }
596
+
593
597
  is Number -> {
594
598
  objects.putDouble(key, value.toDouble())
595
599
  }
@@ -164,7 +164,7 @@ class ThetaClientReactNativeModule(
164
164
  )
165
165
  promise.resolve(true)
166
166
  } catch (t: Throwable) {
167
- promise.reject(t)
167
+ rejectWithDetail(promise, t)
168
168
  }
169
169
  }
170
170
  }
@@ -235,7 +235,7 @@ class ThetaClientReactNativeModule(
235
235
  }
236
236
  promise.resolve(result)
237
237
  } catch (t: Throwable) {
238
- promise.reject(t)
238
+ rejectWithDetail(promise, t)
239
239
  }
240
240
  }
241
241
  }
@@ -257,7 +257,7 @@ class ThetaClientReactNativeModule(
257
257
  val result = theta.getThetaLicense()
258
258
  promise.resolve(result)
259
259
  } catch (t: Throwable) {
260
- promise.reject(t)
260
+ rejectWithDetail(promise, t)
261
261
  }
262
262
  }
263
263
  }
@@ -280,7 +280,7 @@ class ThetaClientReactNativeModule(
280
280
  val result = toResult(state)
281
281
  promise.resolve(result)
282
282
  } catch (t: Throwable) {
283
- promise.reject(t)
283
+ rejectWithDetail(promise, t)
284
284
  }
285
285
  }
286
286
  }
@@ -317,7 +317,7 @@ class ThetaClientReactNativeModule(
317
317
  resultMap.putInt("totalEntries", totalEntries)
318
318
  promise.resolve(resultMap)
319
319
  } catch (t: Throwable) {
320
- promise.reject(t)
320
+ rejectWithDetail(promise, t)
321
321
  }
322
322
  }
323
323
  }
@@ -346,7 +346,7 @@ class ThetaClientReactNativeModule(
346
346
  theta.deleteFiles(fileList)
347
347
  promise.resolve(true)
348
348
  } catch (t: Throwable) {
349
- promise.reject(t)
349
+ rejectWithDetail(promise, t)
350
350
  }
351
351
  }
352
352
  }
@@ -368,7 +368,7 @@ class ThetaClientReactNativeModule(
368
368
  theta.deleteAllFiles()
369
369
  promise.resolve(true)
370
370
  } catch (t: Throwable) {
371
- promise.reject(t)
371
+ rejectWithDetail(promise, t)
372
372
  }
373
373
  }
374
374
  }
@@ -390,7 +390,7 @@ class ThetaClientReactNativeModule(
390
390
  theta.deleteAllImageFiles()
391
391
  promise.resolve(true)
392
392
  } catch (t: Throwable) {
393
- promise.reject(t)
393
+ rejectWithDetail(promise, t)
394
394
  }
395
395
  }
396
396
  }
@@ -412,7 +412,7 @@ class ThetaClientReactNativeModule(
412
412
  theta.deleteAllVideoFiles()
413
413
  promise.resolve(true)
414
414
  } catch (t: Throwable) {
415
- promise.reject(t)
415
+ rejectWithDetail(promise, t)
416
416
  }
417
417
  }
418
418
  }
@@ -436,7 +436,7 @@ class ThetaClientReactNativeModule(
436
436
  val result = toResult(options = response)
437
437
  promise.resolve(result)
438
438
  } catch (t: Throwable) {
439
- promise.reject(t)
439
+ rejectWithDetail(promise, t)
440
440
  }
441
441
  }
442
442
  }
@@ -461,7 +461,7 @@ class ThetaClientReactNativeModule(
461
461
  theta.setOptions(params)
462
462
  promise.resolve(true)
463
463
  } catch (t: Throwable) {
464
- promise.reject(t)
464
+ rejectWithDetail(promise, t)
465
465
  }
466
466
  }
467
467
  }
@@ -509,7 +509,7 @@ class ThetaClientReactNativeModule(
509
509
 
510
510
  promise.resolve(true)
511
511
  } catch (t: Throwable) {
512
- promise.reject(t)
512
+ rejectWithDetail(promise, t)
513
513
  } finally {
514
514
  previewing = false
515
515
  }
@@ -584,7 +584,7 @@ class ThetaClientReactNativeModule(
584
584
  promise.resolve(true)
585
585
  photoCaptureBuilder = null
586
586
  } catch (t: Throwable) {
587
- promise.reject(t)
587
+ rejectWithDetail(promise, t)
588
588
  photoCaptureBuilder = null
589
589
  }
590
590
  }
@@ -669,7 +669,7 @@ class ThetaClientReactNativeModule(
669
669
  promise.resolve(true)
670
670
  timeShiftCaptureBuilder = null
671
671
  } catch (t: Throwable) {
672
- promise.reject(t)
672
+ rejectWithDetail(promise, t)
673
673
  timeShiftCaptureBuilder = null
674
674
  }
675
675
  }
@@ -781,7 +781,7 @@ class ThetaClientReactNativeModule(
781
781
  }
782
782
  promise.resolve(true)
783
783
  } catch (t: Throwable) {
784
- promise.reject(t)
784
+ rejectWithDetail(promise, t)
785
785
  } finally {
786
786
  timeShiftManualCaptureBuilder = null
787
787
  }
@@ -907,7 +907,7 @@ class ThetaClientReactNativeModule(
907
907
  promise.resolve(true)
908
908
  videoCaptureBuilder = null
909
909
  } catch (t: Throwable) {
910
- promise.reject(t)
910
+ rejectWithDetail(promise, t)
911
911
  videoCaptureBuilder = null
912
912
  }
913
913
  }
@@ -1022,7 +1022,7 @@ class ThetaClientReactNativeModule(
1022
1022
  promise.resolve(true)
1023
1023
  limitlessIntervalCaptureBuilder = null
1024
1024
  } catch (t: Throwable) {
1025
- promise.reject(t)
1025
+ rejectWithDetail(promise, t)
1026
1026
  limitlessIntervalCaptureBuilder = null
1027
1027
  }
1028
1028
  }
@@ -1141,7 +1141,7 @@ class ThetaClientReactNativeModule(
1141
1141
  promise.resolve(true)
1142
1142
  shotCountSpecifiedIntervalCaptureBuilder = null
1143
1143
  } catch (t: Throwable) {
1144
- promise.reject(t)
1144
+ rejectWithDetail(promise, t)
1145
1145
  shotCountSpecifiedIntervalCaptureBuilder = null
1146
1146
  }
1147
1147
  }
@@ -1268,7 +1268,7 @@ class ThetaClientReactNativeModule(
1268
1268
  promise.resolve(true)
1269
1269
  compositeIntervalCaptureBuilder = null
1270
1270
  } catch (t: Throwable) {
1271
- promise.reject(t)
1271
+ rejectWithDetail(promise, t)
1272
1272
  compositeIntervalCaptureBuilder = null
1273
1273
  }
1274
1274
  }
@@ -1413,7 +1413,7 @@ class ThetaClientReactNativeModule(
1413
1413
  promise.resolve(true)
1414
1414
  burstCaptureBuilder = null
1415
1415
  } catch (t: Throwable) {
1416
- promise.reject(t)
1416
+ rejectWithDetail(promise, t)
1417
1417
  burstCaptureBuilder = null
1418
1418
  }
1419
1419
  }
@@ -1535,7 +1535,7 @@ class ThetaClientReactNativeModule(
1535
1535
  promise.resolve(true)
1536
1536
  multiBracketCaptureBuilder = null
1537
1537
  } catch (t: Throwable) {
1538
- promise.reject(t)
1538
+ rejectWithDetail(promise, t)
1539
1539
  multiBracketCaptureBuilder = null
1540
1540
  }
1541
1541
  }
@@ -1659,7 +1659,7 @@ class ThetaClientReactNativeModule(
1659
1659
  promise.resolve(true)
1660
1660
  continuousCaptureBuilder = null
1661
1661
  } catch (t: Throwable) {
1662
- promise.reject(t)
1662
+ rejectWithDetail(promise, t)
1663
1663
  continuousCaptureBuilder = null
1664
1664
  }
1665
1665
  }
@@ -1750,7 +1750,7 @@ class ThetaClientReactNativeModule(
1750
1750
  metaInfo.putMap("xmp", xmp)
1751
1751
  promise.resolve(metaInfo)
1752
1752
  } catch (t: Throwable) {
1753
- promise.reject(t)
1753
+ rejectWithDetail(promise, t)
1754
1754
  }
1755
1755
  }
1756
1756
  }
@@ -1772,7 +1772,7 @@ class ThetaClientReactNativeModule(
1772
1772
  theta.reboot()
1773
1773
  promise.resolve(true)
1774
1774
  } catch (t: Throwable) {
1775
- promise.reject(t)
1775
+ rejectWithDetail(promise, t)
1776
1776
  }
1777
1777
  }
1778
1778
  }
@@ -1794,7 +1794,7 @@ class ThetaClientReactNativeModule(
1794
1794
  theta.reset()
1795
1795
  promise.resolve(true)
1796
1796
  } catch (t: Throwable) {
1797
- promise.reject(t)
1797
+ rejectWithDetail(promise, t)
1798
1798
  }
1799
1799
  }
1800
1800
  }
@@ -1816,7 +1816,7 @@ class ThetaClientReactNativeModule(
1816
1816
  theta.restoreSettings()
1817
1817
  promise.resolve(true)
1818
1818
  } catch (t: Throwable) {
1819
- promise.reject(t)
1819
+ rejectWithDetail(promise, t)
1820
1820
  }
1821
1821
  }
1822
1822
  }
@@ -1838,7 +1838,7 @@ class ThetaClientReactNativeModule(
1838
1838
  theta.stopSelfTimer()
1839
1839
  promise.resolve(true)
1840
1840
  } catch (t: Throwable) {
1841
- promise.reject(t)
1841
+ rejectWithDetail(promise, t)
1842
1842
  }
1843
1843
  }
1844
1844
  }
@@ -1876,7 +1876,7 @@ class ThetaClientReactNativeModule(
1876
1876
  }
1877
1877
  promise.resolve(convertedUrl)
1878
1878
  } catch (t: Throwable) {
1879
- promise.reject(t)
1879
+ rejectWithDetail(promise, t)
1880
1880
  }
1881
1881
  }
1882
1882
 
@@ -1899,7 +1899,7 @@ class ThetaClientReactNativeModule(
1899
1899
  theta.cancelVideoConvert()
1900
1900
  promise.resolve(true)
1901
1901
  } catch (t: Throwable) {
1902
- promise.reject(t)
1902
+ rejectWithDetail(promise, t)
1903
1903
  }
1904
1904
  }
1905
1905
  }
@@ -1921,7 +1921,7 @@ class ThetaClientReactNativeModule(
1921
1921
  theta.finishWlan()
1922
1922
  promise.resolve(true)
1923
1923
  } catch (t: Throwable) {
1924
- promise.reject(t)
1924
+ rejectWithDetail(promise, t)
1925
1925
  }
1926
1926
  }
1927
1927
  }
@@ -1943,7 +1943,7 @@ class ThetaClientReactNativeModule(
1943
1943
  val response = theta.listAccessPoints()
1944
1944
  promise.resolve(toListAccessPointsResult(accessPointList = response))
1945
1945
  } catch (t: Throwable) {
1946
- promise.reject(t)
1946
+ rejectWithDetail(promise, t)
1947
1947
  }
1948
1948
  }
1949
1949
  }
@@ -1977,7 +1977,7 @@ class ThetaClientReactNativeModule(
1977
1977
  )
1978
1978
  promise.resolve(true)
1979
1979
  } catch (t: Throwable) {
1980
- promise.reject(t)
1980
+ rejectWithDetail(promise, t)
1981
1981
  }
1982
1982
  }
1983
1983
  }
@@ -2017,7 +2017,7 @@ class ThetaClientReactNativeModule(
2017
2017
  )
2018
2018
  promise.resolve(true)
2019
2019
  } catch (t: Throwable) {
2020
- promise.reject(t)
2020
+ rejectWithDetail(promise, t)
2021
2021
  }
2022
2022
  }
2023
2023
  }
@@ -2047,7 +2047,7 @@ class ThetaClientReactNativeModule(
2047
2047
  theta.setAccessPointConnectionPriority(ssid, connectionPriority.toInt(), ssidStealth)
2048
2048
  promise.resolve(true)
2049
2049
  } catch (t: Throwable) {
2050
- promise.reject(t)
2050
+ rejectWithDetail(promise, t)
2051
2051
  }
2052
2052
  }
2053
2053
  }
@@ -2070,7 +2070,7 @@ class ThetaClientReactNativeModule(
2070
2070
  theta.deleteAccessPoint(ssid)
2071
2071
  promise.resolve(true)
2072
2072
  } catch (t: Throwable) {
2073
- promise.reject(t)
2073
+ rejectWithDetail(promise, t)
2074
2074
  }
2075
2075
  }
2076
2076
  }
@@ -2093,7 +2093,7 @@ class ThetaClientReactNativeModule(
2093
2093
  val deviceName = theta.setBluetoothDevice(uuid)
2094
2094
  promise.resolve(deviceName)
2095
2095
  } catch (t: Throwable) {
2096
- promise.reject(t)
2096
+ rejectWithDetail(promise, t)
2097
2097
  }
2098
2098
  }
2099
2099
  }
@@ -2117,7 +2117,7 @@ class ThetaClientReactNativeModule(
2117
2117
  val options = theta.getMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode))
2118
2118
  promise.resolve(toResult(options = options))
2119
2119
  } catch (t: Throwable) {
2120
- promise.reject(t)
2120
+ rejectWithDetail(promise, t)
2121
2121
  }
2122
2122
  }
2123
2123
  }
@@ -2147,7 +2147,7 @@ class ThetaClientReactNativeModule(
2147
2147
  val options = theta.getMySetting(optionNameList)
2148
2148
  promise.resolve(toResult(options = options))
2149
2149
  } catch (t: Throwable) {
2150
- promise.reject(t)
2150
+ rejectWithDetail(promise, t)
2151
2151
  }
2152
2152
  }
2153
2153
  }
@@ -2172,7 +2172,7 @@ class ThetaClientReactNativeModule(
2172
2172
  theta.setMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode), thetaOptions)
2173
2173
  promise.resolve(true)
2174
2174
  } catch (t: Throwable) {
2175
- promise.reject(t)
2175
+ rejectWithDetail(promise, t)
2176
2176
  }
2177
2177
  }
2178
2178
  }
@@ -2195,7 +2195,7 @@ class ThetaClientReactNativeModule(
2195
2195
  theta.deleteMySetting(ThetaRepository.CaptureModeEnum.valueOf(captureMode))
2196
2196
  promise.resolve(true)
2197
2197
  } catch (t: Throwable) {
2198
- promise.reject(t)
2198
+ rejectWithDetail(promise, t)
2199
2199
  }
2200
2200
  }
2201
2201
  }
@@ -2231,7 +2231,7 @@ class ThetaClientReactNativeModule(
2231
2231
  }
2232
2232
  promise.resolve(result)
2233
2233
  } catch (t: Throwable) {
2234
- promise.reject(t)
2234
+ rejectWithDetail(promise, t)
2235
2235
  }
2236
2236
  }
2237
2237
  }
@@ -2254,7 +2254,7 @@ class ThetaClientReactNativeModule(
2254
2254
  theta.setPlugin(packageName)
2255
2255
  promise.resolve(true)
2256
2256
  } catch (t: Throwable) {
2257
- promise.reject(t)
2257
+ rejectWithDetail(promise, t)
2258
2258
  }
2259
2259
  }
2260
2260
  }
@@ -2277,7 +2277,7 @@ class ThetaClientReactNativeModule(
2277
2277
  theta.startPlugin(packageName)
2278
2278
  promise.resolve(true)
2279
2279
  } catch (t: Throwable) {
2280
- promise.reject(t)
2280
+ rejectWithDetail(promise, t)
2281
2281
  }
2282
2282
  }
2283
2283
  }
@@ -2299,7 +2299,7 @@ class ThetaClientReactNativeModule(
2299
2299
  theta.stopPlugin()
2300
2300
  promise.resolve(true)
2301
2301
  } catch (t: Throwable) {
2302
- promise.reject(t)
2302
+ rejectWithDetail(promise, t)
2303
2303
  }
2304
2304
  }
2305
2305
  }
@@ -2322,7 +2322,7 @@ class ThetaClientReactNativeModule(
2322
2322
  val result = theta.getPluginLicense(packageName)
2323
2323
  promise.resolve(result)
2324
2324
  } catch (t: Throwable) {
2325
- promise.reject(t)
2325
+ rejectWithDetail(promise, t)
2326
2326
  }
2327
2327
  }
2328
2328
  }
@@ -2344,7 +2344,7 @@ class ThetaClientReactNativeModule(
2344
2344
  val result = theta.getPluginOrders()
2345
2345
  promise.resolve(Arguments.fromList(result))
2346
2346
  } catch (t: Throwable) {
2347
- promise.reject(t)
2347
+ rejectWithDetail(promise, t)
2348
2348
  }
2349
2349
  }
2350
2350
  }
@@ -2377,7 +2377,7 @@ class ThetaClientReactNativeModule(
2377
2377
  theta.setPluginOrders(pluginList)
2378
2378
  promise.resolve(true)
2379
2379
  } catch (t: Throwable) {
2380
- promise.reject(t)
2380
+ rejectWithDetail(promise, t)
2381
2381
  }
2382
2382
  }
2383
2383
  }
@@ -2428,7 +2428,7 @@ class ThetaClientReactNativeModule(
2428
2428
  })
2429
2429
  promise.resolve(true)
2430
2430
  } catch (t: Throwable) {
2431
- promise.reject(t)
2431
+ rejectWithDetail(promise, t)
2432
2432
  }
2433
2433
  }
2434
2434
  }
@@ -2452,10 +2452,30 @@ class ThetaClientReactNativeModule(
2452
2452
  }
2453
2453
  }
2454
2454
 
2455
+ private fun rejectWithDetail(promise: Promise, error: Throwable) {
2456
+ val webApiException = error as? ThetaRepository.ThetaWebApiException
2457
+ if (webApiException != null) {
2458
+ val statusCode = webApiException.statusCode
2459
+ val errorCode = webApiException.errorCode
2460
+
2461
+ val userInfo = Arguments.createMap()
2462
+ statusCode?.let { userInfo.putInt(ERROR_STATUS_CODE, it) }
2463
+ errorCode?.let { userInfo.putString(ERROR_CODE, it) }
2464
+
2465
+ android.util.Log.i("ThetaClientReactNative", "ThetaWebApiException statusCode=$statusCode errorCode=$errorCode message=${error.message}")
2466
+ promise.reject(ERROR_CODE_ERROR, error.message, userInfo)
2467
+ } else {
2468
+ promise.reject(error)
2469
+ }
2470
+ }
2471
+
2455
2472
  companion object {
2456
2473
  const val NAME = "ThetaClientReactNative"
2457
2474
  const val EVENT_NAME = "ThetaFrameEvent"
2458
2475
  const val EVENT_NOTIFY = "ThetaNotify"
2476
+ const val ERROR_CODE_ERROR = "error"
2477
+ const val ERROR_STATUS_CODE = "statusCode"
2478
+ const val ERROR_CODE = "errorCode"
2459
2479
  const val NOTIFY_PHOTO_CAPTURING = "PHOTO-CAPTURING"
2460
2480
  const val NOTIFY_TIMESHIFT_PROGRESS = "TIME-SHIFT-PROGRESS"
2461
2481
  const val NOTIFY_TIMESHIFT_STOP_ERROR = "TIME-SHIFT-STOP-ERROR"