react-native-acoustic-connect-beta 18.0.10 → 18.0.12
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/Examples/SampleUI/ConnectConfig.json +180 -0
- package/Examples/SampleUI/android/app/build.gradle +2 -0
- package/Examples/SampleUI/android/app/src/main/AndroidManifest.xml +18 -13
- package/Examples/SampleUI/android/app/src/main/java/com/sampleui/MainActivity.kt +47 -5
- package/Examples/SampleUI/ios/SampleUI.xcodeproj/xcshareddata/xcschemes/SampleUI.xcscheme +17 -0
- package/Examples/SampleUI/metro.config.js +2 -1
- package/Examples/SampleUI/package.json +3 -2
- package/Examples/SampleUI/src/RootNavigator.tsx +10 -1
- package/README.md +4 -0
- package/android/config.gradle +1 -1
- package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
- package/android/src/main/java/com/acousticconnectrn/AcousticConnectRNPackage.java +32 -3
- package/android/src/main/java/com/acousticconnectrn/HybridAcousticConnectRN.kt +116 -6
- package/ios/HybridAcousticConnectRN.swift +2 -44
- package/lib/commonjs/components/Connect.js +98 -0
- package/lib/commonjs/components/Connect.js.map +1 -0
- package/lib/commonjs/index.js +10 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/Connect.js +91 -0
- package/lib/module/components/Connect.js.map +1 -0
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/components/Connect.d.ts +17 -0
- package/lib/typescript/src/components/Connect.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts.map +1 -1
- package/package.json +2 -1
- package/scripts/ConnectConfig.json +1 -1
- package/scripts/gradleParser.js +4 -1
- package/scripts/javaParser.js +104 -68
- package/scripts/postInstallScripts.sh +3 -3
- package/scripts/xmlparser.js +7 -5
- package/src/components/Connect.tsx +110 -0
- package/src/index.ts +3 -3
- package/src/specs/react-native-acoustic-connect.nitro.ts +1 -15
- package/Examples/SampleUI/package-lock.json +0 -17033
- package/android/src/main/java/com/acousticconnectrn/AcousticConnectRNImpl.kt +0 -106
- package/ios/AcousticConnectRNImpl.swift +0 -64
- package/jslib/components/Connect.js +0 -85
- package/lib/commonjs/types.js +0 -24
- package/lib/commonjs/types.js.map +0 -1
- package/lib/module/types.js +0 -24
- package/lib/module/types.js.map +0 -1
- package/lib/typescript/jslib/components/Connect.d.ts +0 -4
- package/lib/typescript/jslib/components/Connect.d.ts.map +0 -1
- package/lib/typescript/src/types.d.ts +0 -1
- package/lib/typescript/src/types.d.ts.map +0 -1
- package/src/types.ts +0 -23
|
@@ -20,9 +20,6 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
20
20
|
|
|
21
21
|
// Constructor
|
|
22
22
|
override init() {
|
|
23
|
-
// Initialize properties
|
|
24
|
-
self.nitrogenAcousticConnectRNImpl = AcousticConnectRNImpl()
|
|
25
|
-
|
|
26
23
|
// Call the superclass initializer
|
|
27
24
|
super.init()
|
|
28
25
|
|
|
@@ -394,47 +391,8 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
394
391
|
}
|
|
395
392
|
}
|
|
396
393
|
|
|
397
|
-
private var nitrogenAcousticConnectRNImpl = AcousticConnectRNImpl()
|
|
398
|
-
// private var networkInfoStatusListener: ((AcousticConnectStatusInfoRNBeta) -> Void)? = nil
|
|
399
|
-
|
|
400
|
-
// var isConnected: Bool {
|
|
401
|
-
// get { nitrogenNetworkInfoImpl.getIsConnected() }
|
|
402
|
-
// }
|
|
403
|
-
|
|
404
|
-
// var connectionType: ConnectionType {
|
|
405
|
-
// get { nitrogenNetworkInfoImpl.getConnectionType() }
|
|
406
|
-
// }
|
|
407
|
-
|
|
408
|
-
// func addListener(listener: @escaping (AcousticConnectStatusInfoRNBeta) -> Void) throws -> () -> Void {
|
|
409
|
-
// networkInfoStatusListener = listener
|
|
410
|
-
//
|
|
411
|
-
// DispatchQueue.main.async { [unowned self] in
|
|
412
|
-
// self.networkInfoStatusListener?(
|
|
413
|
-
// AcousticConnectStatusInfoRNBeta(
|
|
414
|
-
// isConnected: isConnected,
|
|
415
|
-
// connectionType: connectionType
|
|
416
|
-
// )
|
|
417
|
-
// )
|
|
418
|
-
//
|
|
419
|
-
// self.nitrogenNetworkInfoImpl.delegate = self
|
|
420
|
-
// }
|
|
421
|
-
//
|
|
422
|
-
// return { [weak self] in
|
|
423
|
-
// self?.networkInfoStatusListener = nil
|
|
424
|
-
// }
|
|
425
|
-
// }
|
|
426
|
-
|
|
427
394
|
deinit {
|
|
428
|
-
|
|
395
|
+
// Perform any necessary cleanup here
|
|
396
|
+
print("HybridAcousticConnectRN deinitialized")
|
|
429
397
|
}
|
|
430
|
-
|
|
431
|
-
// public func add(ss: Double, b: Double) throws -> Double {
|
|
432
|
-
// return ss + b
|
|
433
|
-
// }
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
extension HybridAcousticConnectRN: AcousticConnectRNDelegate {
|
|
437
|
-
// func acousticConnectRNDidChange(_ acousticConnectRN: AcousticConnectStatusInfoRNBeta) {
|
|
438
|
-
// self.networkInfoStatusListener?(acousticConnectRN)
|
|
439
|
-
// }
|
|
440
398
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
/********************************************************************************************
|
|
12
|
+
* Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
15
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
16
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
17
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
18
|
+
* prohibited.
|
|
19
|
+
********************************************************************************************/
|
|
20
|
+
|
|
21
|
+
// Use type-only import for LayoutChangeEvent
|
|
22
|
+
// import TLTRN from '../TLTRN';
|
|
23
|
+
|
|
24
|
+
const Connect = ({
|
|
25
|
+
children,
|
|
26
|
+
captureKeyboardEvents
|
|
27
|
+
}) => {
|
|
28
|
+
const navigation = children.ref; // Type assertion for children with ref
|
|
29
|
+
const currentRoute = (0, _react.useRef)(undefined);
|
|
30
|
+
const initial = (0, _react.useRef)(false);
|
|
31
|
+
(0, _react.useEffect)(() => {
|
|
32
|
+
// TLTRN.interceptKeyboardEvents(captureKeyboardEvents);
|
|
33
|
+
}, [captureKeyboardEvents]);
|
|
34
|
+
(0, _react.useEffect)(() => {
|
|
35
|
+
if (!navigation || typeof navigation.current.addListener !== "function" || typeof navigation.current.getCurrentRoute !== "function") {
|
|
36
|
+
console.warn("Connect: The Connect component's first child must be a NavigationContainer with a ref.");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const unsubscribe = navigation.current.addListener("state", () => {
|
|
40
|
+
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
41
|
+
console.log("State change - ", currentRoute.current);
|
|
42
|
+
if (_reactNative.Platform.OS === "ios" && currentRoute && currentRoute.current) {
|
|
43
|
+
// TLTRN.setCurrentScreenName(currentRoute.current);
|
|
44
|
+
} else if (_reactNative.Platform.OS === "android") {
|
|
45
|
+
// TLTRN.setCurrentScreenName(currentRoute.current);
|
|
46
|
+
// TLTRN.logScreenLayout(currentRoute.current);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return unsubscribe;
|
|
50
|
+
}, [navigation]);
|
|
51
|
+
const onStartShouldSetResponderCapture = (0, _react.useCallback)(event => {
|
|
52
|
+
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
53
|
+
if (currentRoute && currentRoute.current) {
|
|
54
|
+
// TLTRN.setCurrentScreenName(currentRoute.current);
|
|
55
|
+
}
|
|
56
|
+
// Log the click event
|
|
57
|
+
console.log("event - ", event.nativeEvent);
|
|
58
|
+
// TLTRN.logClickEvent(event);
|
|
59
|
+
return false; // Must be false; true means this component becomes the touch responder and events don't bubble
|
|
60
|
+
}, []);
|
|
61
|
+
const onLayout = (0, _react.useCallback)(event => {
|
|
62
|
+
if (initial.current) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
initial.current = true;
|
|
66
|
+
console.log("event - ", event.nativeEvent);
|
|
67
|
+
currentRoute.current = navigation.current.getCurrentRoute()?.name;
|
|
68
|
+
if (_reactNative.Platform.OS === "ios" && currentRoute && currentRoute.current) {
|
|
69
|
+
// TLTRN.setCurrentScreenName(currentRoute.current);
|
|
70
|
+
} else if (_reactNative.Platform.OS === "android") {
|
|
71
|
+
// TLTRN.logScreenLayout(currentRoute.current);
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
}, [navigation]);
|
|
75
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
76
|
+
style: styles.connect_main,
|
|
77
|
+
onLayout: onLayout,
|
|
78
|
+
onStartShouldSetResponderCapture: onStartShouldSetResponderCapture,
|
|
79
|
+
children: children
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
function extractName(navigation) {
|
|
83
|
+
const routeParams = navigation.current.getCurrentRoute()?.params;
|
|
84
|
+
if (routeParams) {
|
|
85
|
+
const {
|
|
86
|
+
name
|
|
87
|
+
} = routeParams;
|
|
88
|
+
return name || "";
|
|
89
|
+
}
|
|
90
|
+
return "";
|
|
91
|
+
}
|
|
92
|
+
var _default = exports.default = Connect;
|
|
93
|
+
const styles = _reactNative.StyleSheet.create({
|
|
94
|
+
connect_main: {
|
|
95
|
+
flex: 1
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=Connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Connect","children","captureKeyboardEvents","navigation","ref","currentRoute","useRef","undefined","initial","useEffect","current","addListener","getCurrentRoute","console","warn","unsubscribe","extractName","name","log","Platform","OS","onStartShouldSetResponderCapture","useCallback","event","nativeEvent","onLayout","jsx","View","style","styles","connect_main","routeParams","params","_default","exports","StyleSheet","create","flex"],"sourceRoot":"../../../src","sources":["components/Connect.tsx"],"mappings":";;;;;;AASA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAyF,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,u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eAAe,CAAC,CAAC,EAAEK,IAAI;IACjE,IAAIE,qBAAQ,CAACC,EAAE,KAAK,KAAK,IAAIf,YAAY,IAAIA,YAAY,CAACK,OAAO,EAAE;MAC/D;IAAA,CACH,MAAM,IAAIS,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;MAClC;IAAA;IAEJ,OAAO,IAAI;EACf,CAAC,EAAE,CAACjB,UAAU,CAAC,CAAC;EAEhB,oBACI,IAAAvB,WAAA,CAAA8C,GAAA,EAAC/C,YAAA,CAAAgD,IAAI;IACDC,KAAK,EAAEC,MAAM,CAACC,YAAa;IAC3BL,QAAQ,EAAEA,QAAS;IACnBJ,gCAAgC,EAAEA,gCAAiC;IAAApB,QAAA,EAElEA;EAAQ,CACP,CAAC;AAEf,CAAC;AAED,SAASe,WAAWA,CAACb,UAAe,EAAU;EAC1C,MAAM4B,WAAW,GAAG5B,UAAU,CAACO,OAAO,CAACE,eAAe,CAAC,CAAC,EAAEoB,MAAM;EAChE,IAAID,WAAW,EAAE;IACb,MAAM;MAAEd;IAAK,CAAC,GAAGc,WAAW;IAC5B,OAAOd,IAAI,IAAI,EAAE;EACrB;EACA,OAAO,EAAE;AACb;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAA3C,OAAA,GAEcS,OAAO;AAEtB,MAAM6B,MAAM,GAAGM,uBAAU,CAACC,MAAM,CAAC;EAC7BN,YAAY,EAAE;IACVO,IAAI,EAAE;EACV;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "Connect", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Connect.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
exports.default = void 0;
|
|
7
13
|
var _reactNativeNitroModules = require("react-native-nitro-modules");
|
|
14
|
+
var _Connect = _interopRequireDefault(require("./components/Connect"));
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
16
|
/********************************************************************************************
|
|
9
17
|
* Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
10
18
|
*
|
|
@@ -18,8 +26,9 @@ var _reactNativeNitroModules = require("react-native-nitro-modules");
|
|
|
18
26
|
*
|
|
19
27
|
********************************************************************************************/
|
|
20
28
|
|
|
21
|
-
//
|
|
29
|
+
// Import Connect.tsx
|
|
22
30
|
|
|
23
31
|
const AcousticConnectRN = _reactNativeNitroModules.NitroModules.createHybridObject('AcousticConnectRN');
|
|
32
|
+
// Export Connect.tsx
|
|
24
33
|
var _default = exports.default = AcousticConnectRN;
|
|
25
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeNitroModules","require","AcousticConnectRN","NitroModules","createHybridObject","_default","exports"
|
|
1
|
+
{"version":3,"names":["_reactNativeNitroModules","require","_Connect","_interopRequireDefault","e","__esModule","default","AcousticConnectRN","NitroModules","createHybridObject","_default","exports"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;AAaA,IAAAA,wBAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA0C,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAf1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAI2C;;AAE3C,MAAMG,iBAAiB,GAAGC,qCAAY,CAACC,kBAAkB,CAAwB,mBAAmB,CAAC;AAElF;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAL,OAAA,GACJC,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/********************************************************************************************
|
|
4
|
+
* Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
7
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
8
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
9
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
10
|
+
* prohibited.
|
|
11
|
+
********************************************************************************************/
|
|
12
|
+
import React, { useCallback, useEffect, useRef } from "react";
|
|
13
|
+
import { View, StyleSheet, Platform } from "react-native";
|
|
14
|
+
// Use type-only import for LayoutChangeEvent
|
|
15
|
+
// import TLTRN from '../TLTRN';
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
const Connect = ({
|
|
18
|
+
children,
|
|
19
|
+
captureKeyboardEvents
|
|
20
|
+
}) => {
|
|
21
|
+
const navigation = children.ref; // Type assertion for children with ref
|
|
22
|
+
const currentRoute = useRef(undefined);
|
|
23
|
+
const initial = useRef(false);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
// TLTRN.interceptKeyboardEvents(captureKeyboardEvents);
|
|
26
|
+
}, [captureKeyboardEvents]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!navigation || typeof navigation.current.addListener !== "function" || typeof navigation.current.getCurrentRoute !== "function") {
|
|
29
|
+
console.warn("Connect: The Connect component's first child must be a NavigationContainer with a ref.");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const unsubscribe = navigation.current.addListener("state", () => {
|
|
33
|
+
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
34
|
+
console.log("State change - ", currentRoute.current);
|
|
35
|
+
if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
|
|
36
|
+
// TLTRN.setCurrentScreenName(currentRoute.current);
|
|
37
|
+
} else if (Platform.OS === "android") {
|
|
38
|
+
// TLTRN.setCurrentScreenName(currentRoute.current);
|
|
39
|
+
// TLTRN.logScreenLayout(currentRoute.current);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return unsubscribe;
|
|
43
|
+
}, [navigation]);
|
|
44
|
+
const onStartShouldSetResponderCapture = useCallback(event => {
|
|
45
|
+
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
46
|
+
if (currentRoute && currentRoute.current) {
|
|
47
|
+
// TLTRN.setCurrentScreenName(currentRoute.current);
|
|
48
|
+
}
|
|
49
|
+
// Log the click event
|
|
50
|
+
console.log("event - ", event.nativeEvent);
|
|
51
|
+
// TLTRN.logClickEvent(event);
|
|
52
|
+
return false; // Must be false; true means this component becomes the touch responder and events don't bubble
|
|
53
|
+
}, []);
|
|
54
|
+
const onLayout = useCallback(event => {
|
|
55
|
+
if (initial.current) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
initial.current = true;
|
|
59
|
+
console.log("event - ", event.nativeEvent);
|
|
60
|
+
currentRoute.current = navigation.current.getCurrentRoute()?.name;
|
|
61
|
+
if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
|
|
62
|
+
// TLTRN.setCurrentScreenName(currentRoute.current);
|
|
63
|
+
} else if (Platform.OS === "android") {
|
|
64
|
+
// TLTRN.logScreenLayout(currentRoute.current);
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}, [navigation]);
|
|
68
|
+
return /*#__PURE__*/_jsx(View, {
|
|
69
|
+
style: styles.connect_main,
|
|
70
|
+
onLayout: onLayout,
|
|
71
|
+
onStartShouldSetResponderCapture: onStartShouldSetResponderCapture,
|
|
72
|
+
children: children
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
function extractName(navigation) {
|
|
76
|
+
const routeParams = navigation.current.getCurrentRoute()?.params;
|
|
77
|
+
if (routeParams) {
|
|
78
|
+
const {
|
|
79
|
+
name
|
|
80
|
+
} = routeParams;
|
|
81
|
+
return name || "";
|
|
82
|
+
}
|
|
83
|
+
return "";
|
|
84
|
+
}
|
|
85
|
+
export default Connect;
|
|
86
|
+
const styles = StyleSheet.create({
|
|
87
|
+
connect_main: {
|
|
88
|
+
flex: 1
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=Connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useRef","View","StyleSheet","Platform","jsx","_jsx","Connect","children","captureKeyboardEvents","navigation","ref","currentRoute","undefined","initial","current","addListener","getCurrentRoute","console","warn","unsubscribe","extractName","name","log","OS","onStartShouldSetResponderCapture","event","nativeEvent","onLayout","style","styles","connect_main","routeParams","params","create","flex"],"sourceRoot":"../../../src","sources":["components/Connect.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC7D,SAASC,IAAI,EAAEC,UAAU,EAAEC,QAAQ,QAAuC,cAAc;AACjC;AACvD;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAOA,MAAMC,OAA+B,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAsB,CAAC,KAAK;EAC7E,MAAMC,UAAU,GAAIF,QAAQ,CAASG,GAAG,CAAC,CAAC;EAC1C,MAAMC,YAAY,GAAGX,MAAM,CAAqBY,SAAS,CAAC;EAC1D,MAAMC,OAAO,GAAGb,MAAM,CAAU,KAAK,CAAC;EAEtCD,SAAS,CAAC,MAAM;IACZ;EAAA,CACH,EAAE,CAACS,qBAAqB,CAAC,CAAC;EAE3BT,SAAS,CAAC,MAAM;IACZ,IACI,CAACU,UAAU,IACX,OAAOA,UAAU,CAACK,OAAO,CAACC,WAAW,KAAK,UAAU,IACpD,OAAON,UAAU,CAACK,OAAO,CAACE,eAAe,KAAK,UAAU,EAC1D;MACEC,OAAO,CAACC,IAAI,CACR,wFACJ,CAA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AAEK,IAAI;IACjE,IAAIlB,QAAQ,CAACoB,EAAE,KAAK,KAAK,IAAIZ,YAAY,IAAIA,YAAY,CAACG,OAAO,EAAE;MAC/D;IAAA,CACH,MAAM,IAAIX,QAAQ,CAACoB,EAAE,KAAK,SAAS,EAAE;MAClC;IAAA;IAEJ,OAAO,IAAI;EACf,CAAC,EAAE,CAACd,UAAU,CAAC,CAAC;EAEhB,oBACIJ,IAAA,CAACJ,IAAI;IACD2B,KAAK,EAAEC,MAAM,CAACC,YAAa;IAC3BH,QAAQ,EAAEA,QAAS;IACnBH,gCAAgC,EAAEA,gCAAiC;IAAAjB,QAAA,EAElEA;EAAQ,CACP,CAAC;AAEf,CAAC;AAED,SAASa,WAAWA,CAACX,UAAe,EAAU;EAC1C,MAAMsB,WAAW,GAAGtB,UAAU,CAACK,OAAO,CAACE,eAAe,CAAC,CAAC,EAAEgB,MAAM;EAChE,IAAID,WAAW,EAAE;IACb,MAAM;MAAEV;IAAK,CAAC,GAAGU,WAAW;IAC5B,OAAOV,IAAI,IAAI,EAAE;EACrB;EACA,OAAO,EAAE;AACb;AAEA,eAAef,OAAO;AAEtB,MAAMuB,MAAM,GAAG3B,UAAU,CAAC+B,MAAM,CAAC;EAC7BH,YAAY,EAAE;IACVI,IAAI,EAAE;EACV;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
********************************************************************************************/
|
|
15
15
|
|
|
16
16
|
import { NitroModules } from 'react-native-nitro-modules';
|
|
17
|
-
|
|
17
|
+
import Connect from './components/Connect'; // Import Connect.tsx
|
|
18
18
|
|
|
19
19
|
const AcousticConnectRN = NitroModules.createHybridObject('AcousticConnectRN');
|
|
20
|
+
export { Connect }; // Export Connect.tsx
|
|
20
21
|
export default AcousticConnectRN;
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NitroModules","AcousticConnectRN","createHybridObject"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,QAAQ,4BAA4B;AAEzD;;
|
|
1
|
+
{"version":3,"names":["NitroModules","Connect","AcousticConnectRN","createHybridObject"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,QAAQ,4BAA4B;AAEzD,OAAOC,OAAO,MAAM,sBAAsB,EAAC;;AAE3C,MAAMC,iBAAiB,GAAGF,YAAY,CAACG,kBAAkB,CAAwB,mBAAmB,CAAC;AAErG,SAASF,OAAO,GAAE,CAAC;AACnB,eAAeC,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/********************************************************************************************
|
|
2
|
+
* Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
********************************************************************************************/
|
|
10
|
+
import React from "react";
|
|
11
|
+
interface ConnectProps {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
captureKeyboardEvents: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const Connect: React.FC<ConnectProps>;
|
|
16
|
+
export default Connect;
|
|
17
|
+
//# sourceMappingURL=Connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Connect.d.ts","sourceRoot":"","sources":["../../../../src/components/Connect.tsx"],"names":[],"mappings":"AAAA;;;;;;;;6FAQ6F;AAC7F,OAAO,KAAyC,MAAM,OAAO,CAAC;AAK9D,UAAU,YAAY;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;CAClC;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAyEnC,CAAC;AAWF,eAAe,OAAO,CAAC"}
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
*
|
|
12
12
|
********************************************************************************************/
|
|
13
13
|
import type { AcousticConnectRN as AcousticConnectRNSpec } from './specs/react-native-acoustic-connect.nitro';
|
|
14
|
+
import Connect from './components/Connect';
|
|
14
15
|
declare const AcousticConnectRN: AcousticConnectRNSpec;
|
|
16
|
+
export { Connect };
|
|
15
17
|
export default AcousticConnectRN;
|
|
16
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;6FAW6F;AAG7F,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;6FAW6F;AAG7F,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAC7G,OAAO,OAAO,MAAM,sBAAsB,CAAA;AAE1C,QAAA,MAAM,iBAAiB,uBAA8E,CAAA;AAErG,OAAO,EAAE,OAAO,EAAE,CAAA;AAClB,eAAe,iBAAiB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native-acoustic-connect.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/react-native-acoustic-connect.nitro.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B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|
15
15
|
"@types/react": "^19.0.10",
|
|
16
16
|
"jetifier": "^1.6.3",
|
|
17
17
|
"nitro-codegen": "0.25.2",
|
|
18
|
+
"prettier-plugin-kotlin": "^2.1.0",
|
|
18
19
|
"react": "19.0.0",
|
|
19
20
|
"react-native": "0.78.0",
|
|
20
21
|
"react-native-builder-bob": "^0.37.0",
|
|
@@ -192,7 +193,7 @@
|
|
|
192
193
|
"source": "src/index",
|
|
193
194
|
"summary": "react-native ios android tealeaf connect cxa wxca er enhanced-replay",
|
|
194
195
|
"types": "./lib/typescript/src/index.d.ts",
|
|
195
|
-
"version": "18.0.
|
|
196
|
+
"version": "18.0.12",
|
|
196
197
|
"workspaces": [
|
|
197
198
|
"example"
|
|
198
199
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Connect": {
|
|
3
|
-
"AndroidVersion": "10.4.
|
|
3
|
+
"AndroidVersion": "10.4.37",
|
|
4
4
|
"AppKey": "b6c3709b7a4c479bb4b5a9fb8fec324c",
|
|
5
5
|
"KillSwitchUrl": "https://lib-us-2.brilliantcollector.com/collector/switch/b6c3709b7a4c479bb4b5a9fb8fec324c",
|
|
6
6
|
"PostMessageUrl": "https://lib-us-2.brilliantcollector.com/collector/collectorPost",
|
package/scripts/gradleParser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************************
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
5
|
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
@@ -27,6 +27,9 @@ let gradleData = '';
|
|
|
27
27
|
try {
|
|
28
28
|
const filePath = `${directoryPath}/android/app/build.gradle`
|
|
29
29
|
gradleData = fs.readFileSync(filePath, 'utf8');
|
|
30
|
+
console.log("Read: " + filePath);
|
|
31
|
+
console.log(gradleData);
|
|
32
|
+
// Check if the gradle file already contains the acoustic connect code
|
|
30
33
|
const re = new RegExp(/react-native-acoustic-connect-beta/, "g");
|
|
31
34
|
const found = re.test(gradleData);
|
|
32
35
|
if(!found){
|
package/scripts/javaParser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************************
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
5
|
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
@@ -78,70 +78,106 @@ if (packageName == null) {
|
|
|
78
78
|
exit(0);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
//
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
//
|
|
147
|
-
|
|
81
|
+
const upperJavaPath = packageName.replace(/\./g, "/");
|
|
82
|
+
const mainActivityPathBase = `${directoryPath}/android/app/src/main/java/${upperJavaPath}/MainActivity.`;
|
|
83
|
+
const mainActivityPathJava = `${mainActivityPathBase}java`;
|
|
84
|
+
const mainActivityPathKotlin = `${mainActivityPathBase}kt`;
|
|
85
|
+
const useJava = fs.existsSync(mainActivityPathJava)
|
|
86
|
+
const mainActivityPath = useJava ? mainActivityPathJava : mainActivityPathKotlin;
|
|
87
|
+
const mainActivityFile = readFile(mainActivityPath);
|
|
88
|
+
|
|
89
|
+
const semiColonCode = useJava ? ";" : "";
|
|
90
|
+
const upperCode = `package ${packageName}${semiColonCode}`;
|
|
91
|
+
const importCode1 = `${upperCode}\nimport android.view.MotionEvent${semiColonCode}`;
|
|
92
|
+
const importCode2 = `${upperCode}\nimport com.acoustic.connect.android.connectmod.Connect${semiColonCode}`;
|
|
93
|
+
|
|
94
|
+
const javaCode1 = `public boolean dispatchTouchEvent(MotionEvent e) {
|
|
95
|
+
Connect.INSTANCE.dispatchTouchEvent(this, e);
|
|
96
|
+
return super.dispatchTouchEvent(e);
|
|
97
|
+
}`;
|
|
98
|
+
const javaCode2 = `Connect.INSTANCE.dispatchTouchEvent(this, e);
|
|
99
|
+
return super.dispatchTouchEvent(e);`;
|
|
100
|
+
|
|
101
|
+
const kotlinCode1 = `\noverride fun dispatchTouchEvent(e: MotionEvent?): Boolean {
|
|
102
|
+
Connect.dispatchTouchEvent(this, e)
|
|
103
|
+
return super.dispatchTouchEvent(e)
|
|
104
|
+
}`;
|
|
105
|
+
const kotlinCode2 = `Connect.dispatchTouchEvent(this, e)
|
|
106
|
+
return super.dispatchTouchEvent(e)`;
|
|
107
|
+
|
|
108
|
+
const code1 = useJava ? javaCode1 : kotlinCode1;
|
|
109
|
+
const code2 = useJava ? javaCode2 : kotlinCode2;
|
|
110
|
+
// Determine if we are using Java or Kotlin
|
|
111
|
+
const prettierPluginKotlin = require("prettier-plugin-kotlin");
|
|
112
|
+
|
|
113
|
+
// Determine the parser based on whether the file is Java or Kotlin
|
|
114
|
+
const parser = useJava ? "java" : "kotlin";
|
|
115
|
+
const plugins = useJava ? [javaPaserPlugin] : [prettierPluginKotlin];
|
|
116
|
+
|
|
117
|
+
// Format the MainActivity file and setup to update file
|
|
118
|
+
var updateMainActivityData = prettier.format(mainActivityFile, {
|
|
119
|
+
parser: parser,
|
|
120
|
+
plugins: plugins,
|
|
121
|
+
tabWidth: 4,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
let updateMainActivity = false;
|
|
125
|
+
|
|
126
|
+
console.log("useJava: " + useJava);
|
|
127
|
+
console.log("parser: " + parser);
|
|
128
|
+
|
|
129
|
+
// Look for import
|
|
130
|
+
const regExImport1 = new RegExp("import android.view.MotionEvent", "g");
|
|
131
|
+
if(!regExImport1.test(updateMainActivityData)){
|
|
132
|
+
updateMainActivity = true;
|
|
133
|
+
updateMainActivityData = updateMainActivityData.replace(upperCode,importCode1);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const regExImport2 = new RegExp("import com.acoustic.connect.android.connectmod.Connect", "g");
|
|
137
|
+
if(!regExImport2.test(updateMainActivityData)){
|
|
138
|
+
updateMainActivity = true;
|
|
139
|
+
updateMainActivityData = updateMainActivityData.replace(upperCode,importCode2);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Look for dispatchTouchEvent method
|
|
143
|
+
const regExDispatchTouchEvent = new RegExp(/oolean dispatchTouchEvent/, "g");
|
|
144
|
+
if (!regExDispatchTouchEvent.test(updateMainActivityData)) {
|
|
145
|
+
updateMainActivity = true;
|
|
146
|
+
// Add dispatchTouchEvent method with library call
|
|
147
|
+
updateMainActivityData = updateMainActivityData.slice(0, updateMainActivityData.lastIndexOf("}"));
|
|
148
|
+
updateMainActivityData = `${updateMainActivityData.substring(0, updateMainActivityData.length)}${code1} }`;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Check if our call has been added in dispatchTouchEvent
|
|
152
|
+
const regExConnectDispatchTouchEvent = useJava ? new RegExp(/Connect.INSTANCE.dispatchTouchEvent/, "g") : new RegExp(/Connect.dispatchTouchEvent/, "g");
|
|
153
|
+
if (!regExConnectDispatchTouchEvent.test(updateMainActivityData)) {
|
|
154
|
+
updateMainActivity = true;
|
|
155
|
+
// Add Connect.INSTANCE.dispatchTouchEvent
|
|
156
|
+
updateMainActivityData = updateMainActivityData.replace(/return super.dispatchTouchEvent\(e\);/, code2);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Update activity
|
|
160
|
+
if (updateMainActivity) {
|
|
161
|
+
// // Format the MainActivity file and setup to update file
|
|
162
|
+
updateMainActivityData = prettier.format(updateMainActivityData, {
|
|
163
|
+
parser: parser,
|
|
164
|
+
plugins: plugins,
|
|
165
|
+
tabWidth: 4,
|
|
166
|
+
useTabs: false,
|
|
167
|
+
kotlinPlugin: {
|
|
168
|
+
alignMultilineComments: true
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
console.log("File to be saved:\n" + updateMainActivityData);
|
|
173
|
+
|
|
174
|
+
try {
|
|
175
|
+
fs.writeFileSync(mainActivityPath, updateMainActivityData);
|
|
176
|
+
console.log("Updated:" + mainActivityPath);
|
|
177
|
+
} catch (err) {
|
|
178
|
+
console.log("Error writing:" + mainActivityPath);
|
|
179
|
+
console.error(err);
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
console.log("Update not needed for:" + mainActivityPath);
|
|
183
|
+
}
|
|
@@ -4,8 +4,8 @@ echo "Current directory:"
|
|
|
4
4
|
pwd
|
|
5
5
|
echo "Running Node scripts..."
|
|
6
6
|
node ./scripts/reviewConnectConfig.js
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
node ./scripts/javaParser.js
|
|
8
|
+
node ./scripts/xmlParser.js
|
|
9
|
+
node ./scripts/gradleParser.js
|
|
10
10
|
echo "*********************************************************************************************"
|
|
11
11
|
echo "Running here scripts..."
|