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.
Files changed (49) hide show
  1. package/Examples/SampleUI/ConnectConfig.json +180 -0
  2. package/Examples/SampleUI/android/app/build.gradle +2 -0
  3. package/Examples/SampleUI/android/app/src/main/AndroidManifest.xml +18 -13
  4. package/Examples/SampleUI/android/app/src/main/java/com/sampleui/MainActivity.kt +47 -5
  5. package/Examples/SampleUI/ios/SampleUI.xcodeproj/xcshareddata/xcschemes/SampleUI.xcscheme +17 -0
  6. package/Examples/SampleUI/metro.config.js +2 -1
  7. package/Examples/SampleUI/package.json +3 -2
  8. package/Examples/SampleUI/src/RootNavigator.tsx +10 -1
  9. package/README.md +4 -0
  10. package/android/config.gradle +1 -1
  11. package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
  12. package/android/src/main/java/com/acousticconnectrn/AcousticConnectRNPackage.java +32 -3
  13. package/android/src/main/java/com/acousticconnectrn/HybridAcousticConnectRN.kt +116 -6
  14. package/ios/HybridAcousticConnectRN.swift +2 -44
  15. package/lib/commonjs/components/Connect.js +98 -0
  16. package/lib/commonjs/components/Connect.js.map +1 -0
  17. package/lib/commonjs/index.js +10 -1
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/module/components/Connect.js +91 -0
  20. package/lib/module/components/Connect.js.map +1 -0
  21. package/lib/module/index.js +2 -1
  22. package/lib/module/index.js.map +1 -1
  23. package/lib/typescript/src/components/Connect.d.ts +17 -0
  24. package/lib/typescript/src/components/Connect.d.ts.map +1 -0
  25. package/lib/typescript/src/index.d.ts +2 -0
  26. package/lib/typescript/src/index.d.ts.map +1 -1
  27. package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts.map +1 -1
  28. package/package.json +2 -1
  29. package/scripts/ConnectConfig.json +1 -1
  30. package/scripts/gradleParser.js +4 -1
  31. package/scripts/javaParser.js +104 -68
  32. package/scripts/postInstallScripts.sh +3 -3
  33. package/scripts/xmlparser.js +7 -5
  34. package/src/components/Connect.tsx +110 -0
  35. package/src/index.ts +3 -3
  36. package/src/specs/react-native-acoustic-connect.nitro.ts +1 -15
  37. package/Examples/SampleUI/package-lock.json +0 -17033
  38. package/android/src/main/java/com/acousticconnectrn/AcousticConnectRNImpl.kt +0 -106
  39. package/ios/AcousticConnectRNImpl.swift +0 -64
  40. package/jslib/components/Connect.js +0 -85
  41. package/lib/commonjs/types.js +0 -24
  42. package/lib/commonjs/types.js.map +0 -1
  43. package/lib/module/types.js +0 -24
  44. package/lib/module/types.js.map +0 -1
  45. package/lib/typescript/jslib/components/Connect.d.ts +0 -4
  46. package/lib/typescript/jslib/components/Connect.d.ts.map +0 -1
  47. package/lib/typescript/src/types.d.ts +0 -1
  48. package/lib/typescript/src/types.d.ts.map +0 -1
  49. package/src/types.ts +0 -23
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************************
2
- * Copyright (C) 2024 Acoustic, L.P. All rights reserved.
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
@@ -42,10 +42,14 @@ try {
42
42
  count = 0
43
43
  permssions.forEach(permssion =>{
44
44
  if (!result.includes(permssion)){
45
- build = build + `<uses-permission android:name="${permssion}"/>\n`
45
+ build = build + ` <uses-permission android:name="${permssion}"/>\n`
46
46
  count++
47
47
  }
48
48
  })
49
+
50
+ if (count > 0) {
51
+ build = build.replace(/\n$/, "");
52
+ }
49
53
 
50
54
  result = result.replace(">" , build)
51
55
 
@@ -55,12 +59,10 @@ try {
55
59
  tabWidth: 2,
56
60
  });
57
61
 
58
-
59
62
  if( count > 0){
60
63
  fs.writeFileSync(filePath, result);
61
64
  }
62
-
63
-
65
+ console.log("Updated AndroidManifest.xml with permissions:", result);
64
66
  } catch (err) {
65
67
  console.error(err);
66
68
  }
