Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
feat: add auto install switch
Browse files Browse the repository at this point in the history
Change-Id: I88402be61c6ccc816ecd51496e75cc4770e2eefc
  • Loading branch information
myml committed Dec 17, 2018
1 parent abf53c1 commit fa8c844
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<div class="remote-install">
<div class="auto-install">
<span class="subtitle">自动安装新软件</span>
<dstore-switch-button></dstore-switch-button>
<dstore-switch-button
[value]="autoInstall | async"
(valueChange)="change($event)"
></dstore-switch-button>
</div>
<dstore-batch-install #batchInstall></dstore-batch-install>
<button class="primary"
(click)="batchInstall.show()">一键安装</button>
</div>
<button class="primary" (click)="batchInstall.show()">一键安装</button>
</div>
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { Component, OnInit, Input } from '@angular/core';
import { App } from 'app/services/app.service';
import { AutoInstallService } from '../../services/auto-install.service';

@Component({
selector: 'dstore-remote-install',
templateUrl: './remote-install.component.html',
styleUrls: ['./remote-install.component.scss'],
})
export class RemoteInstallComponent implements OnInit {
@Input()
apps: App[] = [];
constructor() {}

constructor(private autoInstallService: AutoInstallService) {}
autoInstall = this.autoInstallService.getAutoInstall();
ngOnInit() {}
change(auto: boolean) {
this.autoInstallService.setAutoInstall(auto);
}
}
17 changes: 17 additions & 0 deletions src/web/src/app/modules/my-apps/services/auto-install.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Injectable, NgZone } from '@angular/core';
import { Channel } from 'app/modules/client/utils/channel';

@Injectable({
providedIn: 'root',
})
export class AutoInstallService {
constructor(private zone: NgZone) {}
setAutoInstall(auto: boolean) {
return Channel.exec('settings.setAutoInstall', auto);
}
getAutoInstall() {
return Channel.exec('settings.getAutoInstall').then(() =>
this.zone.run(() => {}),
);
}
}
1 change: 0 additions & 1 deletion src/web/src/app/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export class AuthService {
).pipe(
map(info => {
this.zone.run(() => {});
return null;
if (info && info.UserID) {
console.log('welcome', info.UserID);
return info;
Expand Down

0 comments on commit fa8c844

Please sign in to comment.