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
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
// Copyright (C) 2024 Acoustic, L.P. All rights reserved.
|
|
2
|
-
//
|
|
3
|
-
// NOTICE: This file contains material that is confidential and proprietary to
|
|
4
|
-
// Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
5
|
-
// industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
6
|
-
// Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
7
|
-
// prohibited.
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// Created by Omar Hernandez on 5/9/25.
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
package com.acousticconnectrn
|
|
14
|
-
|
|
15
|
-
import android.content.Context
|
|
16
|
-
import android.os.Handler
|
|
17
|
-
import android.os.Looper
|
|
18
|
-
|
|
19
|
-
//import com.margelo.nitro.acousticconnectrn.ConnectionType
|
|
20
|
-
//import com.margelo.nitro.acousticconnectrn.AcousticConnectStatusInfoRNBeta
|
|
21
|
-
|
|
22
|
-
interface NetworkInfoDelegate {
|
|
23
|
-
// fun onNetworkInfoChanged(info: AcousticConnectStatusInfoRNBeta)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
class AcousticConnectRNImpl(val context: Context, val delegate: NetworkInfoDelegate? = null) {
|
|
27
|
-
// private val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
|
28
|
-
// private var networkCallback: ConnectivityManager.NetworkCallback? = null
|
|
29
|
-
private val mainHandler = Handler(Looper.getMainLooper())
|
|
30
|
-
|
|
31
|
-
// init {
|
|
32
|
-
//// registerNetworkCallback()
|
|
33
|
-
// }
|
|
34
|
-
|
|
35
|
-
// private fun registerNetworkCallback() {
|
|
36
|
-
// val request = NetworkRequest.Builder()
|
|
37
|
-
// .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
|
|
38
|
-
// .build()
|
|
39
|
-
//
|
|
40
|
-
// networkCallback = object : ConnectivityManager.NetworkCallback() {
|
|
41
|
-
// override fun onAvailable(network: Network) {
|
|
42
|
-
// Log.d(TAG, "Network is available")
|
|
43
|
-
// val ni = AcousticConnectStatusInfoRNBeta(
|
|
44
|
-
// isConnected = true,
|
|
45
|
-
// connectionType = getConnectionType()
|
|
46
|
-
// )
|
|
47
|
-
// mainHandler.post {
|
|
48
|
-
// delegate?.onNetworkInfoChanged(ni)
|
|
49
|
-
// }
|
|
50
|
-
// }
|
|
51
|
-
//
|
|
52
|
-
// override fun onLost(network: Network) {
|
|
53
|
-
// Log.d(TAG, "Network is lost")
|
|
54
|
-
// val ni = AcousticConnectStatusInfoRNBeta(
|
|
55
|
-
// isConnected = false,
|
|
56
|
-
// connectionType = ConnectionType.UNKNOWN
|
|
57
|
-
// )
|
|
58
|
-
// mainHandler.post {
|
|
59
|
-
// delegate?.onNetworkInfoChanged(ni)
|
|
60
|
-
// }
|
|
61
|
-
// }
|
|
62
|
-
// }
|
|
63
|
-
// networkCallback?.let {
|
|
64
|
-
// connectivityManager.registerNetworkCallback(request, it)
|
|
65
|
-
// }
|
|
66
|
-
//
|
|
67
|
-
// }
|
|
68
|
-
|
|
69
|
-
// fun getIsConnection(): Boolean {
|
|
70
|
-
// val network = connectivityManager.activeNetwork
|
|
71
|
-
// val capabilities = connectivityManager.getNetworkCapabilities(network)
|
|
72
|
-
// return capabilities?.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) == true
|
|
73
|
-
// }
|
|
74
|
-
|
|
75
|
-
// fun getConnectionType(): ConnectionType {
|
|
76
|
-
// val network = connectivityManager.activeNetwork
|
|
77
|
-
// val capabilities = connectivityManager.getNetworkCapabilities(network)
|
|
78
|
-
// val connectionType = when (true) {
|
|
79
|
-
// capabilities?.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> {
|
|
80
|
-
// ConnectionType.WIFI
|
|
81
|
-
// }
|
|
82
|
-
//
|
|
83
|
-
// capabilities?.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> {
|
|
84
|
-
// ConnectionType.CELLULAR
|
|
85
|
-
// }
|
|
86
|
-
//
|
|
87
|
-
// capabilities?.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) -> {
|
|
88
|
-
// ConnectionType.ETHERNET
|
|
89
|
-
// }
|
|
90
|
-
//
|
|
91
|
-
// else -> ConnectionType.UNKNOWN
|
|
92
|
-
// }
|
|
93
|
-
// return connectionType
|
|
94
|
-
// }
|
|
95
|
-
|
|
96
|
-
fun unregister() {
|
|
97
|
-
// networkCallback?.let {
|
|
98
|
-
// connectivityManager.unregisterNetworkCallback(it)
|
|
99
|
-
// }
|
|
100
|
-
// networkCallback = null
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
companion object {
|
|
104
|
-
const val TAG = "AcousticConnectRN"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// AcousticConnectRNImpl.swift
|
|
3
|
-
// AcousticConnectRN
|
|
4
|
-
//
|
|
5
|
-
// Created by Patrick Kabwe on 04/05/2025.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import Foundation
|
|
9
|
-
import Network
|
|
10
|
-
|
|
11
|
-
protocol AcousticConnectRNDelegate: AnyObject {
|
|
12
|
-
// func acousticConnectRNDidChange(_ acousticConnectRN: AcousticConnectStatusInfoRN)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
class AcousticConnectRNImpl {
|
|
16
|
-
// var nwPathMonitor = NWPathMonitor()
|
|
17
|
-
weak var delegate: AcousticConnectRNDelegate?
|
|
18
|
-
// var nwPath: NWPath?
|
|
19
|
-
// var isConnected: Bool = false {
|
|
20
|
-
// didSet {
|
|
21
|
-
// #if DEBUG
|
|
22
|
-
// print("isConnected: \(isConnected)")
|
|
23
|
-
// #endif
|
|
24
|
-
// }
|
|
25
|
-
// }
|
|
26
|
-
|
|
27
|
-
init() {
|
|
28
|
-
// nwPathMonitor.start(queue: .global(qos: .background))
|
|
29
|
-
// nwPathMonitor.pathUpdateHandler = { path in
|
|
30
|
-
// DispatchQueue.main.async { [weak self] in
|
|
31
|
-
// guard let self else { return }
|
|
32
|
-
// // let ni = AcousticConnectStatusInfoRN(
|
|
33
|
-
// // isConnected: path.status == .satisfied,
|
|
34
|
-
// // connectionType: self.getConnectionType()
|
|
35
|
-
// // )
|
|
36
|
-
// self.isConnected = path.status == .satisfied
|
|
37
|
-
// self.nwPath = path
|
|
38
|
-
// // self.delegate?.acousticConnectRNDidChange(ni)
|
|
39
|
-
// }
|
|
40
|
-
// }
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// func getIsConnected() -> Bool {
|
|
44
|
-
// return isConnected
|
|
45
|
-
// }
|
|
46
|
-
|
|
47
|
-
// func getConnectionType() -> ConnectionType {
|
|
48
|
-
// switch true {
|
|
49
|
-
// case nwPath?.usesInterfaceType(.cellular):
|
|
50
|
-
// return .cellular
|
|
51
|
-
// case nwPath?.usesInterfaceType(.wifi):
|
|
52
|
-
// return .wifi
|
|
53
|
-
// case nwPath?.usesInterfaceType(.wiredEthernet):
|
|
54
|
-
// return .ethernet
|
|
55
|
-
// default:
|
|
56
|
-
// return .unknown
|
|
57
|
-
// }
|
|
58
|
-
// }
|
|
59
|
-
|
|
60
|
-
func unregister() {
|
|
61
|
-
self.delegate = nil
|
|
62
|
-
// nwPathMonitor.cancel()
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/********************************************************************************************
|
|
2
|
-
* Copyright (C) 2024 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 TLTRN from '../TLTRN';
|
|
13
|
-
|
|
14
|
-
const Connect = (props) => {
|
|
15
|
-
const { children, captureKeyboardEvents } = props;
|
|
16
|
-
const navigation = children.ref;
|
|
17
|
-
const currentRoute = useRef();
|
|
18
|
-
const initial = useRef(false);
|
|
19
|
-
|
|
20
|
-
useEffect(() => { TLTRN.interceptKeyboardEvents(captureKeyboardEvents); }, [captureKeyboardEvents]);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if(!navigation || typeof navigation.current.addListener !== 'function' || typeof navigation.current.getCurrentRoute !== 'function'){
|
|
24
|
-
console.warn('Connect: The Connect components first child must be a NavigationContainer with a ref.');
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const unsubscribe = navigation.current.addListener('state', () => {
|
|
29
|
-
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute().name;
|
|
30
|
-
console.log('State change - ', currentRoute.current);
|
|
31
|
-
|
|
32
|
-
if (Platform.OS === 'ios' && currentRoute && currentRoute.current) {
|
|
33
|
-
TLTRN.setCurrentScreenName(currentRoute.current);
|
|
34
|
-
} else if (Platform.OS === 'android') {
|
|
35
|
-
TLTRN.setCurrentScreenName(currentRoute.current);
|
|
36
|
-
TLTRN.logScreenLayout(currentRoute.current);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
return unsubscribe;
|
|
41
|
-
}, [navigation]);
|
|
42
|
-
|
|
43
|
-
const onStartShouldSetResponderCapture = useCallback((event) => {
|
|
44
|
-
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute().name;
|
|
45
|
-
if (currentRoute && currentRoute.current) {
|
|
46
|
-
TLTRN.setCurrentScreenName(currentRoute.current);
|
|
47
|
-
}
|
|
48
|
-
TLTRN.logClickEvent(event);
|
|
49
|
-
return false; // Must be false; true means this component becomes the touch responder and events dont bubble
|
|
50
|
-
}, []);
|
|
51
|
-
|
|
52
|
-
const onLayout = useCallback(() => {
|
|
53
|
-
if(initial.current){ return false; }
|
|
54
|
-
initial.current = true;
|
|
55
|
-
|
|
56
|
-
currentRoute.current = navigation.current.getCurrentRoute().name;
|
|
57
|
-
if (Platform.OS === 'ios' && currentRoute && currentRoute.current) {
|
|
58
|
-
TLTRN.setCurrentScreenName(currentRoute.current);
|
|
59
|
-
} else if (Platform.OS === 'android') {
|
|
60
|
-
TLTRN.logScreenLayout(currentRoute.current);
|
|
61
|
-
}
|
|
62
|
-
}, [navigation]);
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<View style={styles.connect_main}
|
|
66
|
-
onLayout={onLayout}
|
|
67
|
-
onStartShouldSetResponderCapture={onStartShouldSetResponderCapture}>
|
|
68
|
-
{children}
|
|
69
|
-
</View>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
function extractName(navigation){
|
|
73
|
-
if(navigation.current.getCurrentRoute().params){
|
|
74
|
-
const { name } = navigation.current.getCurrentRoute().params
|
|
75
|
-
return name
|
|
76
|
-
}
|
|
77
|
-
return ""
|
|
78
|
-
}
|
|
79
|
-
export default Connect;
|
|
80
|
-
|
|
81
|
-
const styles = StyleSheet.create({
|
|
82
|
-
connect_main: {
|
|
83
|
-
flex: 1
|
|
84
|
-
}
|
|
85
|
-
})
|
package/lib/commonjs/types.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Copyright (C) 2024 Acoustic, L.P. All rights reserved.
|
|
2
|
-
//
|
|
3
|
-
// NOTICE: This file contains material that is confidential and proprietary to
|
|
4
|
-
// Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
5
|
-
// industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
6
|
-
// Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
7
|
-
// prohibited.
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// Created by Omar Hernandez on 5/9/25.
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
// export type ConnectionType = 'unknown' | 'ethernet' | 'wifi' | 'cellular'
|
|
14
|
-
|
|
15
|
-
// export type AcousticConnectStatusInfoRNBeta = {
|
|
16
|
-
// isConnected: boolean
|
|
17
|
-
// connectionType: ConnectionType
|
|
18
|
-
// }
|
|
19
|
-
|
|
20
|
-
// export type NetworkInfoListener = (networkInfo: AcousticConnectStatusInfoRNBeta) => void
|
|
21
|
-
|
|
22
|
-
// export type ConnectionType = 'Ignore' | 'CellularAndWiFi' | 'WiFi'
|
|
23
|
-
"use strict";
|
|
24
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAGA;;AAEA;AAAA","ignoreList":[]}
|
package/lib/module/types.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Copyright (C) 2024 Acoustic, L.P. All rights reserved.
|
|
2
|
-
//
|
|
3
|
-
// NOTICE: This file contains material that is confidential and proprietary to
|
|
4
|
-
// Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
5
|
-
// industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
6
|
-
// Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
7
|
-
// prohibited.
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// Created by Omar Hernandez on 5/9/25.
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
// export type ConnectionType = 'unknown' | 'ethernet' | 'wifi' | 'cellular'
|
|
14
|
-
|
|
15
|
-
// export type AcousticConnectStatusInfoRNBeta = {
|
|
16
|
-
// isConnected: boolean
|
|
17
|
-
// connectionType: ConnectionType
|
|
18
|
-
// }
|
|
19
|
-
|
|
20
|
-
// export type NetworkInfoListener = (networkInfo: AcousticConnectStatusInfoRNBeta) => void
|
|
21
|
-
|
|
22
|
-
// export type ConnectionType = 'Ignore' | 'CellularAndWiFi' | 'WiFi'
|
|
23
|
-
"use strict";
|
|
24
|
-
//# sourceMappingURL=types.js.map
|
package/lib/module/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAGA;;AAEA;AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Connect.d.ts","sourceRoot":"","sources":["../../../../jslib/components/Connect.js"],"names":[],"mappings":";AAaA,wDAyDC;kBA7DmD,OAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":""}
|
package/src/types.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Copyright (C) 2024 Acoustic, L.P. All rights reserved.
|
|
2
|
-
//
|
|
3
|
-
// NOTICE: This file contains material that is confidential and proprietary to
|
|
4
|
-
// Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
5
|
-
// industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
6
|
-
// Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
7
|
-
// prohibited.
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// Created by Omar Hernandez on 5/9/25.
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
// export type ConnectionType = 'unknown' | 'ethernet' | 'wifi' | 'cellular'
|
|
14
|
-
|
|
15
|
-
// export type AcousticConnectStatusInfoRNBeta = {
|
|
16
|
-
// isConnected: boolean
|
|
17
|
-
// connectionType: ConnectionType
|
|
18
|
-
// }
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// export type NetworkInfoListener = (networkInfo: AcousticConnectStatusInfoRNBeta) => void
|
|
22
|
-
|
|
23
|
-
// export type ConnectionType = 'Ignore' | 'CellularAndWiFi' | 'WiFi'
|