AyogoHealth / cordova-plugin-update-notifier

Cordova plugin for showing a notification for app updates.
Apache License 2.0
27 stars 10 forks source link

How to keep SyrenAlert preference after capacitor sync #17

Closed abnersouza closed 2 years ago

abnersouza commented 2 years ago

Hi guys,

I'm using capacitor with Angular and I have added <preference name="SirenAlertType" value="critical" /> to the config.xml file inside the ios folder, but the issue I have is every time I run: npx cap sync, that config.xml file is rewritten, and the preference tag is removed.

Is there anyway to keep the preference tag after a sync or copy?

Here my config.xml file:

<?xml version='1.0' encoding='utf-8'?>
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
  <access origin="*" />

  <feature name="IosDisableBounce">
    <param name="ios-package" value="CDVIosDisableBounce"/>
  </feature>

  <feature name="UpdateNotifier">
    <param name="ios-package" value="CDVUpdateNotifierPlugin"/>
    <param name="onload" value="true"/>
  </feature>

  <preference name="SirenAlertType" value="critical" /> --> After sync this line is removed

</widget>

Wait to hear from you, Abner

dpogue commented 2 years ago

You can specify the preferences in your capacitor.config.json under a cordova key, and they will be added to config.xml by Capacitor during sync.

Example:

{
  "cordova": {
    "preferences": {
      "SirenAlertType": "critical",
      "AndroidUpdateAlertType": "Immediate"
    }
  }
}
abnersouza commented 2 years ago

You can specify the preferences in your capacitor.config.json under a cordova key, and they will be added to config.xml by Capacitor during sync.

Example:

{
  "cordova": {
    "preferences": {
      "SirenAlertType": "critical",
      "AndroidUpdateAlertType": "Immediate"
    }
  }
}

Thanks so much @dpogue one of my colleagues here sent that option to be added to the capacitor.config.ts, and is very much similar to your

cordova: {
    preferences: {
      SirenAlertType: "critical",
      AndroidUpdateAlertType: "Immediate"
    }
  },

Thanks, maybe as a suggestion to add that info to the reame.md file.