react-native-acoustic-connect-beta 18.0.10 → 18.0.11
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/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/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/android/src/main/java/com/acousticconnectrn/AcousticConnectRNImpl.kt +0 -106
- package/ios/AcousticConnectRNImpl.swift +0 -64
package/android/config.gradle
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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (C)
|
|
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
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
package com.acousticconnectrn;
|
|
14
14
|
|
|
15
|
+
import android.os.Handler;
|
|
16
|
+
import android.os.Looper;
|
|
15
17
|
import android.util.Log;
|
|
16
18
|
import androidx.annotation.Nullable;
|
|
17
19
|
import androidx.annotation.NonNull;
|
|
@@ -20,11 +22,10 @@ import com.facebook.react.bridge.NativeModule;
|
|
|
20
22
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
21
23
|
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
22
24
|
import com.facebook.react.TurboReactPackage;
|
|
23
|
-
import com.margelo.nitro.
|
|
25
|
+
import com.margelo.nitro.NitroModules;
|
|
24
26
|
import com.margelo.nitro.acousticconnectrn.AcousticConnectRNOnLoad;
|
|
25
27
|
|
|
26
28
|
import java.util.HashMap;
|
|
27
|
-
import java.util.function.Supplier;
|
|
28
29
|
|
|
29
30
|
public class AcousticConnectRNPackage extends TurboReactPackage {
|
|
30
31
|
@Nullable
|
|
@@ -41,5 +42,33 @@ public class AcousticConnectRNPackage extends TurboReactPackage {
|
|
|
41
42
|
|
|
42
43
|
static {
|
|
43
44
|
AcousticConnectRNOnLoad.initializeNative();
|
|
45
|
+
try {
|
|
46
|
+
// Start a background thread to wait for the context
|
|
47
|
+
new Thread(() -> {
|
|
48
|
+
ReactApplicationContext reactContext = null;
|
|
49
|
+
|
|
50
|
+
// Poll until NitroModules.getApplicationContext() is not null
|
|
51
|
+
while (reactContext == null) {
|
|
52
|
+
reactContext = NitroModules.getApplicationContext();
|
|
53
|
+
if (reactContext == null) {
|
|
54
|
+
try {
|
|
55
|
+
Thread.sleep(100); // Sleep for 100ms before checking again
|
|
56
|
+
} catch (InterruptedException e) {
|
|
57
|
+
Log.e("AcousticConnectRNPackage", "Thread interrupted while waiting for ReactApplicationContext.", e);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Post initialization logic to the main (UI) thread
|
|
64
|
+
ReactApplicationContext finalReactContext = reactContext;
|
|
65
|
+
new Handler(Looper.getMainLooper()).post(() -> {
|
|
66
|
+
HybridAcousticConnectRN hybridInstance = new HybridAcousticConnectRN(finalReactContext);
|
|
67
|
+
Log.i("AcousticConnectRNPackage", "HybridAcousticConnectRN initialized successfully.");
|
|
68
|
+
});
|
|
69
|
+
}).start();
|
|
70
|
+
} catch (Exception e) {
|
|
71
|
+
Log.e("AcousticConnectRNPackage", "Failed to initialize HybridAcousticConnectRN.", e);
|
|
72
|
+
}
|
|
44
73
|
}
|
|
45
74
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (C)
|
|
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
|
|
@@ -12,9 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
package com.acousticconnectrn
|
|
14
14
|
|
|
15
|
-
//import com.margelo.nitro.acousticconnectrn.Variant_String_Double_Boolean_KeyValueObject
|
|
16
15
|
import android.app.Activity
|
|
16
|
+
import android.app.Application
|
|
17
17
|
import android.content.Context
|
|
18
|
+
import android.os.Handler
|
|
19
|
+
import android.os.Looper
|
|
18
20
|
import android.text.TextUtils
|
|
19
21
|
import android.view.View
|
|
20
22
|
import android.view.View.OnFocusChangeListener
|
|
@@ -26,13 +28,19 @@ import com.acoustic.connect.android.connectmod.Connect.TLF_ON_FOCUS_CHANGE_IN
|
|
|
26
28
|
import com.acoustic.connect.android.connectmod.Connect.TLF_ON_FOCUS_CHANGE_OUT
|
|
27
29
|
import com.acoustic.connect.android.connectmod.Connect.TLF_UI_KEYBOARD_DID_HIDE_NOTIFICATION
|
|
28
30
|
import com.acoustic.connect.android.connectmod.Connect.TLF_UI_KEYBOARD_DID_SHOW_NOTIFICATION
|
|
31
|
+
import com.acoustic.connect.android.connectmod.Connect.enable
|
|
32
|
+
import com.acoustic.connect.android.connectmod.Connect.getApplication
|
|
33
|
+
import com.acoustic.connect.android.connectmod.Connect.init
|
|
34
|
+
import com.acoustic.connect.android.connectmod.Connect.isEnabled
|
|
29
35
|
import com.acoustic.connect.android.connectmod.Connect.logEvent
|
|
30
36
|
import com.acoustic.connect.android.connectmod.Connect.logGeolocation
|
|
31
37
|
import com.acoustic.connect.android.connectmod.Connect.logLocationUpdateEventWithLatitude
|
|
32
38
|
import com.acoustic.connect.android.connectmod.Connect.logScreenLayout
|
|
33
39
|
import com.acoustic.connect.android.connectmod.Connect.logScreenview
|
|
40
|
+
import com.acoustic.connect.android.connectmod.Connect.onResume
|
|
34
41
|
import com.acoustic.connect.android.connectmod.Connect.registerFormField
|
|
35
42
|
import com.acoustic.connect.android.connectmod.Connect.resumeConnect
|
|
43
|
+
import com.facebook.react.bridge.LifecycleEventListener
|
|
36
44
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
37
45
|
import com.facebook.react.uimanager.NativeViewHierarchyManager
|
|
38
46
|
import com.facebook.react.uimanager.UIManagerModule
|
|
@@ -41,14 +49,26 @@ import com.ibm.eo.model.EOMonitoringLevel
|
|
|
41
49
|
import com.margelo.nitro.NitroModules
|
|
42
50
|
import com.margelo.nitro.acousticconnectrn.HybridAcousticConnectRNSpec
|
|
43
51
|
import com.margelo.nitro.acousticconnectrn.Variant_String_Double_Boolean
|
|
52
|
+
import com.tl.uic.Tealeaf
|
|
44
53
|
import com.tl.uic.model.ScreenviewType
|
|
45
54
|
import com.tl.uic.util.LayoutUtil
|
|
46
55
|
import com.tl.uic.util.keyboardview.KeyboardView
|
|
47
56
|
import java.util.Objects
|
|
48
57
|
|
|
58
|
+
class HybridAcousticConnectRN(private val reactContext: ReactApplicationContext) : HybridAcousticConnectRNSpec(), LifecycleEventListener {
|
|
49
59
|
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
init {
|
|
61
|
+
// Add your listener logic here
|
|
62
|
+
println("HybridAcousticConnectRNSpec has been initialized")
|
|
63
|
+
|
|
64
|
+
Handler(Looper.getMainLooper()).post {
|
|
65
|
+
if (reactContext.hasActiveCatalystInstance()) {
|
|
66
|
+
reactContext.addLifecycleEventListener(this)
|
|
67
|
+
} else {
|
|
68
|
+
println("ReactContext is not ready. LifecycleEventListener not registered.")
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
52
72
|
|
|
53
73
|
/**
|
|
54
74
|
* Sets the module's boolean configuration item from AdvancedConfig.json or BasicConfig.properties that matches the specified key.
|
|
@@ -491,7 +511,97 @@ class HybridAcousticConnectRN(private val reactContext: ReactApplicationContext)
|
|
|
491
511
|
registerFormField(textView, activity)
|
|
492
512
|
}
|
|
493
513
|
|
|
494
|
-
//
|
|
495
|
-
//
|
|
514
|
+
// override fun onWindowFocusChanged(hasFocus: Boolean) {
|
|
515
|
+
// if (!reactContext.hasActiveCatalystInstance()) {
|
|
516
|
+
// logEvent("WindowFocus", "Context is not ready. Skipping onWindowFocusChanged.")
|
|
517
|
+
// return
|
|
518
|
+
// }
|
|
519
|
+
//
|
|
520
|
+
// // Handle window focus change
|
|
521
|
+
// if (hasFocus) {
|
|
522
|
+
// logEvent("WindowFocus", "Window gained focus")
|
|
523
|
+
// } else {
|
|
524
|
+
// logEvent("WindowFocus", "Window lost focus")
|
|
525
|
+
// }
|
|
526
|
+
// }
|
|
527
|
+
|
|
528
|
+
// override fun onWindowFocusChanged(hasFocus: Boolean) {
|
|
529
|
+
// super.onWindowFocusChanged(hasFocus)
|
|
530
|
+
//
|
|
531
|
+
// val reactHost = (application as MainApplication).reactHost
|
|
532
|
+
// if (reactHost != null) {
|
|
533
|
+
// reactHost.onWindowFocusChange(hasFocus)
|
|
496
534
|
// }
|
|
535
|
+
// }
|
|
536
|
+
|
|
537
|
+
fun onWindowFocusChanged(hasFocus: Boolean) {
|
|
538
|
+
if (!reactContext.hasActiveCatalystInstance()) {
|
|
539
|
+
// logEvent("WindowFocus", "Context is not ready. Skipping onWindowFocusChanged.")
|
|
540
|
+
return
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// Handle window focus change
|
|
544
|
+
if (hasFocus) {
|
|
545
|
+
// logEvent("WindowFocus", "Window gained focus")
|
|
546
|
+
} else {
|
|
547
|
+
// logEvent("WindowFocus", "Window lost focus")
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Used when host resumes.
|
|
553
|
+
*/
|
|
554
|
+
override fun onHostResume() {
|
|
555
|
+
// Initialize Connect library, and hook into activity lifecycle events to help detect if app is in background
|
|
556
|
+
if (!reactContext.hasActiveCatalystInstance()) {
|
|
557
|
+
// logEvent("Lifecycle", "onHostResume skipped: ReactContext is not ready")
|
|
558
|
+
return
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
val activity = getCurrentActivity()
|
|
562
|
+
if (activity == null) {
|
|
563
|
+
// logEvent("Lifecycle", "onHostResume skipped: Activity is null")
|
|
564
|
+
return
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
if (!isEnabled()) {
|
|
568
|
+
if (getApplication() == null) {
|
|
569
|
+
init((reactContext.applicationContext as Application))
|
|
570
|
+
}
|
|
571
|
+
enable()
|
|
572
|
+
}
|
|
573
|
+
onResume(activity, null)
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Used when host gets paused.
|
|
578
|
+
*/
|
|
579
|
+
override fun onHostPause() {
|
|
580
|
+
val activity = getCurrentActivity()
|
|
581
|
+
if (activity == null) {
|
|
582
|
+
// logEvent("Lifecycle", "onHostPause skipped: Activity is null")
|
|
583
|
+
return
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
Connect.onPause(activity, null)
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Used when host gets destroyed.
|
|
591
|
+
*/
|
|
592
|
+
override fun onHostDestroy() {
|
|
593
|
+
val activity = getCurrentActivity()
|
|
594
|
+
if (activity == null) {
|
|
595
|
+
// logEvent("Lifecycle", "onHostDestroy skipped: Activity is null")
|
|
596
|
+
return
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
Tealeaf.onDestroy(activity, null)
|
|
600
|
+
// Uncomment if Connect.onDestroy is needed
|
|
601
|
+
// Connect.onDestroy(activity, null)
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
companion object {
|
|
605
|
+
const val TAG = "AcousticConnectRN"
|
|
606
|
+
}
|
|
497
607
|
}
|
|
@@ -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
|
}
|
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
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.11",
|
|
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.35",
|
|
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..."
|
package/scripts/xmlparser.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
|
|
@@ -42,10 +42,14 @@ try {
|
|
|
42
42
|
count = 0
|
|
43
43
|
permssions.forEach(permssion =>{
|
|
44
44
|
if (!result.includes(permssion)){
|
|
45
|
-
build = build +
|
|
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
|
}
|
|
@@ -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
|
-
}
|