diff options
author | Minseo Lee <itoupluk427@gmail.com> | 2024-03-07 11:19:50 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-07 11:19:50 +0900 |
commit | e74c46e9ab480959c4416f83a78289e460bdeec7 (patch) | |
tree | c770265051354782bb6e779905e0351cc8f8abd9 /plugins/withAndroidManifestFCMIconPlugin.js | |
parent | f3db23a3b14e9444cb499c727b9d62c414e5a840 (diff) | |
parent | 8b0e575f6423575c08e9a6748be41c888611d631 (diff) | |
download | voidsky-e74c46e9ab480959c4416f83a78289e460bdeec7.tar.zst |
Merge branch 'main' into patch-3
Diffstat (limited to 'plugins/withAndroidManifestFCMIconPlugin.js')
-rw-r--r-- | plugins/withAndroidManifestFCMIconPlugin.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/withAndroidManifestFCMIconPlugin.js b/plugins/withAndroidManifestFCMIconPlugin.js new file mode 100644 index 000000000..066a975d8 --- /dev/null +++ b/plugins/withAndroidManifestFCMIconPlugin.js @@ -0,0 +1,37 @@ +const {withAndroidManifest} = require('expo/config-plugins') + +module.exports = function withAndroidManifestFCMIconPlugin(appConfig) { + return withAndroidManifest(appConfig, function (decoratedAppConfig) { + try { + function addOrModifyMetaData(metaData, name, resource) { + const elem = metaData.find(elem => elem.$['android:name'] === name) + if (elem === undefined) { + metaData.push({ + $: { + 'android:name': name, + 'android:resource': resource, + }, + }) + } else { + elem.$['android:resource'] = resource + } + } + const androidManifest = decoratedAppConfig.modResults.manifest + const metaData = androidManifest.application[0]['meta-data'] + addOrModifyMetaData( + metaData, + 'com.google.firebase.messaging.default_notification_color', + '@color/notification_icon_color', + ) + addOrModifyMetaData( + metaData, + 'com.google.firebase.messaging.default_notification_icon', + '@drawable/notification_icon', + ) + return decoratedAppConfig + } catch (e) { + console.error(`withAndroidManifestFCMIconPlugin failed`, e) + } + return decoratedAppConfig + }) +} |