react-native-acoustic-connect-beta 18.0.18 → 18.0.20

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 (50) hide show
  1. package/Examples/SampleUI/ios/Podfile +13 -0
  2. package/Examples/SampleUI/ios/Podfile.lock +2276 -0
  3. package/Examples/SampleUI/package.json +1 -1
  4. package/README.md +1 -1
  5. package/android/build.gradle +6 -11
  6. package/android/config.gradle +89 -5
  7. package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
  8. package/android/src/main/assets/ConnectBasicConfig.properties +35 -0
  9. package/android/src/main/assets/TealeafAdvancedConfig.json +1 -1
  10. package/android/src/main/cpp/cpp-adapter.cpp +4 -1
  11. package/android/src/main/java/com/acousticconnectrn/HybridAcousticConnectRN.kt +17 -16
  12. package/ios/HybridAcousticConnectRN.swift +104 -47
  13. package/nitrogen/generated/.gitattributes +1 -1
  14. package/nitrogen/generated/android/AcousticConnectRN+autolinking.cmake +10 -5
  15. package/nitrogen/generated/android/AcousticConnectRN+autolinking.gradle +1 -1
  16. package/nitrogen/generated/android/AcousticConnectRNOnLoad.cpp +27 -19
  17. package/nitrogen/generated/android/AcousticConnectRNOnLoad.hpp +14 -5
  18. package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.cpp +70 -55
  19. package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.hpp +28 -27
  20. package/nitrogen/generated/android/c++/JVariant_Boolean_String_Double.cpp +30 -0
  21. package/nitrogen/generated/android/c++/JVariant_Boolean_String_Double.hpp +83 -0
  22. package/nitrogen/generated/android/c++/JVariant_NullType_String.cpp +26 -0
  23. package/nitrogen/generated/android/c++/JVariant_NullType_String.hpp +70 -0
  24. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/AcousticConnectRNOnLoad.kt +1 -1
  25. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/HybridAcousticConnectRNSpec.kt +27 -24
  26. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/Variant_Boolean_String_Double.kt +75 -0
  27. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/Variant_NullType_String.kt +62 -0
  28. package/nitrogen/generated/ios/AcousticConnectRN+autolinking.rb +4 -2
  29. package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Bridge.cpp +7 -6
  30. package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Bridge.hpp +86 -47
  31. package/nitrogen/generated/ios/AcousticConnectRN-Swift-Cxx-Umbrella.hpp +4 -2
  32. package/nitrogen/generated/ios/AcousticConnectRNAutolinking.mm +2 -2
  33. package/nitrogen/generated/ios/AcousticConnectRNAutolinking.swift +11 -10
  34. package/nitrogen/generated/ios/c++/HybridAcousticConnectRNSpecSwift.cpp +1 -1
  35. package/nitrogen/generated/ios/c++/HybridAcousticConnectRNSpecSwift.hpp +22 -10
  36. package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec.swift +20 -13
  37. package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec_cxx.swift +159 -63
  38. package/nitrogen/generated/ios/swift/Variant_Bool_String_Double.swift +32 -0
  39. package/nitrogen/generated/ios/swift/Variant_NullType_String.swift +30 -0
  40. package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.cpp +1 -1
  41. package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.hpp +10 -9
  42. package/package.json +5 -5
  43. package/scripts/ConnectConfig.json +1 -1
  44. package/scripts/gradleParser.js +5 -6
  45. package/scripts/postInstallScripts.sh +0 -1
  46. package/scripts/xmlparser.js +4 -5
  47. package/nitrogen/generated/android/c++/JVariant_String_Double_Boolean.hpp +0 -98
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/Variant_String_Double_Boolean.kt +0 -49
  49. package/nitrogen/generated/ios/swift/Variant_String_Double_Bool.swift +0 -17
  50. package/scripts/javaParser.js +0 -183
