theta-client-react-native 1.3.1 → 1.4.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 (104) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/ricoh360/thetaclientreactnative/Converter.kt +81 -0
  3. package/android/src/main/java/com/ricoh360/thetaclientreactnative/ThetaClientSdkModule.kt +55 -19
  4. package/ios/ConvertUtil.swift +989 -0
  5. package/ios/ThetaClientReactNative-Bridging-Header.h +3 -0
  6. package/ios/ThetaClientReactNative.m +201 -0
  7. package/ios/ThetaClientReactNative.swift +1337 -0
  8. package/ios/ThetaClientReactNative.xcodeproj/project.pbxproj +15 -57
  9. package/lib/commonjs/capture/photo-capture.js +19 -1
  10. package/lib/commonjs/capture/photo-capture.js.map +1 -1
  11. package/lib/commonjs/capture/time-shift-capture.js +27 -23
  12. package/lib/commonjs/capture/time-shift-capture.js.map +1 -1
  13. package/lib/commonjs/capture/video-capture.js +33 -5
  14. package/lib/commonjs/capture/video-capture.js.map +1 -1
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/commonjs/theta-repository/notify-controller.js +40 -0
  17. package/lib/commonjs/theta-repository/notify-controller.js.map +1 -0
  18. package/lib/commonjs/theta-repository/options/index.js +44 -0
  19. package/lib/commonjs/theta-repository/options/index.js.map +1 -1
  20. package/lib/commonjs/theta-repository/options/option-face-detect.js +22 -0
  21. package/lib/commonjs/theta-repository/options/option-face-detect.js.map +1 -0
  22. package/lib/commonjs/theta-repository/options/option-function.js +27 -0
  23. package/lib/commonjs/theta-repository/options/option-function.js.map +1 -0
  24. package/lib/commonjs/theta-repository/options/option-gain.js +26 -0
  25. package/lib/commonjs/theta-repository/options/option-gain.js.map +1 -0
  26. package/lib/commonjs/theta-repository/options/option-image-stitching.js +38 -0
  27. package/lib/commonjs/theta-repository/options/option-image-stitching.js.map +1 -0
  28. package/lib/commonjs/theta-repository/options/options.js +8 -0
  29. package/lib/commonjs/theta-repository/options/options.js.map +1 -1
  30. package/lib/commonjs/theta-repository/theta-repository.js +2 -3
  31. package/lib/commonjs/theta-repository/theta-repository.js.map +1 -1
  32. package/lib/commonjs/theta-repository/theta-state.js +1 -13
  33. package/lib/commonjs/theta-repository/theta-state.js.map +1 -1
  34. package/lib/module/capture/photo-capture.js +19 -1
  35. package/lib/module/capture/photo-capture.js.map +1 -1
  36. package/lib/module/capture/time-shift-capture.js +27 -23
  37. package/lib/module/capture/time-shift-capture.js.map +1 -1
  38. package/lib/module/capture/video-capture.js +33 -5
  39. package/lib/module/capture/video-capture.js.map +1 -1
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/module/theta-repository/notify-controller.js +33 -0
  42. package/lib/module/theta-repository/notify-controller.js.map +1 -0
  43. package/lib/module/theta-repository/options/index.js +4 -0
  44. package/lib/module/theta-repository/options/index.js.map +1 -1
  45. package/lib/module/theta-repository/options/option-face-detect.js +15 -0
  46. package/lib/module/theta-repository/options/option-face-detect.js.map +1 -0
  47. package/lib/module/theta-repository/options/option-function.js +20 -0
  48. package/lib/module/theta-repository/options/option-function.js.map +1 -0
  49. package/lib/module/theta-repository/options/option-gain.js +19 -0
  50. package/lib/module/theta-repository/options/option-gain.js.map +1 -0
  51. package/lib/module/theta-repository/options/option-image-stitching.js +31 -0
  52. package/lib/module/theta-repository/options/option-image-stitching.js.map +1 -0
  53. package/lib/module/theta-repository/options/options.js +8 -0
  54. package/lib/module/theta-repository/options/options.js.map +1 -1
  55. package/lib/module/theta-repository/theta-repository.js +2 -3
  56. package/lib/module/theta-repository/theta-repository.js.map +1 -1
  57. package/lib/module/theta-repository/theta-state.js +0 -12
  58. package/lib/module/theta-repository/theta-state.js.map +1 -1
  59. package/lib/typescript/capture/photo-capture.d.ts +7 -1
  60. package/lib/typescript/capture/photo-capture.d.ts.map +1 -1
  61. package/lib/typescript/capture/time-shift-capture.d.ts +4 -7
  62. package/lib/typescript/capture/time-shift-capture.d.ts.map +1 -1
  63. package/lib/typescript/capture/video-capture.d.ts +5 -1
  64. package/lib/typescript/capture/video-capture.d.ts.map +1 -1
  65. package/lib/typescript/theta-repository/notify-controller.d.ts +17 -0
  66. package/lib/typescript/theta-repository/notify-controller.d.ts.map +1 -0
  67. package/lib/typescript/theta-repository/options/index.d.ts +4 -0
  68. package/lib/typescript/theta-repository/options/index.d.ts.map +1 -1
  69. package/lib/typescript/theta-repository/options/option-face-detect.d.ts +15 -0
  70. package/lib/typescript/theta-repository/options/option-face-detect.d.ts.map +1 -0
  71. package/lib/typescript/theta-repository/options/option-function.d.ts +20 -0
  72. package/lib/typescript/theta-repository/options/option-function.d.ts.map +1 -0
  73. package/lib/typescript/theta-repository/options/option-gain.d.ts +19 -0
  74. package/lib/typescript/theta-repository/options/option-gain.d.ts.map +1 -0
  75. package/lib/typescript/theta-repository/options/option-image-stitching.d.ts +30 -0
  76. package/lib/typescript/theta-repository/options/option-image-stitching.d.ts.map +1 -0
  77. package/lib/typescript/theta-repository/options/options.d.ts +20 -0
  78. package/lib/typescript/theta-repository/options/options.d.ts.map +1 -1
  79. package/lib/typescript/theta-repository/theta-repository.d.ts.map +1 -1
  80. package/lib/typescript/theta-repository/theta-state.d.ts +1 -11
  81. package/lib/typescript/theta-repository/theta-state.d.ts.map +1 -1
  82. package/package.json +14 -8
  83. package/src/capture/photo-capture.ts +20 -3
  84. package/src/capture/time-shift-capture.ts +40 -33
  85. package/src/capture/video-capture.ts +49 -6
  86. package/src/theta-repository/notify-controller.ts +50 -0
  87. package/src/theta-repository/options/index.ts +4 -0
  88. package/src/theta-repository/options/option-face-detect.ts +16 -0
  89. package/src/theta-repository/options/option-function.ts +21 -0
  90. package/src/theta-repository/options/option-gain.ts +19 -0
  91. package/src/theta-repository/options/option-image-stitching.ts +32 -0
  92. package/src/theta-repository/options/options.ts +20 -0
  93. package/src/theta-repository/theta-repository.ts +3 -3
  94. package/src/theta-repository/theta-state.ts +2 -14
  95. package/theta-client-react-native.podspec +2 -2
  96. package/ios/ThetaClientReactNative.h +0 -34
  97. package/ios/ThetaClientReactNative.mm +0 -4087
  98. package/lib/commonjs/capture/notify.js +0 -12
  99. package/lib/commonjs/capture/notify.js.map +0 -1
  100. package/lib/module/capture/notify.js +0 -6
  101. package/lib/module/capture/notify.js.map +0 -1
  102. package/lib/typescript/capture/notify.d.ts +0 -13
  103. package/lib/typescript/capture/notify.d.ts.map +0 -1
  104. package/src/capture/notify.ts +0 -27
