Add 'New update available' dialog to the electron version (#299)
* build(tsconfig): Rename root tsconfig.json -> tsconfig.base.json * feat(auto-update): Add update dialog When new update available than new message will visible of the top of the screen with 2 buttons 'Update' and 'Close'. - Update button: Update the application (close and restart) - Close button: Hide the updatePanel * fix(auto-update): Add types to the event methods * style: Add comma after SafeStylePipe import I forgot add the comma when I rebased the branch * fix(auto-update): Use electron-is-dev package to detect dev build I removed the isDev() function from the shared util library because it is electron specific code. * ci: Change osx_image: xcode8.3 Recommended after the last travis upgrade * feat(auto-update): Add auto update settings page and save config save on electron platform * ci: Fix osx image * ci: Upgrade the electron builder -> 19.6.1 The builder now use the 2 package.json structure and build only the necessary dependencies.
This commit is contained in:
committed by
László Monda
parent
2598109f8c
commit
121807a65a
@@ -1,12 +1,17 @@
|
||||
import { InjectionToken } from '@angular/core';
|
||||
|
||||
import { UserConfiguration } from '../config-serializer/config-items/UserConfiguration';
|
||||
import { AutoUpdateSettings } from '../models/auto-update-settings';
|
||||
|
||||
export interface DataStorageRepositoryService {
|
||||
|
||||
getConfig(): UserConfiguration;
|
||||
|
||||
saveConfig(config: UserConfiguration): void;
|
||||
|
||||
getAutoUpdateSettings(): AutoUpdateSettings;
|
||||
|
||||
saveAutoUpdateSettings(settings: AutoUpdateSettings): void;
|
||||
}
|
||||
|
||||
export let DATA_STORAGE_REPOSITORY = new InjectionToken('dataStorage-repository');
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { UserConfiguration } from '../config-serializer/config-items/UserConfiguration';
|
||||
import { DataStorageRepositoryService } from './datastorage-repository.service';
|
||||
import { DefaultUserConfigurationService } from './default-user-configuration.service';
|
||||
import { State as AutoUpdateSettings } from '../store/reducers/auto-update-settings';
|
||||
|
||||
@Injectable()
|
||||
export class LocalDataStorageRepositoryService implements DataStorageRepositoryService {
|
||||
constructor(private defaultUserConfigurationService: DefaultUserConfigurationService) { }
|
||||
|
||||
getConfig(): UserConfiguration {
|
||||
const configJsonString = localStorage.getItem('config');
|
||||
let config: UserConfiguration;
|
||||
|
||||
if (configJsonString) {
|
||||
const configJsonObject = JSON.parse(configJsonString);
|
||||
if (configJsonObject.dataModelVersion === this.defaultUserConfigurationService.getDefault().dataModelVersion) {
|
||||
config = new UserConfiguration().fromJsonObject(configJsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
return config;
|
||||
return JSON.parse(localStorage.getItem('config'));
|
||||
}
|
||||
|
||||
saveConfig(config: UserConfiguration): void {
|
||||
localStorage.setItem('config', JSON.stringify(config.toJsonObject()));
|
||||
}
|
||||
|
||||
getAutoUpdateSettings(): AutoUpdateSettings {
|
||||
return JSON.parse(localStorage.getItem('auto-update-settings'));
|
||||
}
|
||||
|
||||
saveAutoUpdateSettings(settings: AutoUpdateSettings): void {
|
||||
localStorage.setItem('auto-update-settings', JSON.stringify(settings));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user