codeplay-common 3.1.8 → 3.1.9

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,113 @@ 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
+
2180
+ 👉 Expected code block not found.
2181
+
2182
+ This usually means Capacitor updated internally.
2183
+
2184
+ Please:
2185
+ 1. Open SystemBars.java
2186
+ 2. Update patch script
2187
+ 3. Re-run build
2188
+
2189
+ ⛔ Build stopped.
2190
+ `;
2191
+
2192
+ function patchFile() {
2193
+ if (!fs.existsSync(filePath)) {
2194
+ console.error("❌ SystemBars.java not found!");
2195
+ process.exit(1);
2196
+ }
2197
+
2198
+ let content = fs.readFileSync(filePath, "utf8");
2199
+
2200
+ // ✅ Already patched?
2201
+ if (content.includes("🔴 ORIGINAL CODE (COMMENTED FOR SAFETY)")) {
2202
+ console.log("✅ Already SystemBars.java patched. Skipping...");
2203
+ return;
2204
+ }
2205
+
2206
+ // 🔍 Check old block exists
2207
+ if (!content.includes(OLD_BLOCK)) {
2208
+ console.error(ERROR_MSG);
2209
+ process.exit(1);
2210
+ }
2211
+
2212
+ // 🔁 Replace
2213
+ const updated = content.replace(OLD_BLOCK, NEW_BLOCK);
2214
+
2215
+ fs.writeFileSync(filePath, updated, "utf8");
2216
+
2217
+ console.log("✅ SystemBars.java patched (comment + new logic)!");
2218
+ }
2219
+
2220
+ patchFile();
2221
+
2222
+ //################################## SystemBars.java update for "@capacitor/android": "^8.3.0" plugin END ###############################
2223
+
2224
+
2225
+
2226
+
2120
2227
  /*
2121
2228
  Release Notes
2122
2229