@@ -1,3 +1,4 @@
1
+ import type { ShootingFunctionEnum } from './options/option-function';
1
2
  /** Battery charging state constants */
2
3
  export declare const ChargingStateEnum: {
3
4
  /** Charging */
@@ -30,17 +31,6 @@ export declare const CaptureStatusEnum: {
30
31
  };
31
32
  /** type definition of CaptureStatusEnum */
32
33
  export type CaptureStatusEnum = (typeof CaptureStatusEnum)[keyof typeof CaptureStatusEnum];
33
- /** Shooting function status constants */
34
- export declare const ShootingFunctionEnum: {
35
- /** normal */
36
- readonly NORMAL: "NORMAL";
37
- /** selfTimer */
38
- readonly SELF_TIMER: "SELF_TIMER";
39
- /** mySetting */
40
- readonly MY_SETTING: "MY_SETTING";
41
- };
42
- /** type definition of ShootingFunctionEnum */
43
- export type ShootingFunctionEnum = (typeof ShootingFunctionEnum)[keyof typeof ShootingFunctionEnum];
44
34
  /** Microphone option constants */
45
35
  export declare const MicrophoneOptionEnum: {
46
36
  /** auto */
@@ -1 +1 @@
1
- {"version":3,"file":"theta-state.d.ts","sourceRoot":"","sources":["../../../src/theta-repository/theta-state.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,eAAO,MAAM,iBAAiB;IAC5B,eAAe;;IAEf,yBAAyB;;IAEzB,mBAAmB;;CAEX,CAAC;AAEX,2CAA2C;AAC3C,MAAM,MAAM,iBAAiB,GAC3B,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE7D,+BAA+B;AAC/B,eAAO,MAAM,iBAAiB;IAC5B,oCAAoC;;IAEpC,iBAAiB;;IAEjB,8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DAAgD;AAChD,MAAM,MAAM,UAAU,GAAG;IACvB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,gCAAgC;IAChC,aAAa,EAAE,iBAAiB,CAAC;IACjC,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,yDAAyD;IACzD,4BAA4B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB;IACrB,aAAa,EAAE,iBAAiB,CAAC;IACjC,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,eAAe,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC,+DAA+D;IAC/D,iBAAiB,EAAE,OAAO,GAAG,IAAI,CAAC;IAClC,8BAA8B;IAC9B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,+BAA+B;IAC/B,kBAAkB,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,2DAA2D;IAC3D,iBAAiB,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC/C,gCAAgC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,sCAAsC;IACtC,WAAW,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC;IAC3C,0DAA0D;IAC1D,eAAe,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "theta-client-react-native",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "This library provides a way to control RICOH THETA using.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -14,7 +14,7 @@
14
14
  "ios",
15
15
  "cpp",
16
16
  "*.podspec",
17
- "!lib/typescript/example",
17
+ "!lib/typescript/verification-tool",
18
18
  "!ios/build",
19
19
  "!android/build",
20
20
  "!android/gradle",
@@ -28,11 +28,13 @@
28
28
  ],
29
29
  "scripts": {
30
30
  "test": "jest",
31
- "typescript": "tsc --noEmit",
31
+ "typecheck": "tsc --noEmit",
32
32
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
33
- "prepare": "bob build",
33
+ "prepack": "bob build",
34
34
  "release": "release-it",
35
- "bootstrap": "yarn install"
35
+ "verification-tool": "yarn --cwd verification-tool",
36
+ "bootstrap": "yarn verification-tool && yarn install && yarn verification-tool pods",
37
+ "clean": "del-cli android/build verification-tool/android/build verification-tool/android/app/build verification-tool/ios/build"
36
38
  },
37
39
  "keywords": [
38
40
  "react-native",
@@ -51,8 +53,7 @@
51
53
  "registry": "https://registry.npmjs.org/"
52
54
  },
53
55
  "devDependencies": {
54
- "@arkweid/lefthook": "^0.7.7",
55
- "@commitlint/config-conventional": "^17.3.0",
56
+ "@commitlint/config-conventional": "^17.0.3",
56
57
  "@react-native-community/eslint-config": "^3.0.2",
57
58
  "@release-it/conventional-changelog": "^5.0.0",
58
59
  "@types/jest": "^29.2.4",
@@ -67,7 +68,7 @@
67
68
  "pod-install": "^0.1.0",
68
69
  "prettier": "^2.8.1",
69
70
  "react": "18.2.0",
70
- "react-native": "0.70.6",
71
+ "react-native": "0.71.7",
71
72
  "react-native-builder-bob": "^0.20.3",
72
73
  "release-it": "^15.5.1",
73
74
  "typescript": "^4.9.4"
@@ -79,9 +80,14 @@
79
80
  "react": "*",
80
81
  "react-native": "*"
81
82
  },
83
+ "engines": {
84
+ "node": ">= 16.0.0"
85
+ },
86
+ "packageManager": "^yarn@1.22.15",
82
87
  "jest": {
83
88
  "preset": "react-native",
84
89
  "modulePathIgnorePatterns": [
90
+ "<rootDir>/verification-tool/node_modules",
85
91
  "<rootDir>/lib/"
86
92
  ]
87
93
  },
@@ -2,6 +2,7 @@ import { CaptureBuilder } from './capture';
2
2
  import type {
3
3
  FilterEnum,
4
4
  PhotoFileFormatEnum,
5
+ PresetEnum,
5
6
  } from '../theta-repository/options';
6
7
 
7
8
  import { NativeModules } from 'react-native';
@@ -48,6 +49,16 @@ export class PhotoCaptureBuilder extends CaptureBuilder<PhotoCaptureBuilder> {
48
49
  return this;
49
50
  }
50
51
 
52
+ /**
53
+ * Set preset mode of Theta SC2 and Theta SC2 for business.
54
+ * @param {FilterEnum} preset Preset mode to set
55
+ * @return PhotoCaptureBuilder
56
+ */
57
+ setPreset(preset: PresetEnum): PhotoCaptureBuilder {
58
+ this.options.preset = preset;
59
+ return this;
60
+ }
61
+
51
62
  /**
52
63
  * Builds an instance of a PhotoCapture that has all the combined
53
64
  * parameters of the Options that have been added to the Builder.
@@ -55,8 +66,14 @@ export class PhotoCaptureBuilder extends CaptureBuilder<PhotoCaptureBuilder> {
55
66
  * @return promise of PhotoCapture instance
56
67
  */
57
68
  build(): Promise<PhotoCapture> {
58
- return ThetaClientReactNative.buildPhotoCapture(this.options).then(
59
- () => new PhotoCapture()
60
- );
69
+ return new Promise<PhotoCapture>(async (resolve, reject) => {
70
+ try {
71
+ await ThetaClientReactNative.getPhotoCaptureBuilder();
72
+ await ThetaClientReactNative.buildPhotoCapture(this.options);
73
+ resolve(new PhotoCapture());
74
+ } catch (error) {
75
+ reject(error);
76
+ }
77
+ });
61
78
  }
62
79
  }
@@ -1,17 +1,28 @@
1
- import type { EmitterSubscription } from 'react-native';
2
1
  import { CaptureBuilder } from './capture';
3
2
  import { NativeModules } from 'react-native';
4
- import { BaseNotify, CaptureProgressNotify, addNotifyListener } from './notify';
5
3
  import type { TimeShiftIntervalEnum } from '../theta-repository/options';
4
+ import {
5
+ BaseNotify,
6
+ NotifyController,
7
+ } from '../theta-repository/notify-controller';
6
8
  const ThetaClientReactNative = NativeModules.ThetaClientReactNative;
7
9
 
10
+ const NOTIFY_NAME = 'TIME-SHIFT-PROGRESS';
11
+
12
+ interface CaptureProgressNotify extends BaseNotify {
13
+ params?: {
14
+ completion: number;
15
+ };
16
+ }
17
+
8
18
  /**
9
19
  * TimeShiftCapture class
10
20
  */
11
21
  export class TimeShiftCapture {
12
- eventListener?: EmitterSubscription = undefined;
13
- notifyList = new Map<string, ((notify: BaseNotify) => void) | undefined>();
14
-
22
+ notify: NotifyController;
23
+ constructor(notify: NotifyController) {
24
+ this.notify = notify;
25
+ }
15
26
  /**
16
27
  * start time-shift
17
28
  * @param onProgress the block for time-shift onProgress
@@ -19,27 +30,23 @@ export class TimeShiftCapture {
19
30
  */
20
31
  async startCapture(
21
32
  onProgress?: (completion?: number) => void
22
- ): Promise<string> {
23
- await this.initNotify();
24
- this.notifyList.set(
25
- 'TIME-SHIFT-PROGRESS',
26
- onProgress
27
- ? (event: CaptureProgressNotify) => {
28
- onProgress(event.params?.completion);
29
- }
30
- : undefined
31
- );
33
+ ): Promise<string | undefined> {
34
+ if (onProgress) {
35
+ this.notify.addNotify(NOTIFY_NAME, (event: CaptureProgressNotify) => {
36
+ onProgress(event.params?.completion);
37
+ });
38
+ }
32
39
 
33
- return new Promise<string>(async (resolve, reject) => {
40
+ return new Promise<string | undefined>(async (resolve, reject) => {
34
41
  await ThetaClientReactNative.startTimeShiftCapture()
35
- .then((result: string) => {
36
- resolve(result);
42
+ .then((result?: string) => {
43
+ resolve(result ?? undefined);
37
44
  })
38
45
  .catch((error: any) => {
39
46
  reject(error);
40
47
  })
41
48
  .finally(() => {
42
- this.releaseNotify();
49
+ this.notify.removeNotify(NOTIFY_NAME);
43
50
  });
44
51
  });
45
52
  }
@@ -50,16 +57,6 @@ export class TimeShiftCapture {
50
57
  async cancelCapture(): Promise<any> {
51
58
  return await ThetaClientReactNative.cancelTimeShiftCapture();
52
59
  }
53
-
54
- async initNotify() {
55
- this.eventListener = addNotifyListener((notify: BaseNotify) => {
56
- this.notifyList.get(notify.name)?.(notify as BaseNotify);
57
- });
58
- }
59
-
60
- releaseNotify() {
61
- this.eventListener?.remove();
62
- }
63
60
  }
64
61
 
65
62
  /**
@@ -137,9 +134,19 @@ export class TimeShiftCaptureBuilder extends CaptureBuilder<TimeShiftCaptureBuil
137
134
  * @return promise of TimeShiftCapture instance
138
135
  */
139
136
  build(): Promise<TimeShiftCapture> {
140
- return ThetaClientReactNative.buildTimeShiftCapture(
141
- this.options,
142
- this.interval ?? -1
143
- ).then(() => new TimeShiftCapture());
137
+ let params = {
138
+ ...this.options,
139
+ // Cannot pass negative values in IOS, use objects
140
+ _capture_interval: this.interval ?? -1,
141
+ };
142
+ return new Promise<TimeShiftCapture>(async (resolve, reject) => {
143
+ try {
144
+ await ThetaClientReactNative.getTimeShiftCaptureBuilder();
145
+ await ThetaClientReactNative.buildTimeShiftCapture(params);
146
+ resolve(new TimeShiftCapture(NotifyController.instance));
147
+ } catch (error) {
148
+ reject(error);
149
+ }
150
+ });
144
151
  }
145
152
  }
@@ -5,24 +5,61 @@ import type {
5
5
  } from '../theta-repository/options';
6
6
 
7
7
  import { NativeModules } from 'react-native';
8
+ import {
9
+ BaseNotify,
10
+ NotifyController,
11
+ } from '../theta-repository/notify-controller';
8
12
  const ThetaClientReactNative = NativeModules.ThetaClientReactNative;
9
13
 
14
+ const NOTIFY_NAME = 'VIDEO-CAPTURE-STOP-ERROR';
15
+
16
+ interface CaptureStopErrorNotify extends BaseNotify {
17
+ params?: {
18
+ message: string;
19
+ };
20
+ }
21
+
10
22
  /**
11
23
  * VideoCapture class
12
24
  */
13
25
  export class VideoCapture {
26
+ notify: NotifyController;
27
+ constructor(notify: NotifyController) {
28
+ this.notify = notify;
29
+ }
30
+
14
31
  /**
15
32
  * start video capture
33
+ * @param onStopFailed the block for error of stopCapture
16
34
  * @return promise of captured file url
17
35
  */
18
- startCapture(): Promise<string> {
19
- return ThetaClientReactNative.startCapture();
36
+ startCapture(
37
+ onStopFailed?: (error: any) => void
38
+ ): Promise<string | undefined> {
39
+ if (onStopFailed) {
40
+ this.notify.addNotify(NOTIFY_NAME, (event: CaptureStopErrorNotify) => {
41
+ onStopFailed(event.params);
42
+ });
43
+ }
44
+ return new Promise<string | undefined>(async (resolve, reject) => {
45
+ await ThetaClientReactNative.startVideoCapture()
46
+ .then((result?: string) => {
47
+ resolve(result ?? undefined);
48
+ })
49
+ .catch((error: any) => {
50
+ reject(error);
51
+ })
52
+ .finally(() => {
53
+ this.notify.removeNotify(NOTIFY_NAME);
54
+ });
55
+ });
20
56
  }
57
+
21
58
  /**
22
59
  * stop video capture
23
60
  */
24
61
  stopCapture() {
25
- ThetaClientReactNative.stopCapture();
62
+ ThetaClientReactNative.stopVideoCapture();
26
63
  }
27
64
  }
28
65
 
@@ -62,8 +99,14 @@ export class VideoCaptureBuilder extends CaptureBuilder<VideoCaptureBuilder> {
62
99
  * @return promise of VideoCapture instance
63
100
  */
64
101
  build(): Promise<VideoCapture> {
65
- return ThetaClientReactNative.buildVideoCapture(this.options).then(
66
- () => new VideoCapture()
67
- );
102
+ return new Promise<VideoCapture>(async (resolve, reject) => {
103
+ try {
104
+ await ThetaClientReactNative.getVideoCaptureBuilder();
105
+ await ThetaClientReactNative.buildVideoCapture(this.options);
106
+ resolve(new VideoCapture(NotifyController.instance));
107
+ } catch (error) {
108
+ reject(error);
109
+ }
110
+ });
68
111
  }
69
112
  }
@@ -0,0 +1,50 @@
1
+ import {
2
+ NativeEventEmitter,
3
+ type EmitterSubscription,
4
+ NativeModules,
5
+ } from 'react-native';
6
+
7
+ export interface BaseNotify {
8
+ name: string;
9
+ params?: any;
10
+ }
11
+
12
+ export class NotifyController {
13
+ static _instance = new NotifyController();
14
+ static get instance(): NotifyController {
15
+ return NotifyController._instance;
16
+ }
17
+
18
+ eventListener?: EmitterSubscription = undefined;
19
+ notifyList = new Map<string, ((notify: BaseNotify) => void) | undefined>();
20
+
21
+ init() {
22
+ this.release();
23
+ this.eventListener = this.addNotifyListener((notify: BaseNotify) => {
24
+ this.notifyList.get(notify.name)?.(notify as BaseNotify);
25
+ });
26
+ }
27
+
28
+ release() {
29
+ this.eventListener?.remove();
30
+ this.eventListener = undefined;
31
+ this.notifyList.clear();
32
+ }
33
+
34
+ addNotify(name: string, callback: (notify: BaseNotify) => void) {
35
+ this.notifyList.set(name, callback);
36
+ }
37
+
38
+ removeNotify(name: string) {
39
+ this.notifyList.delete(name);
40
+ }
41
+
42
+ private addNotifyListener(
43
+ callback: (event: BaseNotify) => void
44
+ ): EmitterSubscription {
45
+ const eventEmitter = new NativeEventEmitter(
46
+ NativeModules.ThetaClientReactNative
47
+ );
48
+ return eventEmitter.addListener('ThetaNotify', callback);
49
+ }
50
+ }
@@ -7,7 +7,11 @@ export * from './option-camera-control-source';
7
7
  export * from './option-camera-mode';
8
8
  export * from './option-capture-mode';
9
9
  export * from './option-continuous-number';
10
+ export * from './option-face-detect';
10
11
  export * from './option-filter';
12
+ export * from './option-function';
13
+ export * from './option-gain';
14
+ export * from './option-image-stitching';
11
15
  export * from './option-network-type';
12
16
  export * from './option-power-saving';
13
17
  export * from './option-preset';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Face detection
3
+ *
4
+ * For
5
+ * - RICOH THETA X
6
+ */
7
+ export const FaceDetectEnum = {
8
+ /** Face detection ON */
9
+ ON: 'ON',
10
+ /** Face detection OFF */
11
+ OFF: 'OFF',
12
+ } as const;
13
+
14
+ /** type definition of FaceDetectEnum */
15
+ export type FaceDetectEnum =
16
+ (typeof FaceDetectEnum)[keyof typeof FaceDetectEnum];
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Shooting function.
3
+ * Shooting settings are retained separately for both the Still image shooting mode and Video shooting mode.
4
+ * Setting them at the same time as exposureDelay will result in an error.
5
+ *
6
+ * For
7
+ * - RICOH THETA X
8
+ * - RICOH THETA Z1
9
+ */
10
+ export const ShootingFunctionEnum = {
11
+ /** Normal shooting function */
12
+ NORMAL: 'NORMAL',
13
+ /** Self-timer shooting function(RICOH THETA X is not supported.) */
14
+ SELF_TIMER: 'SELF_TIMER',
15
+ /** My setting shooting function */
16
+ MY_SETTING: 'MY_SETTING',
17
+ } as const;
18
+
19
+ /** type definition of ShootingFunctionEnum */
20
+ export type ShootingFunctionEnum =
21
+ (typeof ShootingFunctionEnum)[keyof typeof ShootingFunctionEnum];
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Microphone gain.
3
+ *
4
+ * For
5
+ * - RICOH THETA X
6
+ * - RICOH THETA Z1
7
+ * - RICOH THETA V
8
+ */
9
+ export const GainEnum = {
10
+ /** Normal mode */
11
+ NORMAL: 'NORMAL',
12
+ /** Loud volume mode */
13
+ MEGA_VOLUME: 'MEGA_VOLUME',
14
+ /** Mute mode (RICOH THETA V firmware v2.50.1 or later, RICOH THETA X is not supported.) */
15
+ MUTE: 'MUTE',
16
+ } as const;
17
+
18
+ /** type definition of GainEnum */
19
+ export type GainEnum = (typeof GainEnum)[keyof typeof GainEnum];
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Still image stitching setting during shooting.
3
+ *
4
+ * For Theta X, Z1 and V.
5
+ **/
6
+
7
+ export const ImageStitchingEnum = {
8
+ /** Refer to stitching when shooting with "auto" */
9
+ AUTO: 'AUTO',
10
+ /** Performs static stitching */
11
+ STATIC: 'STATIC',
12
+ /** Performs dynamic stitching(RICOH THETA X or later) */
13
+ DYNAMIC: 'DYNAMIC',
14
+ /** For Normal shooting, performs dynamic stitching,
15
+ * for Interval shooting, saves dynamic distortion correction parameters for the first image
16
+ * and then uses them for the 2nd and subsequent images(RICOH THETA X is not supported) */
17
+ DYNAMIC_AUTO: 'DYNAMIC_AUTO',
18
+ /** Performs semi-dynamic stitching
19
+ * Saves dynamic distortion correction parameters for the first image
20
+ * and then uses them for the 2nd and subsequent images(RICOH THETA X or later) */
21
+ DYNAMIC_SEMI_AUTO: 'DYNAMIC_SEMI_AUTO',
22
+ /** Performs dynamic stitching and then saves distortion correction parameters */
23
+ DYNAMIC_SAVE: 'DYNAMIC_SAVE',
24
+ /** Performs stitching using the saved distortion correction parameters */
25
+ DYNAMIC_LOAD: 'DYNAMIC_LOAD',
26
+ /** Does not perform stitching */
27
+ NONE: 'NONE',
28
+ } as const;
29
+
30
+ /** Type definition of ImageStitchingEnum */
31
+ export type ImageStitchingEnum =
32
+ (typeof ImageStitchingEnum)[keyof typeof ImageStitchingEnum];
@@ -6,7 +6,11 @@ import type { CameraControlSourceEnum } from './option-camera-control-source';
6
6
  import type { CameraModeEnum } from './option-camera-mode';
7
7
  import type { CaptureModeEnum } from './option-capture-mode';
8
8
  import type { ContinuousNumberEnum } from './option-continuous-number';
9
+ import type { FaceDetectEnum } from './option-face-detect';
9
10
  import type { FilterEnum } from './option-filter';
11
+ import type { ShootingFunctionEnum } from './option-function';
12
+ import type { GainEnum } from './option-gain';
13
+ import type { ImageStitchingEnum } from './option-image-stitching';
10
14
  import type { NetworkTypeEnum } from './option-network-type';
11
15
  import type { PowerSavingEnum } from './option-power-saving';
12
16
  import type { PresetEnum } from './option-preset';
@@ -477,12 +481,20 @@ export const OptionNameEnum = {
477
481
  ExposureDelay: 'ExposureDelay',
478
482
  /** exposureProgram */
479
483
  ExposureProgram: 'ExposureProgram',
484
+ /** _faceDetect */
485
+ FaceDetect: 'FaceDetect',
480
486
  /** fileFormat */
481
487
  FileFormat: 'FileFormat',
482
488
  /** filter */
483
489
  Filter: 'Filter',
490
+ /** _function */
491
+ Function: 'Function',
492
+ /** _gain */
493
+ Gain: 'Gain',
484
494
  /** gpsInfo */
485
495
  GpsInfo: 'GpsInfo',
496
+ /** imageStitching */
497
+ ImageStitching: 'ImageStitching',
486
498
  /** isGpsOn */
487
499
  IsGpsOn: 'IsGpsOn',
488
500
  /** iso */
@@ -630,12 +642,20 @@ export type Options = {
630
642
  exposureDelay?: ExposureDelayEnum;
631
643
  /** Exposure program. The exposure settings that take priority can be selected. */
632
644
  exposureProgram?: ExposureProgramEnum;
645
+ /** Face detection */
646
+ faceDetect?: FaceDetectEnum;
633
647
  /** Image format used in shooting. */
634
648
  fileFormat?: PhotoFileFormatEnum | VideoFileFormatEnum;
635
649
  /** Image processing filter. */
636
650
  filter?: FilterEnum;
651
+ /** Shooting function. */
652
+ function?: ShootingFunctionEnum;
653
+ /** Microphone gain. */
654
+ gain?: GainEnum;
637
655
  /** GPS location information. */
638
656
  gpsInfo?: GpsInfo;
657
+ /** Still image stitching setting during shooting. */
658
+ imageStitching?: ImageStitchingEnum;
639
659
  /** Turns position information assigning ON/OFF. */
640
660
  isGpsOn?: boolean;
641
661
  /** ISO sensitivity */
@@ -19,6 +19,7 @@ import {
19
19
  } from '../capture';
20
20
  import type { ThetaConfig } from './theta-config';
21
21
  import type { ThetaTimeout } from './theta-timeout';
22
+ import { NotifyController } from './notify-controller';
22
23
  const ThetaClientReactNative = NativeModules.ThetaClientReactNative;
23
24
 
24
25
  /**
@@ -35,6 +36,8 @@ export function initialize(
35
36
  config?: ThetaConfig,
36
37
  timeout?: ThetaTimeout
37
38
  ): Promise<boolean> {
39
+ NotifyController.instance.init();
40
+
38
41
  return ThetaClientReactNative.initialize(endPoint, config, timeout);
39
42
  }
40
43
 
@@ -66,7 +69,6 @@ export function reset(): Promise<boolean> {
66
69
  * @return created PhotoCaptureBuilder
67
70
  */
68
71
  export function getPhotoCaptureBuilder(): PhotoCaptureBuilder {
69
- ThetaClientReactNative.getPhotoCaptureBuilder();
70
72
  return new PhotoCaptureBuilder();
71
73
  }
72
74
 
@@ -77,7 +79,6 @@ export function getPhotoCaptureBuilder(): PhotoCaptureBuilder {
77
79
  * @return created TimeShiftCaptureBuilder
78
80
  */
79
81
  export function getTimeShiftCaptureBuilder(): TimeShiftCaptureBuilder {
80
- ThetaClientReactNative.getTimeShiftCaptureBuilder();
81
82
  return new TimeShiftCaptureBuilder();
82
83
  }
83
84
 
@@ -88,7 +89,6 @@ export function getTimeShiftCaptureBuilder(): TimeShiftCaptureBuilder {
88
89
  * @return created VideoCaptureBuilder instance
89
90
  */
90
91
  export function getVideoCaptureBuilder(): VideoCaptureBuilder {
91
- ThetaClientReactNative.getVideoCaptureBuilder();
92
92
  return new VideoCaptureBuilder();
93
93
  }
94
94
 
@@ -1,3 +1,5 @@
1
+ import type { ShootingFunctionEnum } from './options/option-function';
2
+
1
3
  /** Battery charging state constants */
2
4
  export const ChargingStateEnum = {
3
5
  /** Charging */
@@ -36,20 +38,6 @@ export const CaptureStatusEnum = {
36
38
  export type CaptureStatusEnum =
37
39
  (typeof CaptureStatusEnum)[keyof typeof CaptureStatusEnum];
38
40
 
39
- /** Shooting function status constants */
40
- export const ShootingFunctionEnum = {
41
- /** normal */
42
- NORMAL: 'NORMAL',
43
- /** selfTimer */
44
- SELF_TIMER: 'SELF_TIMER',
45
- /** mySetting */
46
- MY_SETTING: 'MY_SETTING',
47
- } as const;
48
-
49
- /** type definition of ShootingFunctionEnum */
50
- export type ShootingFunctionEnum =
51
- (typeof ShootingFunctionEnum)[keyof typeof ShootingFunctionEnum];
52
-
53
41
  /** Microphone option constants */
54
42
  export const MicrophoneOptionEnum = {
55
43
  /** auto */
@@ -14,10 +14,10 @@ Pod::Spec.new do |s|
14
14
  s.platforms = { :ios => "15.0" }
15
15
  s.source = { :git => "git@github.com:ricohapi/theta-client.git", :tag => "#{s.version}" }
16
16
 
17
- s.source_files = "ios/**/*.{h,m,mm}"
17
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
 
19
19
  s.dependency "React-Core"
20
- s.dependency "THETAClient", "1.3.1"
20
+ s.dependency "THETAClient", "1.4.0"
21
21
 
22
22
  # Don't install the dependencies when we run `pod install` in the old architecture.
23
23
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
@@ -1,34 +0,0 @@
1
-
2
- #ifdef RCT_NEW_ARCH_ENABLED
3
- #import "RNThetaClientReactNativeSpec.h"
4
- #import <React/RCTEventEmitter.h>
5
-
6
- @interface ThetaClientReactNative : RCTEventEmitter <NativeThetaClientReactNativeSpec>
7
- #else
8
- #import <React/RCTBridgeModule.h>
9
- #import <React/RCTEventEmitter.h>
10
-
11
- @interface ThetaClientReactNative : RCTEventEmitter <RCTBridgeModule>
12
- #endif
13
-
14
- /** theta repository instance */
15
- @property(nonatomic, strong) THETACThetaRepository *theta;
16
- /** photoCapture builder instance */
17
- @property(nonatomic, strong) THETACPhotoCaptureBuilder *photoCaptureBuilder;
18
- /** photoCapture instance */
19
- @property(nonatomic, strong) THETACPhotoCapture *photoCapture;
20
- /** timeShiftCapture builder instance */
21
- @property(nonatomic, strong) THETACTimeShiftCaptureBuilder *timeShiftCaptureBuilder;
22
- /** timeShiftCapture instance */
23
- @property(nonatomic, strong) THETACTimeShiftCapture *timeShiftCapture;
24
- /** timeShiftCapturing instance */
25
- @property(nonatomic, strong) THETACTimeShiftCapturing *timeShiftCapturing;
26
- /** videoCapture builder instance */
27
- @property(nonatomic, strong) THETACVideoCaptureBuilder *videoCaptureBuilder;
28
- /** videoCapture instance */
29
- @property(nonatomic, strong) THETACVideoCapture *videoCapture;
30
- /** videoCapturing instance */
31
- @property(nonatomic, strong) THETACVideoCapturing *videoCapturing;
32
- /** previewing in progress flag */
33
- @property(nonatomic) BOOL previewing;
34
- @end