@@ -0,0 +1,32 @@
1
+ ///
2
+ /// Variant_Bool_String_Double.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+
9
+
10
+ /**
11
+ * An Swift enum with associated values representing a Variant/Union type.
12
+ * JS type: `boolean | string | number`
13
+ */
14
+ @frozen
15
+ public enum Variant_Bool_String_Double {
16
+ case first(Bool)
17
+ case second(String)
18
+ case third(Double)
19
+ }
20
+
21
+ public extension Variant_Bool_String_Double {
22
+ func asType<T>(_ type: T.Type = T.self) -> T? {
23
+ switch self {
24
+ case .first(let value): return value as? T
25
+ case .second(let value): return value as? T
26
+ case .third(let value): return value as? T
27
+ }
28
+ }
29
+ func isType<T>(_ type: T.Type = T.self) -> Bool {
30
+ return self.asType(type) != nil
31
+ }
32
+ }
@@ -0,0 +1,30 @@
1
+ ///
2
+ /// Variant_NullType_String.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * An Swift enum with associated values representing a Variant/Union type.
12
+ * JS type: `null | string`
13
+ */
14
+ @frozen
15
+ public enum Variant_NullType_String {
16
+ case first(NullType)
17
+ case second(String)
18
+ }
19
+
20
+ public extension Variant_NullType_String {
21
+ func asType<T>(_ type: T.Type = T.self) -> T? {
22
+ switch self {
23
+ case .first(let value): return value as? T
24
+ case .second(let value): return value as? T
25
+ }
26
+ }
27
+ func isType<T>(_ type: T.Type = T.self) -> Bool {
28
+ return self.asType(type) != nil
29
+ }
30
+ }
@@ -2,7 +2,7 @@
2
2
  /// HybridAcousticConnectRNSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridAcousticConnectRNSpec.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridAcousticConnectRNSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -17,6 +17,7 @@
17
17
 
18
18
  #include <string>
19
19
  #include <variant>
20
+ #include <NitroModules/Null.hpp>
20
21
  #include <optional>
21
22
  #include <unordered_map>
22
23
 
