codeplay-common 2.1.42 → 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.
package/files/buildCodeplay/{packageidBaseModification-1.3.js → packageidBaseModification-1.4.js}
RENAMED
|
@@ -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;
|