codeplay-common 3.1.8 → 3.2.0

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.
@@ -2117,6 +2117,116 @@ validateAndRestoreSignDetails()
2117
2117
 
2118
2118
  execSync('node buildCodeplay/fix-onesignal-plugin.js', { stdio: 'inherit' });
2119
2119
 
2120
+
2121
+
2122
+
2123
+
2124
+
2125
+
2126
+ //################################## SystemBars.java update for "@capacitor/android": "^8.3.0" plugin START ###############################
2127
+
2128
+
2129
+ const filePath = path.join(
2130
+ __dirname,
2131
+ "../node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/SystemBars.java"
2132
+ );
2133
+
2134
+ // 🔍 OLD BLOCK (anchor)
2135
+ const OLD_BLOCK = `if (shouldPassthroughInsets) {
2136
+ // We need to correct for a possible shown IME
2137
+ v.setPadding(0, 0, 0, keyboardVisible ? imeInsets.bottom : 0);
2138
+
2139
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM && hasViewportCover && insetHandlingEnabled) {
2140
+ Insets safeAreaInsets = calcSafeAreaInsets(insets);
2141
+ injectSafeAreaCSS(safeAreaInsets.top, safeAreaInsets.right, safeAreaInsets.bottom, safeAreaInsets.left);
2142
+ }
2143
+
2144
+ return new WindowInsetsCompat.Builder(insets)
2145
+ .setInsets(
2146
+ WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.displayCutout(),
2147
+ Insets.of(
2148
+ systemBarsInsets.left,
2149
+ systemBarsInsets.top,
2150
+ systemBarsInsets.right,
2151
+ getBottomInset(systemBarsInsets, keyboardVisible)
2152
+ )
2153
+ )
2154
+ .build();
2155
+ }`;
2156
+
2157
+ // ✅ NEW BLOCK
2158
+ const NEW_BLOCK = `if (shouldPassthroughInsets) {
2159
+ /* 🔴 ORIGINAL CODE (COMMENTED FOR SAFETY)
2160
+ ${OLD_BLOCK.split("\n").map(line => " " + line).join("\n")}
2161
+ */
2162
+
2163
+ // ✅ NEW LOGIC (CUSTOM FIX)
2164
+ v.setPadding(0, 0, 0, 0);
2165
+
2166
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM && hasViewportCover && insetHandlingEnabled) {
2167
+ Insets safeAreaInsets = calcSafeAreaInsets(insets);
2168
+ injectSafeAreaCSS(safeAreaInsets.top, safeAreaInsets.right, safeAreaInsets.bottom, safeAreaInsets.left);
2169
+ }
2170
+
2171
+ return insets; // WebView handles everything
2172
+ }`;
2173
+
2174
+ // 🚨 ERROR MESSAGE
2175
+ const ERROR_MSG = `
2176
+ ❌ Capacitor SystemBars.java structure changed!
2177
+
2178
+ Plugin: @capacitor/android
2179
+ Path : node_modules\@capacitor\android\capacitor\src\main\java\com\getcapacitor\plugin\SystemBars.java
2180
+
2181
+ Check version of "@capacitor/android": in package.json
2182
+
2183
+ 👉 Expected code block not found.
2184
+
2185
+ This usually means Capacitor updated internally.
2186
+
2187
+ Please:
2188
+ 1. Open SystemBars.java
2189
+ 2. Update patch script
2190
+ 3. Re-run build
2191
+
2192
+ ⛔ Build stopped.
2193
+ `;
2194
+
2195
+ function patchFile() {
2196
+ if (!fs.existsSync(filePath)) {
2197
+ console.error("❌ SystemBars.java not found!");
2198
+ process.exit(1);
2199
+ }
2200
+
2201
+ let content = fs.readFileSync(filePath, "utf8");
2202
+
2203
+ // ✅ Already patched?
2204
+ if (content.includes("🔴 ORIGINAL CODE (COMMENTED FOR SAFETY)")) {
2205
+ console.log("✅ Already SystemBars.java patched. Skipping...");
2206
+ return;
2207
+ }
2208
+
2209
+ // 🔍 Check old block exists
2210
+ if (!content.includes(OLD_BLOCK)) {
2211
+ console.error(ERROR_MSG);
2212
+ process.exit(1);
2213
+ }
2214
+
2215
+ // 🔁 Replace
2216
+ const updated = content.replace(OLD_BLOCK, NEW_BLOCK);
2217
+
2218
+ fs.writeFileSync(filePath, updated, "utf8");
2219
+
2220
+ console.log("✅ SystemBars.java patched (comment + new logic)!");
2221
+ }
2222
+
2223
+ patchFile();
2224
+
2225
+ //################################## SystemBars.java update for "@capacitor/android": "^8.3.0" plugin END ###############################
2226
+
2227
+
2228
+
2229
+
2120
2230
  /*
2121
2231
  Release Notes
2122
2232