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

Commit

Permalink
fix(update): undo broken beta channel config
Browse files Browse the repository at this point in the history
  • Loading branch information
RangerRick committed Sep 20, 2020
1 parent 3c0ced9 commit 5f5b641
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/lib/update.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ 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 @@ -28,8 +31,23 @@ export class UpdateService {

constructor(
private deploy: Deploy,
private device: Device,
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 5f5b641

Please sign in to comment.