react-native-acoustic-connect-beta 16.0.23 → 16.0.25
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/Example/nativebase-v3-kitchensink/ConnectConfig.json +1 -0
- package/Example/nativebase-v3-kitchensink/android/app/build.gradle +0 -1
- package/Example/nativebase-v3-kitchensink/android/app/src/main/java/com/geekyants/kitchensinkappnativebase/MainActivity.java +15 -13
- package/Example/nativebase-v3-kitchensink/package.json +1 -1
- package/android/build.gradle +1 -3
- package/android/config.gradle +60 -43
- package/package.json +1 -1
- package/scripts/ConnectConfig.json +1 -0
- package/scripts/javaParser.js +98 -42
- package/android/src/main/assets/ConnectAdvancedConfig.json +0 -3
- package/android/src/main/assets/EOCoreAdvancedConfig.json +0 -1508
- package/android/src/main/assets/EOCoreBasicConfig.properties +0 -29
- package/android/src/main/assets/TealeafAdvancedConfig.json +0 -39
- package/android/src/main/assets/TealeafBasicConfig.properties +0 -35
- package/android/src/main/assets/TealeafLayoutConfig.json +0 -1
- package/android/src/main/assets/TealeafLayoutConfigDefault.json +0 -40
|
@@ -264,5 +264,4 @@ dependencies {
|
|
|
264
264
|
apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle")
|
|
265
265
|
applyNativeModulesAppBuildGradle(project)
|
|
266
266
|
|
|
267
|
-
//apply from: project(':react-native-acoustic-ea-tealeaf-beta').projectDir.getPath() + "/config.gradle"
|
|
268
267
|
apply from: project(':react-native-acoustic-connect-beta').projectDir.getPath() + "/config.gradle"
|
|
@@ -2,21 +2,19 @@ package com.geekyants.kitchensinkappnativebase;
|
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle;
|
|
4
4
|
import android.view.MotionEvent;
|
|
5
|
-
|
|
5
|
+
import com.acoustic.connect.android.connectmod.Connect;
|
|
6
6
|
import com.facebook.react.ReactActivity;
|
|
7
7
|
import com.facebook.react.ReactActivityDelegate;
|
|
8
8
|
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
|
|
9
9
|
import com.facebook.react.defaults.DefaultReactActivityDelegate;
|
|
10
|
-
//import com.tl.uic.Tealeaf;
|
|
11
|
-
|
|
12
10
|
import expo.modules.ReactActivityDelegateWrapper;
|
|
13
11
|
|
|
14
12
|
public class MainActivity extends ReactActivity {
|
|
15
|
-
@Override
|
|
16
|
-
protected void onCreate(Bundle savedInstanceState) {
|
|
17
|
-
super.onCreate(null);
|
|
18
|
-
}
|
|
19
13
|
|
|
14
|
+
@Override
|
|
15
|
+
protected void onCreate(Bundle savedInstanceState) {
|
|
16
|
+
super.onCreate(null);
|
|
17
|
+
}
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
20
|
* Returns the name of the main component registered from JavaScript.
|
|
@@ -34,16 +32,20 @@ public class MainActivity extends ReactActivity {
|
|
|
34
32
|
*/
|
|
35
33
|
@Override
|
|
36
34
|
protected ReactActivityDelegate createReactActivityDelegate() {
|
|
37
|
-
return new ReactActivityDelegateWrapper(
|
|
35
|
+
return new ReactActivityDelegateWrapper(
|
|
38
36
|
this,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
|
|
38
|
+
new DefaultReactActivityDelegate(
|
|
39
|
+
this,
|
|
40
|
+
getMainComponentName(),
|
|
41
|
+
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
|
|
42
|
+
DefaultNewArchitectureEntryPoint.getFabricEnabled()
|
|
43
|
+
)
|
|
44
|
+
);
|
|
42
45
|
}
|
|
43
46
|
|
|
44
|
-
@Override
|
|
45
47
|
public boolean dispatchTouchEvent(MotionEvent e) {
|
|
46
|
-
|
|
48
|
+
Connect.INSTANCE.dispatchTouchEvent(this, e);
|
|
47
49
|
return super.dispatchTouchEvent(e);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"react": "18.2.0",
|
|
16
16
|
"react-dom": "18.2.0",
|
|
17
17
|
"react-native": "0.72.10",
|
|
18
|
-
"react-native-acoustic-connect-beta": "16.0.
|
|
18
|
+
"react-native-acoustic-connect-beta": "16.0.25",
|
|
19
19
|
"react-native-gesture-handler": "~2.12.0",
|
|
20
20
|
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
21
21
|
"react-native-reanimated": "~3.3.0",
|
package/android/build.gradle
CHANGED
|
@@ -45,7 +45,5 @@ dependencies {
|
|
|
45
45
|
implementation 'com.facebook.react:react-native:+'
|
|
46
46
|
|
|
47
47
|
// Connect SDK libraries
|
|
48
|
-
|
|
49
|
-
implementation "io.github.go-acoustic:tealeaf:+"
|
|
50
|
-
implementation 'io.github.go-acoustic:eocore:+'
|
|
48
|
+
api 'io.github.go-acoustic:connect:+'
|
|
51
49
|
}
|
package/android/config.gradle
CHANGED
|
@@ -13,15 +13,15 @@ import java.util.regex.Pattern
|
|
|
13
13
|
import groovy.json.JsonSlurper
|
|
14
14
|
import groovy.json.JsonOutput
|
|
15
15
|
|
|
16
|
+
def getConfigJSON() {
|
|
17
|
+
def configFile = "$project.rootDir/../ConnectConfig.json"
|
|
18
|
+
println("Reading file $configFile")
|
|
19
|
+
def jsonSlurper = new JsonSlurper()
|
|
20
|
+
return jsonSlurper.parse(new File(configFile))
|
|
21
|
+
}
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def writeConfig(json) {
|
|
20
|
-
def module_path = project(':react-native-acoustic-connect-beta').projectDir.getPath()
|
|
21
|
-
def propertiesFile = "$module_path/src/main/assets/TealeafBasicConfig.properties"
|
|
22
|
-
|
|
23
|
-
println("Writing config to file $propertiesFile")
|
|
24
|
-
|
|
23
|
+
def updateTealeafBasicConfig(mp, json) {
|
|
24
|
+
def propertiesFile = "$mp/src/main/assets/TealeafBasicConfig.properties"
|
|
25
25
|
FileInputStream _file = new FileInputStream(propertiesFile);
|
|
26
26
|
Properties properties = new Properties();
|
|
27
27
|
properties.load(_file);
|
|
@@ -30,65 +30,82 @@ def writeConfig(json) {
|
|
|
30
30
|
FileOutputStream out = new FileOutputStream(propertiesFile);
|
|
31
31
|
|
|
32
32
|
json.each { key, value ->
|
|
33
|
-
if(key != "
|
|
33
|
+
if(key != "Connect"){ return }
|
|
34
34
|
|
|
35
|
+
println("Update/Add the following key/values:")
|
|
35
36
|
value.each { config_key, config_value ->
|
|
36
37
|
if(config_value.getClass() != java.lang.String
|
|
37
38
|
&& config_value.getClass() != java.lang.Boolean
|
|
38
39
|
&& config_value.getClass() != java.lang.Integer){
|
|
39
40
|
return
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
+
// Just update the following items
|
|
43
|
+
if (config_key == "AppKey" ||
|
|
44
|
+
config_key == "PostMessageUrl" ||
|
|
45
|
+
config_key == "KillSwitchUrl") {
|
|
46
|
+
println(config_key + "=" + config_value)
|
|
47
|
+
properties.setProperty(config_key, config_value.toString())
|
|
48
|
+
}
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
properties.store(out, null);
|
|
46
53
|
out.close();
|
|
54
|
+
println("Updating:$propertiesFile")
|
|
47
55
|
}
|
|
48
56
|
|
|
49
|
-
def
|
|
50
|
-
def
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def jsonSlurper = new JsonSlurper()
|
|
55
|
-
def data = jsonSlurper.parse(new File(configFile))
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
def overrideLayoutConfig(){
|
|
59
|
-
def configFilePath = "$project.rootDir/../ConnectConfig.json"
|
|
60
|
-
def module_path = project(':react-native-acoustic-connect-beta').projectDir.getPath()
|
|
61
|
-
def layoutConfigPath = "$module_path/src/main/assets/TealeafLayoutConfig.json"
|
|
62
|
-
def layoutConfigDefaultPath = "$module_path/src/main/assets/TealeafLayoutConfigDefault.json"
|
|
63
|
-
|
|
64
|
-
def configFile = new File(configFilePath)
|
|
65
|
-
|
|
66
|
-
def jsonSlurper = new JsonSlurper()
|
|
67
|
-
def data = jsonSlurper.parse(configFile)
|
|
68
|
-
|
|
69
|
-
def override = data.Connect.layoutConfig;
|
|
70
|
-
|
|
57
|
+
def updateLayoutConfig(mp, json){
|
|
58
|
+
def layoutConfigPath = "$mp/src/main/assets/TealeafLayoutConfig.json"
|
|
59
|
+
def layoutConfigDefaultPath = "$mp/src/main/assets/TealeafLayoutConfigDefault.json"
|
|
60
|
+
def override = json.Connect.layoutConfig;
|
|
71
61
|
def overrideJson = JsonOutput.toJson(override)
|
|
72
62
|
|
|
73
|
-
|
|
74
63
|
if(override != null){
|
|
75
64
|
def layoutConfigFile = new File(layoutConfigPath)
|
|
76
65
|
layoutConfigFile.text = overrideJson
|
|
77
|
-
}else{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
66
|
+
} else {
|
|
67
|
+
def layoutConfigDefaultFile = new File(layoutConfigDefaultPath)
|
|
68
|
+
def layoutConfigFile = new File(layoutConfigPath)
|
|
69
|
+
layoutConfigFile.text = layoutConfigDefaultFile.text
|
|
70
|
+
}
|
|
71
|
+
println("Updating:$layoutConfigPath")
|
|
83
72
|
}
|
|
84
73
|
|
|
74
|
+
def updateGradle(mp, json){
|
|
75
|
+
def buildGradlePath = "$mp/build.gradle"
|
|
76
|
+
def buildGradleFile = new File(buildGradlePath)
|
|
77
|
+
def updatedBuildGradle = buildGradleFile.text
|
|
78
|
+
|
|
79
|
+
if (json != null && json.Connect) {
|
|
80
|
+
if(json.Connect.AndroidVersion != null) {
|
|
81
|
+
def connectSDK = "io.github.go-acoustic:connect:"
|
|
82
|
+
if(json.Connect.AndroidVersion.length() > 0) {
|
|
83
|
+
connectSDK += json.Connect.AndroidVersion
|
|
84
|
+
} else {
|
|
85
|
+
connectSDK += "+"
|
|
86
|
+
}
|
|
87
|
+
updatedBuildGradle = updatedBuildGradle.replaceAll(~/io.github.go-acoustic:connect:(\+|\d+.\d+.\d+)/, connectSDK)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
buildGradleFile.text = updatedBuildGradle
|
|
92
|
+
println("Updating:$buildGradlePath")
|
|
93
|
+
}
|
|
85
94
|
|
|
86
95
|
try {
|
|
87
|
-
|
|
88
|
-
writeConfig(getConfigJSON())
|
|
96
|
+
def module_path = project(':react-native-acoustic-connect-beta').projectDir.getPath()
|
|
89
97
|
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
println("**Acoustic Integration***********************************************************************")
|
|
99
|
+
println("Executing $module_path/config.gradle")
|
|
100
|
+
println("Step 1:")
|
|
101
|
+
def configJSONData = getConfigJSON()
|
|
102
|
+
println("Step 2:")
|
|
103
|
+
updateTealeafBasicConfig(module_path, configJSONData)
|
|
104
|
+
println("Step 3:")
|
|
105
|
+
updateLayoutConfig(module_path, configJSONData)
|
|
106
|
+
println("Step 4:")
|
|
107
|
+
updateGradle(module_path, configJSONData)
|
|
108
|
+
println("*********************************************************************************************")
|
|
92
109
|
} catch (FileNotFoundException e) {
|
|
93
110
|
e.printStackTrace()
|
|
94
111
|
} catch (IOException e) {
|
package/package.json
CHANGED
package/scripts/javaParser.js
CHANGED
|
@@ -7,74 +7,130 @@ const { exit } = require("process");
|
|
|
7
7
|
const { isValid } = require('./util');
|
|
8
8
|
const directoryPath = path.join(__dirname, "..", "..", "..");
|
|
9
9
|
|
|
10
|
+
console.log("**Acoustic Integration***********************************************************************");
|
|
11
|
+
|
|
10
12
|
if (!isValid(`${directoryPath}/android`)) {
|
|
13
|
+
console.log("Directory not valid:")
|
|
14
|
+
console.log(`${directoryPath}/android`)
|
|
15
|
+
console.log("*********************************************************************************************");
|
|
11
16
|
exit(0);
|
|
12
17
|
}
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
function readFile(path) {
|
|
20
|
+
let data = "";
|
|
21
|
+
try {
|
|
22
|
+
data = fs.readFileSync(path, "utf8");
|
|
23
|
+
console.log("Read:" + path);
|
|
24
|
+
// console.log(data);
|
|
25
|
+
} catch (err) {
|
|
26
|
+
console.log("Error reading:" + path);
|
|
27
|
+
console.error(err);
|
|
28
|
+
}
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
15
31
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
preserveOrder: false,
|
|
20
|
-
};
|
|
32
|
+
const buildGradlePath = `${directoryPath}/android/app/build.gradle`;
|
|
33
|
+
console.log("Read build.gradle to get applicationId");
|
|
34
|
+
const buildGradleFile = readFile(buildGradlePath)
|
|
21
35
|
|
|
22
|
-
const
|
|
36
|
+
const regex = /applicationId.*/g;
|
|
37
|
+
const foundIt = buildGradleFile.match(regex);
|
|
23
38
|
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
let packageName = null
|
|
40
|
+
if (foundIt != null && foundIt[0] != null) {
|
|
41
|
+
const singleQuote = foundIt[0].split("'");
|
|
42
|
+
const doubleQuote = foundIt[0].split('"');
|
|
43
|
+
if (singleQuote != null && singleQuote.length >= 2) {
|
|
44
|
+
packageName = singleQuote[1];
|
|
45
|
+
} else if (doubleQuote != null && doubleQuote.length >= 2) {
|
|
46
|
+
packageName = doubleQuote[1];
|
|
47
|
+
}
|
|
29
48
|
}
|
|
30
49
|
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
if (packageName == null) {
|
|
51
|
+
const xmlFilePath = `${directoryPath}/android/app/src/main/AndroidManifest.xml`;
|
|
52
|
+
console.log("Did not find it in " + buildGradlePath + ". I will look in " + xmlFilePath);
|
|
53
|
+
const manifestFile = readFile(xmlFilePath)
|
|
54
|
+
const options = {
|
|
55
|
+
ignoreAttributes: false,
|
|
56
|
+
format: true,
|
|
57
|
+
preserveOrder: false,
|
|
58
|
+
};
|
|
59
|
+
const parser = new XMLParser(options);
|
|
60
|
+
const jsonObj = parser.parse(manifestFile);
|
|
61
|
+
packageName = jsonObj["manifest"]["@_package"];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
console.log("Found the following applicationId:" + packageName);
|
|
65
|
+
if (packageName == null) {
|
|
66
|
+
console.log("applicationId not found:")
|
|
67
|
+
console.log("*********************************************************************************************");
|
|
68
|
+
exit(0);
|
|
42
69
|
}
|
|
43
70
|
|
|
71
|
+
const upperJavaPath = packageName.replace(/\./g, "/");
|
|
72
|
+
const mainActivityPath = `${directoryPath}/android/app/src/main/java/${upperJavaPath}/MainActivity.java`;
|
|
73
|
+
const mainActivityFile = readFile(mainActivityPath)
|
|
74
|
+
|
|
44
75
|
const javaCode = `public boolean dispatchTouchEvent(MotionEvent e) {
|
|
45
|
-
Connect.dispatchTouchEvent(this, e);
|
|
76
|
+
Connect.INSTANCE.dispatchTouchEvent(this, e);
|
|
46
77
|
return super.dispatchTouchEvent(e);
|
|
47
78
|
}`;
|
|
79
|
+
const upperJavaCode = `package ${packageName};`;
|
|
80
|
+
const javaCode2 = `${upperJavaCode}\nimport com.acoustic.connect.android.connectmod.Connect;`;
|
|
81
|
+
const javaCode3 = `Connect.INSTANCE.dispatchTouchEvent(this, e);
|
|
82
|
+
return super.dispatchTouchEvent(e);`;
|
|
48
83
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
84
|
+
// Setup to update file
|
|
85
|
+
let updateMainActivityData = prettier.format(mainActivityFile, {
|
|
86
|
+
parser: "java",
|
|
87
|
+
plugins: [javaPaserPlugin],
|
|
88
|
+
tabWidth: 4,
|
|
89
|
+
});
|
|
53
90
|
|
|
54
|
-
|
|
55
|
-
let result = prettier.format(javaData, {
|
|
56
|
-
parser: "java",
|
|
57
|
-
plugins: [javaPaserPlugin],
|
|
58
|
-
tabWidth: 2,
|
|
59
|
-
});
|
|
91
|
+
let updateMainActivity = false;
|
|
60
92
|
|
|
61
|
-
|
|
93
|
+
// Look for dispatchTouchEvent method
|
|
94
|
+
const regExDispatchTouchEvent = new RegExp(/oolean dispatchTouchEvent/, "g");
|
|
95
|
+
if (!regExDispatchTouchEvent.test(updateMainActivityData)) {
|
|
96
|
+
updateMainActivity = true;
|
|
97
|
+
// Add dispatchTouchEvent method with library call
|
|
98
|
+
updateMainActivityData = `${updateMainActivityData.substring(0, updateMainActivityData.length - 2)}${javaCode} }`;
|
|
99
|
+
}
|
|
62
100
|
|
|
63
|
-
|
|
101
|
+
// Check if our call has been added in dispatchTouchEvent
|
|
102
|
+
const regExConnectDispatchTouchEvent = new RegExp(/Connect.INSTANCE.dispatchTouchEvent/, "g");
|
|
103
|
+
if (!regExConnectDispatchTouchEvent.test(updateMainActivityData)) {
|
|
104
|
+
updateMainActivity = true;
|
|
105
|
+
// Add Connect.INSTANCE.dispatchTouchEvent
|
|
106
|
+
updateMainActivityData = updateMainActivityData.replace(/return super.dispatchTouchEvent\(e\);/, javaCode3);
|
|
107
|
+
}
|
|
64
108
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
109
|
+
// Look for import
|
|
110
|
+
const regExImport = new RegExp("import com.acoustic.connect.android.connectmod.Connect", "g");
|
|
111
|
+
if(!regExImport.test(updateMainActivityData)){
|
|
112
|
+
updateMainActivity = true;
|
|
113
|
+
// Add import
|
|
114
|
+
updateMainActivityData = updateMainActivityData.replace(upperJavaCode,javaCode2);
|
|
115
|
+
}
|
|
68
116
|
|
|
69
|
-
|
|
117
|
+
// Update activity
|
|
118
|
+
if (updateMainActivity) {
|
|
119
|
+
updateMainActivityData = prettier.format(updateMainActivityData, {
|
|
70
120
|
parser: "java",
|
|
71
121
|
plugins: [javaPaserPlugin],
|
|
72
|
-
tabWidth:
|
|
122
|
+
tabWidth: 4,
|
|
73
123
|
});
|
|
74
124
|
|
|
75
125
|
try {
|
|
76
|
-
fs.writeFileSync(
|
|
126
|
+
fs.writeFileSync(mainActivityPath, updateMainActivityData);
|
|
127
|
+
console.log("Updated:" + mainActivityPath);
|
|
77
128
|
} catch (err) {
|
|
129
|
+
console.log("Error writing:" + mainActivityPath);
|
|
78
130
|
console.error(err);
|
|
79
131
|
}
|
|
132
|
+
} else {
|
|
133
|
+
console.log("Update not needed for:" + mainActivityPath);
|
|
80
134
|
}
|
|
135
|
+
|
|
136
|
+
console.log("*********************************************************************************************");
|