@@ -54,25 +55,25 @@ namespace margelo::nitro::acousticconnectrn {
54
55
  virtual bool setBooleanConfigItemForKey(const std::string& key, bool value, const std::string& moduleName) = 0;
55
56
  virtual bool setStringItemForKey(const std::string& key, const std::string& value, const std::string& moduleName) = 0;
56
57
  virtual bool setNumberItemForKey(const std::string& key, double value, const std::string& moduleName) = 0;
57
- virtual bool setConfigItemForKey(const std::string& key, const std::variant<std::string, double, bool>& value, const std::string& moduleName) = 0;
58
+ virtual bool setConfigItemForKey(const std::string& key, const std::variant<bool, std::string, double>& value, const std::string& moduleName) = 0;
58
59
  virtual bool getBooleanConfigItemForKey(bool theDefault, const std::string& key, const std::string& moduleName) = 0;
59
- virtual std::optional<std::string> getStringItemForKey(const std::string& theDefault, const std::string& key, const std::string& moduleName) = 0;
60
+ virtual std::optional<std::variant<nitro::NullType, std::string>> getStringItemForKey(const std::string& theDefault, const std::string& key, const std::string& moduleName) = 0;
60
61
  virtual double getNumberItemForKey(double theDefault, const std::string& key, const std::string& moduleName) = 0;
61
- virtual bool logCustomEvent(const std::string& eventName, const std::unordered_map<std::string, std::variant<std::string, double, bool>>& values, double level) = 0;
62
- virtual bool logSignal(const std::unordered_map<std::string, std::variant<std::string, double, bool>>& values, double level) = 0;
62
+ virtual bool logCustomEvent(const std::string& eventName, const std::unordered_map<std::string, std::variant<bool, std::string, double>>& values, double level) = 0;
63
+ virtual bool logSignal(const std::unordered_map<std::string, std::variant<bool, std::string, double>>& values, double level) = 0;
63
64
  virtual bool logExceptionEvent(const std::string& message, const std::string& stackInfo, bool unhandled) = 0;
64
65
  virtual bool logLocation() = 0;
65
66
  virtual bool logLocationWithLatitudeLongitude(double latitude, double longitude, double level) = 0;
66
67
  virtual bool logClickEvent(double target, const std::string& controlId) = 0;
67
- virtual bool logTextChangeEvent(double target, const std::string& controlId, const std::optional<std::string>& text) = 0;
68
+ virtual bool logTextChangeEvent(double target, const std::string& controlId, const std::optional<std::variant<nitro::NullType, std::string>>& text) = 0;
68
69
  virtual bool setCurrentScreenName(const std::string& logicalPageName) = 0;
69
- virtual bool logScreenViewContextLoad(const std::optional<std::string>& logicalPageName, const std::optional<std::string>& referrer) = 0;
70
- virtual bool logScreenViewContextUnload(const std::optional<std::string>& logicalPageName, const std::optional<std::string>& referrer) = 0;
70
+ virtual bool logScreenViewContextLoad(const std::optional<std::variant<nitro::NullType, std::string>>& logicalPageName, const std::optional<std::variant<nitro::NullType, std::string>>& referrer) = 0;
71
+ virtual bool logScreenViewContextUnload(const std::optional<std::variant<nitro::NullType, std::string>>& logicalPageName, const std::optional<std::variant<nitro::NullType, std::string>>& referrer) = 0;
71
72
  virtual bool logScreenLayout(const std::string& name, double delay) = 0;
72
73
  virtual bool logDialogShowEvent(const std::string& dialogId, const std::string& dialogTitle, const std::string& dialogType) = 0;
73
74
  virtual bool logDialogDismissEvent(const std::string& dialogId, const std::string& dismissReason) = 0;
74
75
  virtual bool logDialogButtonClickEvent(const std::string& dialogId, const std::string& buttonText, double buttonIndex) = 0;
75
- virtual bool logDialogCustomEvent(const std::string& dialogId, const std::string& eventName, const std::unordered_map<std::string, std::variant<std::string, double, bool>>& values) = 0;
76
+ virtual bool logDialogCustomEvent(const std::string& dialogId, const std::string& eventName, const std::unordered_map<std::string, std::variant<bool, std::string, double>>& values) = 0;
76
77
 
77
78
  protected:
78
79
  // Hybrid Setup
package/package.json CHANGED
@@ -14,12 +14,12 @@
14
14
  "@types/jest": "^29.5.12",
15
15
  "@types/react": "^19.0.10",
16
16
  "jetifier": "^1.6.3",
17
- "nitro-codegen": "0.25.2",
17
+ "nitrogen": "0.35.4",
18
18
  "prettier-plugin-kotlin": "^2.1.0",
19
19
  "react": "19.0.0",
20
20
  "react-native": "0.78.0",
21
21
  "react-native-builder-bob": "^0.37.0",
22
- "react-native-nitro-modules": "0.25.1",
22
+ "react-native-nitro-modules": "0.35.4",
23
23
  "release-it": "^19.0.2",
24
24
  "typescript": "5.0.4"
25
25
  },
@@ -96,7 +96,7 @@
96
96
  "peerDependencies": {
97
97
  "react": "*",
98
98
  "react-native": "*",
99
- "react-native-nitro-modules": ">=0.25.1 <0.35.0"
99
+ "react-native-nitro-modules": ">=0.35.0 <0.36.0"
100
100
  },
