@cuby-ui/ar 0.0.12 → 0.0.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/README.md CHANGED
@@ -14,8 +14,12 @@ npx cap sync
14
14
  <docgen-index>
15
15
 
16
16
  * [`startAR()`](#startar)
17
- * [`logMessage(...)`](#logmessage)
18
- * [`addListener('click', ...)`](#addlistenerclick-)
17
+ * [`addOnScreenDebugMessage(...)`](#addonscreendebugmessage)
18
+ * [`addListener(string, ...)`](#addlistenerstring-)
19
+ * [`setFbxFolderPath(...)`](#setfbxfolderpath)
20
+ * [`getFbxFolderPath()`](#getfbxfolderpath)
21
+ * [`setJsonFile(...)`](#setjsonfile)
22
+ * [`getJsonFile()`](#getjsonfile)
19
23
  * [Interfaces](#interfaces)
20
24
 
21
25
  </docgen-index>
@@ -34,10 +38,10 @@ Launches the AR activity.
34
38
  --------------------
35
39
 
36
40
 
37
- ### logMessage(...)
41
+ ### addOnScreenDebugMessage(...)
38
42
 
39
43
  ```typescript
40
- logMessage(options: { message: string; duration?: number; }) => void
44
+ addOnScreenDebugMessage(options: { message: string; duration?: number; }) => void
41
45
  ```
42
46
 
43
47
  Sends a message to native code to be logged. Returns a small status
@@ -50,17 +54,17 @@ object on success.
50
54
  --------------------
51
55
 
52
56
 
53
- ### addListener('click', ...)
57
+ ### addListener(string, ...)
54
58
 
55
59
  ```typescript
56
- addListener(eventName: 'click', listenerFunc: (event: { data: string; }) => void) => PluginListenerHandle
60
+ addListener(eventName: string, listenerFunc: (event: { data: string; }) => void) => PluginListenerHandle
57
61
  ```
58
62
 
59
- Listens for click events from the native AR view.
63
+ Listens for events from the native AR activity.
60
64
 
61
65
  | Param | Type | Description |
62
66
  | ------------------ | -------------------------------------------------- | -------------------------------------------------------------------------------- |
63
- | **`eventName`** | <code>'click'</code> | The name of the event to listen for (should be 'click'). |
67
+ | **`eventName`** | <code>string</code> | The name of the event to listen for. |
64
68
  | **`listenerFunc`** | <code>(event: { data: string; }) =&gt; void</code> | The function to call when the event occurs, receiving an event object with data. |
65
69
 
66
70
  **Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
@@ -68,6 +72,66 @@ Listens for click events from the native AR view.
68
72
  --------------------
69
73
 
70
74
 
75
+ ### setFbxFolderPath(...)
76
+
77
+ ```typescript
78
+ setFbxFolderPath(options: { path: string; }) => string
79
+ ```
80
+
81
+ Sets the path to the FBX folder in native code.
82
+
83
+ | Param | Type | Description |
84
+ | ------------- | ------------------------------ | ------------------------------------- |
85
+ | **`options`** | <code>{ path: string; }</code> | An object containing the path string. |
86
+
87
+ **Returns:** <code>string</code>
88
+
89
+ --------------------
90
+
91
+
92
+ ### getFbxFolderPath()
93
+
94
+ ```typescript
95
+ getFbxFolderPath() => string
96
+ ```
97
+
98
+ Gets the current FBX folder path from native code.
99
+
100
+ **Returns:** <code>string</code>
101
+
102
+ --------------------
103
+
104
+
105
+ ### setJsonFile(...)
106
+
107
+ ```typescript
108
+ setJsonFile(options: { path: string; }) => string
109
+ ```
110
+
111
+ Sets the path to the JSON file in native code.
112
+
113
+ | Param | Type | Description |
114
+ | ------------- | ------------------------------ | ------------------------------------- |
115
+ | **`options`** | <code>{ path: string; }</code> | An object containing the path string. |
116
+
117
+ **Returns:** <code>string</code>
118
+
119
+ --------------------
120
+
121
+
122
+ ### getJsonFile()
123
+
124
+ ```typescript
125
+ getJsonFile() => string
126
+ ```
127
+
128
+ Gets the current JSON file path from native code.
129
+
130
+ **Returns:** <code>string</code>
131
+
132
+ --------------------
133
+
134
+
71
135
  ### Interfaces
72
136
 
73
137
 
@@ -63,6 +63,4 @@ dependencies {
63
63
  testImplementation "junit:junit:$junitVersion"
64
64
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
65
65
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
66
-
67
-
68
66
  }
Binary file
@@ -7,6 +7,7 @@ import android.app.Activity;
7
7
  import android.content.Intent;
8
8
  import android.util.Log;
9
9
  import com.cuby.cubyar.NativeLogger;
10
+ import com.cuby.cubyar.ModelData;
10
11
  import com.getcapacitor.PermissionState;
11
12
  import com.getcapacitor.Plugin;
12
13
  import com.getcapacitor.PluginCall;
@@ -110,7 +111,7 @@ public class NativeBridge extends Plugin {
110
111
  }
111
112
 
112
113
  try {
113
- NativeLogger.logMessage(message, (float) duration);
114
+ NativeLogger.addOnScreenDebugMessage(message, (float) duration);
114
115
  String data = NativeLogger.returnData();
115
116
  Log.i(LOG_TAG, "Native data: " + data);
116
117
  JSObject ret = new JSObject();
@@ -121,15 +122,75 @@ public class NativeBridge extends Plugin {
121
122
  }
122
123
  }
123
124
 
124
- public String getNativeData() {
125
+ @PluginMethod
126
+ public void setFbxFolderPath(PluginCall call) {
127
+ String path = call.getString("path");
128
+ if (path == null) {
129
+ call.reject("Missing 'path' parameter");
130
+ return;
131
+ }
132
+
125
133
  try {
126
- String data = NativeLogger.returnData();
134
+ ModelData.setFbxFolderPath(path);
135
+ JSObject ret = new JSObject();
136
+ ret.put("status", "fbxPathSet");
137
+ call.resolve(ret);
138
+ } catch (Exception e) {
139
+ call.reject("Failed to set FBX folder path", e);
140
+ }
141
+ }
142
+
143
+ @PluginMethod
144
+ public void getFbxFolderPath(PluginCall call) {
145
+ try {
146
+ String path = ModelData.getFbxFolderPath();
147
+ JSObject ret = new JSObject();
148
+ ret.put("fbxPath", path);
149
+ call.resolve(ret);
150
+ } catch (Exception e) {
151
+ call.reject("Failed to get FBX folder path", e);
152
+ }
153
+ }
154
+
155
+ @PluginMethod
156
+ public void setJsonFile(PluginCall call) {
157
+ String path = call.getString("path");
158
+ if (path == null) {
159
+ call.reject("Missing 'path' parameter");
160
+ return;
161
+ }
162
+
163
+ try {
164
+ ModelData.setJsonFile(path);
127
165
  JSObject ret = new JSObject();
128
- ret.put("data", data);
129
- notifyListeners("click", ret);
166
+ ret.put("status", "jsonFileSet");
167
+ call.resolve(ret);
130
168
  } catch (Exception e) {
131
- // call.reject("Failed to get native data", e);
169
+ call.reject("Failed to set JSON file path", e);
132
170
  }
133
- return "";
134
171
  }
135
- }
172
+
173
+ @PluginMethod
174
+ public void getJsonFile(PluginCall call) {
175
+ try {
176
+ String path = ModelData.getJsonFile();
177
+ JSObject ret = new JSObject();
178
+ ret.put("jsonPath", path);
179
+ call.resolve(ret);
180
+ } catch (Exception e) {
181
+ call.reject("Failed to get JSON file path", e);
182
+ }
183
+ }
184
+
185
+ // public String getNativeData() {
186
+ // try {
187
+ // String data = NativeLogger.returnData();
188
+ // JSObject ret = new JSObject();
189
+ // ret.put("data", data);
190
+ // notifyListeners("click", ret);
191
+ // } catch (Exception e) {
192
+ // // call.reject("Failed to get native data", e);
193
+ // }
194
+ // return "";
195
+ // }
196
+ }
package/dist/docs.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "slug": "startar"
17
17
  },
18
18
  {
19
- "name": "logMessage",
19
+ "name": "addOnScreenDebugMessage",
20
20
  "signature": "(options: { message: string; duration?: number; }) => void",
21
21
  "parameters": [
22
22
  {
@@ -34,16 +34,16 @@
34
34
  ],
35
35
  "docs": "Sends a message to native code to be logged. Returns a small status\nobject on success.",
36
36
  "complexTypes": [],
37
- "slug": "logmessage"
37
+ "slug": "addonscreendebugmessage"
38
38
  },
39
39
  {
40
40
  "name": "addListener",
41
- "signature": "(eventName: 'click', listenerFunc: (event: { data: string; }) => void) => PluginListenerHandle",
41
+ "signature": "(eventName: string, listenerFunc: (event: { data: string; }) => void) => PluginListenerHandle",
42
42
  "parameters": [
43
43
  {
44
44
  "name": "eventName",
45
- "docs": "The name of the event to listen for (should be 'click').",
46
- "type": "'click'"
45
+ "docs": "The name of the event to listen for.",
46
+ "type": "string"
47
47
  },
48
48
  {
49
49
  "name": "listenerFunc",
@@ -55,7 +55,7 @@
55
55
  "tags": [
56
56
  {
57
57
  "name": "param",
58
- "text": "eventName The name of the event to listen for (should be 'click')."
58
+ "text": "eventName The name of the event to listen for."
59
59
  },
60
60
  {
61
61
  "name": "param",
@@ -66,11 +66,83 @@
66
66
  "text": "A handle to remove the listener when no longer needed."
67
67
  }
68
68
  ],
69
- "docs": "Listens for click events from the native AR view.",
69
+ "docs": "Listens for events from the native AR activity.",
70
70
  "complexTypes": [
71
71
  "PluginListenerHandle"
72
72
  ],
73
- "slug": "addlistenerclick-"
73
+ "slug": "addlistenerstring-"
74
+ },
75
+ {
76
+ "name": "setFbxFolderPath",
77
+ "signature": "(options: { path: string; }) => string",
78
+ "parameters": [
79
+ {
80
+ "name": "options",
81
+ "docs": "An object containing the path string.",
82
+ "type": "{ path: string; }"
83
+ }
84
+ ],
85
+ "returns": "string",
86
+ "tags": [
87
+ {
88
+ "name": "param",
89
+ "text": "options An object containing the path string."
90
+ }
91
+ ],
92
+ "docs": "Sets the path to the FBX folder in native code.",
93
+ "complexTypes": [],
94
+ "slug": "setfbxfolderpath"
95
+ },
96
+ {
97
+ "name": "getFbxFolderPath",
98
+ "signature": "() => string",
99
+ "parameters": [],
100
+ "returns": "string",
101
+ "tags": [
102
+ {
103
+ "name": "returns",
104
+ "text": "An object containing the path string."
105
+ }
106
+ ],
107
+ "docs": "Gets the current FBX folder path from native code.",
108
+ "complexTypes": [],
109
+ "slug": "getfbxfolderpath"
110
+ },
111
+ {
112
+ "name": "setJsonFile",
113
+ "signature": "(options: { path: string; }) => string",
114
+ "parameters": [
115
+ {
116
+ "name": "options",
117
+ "docs": "An object containing the path string.",
118
+ "type": "{ path: string; }"
119
+ }
120
+ ],
121
+ "returns": "string",
122
+ "tags": [
123
+ {
124
+ "name": "param",
125
+ "text": "options An object containing the path string."
126
+ }
127
+ ],
128
+ "docs": "Sets the path to the JSON file in native code.",
129
+ "complexTypes": [],
130
+ "slug": "setjsonfile"
131
+ },
132
+ {
133
+ "name": "getJsonFile",
134
+ "signature": "() => string",
135
+ "parameters": [],
136
+ "returns": "string",
137
+ "tags": [
138
+ {
139
+ "name": "returns",
140
+ "text": "An object containing the path string."
141
+ }
142
+ ],
143
+ "docs": "Gets the current JSON file path from native code.",
144
+ "complexTypes": [],
145
+ "slug": "getjsonfile"
74
146
  }
75
147
  ],
76
148
  "properties": []
@@ -9,17 +9,41 @@ export interface NativeBridgePlugin {
9
9
  * object on success.
10
10
  * @param options The message to log and optional duration in seconds (default is 5).
11
11
  */
12
- logMessage(options: {
12
+ addOnScreenDebugMessage(options: {
13
13
  message: string;
14
14
  duration?: number;
15
15
  }): void;
16
16
  /**
17
- * Listens for click events from the native AR view.
18
- * @param eventName The name of the event to listen for (should be 'click').
17
+ * Listens for events from the native AR activity.
18
+ * @param eventName The name of the event to listen for.
19
19
  * @param listenerFunc The function to call when the event occurs, receiving an event object with data.
20
20
  * @returns A handle to remove the listener when no longer needed.
21
21
  */
22
- addListener(eventName: 'click', listenerFunc: (event: {
22
+ addListener(eventName: string, listenerFunc: (event: {
23
23
  data: string;
24
24
  }) => void): PluginListenerHandle;
25
+ /**
26
+ * Sets the path to the FBX folder in native code.
27
+ * @param options An object containing the path string.
28
+ */
29
+ setFbxFolderPath(options: {
30
+ path: string;
31
+ }): string;
32
+ /**
33
+ * Gets the current FBX folder path from native code.
34
+ * @returns An object containing the path string.
35
+ */
36
+ getFbxFolderPath(): string;
37
+ /**
38
+ * Sets the path to the JSON file in native code.
39
+ * @param options An object containing the path string.
40
+ */
41
+ setJsonFile(options: {
42
+ path: string;
43
+ }): string;
44
+ /**
45
+ * Gets the current JSON file path from native code.
46
+ * @returns An object containing the path string.
47
+ */
48
+ getJsonFile(): string;
25
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { PluginListenerHandle } from '@capacitor/core';\n\nexport interface NativeBridgePlugin {\n /**\n * Launches the AR activity.\n */\n startAR(): void;\n\n /**\n * Sends a message to native code to be logged. Returns a small status\n * object on success.\n * @param options The message to log and optional duration in seconds (default is 5).\n */\n logMessage(options: { message: string; duration?: number; }): void;\n\n /**\n * Listens for click events from the native AR view.\n * @param eventName The name of the event to listen for (should be 'click').\n * @param listenerFunc The function to call when the event occurs, receiving an event object with data.\n * @returns A handle to remove the listener when no longer needed.\n */\n addListener(\n eventName: 'click',\n listenerFunc: (event: { data: string }) => void\n ): PluginListenerHandle;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { PluginListenerHandle } from '@capacitor/core';\n\nexport interface NativeBridgePlugin {\n /**\n * Launches the AR activity.\n */\n startAR(): void;\n\n /**\n * Sends a message to native code to be logged. Returns a small status\n * object on success.\n * @param options The message to log and optional duration in seconds (default is 5).\n */\n addOnScreenDebugMessage(options: { message: string; duration?: number; }): void;\n\n /**\n * Listens for events from the native AR activity.\n * @param eventName The name of the event to listen for.\n * @param listenerFunc The function to call when the event occurs, receiving an event object with data.\n * @returns A handle to remove the listener when no longer needed.\n */\n addListener(\n eventName: string,\n listenerFunc: (event: { data: string }) => void\n ): PluginListenerHandle;\n\n /**\n * Sets the path to the FBX folder in native code.\n * @param options An object containing the path string.\n */\n setFbxFolderPath(options: { path: string }): string;\n\n /**\n * Gets the current FBX folder path from native code.\n * @returns An object containing the path string.\n */\n getFbxFolderPath(): string;\n\n /**\n * Sets the path to the JSON file in native code.\n * @param options An object containing the path string.\n */\n setJsonFile(options: { path: string }): string;\n\n /**\n * Gets the current JSON file path from native code.\n * @returns An object containing the path string.\n */\n getJsonFile(): string;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuby-ui/ar",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Ar/Vr plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,19 +0,0 @@
1
- package com.google.vr.sdk.samples.permission;
2
-
3
- import android.app.Activity;
4
-
5
- public class PermissionHelper {
6
- public static boolean hasPermissions(Activity activity) {
7
- return true;
8
- }
9
-
10
- public static void requestPermissions(Activity activity) {
11
- }
12
-
13
- public static boolean checkPermission(String permission) {
14
- return true;
15
- }
16
-
17
- public static void acquirePermissions(String[] permissions) {
18
- }
19
- }