@cuby-ui/ar 0.0.13 → 0.0.16

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
+ * [`setJsonData(...)`](#setjsondata)
22
+ * [`getJsonData()`](#getjsondata)
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
+ ### setJsonData(...)
106
+
107
+ ```typescript
108
+ setJsonData(options: { data: string; }) => string
109
+ ```
110
+
111
+ Sets the path to the JSON data in native code.
112
+
113
+ | Param | Type | Description |
114
+ | ------------- | ------------------------------ | ------------------------------------- |
115
+ | **`options`** | <code>{ data: string; }</code> | An object containing the path string. |
116
+
117
+ **Returns:** <code>string</code>
118
+
119
+ --------------------
120
+
121
+
122
+ ### getJsonData()
123
+
124
+ ```typescript
125
+ getJsonData() => string
126
+ ```
127
+
128
+ Gets the current JSON data 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,9 +111,7 @@ public class NativeBridge extends Plugin {
110
111
  }
111
112
 
112
113
  try {
113
- NativeLogger.logMessage(message, (float) duration);
114
- String data = NativeLogger.returnData();
115
- Log.i(LOG_TAG, "Native data: " + data);
114
+ NativeLogger.addOnScreenDebugMessage(message, (float) duration);
116
115
  JSObject ret = new JSObject();
117
116
  ret.put("status", "logged");
118
117
  call.resolve(ret);
@@ -121,15 +120,75 @@ public class NativeBridge extends Plugin {
121
120
  }
122
121
  }
123
122
 
124
- public String getNativeData() {
123
+ @PluginMethod
124
+ public void setFbxFolderPath(PluginCall call) {
125
+ String path = call.getString("path");
126
+ if (path == null) {
127
+ call.reject("Missing 'path' parameter");
128
+ return;
129
+ }
130
+
125
131
  try {
126
- String data = NativeLogger.returnData();
132
+ ModelData.setFbxFolderPath(path);
127
133
  JSObject ret = new JSObject();
128
- ret.put("data", data);
129
- notifyListeners("click", ret);
134
+ ret.put("status", "fbxPathSet");
135
+ call.resolve(ret);
130
136
  } catch (Exception e) {
131
- // call.reject("Failed to get native data", e);
137
+ call.reject("Failed to set FBX folder path", e);
132
138
  }
133
- return "";
134
139
  }
135
- }
140
+
141
+ @PluginMethod
142
+ public void getFbxFolderPath(PluginCall call) {
143
+ try {
144
+ String path = ModelData.getFbxFolderPath();
145
+ JSObject ret = new JSObject();
146
+ ret.put("fbxPath", path);
147
+ call.resolve(ret);
148
+ } catch (Exception e) {
149
+ call.reject("Failed to get FBX folder path", e);
150
+ }
151
+ }
152
+
153
+ @PluginMethod
154
+ public void setJsonFile(PluginCall call) {
155
+ String path = call.getString("path");
156
+ if (path == null) {
157
+ call.reject("Missing 'path' parameter");
158
+ return;
159
+ }
160
+
161
+ try {
162
+ ModelData.setJsonFile(path);
163
+ JSObject ret = new JSObject();
164
+ ret.put("status", "jsonFileSet");
165
+ call.resolve(ret);
166
+ } catch (Exception e) {
167
+ call.reject("Failed to set JSON file path", e);
168
+ }
169
+ }
170
+
171
+ @PluginMethod
172
+ public void getJsonFile(PluginCall call) {
173
+ try {
174
+ String path = ModelData.getJsonFile();
175
+ JSObject ret = new JSObject();
176
+ ret.put("jsonPath", path);
177
+ call.resolve(ret);
178
+ } catch (Exception e) {
179
+ call.reject("Failed to get JSON file path", e);
180
+ }
181
+ }
182
+
183
+ // public String getNativeData() {
184
+ // try {
185
+ // String data = NativeLogger.returnData();
186
+ // JSObject ret = new JSObject();
187
+ // ret.put("data", data);
188
+ // notifyListeners("click", ret);
189
+ // } catch (Exception e) {
190
+ // // call.reject("Failed to get native data", e);
191
+ // }
192
+ // return "";
193
+ // }
194
+ }
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": "setJsonData",
113
+ "signature": "(options: { data: string; }) => string",
114
+ "parameters": [
115
+ {
116
+ "name": "options",
117
+ "docs": "An object containing the path string.",
118
+ "type": "{ data: 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 data in native code.",
129
+ "complexTypes": [],
130
+ "slug": "setjsondata"
131
+ },
132
+ {
133
+ "name": "getJsonData",
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 data path from native code.",
144
+ "complexTypes": [],
145
+ "slug": "getjsondata"
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 data in native code.
39
+ * @param options An object containing the path string.
40
+ */
41
+ setJsonData(options: {
42
+ data: string;
43
+ }): string;
44
+ /**
45
+ * Gets the current JSON data path from native code.
46
+ * @returns An object containing the path string.
47
+ */
48
+ getJsonData(): 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 data in native code.\n * @param options An object containing the path string.\n */\n setJsonData(options: { data: string }): string;\n\n /**\n * Gets the current JSON data path from native code.\n * @returns An object containing the path string.\n */\n getJsonData(): string;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuby-ui/ar",
3
- "version": "0.0.13",
3
+ "version": "0.0.16",
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
- }