Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
fix(updates): repair broken beta channel stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
RangerRick authored and Benjamin Reed committed Sep 20, 2020
1 parent 9600162 commit 30fb7db
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/lib/update.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import '@capacitor-community/http';

import { Injectable } from '@angular/core';
import { Platform } from '@ionic/angular';

import { Plugins } from '@capacitor/core';
const { Device } = Plugins;

import { Deploy } from 'cordova-plugin-ionic/dist/ngx';
import { ISnapshotInfo } from 'cordova-plugin-ionic/dist/ngx/IonicCordova';
Expand All @@ -27,7 +31,22 @@ export class UpdateService {

constructor(
private deploy: Deploy,
private platform: Platform,
) {
this.platform.ready().then(async () => {
try {
const deviceInfo = await Device.getInfo();
if (deviceInfo.platform !== 'web') {
const config = await this.deploy.getConfiguration();
const betaEnabled = config?.channel?.toLowerCase() === 'beta';
await this.deploy.configure({
channel: betaEnabled ? 'Beta' : 'Stable'
});
}
} catch (err) {
console.error('SettingsService.init(): failed to get configuration', err);
}
});
}

async reload() {
Expand Down

0 comments on commit 30fb7db

Please sign in to comment.