| 125 | |
| 126 | // Validate provided config for #ready, #setConfig |
| 127 | const validateConfig = (config) => { |
| 128 | // Detect obsolete notification* fields and re-map to Notification instance. |
| 129 | if ( |
| 130 | (config.notificationPriority) || |
| 131 | (config.notificationText) || |
| 132 | (config.notificationTitle) || |
| 133 | (config.notificationChannelName) || |
| 134 | (config.notificationColor) || |
| 135 | (config.notificationSmallIcon) || |
| 136 | (config.notificationLargeIcon) |
| 137 | ) { |
| 138 | console.warn('[BackgroundGeolocation] WARNING: Config.notification* fields (eg: notificationText) are all deprecated in favor of notification: {title: "My Title", text: "My Text"} See docs for "Notification" class'); |
| 139 | config.notification = { |
| 140 | text: config.notificationText, |
| 141 | title: config.notificationTitle, |
| 142 | color: config.notificationColor, |
| 143 | channelName: config.notificationChannelName, |
| 144 | smallIcon: config.notificationSmallIcon, |
| 145 | largeIcon: config.notificationLargeIcon, |
| 146 | priority: config.notificationPriority |
| 147 | }; |
| 148 | } |
| 149 | |
| 150 | config = TransistorAuthorizationService.applyIf(config); |
| 151 | |
| 152 | return config; |
| 153 | }; |
| 154 | |
| 155 | // Cached copy of DeviceInfo. |
| 156 | let deviceInfo = null; |