@@ -0,0 +1,110 @@
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, { useCallback, useEffect, useRef } from "react";
11
+ import { View, StyleSheet, Platform, NativeModules, findNodeHandle } from "react-native";
12
+ import type { LayoutChangeEvent } from "react-native"; // Use type-only import for LayoutChangeEvent
13
+ // import TLTRN from '../TLTRN';
14
+
15
+ interface ConnectProps {
16
+ children: React.ReactNode;
17
+ captureKeyboardEvents: boolean;
18
+ }
19
+
20
+ const Connect: React.FC<ConnectProps> = ({ children, captureKeyboardEvents }) => {
21
+ const navigation = (children as any).ref; // Type assertion for children with ref
22
+ const currentRoute = useRef<string | undefined>(undefined);
23
+ const initial = useRef<boolean>(false);
24
+
25
+ useEffect(() => {
26
+ // TLTRN.interceptKeyboardEvents(captureKeyboardEvents);
27
+ }, [captureKeyboardEvents]);
28
+
29
+ useEffect(() => {
30
+ if (
31
+ !navigation ||
32
+ typeof navigation.current.addListener !== "function" ||
33
+ typeof navigation.current.getCurrentRoute !== "function"
34
+ ) {
35
+ console.warn(
36
+ "Connect: The Connect component's first child must be a NavigationContainer with a ref."
37
+ );
38
+ return;
39
+ }
40
+
41
+ const unsubscribe = navigation.current.addListener("state", () => {
42
+ currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
43
+ console.log("State change - ", currentRoute.current);
44
+
45
+ if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
46
+ // TLTRN.setCurrentScreenName(currentRoute.current);
47
+ } else if (Platform.OS === "android") {
48
+ // TLTRN.setCurrentScreenName(currentRoute.current);
49
+ // TLTRN.logScreenLayout(currentRoute.current);
50
+ }
51
+ });
52
+
53
+ return unsubscribe;
54
+ }, [navigation]);
55
+
56
+ const onStartShouldSetResponderCapture = useCallback((event: any) => {
57
+ currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
58
+ if (currentRoute && currentRoute.current) {
59
+ // TLTRN.setCurrentScreenName(currentRoute.current);
60
+ }
61
+ // Log the click event
62
+ console.log("event - ", event.nativeEvent);
63
+ // TLTRN.logClickEvent(event);
64
+ return false; // Must be false; true means this component becomes the touch responder and events don't bubble
65
+ }, []);
66
+
67
+ const onLayout = useCallback((event: LayoutChangeEvent) => {
68
+ if (initial.current) {
69
+ return false;
70
+ }
71
+ initial.current = true;
72
+
73
+ console.log("event - ", event.nativeEvent);
74
+
75
+ currentRoute.current = navigation.current.getCurrentRoute()?.name;
76
+ if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
77
+ // TLTRN.setCurrentScreenName(currentRoute.current);
78
+ } else if (Platform.OS === "android") {
79
+ // TLTRN.logScreenLayout(currentRoute.current);
80
+ }
81
+ return true
82
+ }, [navigation]);
83
+
84
+ return (
85
+ <View
86
+ style={styles.connect_main}
87
+ onLayout={onLayout}
88
+ onStartShouldSetResponderCapture={onStartShouldSetResponderCapture}
89
+ >
90
+ {children}
91
+ </View>
92
+ );
93
+ };
94
+
95
+ function extractName(navigation: any): string {
96
+ const routeParams = navigation.current.getCurrentRoute()?.params;
97
+ if (routeParams) {
98
+ const { name } = routeParams;
99
+ return name || "";
100
+ }
101
+ return "";
102
+ }
103
+
104
+ export default Connect;
105
+
106
+ const styles = StyleSheet.create({
107
+ connect_main: {
108
+ flex: 1,
109
+ },
110
+ });
package/src/index.ts CHANGED
@@ -13,9 +13,9 @@
13
13
 
14
14
  import { NitroModules } from 'react-native-nitro-modules'
15
15
  import type { AcousticConnectRN as AcousticConnectRNSpec } from './specs/react-native-acoustic-connect.nitro'
16
- // export type * from './types'
16
+ import Connect from './components/Connect' // Import Connect.tsx
17
17
 
18
- const AcousticConnectRN =
19
- NitroModules.createHybridObject<AcousticConnectRNSpec>('AcousticConnectRN')
18
+ const AcousticConnectRN = NitroModules.createHybridObject<AcousticConnectRNSpec>('AcousticConnectRN')
20
19
 
20
+ export { Connect } // Export Connect.tsx
21
21
  export default AcousticConnectRN
@@ -1,4 +1,4 @@
1
- // Copyright (C) 2024 Acoustic, L.P. All rights reserved.
1
+ // Copyright (C) 2025 Acoustic, L.P. All rights reserved.
2
2
  //
3
3
  // NOTICE: This file contains material that is confidential and proprietary to
4
4
  // Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
@@ -11,19 +11,6 @@
11
11
  //
12
12
 
13
13
  import { type HybridObject } from 'react-native-nitro-modules'
14
- // import { type HybridObject, type AnyMap } from 'react-native-nitro-modules'
15
- // import type { ConnectionType, NetworkInfoListener } from '../types'
16
-
17
- // // Define a custom type for the values parameter with limited recursion
18
- // export type KeyValueMap = {
19
- // placeholder: string; // Add a placeholder property to avoid the "empty struct" error
20
- // [key: string]: string | number | boolean | null | KeyValueMapLevel1;
21
- // };
22
-
23
- // // Define a second level to limit recursion
24
- // export type KeyValueMapLevel1 = {
25
- // [key: string]: string | number | boolean | null;
26
- // };
27
14
 
28
15
  // Define a named type for the anonymous object
29
16
  export type KeyValueObject = {
@@ -33,7 +20,6 @@ export type KeyValueObject = {
33
20
 
34
21
  export type ConnectMonitoringLevelType = 'Ignore' | 'CellularAndWiFi' | 'WiFi'
35
22
 
36
-
37
23
  export interface AcousticConnectRN extends HybridObject<{ ios: 'swift', android: 'kotlin' }> {
38
24
  setBooleanConfigItemForKey(key: string, value: boolean, moduleName: string): boolean
39
25
  setStringItemForKey(key: string, value: string, moduleName: string): boolean