Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function initCapacitor() {
// Platform checks
Vue.prototype.$isWeb = helpers.isWeb()
Vue.prototype.$isIOS = helpers.isIOS()
// Set status-bar background and style
StatusBar.setBackgroundColor({ color: helpers.env('INITIAL_STATUSBAR_COLOR') }).catch(helpers.err)
StatusBar.setStyle({ style: StatusBarStyle.Light }).catch(helpers.err)
// Set network checks
Network.getStatus()
.then(s => (Vue.prototype.$networkStatus = s))
.catch(helpers.err)
// Listen to network changes
Network.addListener('networkStatusChange', s => (Vue.prototype.$networkStatus = s)).catch(
helpers.err
)
}
async function initCapacitor() {
const info = await Device.getInfo();
if (info.platform !== 'web') {
const { App, StatusBar } = Plugins;
StatusBar.setStyle(StatusBarStyle.Light);
StatusBar.setBackgroundColor({ color: '#220631'});
App.addListener('appUrlOpen', (data) => {
if (data.url) {
let authResponse = data.url.split(":")[1];
if (authResponse) {
window.location = window.location + '?authResponse=' + authResponse;
}
}
});
}
}
beforeRouteLeave(to, from, next) {
for (const selector of metaSelectors) {
document.querySelector(selector).content = this.initialStatusbarColor
}
StatusBar.setBackgroundColor({ color: this.initialStatusbarColor }).catch(this.$helpers.err)
StatusBar.setStyle({ style: StatusBarStyle.Light }).catch(this.$helpers.err)
next()
},
}