101
101
  "prettier": {
102
102
  "quoteProps": "consistent",
@@ -180,7 +180,7 @@
180
180
  "scripts": {
181
181
  "applyConfiguration": "node scripts/applyConfiguration.js $INIT_CWD",
182
182
  "build": "npm run typecheck && bob build",
183
- "codegen": "nitro-codegen --logLevel=\"debug\" && npm run build && node post-script.js",
183
+ "codegen": "nitrogen --logLevel=\"debug\" && npm run build && node post-script.js",
184
184
  "postinstall": "./scripts/postInstallScripts.sh",
185
185
  "rebuild": "npm run codegen && npm run rebuildExample --prefix ./example",
186
186
  "release": "release-it",
@@ -192,7 +192,7 @@
192
192
  "source": "src/index",
193
193
  "summary": "react-native ios android tealeaf connect cxa wxca er enhanced-replay",
194
194
  "types": "./lib/typescript/src/index.d.ts",
195
- "version": "18.0.18",
195
+ "version": "18.0.20",
196
196
  "workspaces": [
197
197
  "example"
198
198
  ]
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "Connect": {
3
- "AndroidVersion": "11.0.6-beta",
3
+ "AndroidVersion": "11.0.8-beta",
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",
@@ -15,17 +15,16 @@ const directoryPath = path.join(__dirname,"..","..","..")
15
15
 
16
16
  console.log("Run gradleParser.js");
17
17
 
18
- if(!isValid(`${directoryPath}/android`)){
19
- console.log("Directory not valid:")
20
- console.log(`${directoryPath}/android`)
18
+ const gradleCode = `apply from: project(':react-native-acoustic-connect-beta').projectDir.getPath() + "/config.gradle"`
19
+ const filePath = `${directoryPath}/android/app/build.gradle`
20
+
21
+ if(!isValid(filePath)){
22
+ console.log("File not found, skipping:", filePath)
21
23
  exit(0)
22
24
  }
23
25
 
24
- const gradleCode = `apply from: project(':react-native-acoustic-connect-beta').projectDir.getPath() + "/config.gradle"`
25
-
26
26
  let gradleData = '';
27
27
  try {
28
- const filePath = `${directoryPath}/android/app/build.gradle`
29
28
  gradleData = fs.readFileSync(filePath, 'utf8');
30
29
  console.log("Read: " + filePath);
31
30
  console.log(gradleData);
@@ -4,7 +4,6 @@ echo "Current directory:"
4
4
  pwd
5
5
  echo "Running Node scripts..."
6
6
  node ./scripts/reviewConnectConfig.js
7
- node ./scripts/javaParser.js
8
7
  node ./scripts/xmlParser.js
9
8
  node ./scripts/gradleParser.js
10
9
  echo "*********************************************************************************************"
@@ -17,13 +17,12 @@ const { isValid } = require('./util');
17
17
  console.log("Run xmlParser.js");
18
18
 
19
19
  const directoryPath = path.join(__dirname,"..","..","..")
20
- if(!isValid(`${directoryPath}/android`)){
21
- console.log("Directory not valid:")
22
- console.log(`${directoryPath}/android`)
20
+ const filePath = `${directoryPath}/android/app/src/main/AndroidManifest.xml`;
21
+
22
+ if(!isValid(filePath)){
23
+ console.log("File not found, skipping:", filePath)
23
24
  exit(0)
24
25
  }
25
-
26
- const filePath = `${directoryPath}/android/app/src/main/AndroidManifest.xml`;
27
26
  const permssions = ['android.permission.INTERNET',
28
27
  'android.permission.ACCESS_NETWORK_STATE',
29
28
  'android.permission.ACCESS_WIFI_STATE',
@@ -1,98 +0,0 @@
1
- ///
2
- /// JVariant_String_Double_Boolean.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- #pragma once
9
-
10
- #include <fbjni/fbjni.h>
11
- #include <variant>
12
-
13
- #include <variant>
14
- #include <string>
15
-
16
- namespace margelo::nitro::acousticconnectrn {
17
-
18
- using namespace facebook;
19
-
20
- /**
21
- * The C++ JNI bridge between the C++ std::variant and the Java class "Variant_String_Double_Boolean".
22
- */
23
- class JVariant_String_Double_Boolean: public jni::JavaClass<JVariant_String_Double_Boolean> {
24
- public:
25
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/acousticconnectrn/Variant_String_Double_Boolean;";
26
-
27
- static jni::local_ref<JVariant_String_Double_Boolean> create_0(jni::alias_ref<jni::JString> value) {
28
- static const auto method = javaClassStatic()->getStaticMethod<JVariant_String_Double_Boolean(jni::alias_ref<jni::JString>)>("create");
29
- return method(javaClassStatic(), value);
30
- }
31
- static jni::local_ref<JVariant_String_Double_Boolean> create_1(double value) {
32
- static const auto method = javaClassStatic()->getStaticMethod<JVariant_String_Double_Boolean(double)>("create");
33
- return method(javaClassStatic(), value);
34
- }
35
- static jni::local_ref<JVariant_String_Double_Boolean> create_2(jboolean value) {
36
- static const auto method = javaClassStatic()->getStaticMethod<JVariant_String_Double_Boolean(jboolean)>("create");
37
- return method(javaClassStatic(), value);
38
- }
39
-
40
- static jni::local_ref<JVariant_String_Double_Boolean> fromCpp(const std::variant<std::string, double, bool>& variant) {
41
- switch (variant.index()) {
42
- case 0: return create_0(jni::make_jstring(std::get<0>(variant)));
43
- case 1: return create_1(std::get<1>(variant));
44
- case 2: return create_2(std::get<2>(variant));
45
- default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
46
- }
47
- }
48
-
49
- [[nodiscard]] std::variant<std::string, double, bool> toCpp() const;
50
- };
51
-
52
- namespace JVariant_String_Double_Boolean_impl {
53
- class First: public jni::JavaClass<First, JVariant_String_Double_Boolean> {
54
- public:
55
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/acousticconnectrn/Variant_String_Double_Boolean$First;";
56
-
57
- [[nodiscard]] jni::local_ref<jni::JString> getValue() const {
58
- static const auto field = javaClassStatic()->getField<jni::JString>("value");
59
- return getFieldValue(field);
60
- }
61
- };
62
-
63
- class Second: public jni::JavaClass<Second, JVariant_String_Double_Boolean> {
64
- public:
65
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/acousticconnectrn/Variant_String_Double_Boolean$Second;";
66
-
67
- [[nodiscard]] double getValue() const {
68
- static const auto field = javaClassStatic()->getField<double>("value");
69
- return getFieldValue(field);
70
- }
71
- };
72
-
73
- class Third: public jni::JavaClass<Third, JVariant_String_Double_Boolean> {
74
- public:
75
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/acousticconnectrn/Variant_String_Double_Boolean$Third;";
76
-
77
- [[nodiscard]] jboolean getValue() const {
78
- static const auto field = javaClassStatic()->getField<jboolean>("value");
79
- return getFieldValue(field);
80
- }
81
- };
82
- } // namespace JVariant_String_Double_Boolean_impl
83
-
84
- std::variant<std::string, double, bool> JVariant_String_Double_Boolean::toCpp() const {
85
- if (isInstanceOf(JVariant_String_Double_Boolean_impl::First::javaClassStatic())) {
86
- auto jniValue = static_cast<const JVariant_String_Double_Boolean_impl::First*>(this)->getValue();
87
- return jniValue->toStdString();
88
- } else if (isInstanceOf(JVariant_String_Double_Boolean_impl::Second::javaClassStatic())) {
89
- auto jniValue = static_cast<const JVariant_String_Double_Boolean_impl::Second*>(this)->getValue();
90
- return jniValue;
91
- } else if (isInstanceOf(JVariant_String_Double_Boolean_impl::Third::javaClassStatic())) {
92
- auto jniValue = static_cast<const JVariant_String_Double_Boolean_impl::Third*>(this)->getValue();
93
- return static_cast<bool>(jniValue);
94
- }
95
- throw std::invalid_argument("Variant is unknown Kotlin instance!");
96
- }
97
-
98
- } // namespace margelo::nitro::acousticconnectrn
@@ -1,49 +0,0 @@
1
- ///
2
- /// Variant_String_Double_Boolean.kt
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- package com.margelo.nitro.acousticconnectrn
9
-
10
- import com.facebook.proguard.annotations.DoNotStrip
11
-
12
- /**
13
- * Represents the TypeScript variant "String|Double|Boolean".
14
- */
15
- @Suppress("ClassName")
16
- @DoNotStrip
17
- sealed class Variant_String_Double_Boolean {
18
- @DoNotStrip
19
- data class First(@DoNotStrip val value: String): Variant_String_Double_Boolean()
20
- @DoNotStrip
21
- data class Second(@DoNotStrip val value: Double): Variant_String_Double_Boolean()
22
- @DoNotStrip
23
- data class Third(@DoNotStrip val value: Boolean): Variant_String_Double_Boolean()
24
-
25
- inline fun <reified T> getAs(): T? = when (this) {
26
- is First -> value as? T
27
- is Second -> value as? T
28
- is Third -> value as? T
29
- }
30
-
31
- val isFirst: Boolean
32
- get() = this is First
33
- val isSecond: Boolean
34
- get() = this is Second
35
- val isThird: Boolean
36
- get() = this is Third
37
-
38
- companion object {
39
- @JvmStatic
40
- @DoNotStrip
41
- fun create(value: String): Variant_String_Double_Boolean = First(value)
42
- @JvmStatic
43
- @DoNotStrip
44
- fun create(value: Double): Variant_String_Double_Boolean = Second(value)
45
- @JvmStatic
46
- @DoNotStrip
47
- fun create(value: Boolean): Variant_String_Double_Boolean = Third(value)
48
- }
49
- }
@@ -1,17 +0,0 @@
1
- ///
2
- /// Variant_String_Double_Bool.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- /**
9
- * An Swift enum with associated values representing a Variant/Union type.
10
- * JS type: `string | number | boolean`
11
- */
12
- @frozen
13
- public enum Variant_String_Double_Bool {
14
- case first(String)
15
- case second(Double)
16
- case third(Bool)
17
- }
@@ -1,183 +0,0 @@
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
- const prettier = require("prettier");
11
- const fs = require("fs");
12
- const path = require("path");
13
- const javaPaserPlugin = require("prettier-plugin-java");
14
- const { XMLParser, XMLBuilder } = require("fast-xml-parser");
15
- const { exit } = require("process");
16
- const { isValid } = require('./util');
17
- const directoryPath = path.join(__dirname, "..", "..", "..");
18
-
19
- console.log("Run javaParser.js");
20
-
21
- if (!isValid(`${directoryPath}/android`)) {
22
- console.log("Directory not valid:")
23
- console.log(`${directoryPath}/android`)
24
- exit(0);
25
- }
26
-
27
- function readFile(path) {
28
- let data = "";
29
- if (fs.existsSync(path)) {
30
- try {
31
- data = fs.readFileSync(path, "utf8");
32
- console.log("Read: " + path);
33
- } catch (err) {
34
- console.log("Error reading: " + path);
35
- console.error(err);
36
- }
37
- } else {
38
- console.log("File not found: " + path);
39
- }
40
- return data;
41
- }
42
-
43
- const buildGradlePath = `${directoryPath}/android/app/build.gradle`;
44
- console.log("Read build.gradle to get applicationId");
45
- const buildGradleFile = readFile(buildGradlePath)
46
-
47
- const regex = /applicationId.*/g;
48
- const foundIt = buildGradleFile.match(regex);
49
-
50
- let packageName = null
51
- if (foundIt != null && foundIt[0] != null) {
52
- const singleQuote = foundIt[0].split("'");
53
- const doubleQuote = foundIt[0].split('"');
54
- if (singleQuote != null && singleQuote.length >= 2) {
55
- packageName = singleQuote[1];
56
- } else if (doubleQuote != null && doubleQuote.length >= 2) {
57
- packageName = doubleQuote[1];
58
- }
59
- }
60
-
61
- if (packageName == null) {
62
- const xmlFilePath = `${directoryPath}/android/app/src/main/AndroidManifest.xml`;
63
- console.log("Did not find it in " + buildGradlePath + ". I will look in " + xmlFilePath);
64
- const manifestFile = readFile(xmlFilePath)
65
- const options = {
66
- ignoreAttributes: false,
67
- format: true,
68
- preserveOrder: false,
69
- };
70
- const parser = new XMLParser(options);
71
- const jsonObj = parser.parse(manifestFile);
72
- packageName = jsonObj["manifest"]["@_package"];
73
- }
74
-
75
- console.log("Found the following applicationId:" + packageName);
76
- if (packageName == null) {
77
- console.log("applicationId not found:")
78
- exit(0);
79
- }
80
-
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
- }