codeplay-common 2.1.41 → 2.1.43

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.
@@ -22,7 +22,7 @@ const requiredPlugins = [
22
22
  { pattern: /localNotification_AppSettings-(\d+\.\d+)\.js$/, minVersion: '1.0', required: true, baseDir: 'js',mandatoryUpdate: false },
23
23
  { pattern: /onesignal-(\d+\.\d+)\.js$/, minVersion: '2.3', required: true, baseDir: 'js',mandatoryUpdate: false },
24
24
  { pattern: /saveToGalleryAndSaveAnyFile-(\d+\.\d+)(-ios)?\.js$/, minVersion: '3.1', required: true, baseDir: 'js',mandatoryUpdate: true },
25
- { pattern: /Ads[\/\\]admob-emi-(\d+\.\d+)\.js$/, minVersion: '3.4', required: true, baseDir: 'js',mandatoryUpdate: true },
25
+ { pattern: /Ads[\/\\]admob-emi-(\d+\.\d+)\.js$/, minVersion: '3.6', required: true, baseDir: 'js',mandatoryUpdate: true },
26
26
 
27
27
  // New added plugins
28
28
  { pattern: /video-player-(\d+\.\d+)\.js$/, minVersion: '1.5', required: true, baseDir: 'js',mandatoryUpdate: false },
@@ -34,7 +34,7 @@ const requiredPlugins = [
34
34
  { pattern: /IAP-(\d+\.\d+)$/, minVersion: '2.7', isFolder: true , required: true, baseDir: 'js/Ads',mandatoryUpdate: true },
35
35
  { pattern: /editor-(\d+\.\d+)$/, minVersion: '1.9', isFolder: true, required: true, baseDir: 'js',mandatoryUpdate: true },
36
36
  { pattern: /ffmpeg-(\d+\.\d+)$/, minVersion: '1.3', isFolder: true, required: true, baseDir: 'js',mandatoryUpdate: false },
37
- { pattern: /theme-(\d+\.\d+)$/, minVersion: '2.6', isFolder: true , required: true, baseDir: 'theme',mandatoryUpdate: true },
37
+ { pattern: /theme-(\d+\.\d+)$/, minVersion: '2.8', isFolder: true , required: true, baseDir: 'theme',mandatoryUpdate: true },
38
38
 
39
39
 
40
40
  { pattern: /certificatejs-(\d+\.\d+)$/, minVersion: '1.6', isFolder: true , required: true, baseDir: 'certificate',mandatoryUpdate: true }
@@ -1246,7 +1246,7 @@ const REQUIRED_CONFIG_KEYS = [
1246
1246
  }
1247
1247
 
1248
1248
 
1249
- const admobConfigMinVersion="1.4"
1249
+ const admobConfigMinVersion="1.5"
1250
1250
 
1251
1251
  if (compareVersion(admobConfigInJson.VERSION, admobConfigMinVersion) < 0) {
1252
1252
  console.error(`❌ Please use at-least version ${admobConfigMinVersion} in "src/js/Ads/admob-ad-configuration.json"`);
@@ -263,6 +263,72 @@ const targetAppId=config.appId
263
263
 
264
264
 
265
265
 
266
+
267
+
268
+
269
+
270
+ function isNotificationFeatureUsed() {
271
+ const jsDir = path.join(process.cwd(), 'src', 'js');
272
+
273
+ if (!fs.existsSync(jsDir)) return false;
274
+
275
+ const notificationFiles = fs.readdirSync(jsDir).filter(file =>
276
+ /^onesignal-.*\.js$/.test(file) || /^localNotification-.*\.js$/.test(file)
277
+ );
278
+
279
+ if (notificationFiles.length === 0) return false;
280
+
281
+ // collect all js files to scan imports
282
+ const allJsFiles = [];
283
+
284
+ const walk = (dir) => {
285
+ fs.readdirSync(dir).forEach(file => {
286
+ const fullPath = path.join(dir, file);
287
+ if (fs.statSync(fullPath).isDirectory()) {
288
+ walk(fullPath);
289
+ } else if (file.endsWith('.js')) {
290
+ allJsFiles.push(fullPath);
291
+ }
292
+ });
293
+ };
294
+
295
+ walk(path.join(process.cwd(), 'src'));
296
+
297
+ // check if notification file is imported anywhere
298
+ for (const notifFile of notificationFiles) {
299
+ const importRegex = new RegExp(notifFile.replace('.js', ''), 'g');
300
+
301
+ for (const file of allJsFiles) {
302
+ const content = fs.readFileSync(file, 'utf8');
303
+ if (importRegex.test(content)) {
304
+ console.log(`🔔 Notification feature detected via ${notifFile}`);
305
+ return true;
306
+ }
307
+ }
308
+ }
309
+
310
+ return false;
311
+ }
312
+
313
+ function addPostNotificationPermissionIfNeeded() {
314
+ const permission =
315
+ '<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />';
316
+
317
+ if (!isNotificationFeatureUsed()) {
318
+ console.log('ℹ️ Notification feature not used. Skipping POST_NOTIFICATIONS permission.');
319
+ return;
320
+ }
321
+
322
+ console.log('✅ Notification feature is used. Ensuring POST_NOTIFICATIONS permission...');
323
+ addAndroidPermissions([permission]);
324
+ }
325
+
326
+
327
+ addPostNotificationPermissionIfNeeded();
328
+
329
+
330
+
331
+
266
332
  //console.log("TARGET APP ID IS : "+ targetAppId)
267
333
 
268
334
  let permissions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "2.1.41",
3
+ "version": "2.1.43",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",