codeplay-common 1.8.6 → 1.8.8

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.
@@ -1,113 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
-
4
- // Define file paths
5
- const projectFolder = path.resolve(".");
6
- const sourceSplashIcon = path.join(projectFolder, "resources", "splash_icon.png");
7
- const destinationSplashIcon = path.join(
8
- projectFolder,
9
- "android",
10
- "app",
11
- "src",
12
- "main",
13
- "res",
14
- "drawable-nodpi",
15
- "splash_icon.png"
16
- );
17
- const sourceSplashXML = path.join(projectFolder,"buildCodeplay", "splashxml", "codeplay_splashScreen.xml");
18
- const destinationSplashXML = path.join(
19
- projectFolder,
20
- "android",
21
- "app",
22
- "src",
23
- "main",
24
- "res",
25
- "values",
26
- "codeplay_splashScreen.xml"
27
- );
28
- const androidManifestPath = path.join(
29
- projectFolder,
30
- "android",
31
- "app",
32
- "src",
33
- "main",
34
- "AndroidManifest.xml"
35
- );
36
-
37
- // Helper function to copy files
38
- function copyFile(source, destination) {
39
- if (!fs.existsSync(source)) {
40
- throw new Error(`Source file not found: ${source}`);
41
- }
42
- fs.mkdirSync(path.dirname(destination), { recursive: true });
43
- fs.copyFileSync(source, destination);
44
- console.log(`Copied: ${source} -> ${destination}`);
45
- }
46
-
47
- // Helper function to update AndroidManifest.xml
48
- function updateAndroidManifest() {
49
- if (!fs.existsSync(androidManifestPath)) {
50
- throw new Error(`AndroidManifest.xml not found: ${androidManifestPath}`);
51
- }
52
-
53
- let manifestContent = fs.readFileSync(androidManifestPath, "utf-8");
54
-
55
- manifestContent = manifestContent.replace(
56
- /<activity[^>]*?>/,
57
- (match) => {
58
- let updated = match;
59
-
60
- // If android:theme is already present, update it
61
- if (updated.includes('android:theme=')) {
62
- updated = updated.replace(
63
- /android:theme="[^"]*"/,
64
- 'android:theme="@style/Theme.Codeplay.SplashScreen"'
65
- );
66
- }
67
-
68
- // If android:resizeableActivity is already present, update it
69
- if (updated.includes('android:resizeableActivity=')) {
70
- updated = updated.replace(
71
- /android:resizeableActivity="[^"]*"/,
72
- 'android:resizeableActivity="false"'
73
- );
74
- } else {
75
- // Add resizeableActivity attribute
76
- updated = updated.replace('<activity', '<activity android:resizeableActivity="false"');
77
- }
78
-
79
-
80
- // If android:screenOrientation is already present, update it
81
- if (updated.includes('android:screenOrientation=')) {
82
- updated = updated.replace(
83
- /android:screenOrientation="[^"]*"/,
84
- 'android:screenOrientation="portrait"'
85
- );
86
- } else {
87
- updated = updated.replace(
88
- '<activity',
89
- '<activity android:screenOrientation="portrait"'
90
- );
91
- }
92
-
93
-
94
-
95
- return updated;
96
- }
97
- );
98
-
99
- fs.writeFileSync(androidManifestPath, manifestContent, "utf-8");
100
- console.log(`Updated AndroidManifest.xml: ensured resizeableActivity="false" and updated theme if present.`);
101
- }
102
-
103
- // Perform the tasks
104
- try {
105
- console.log("Starting splash screen setup...");
106
- copyFile(sourceSplashIcon, destinationSplashIcon);
107
- copyFile(sourceSplashXML, destinationSplashXML);
108
- updateAndroidManifest();
109
- console.log("Splash screen setup completed.");
110
- } catch (error) {
111
- console.error(`Error: ${error.message}`);
112
- process.exit(1);
113
- }