diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.html
index c76235f8..be398efc 100644
--- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.html
+++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.html
@@ -13,10 +13,11 @@
-
+
+
+
응용 프로그램
- 응용 프로그램 자동 시작
+ 응용 프로그램 자동 시작
- 백그라운드에서 응용 프로그램 열기
+ 백그라운드에서 응용 프로그램 열기
- 닫을 시 응용 프로그램을 계속 실행
+ 닫을 시 응용 프로그램을 계속 실행
로그인
- 실행 시 자동 로그인
+ 실행 시 자동 로그인
@@ -59,11 +76,14 @@
언어
-
-
+
+
한국어 (대한민국)
-
+
영어 (미국)
@@ -75,7 +95,10 @@
시간대
-
+
한국어 (대한민국)
diff --git a/projects/ucap-webmessenger-ui-settings/src/lib/components/general.component.ts b/projects/ucap-webmessenger-ui-settings/src/lib/components/general.component.ts
index 7c0cab31..c178aec9 100644
--- a/projects/ucap-webmessenger-ui-settings/src/lib/components/general.component.ts
+++ b/projects/ucap-webmessenger-ui-settings/src/lib/components/general.component.ts
@@ -3,10 +3,17 @@ import {
OnInit,
ChangeDetectorRef,
Output,
- EventEmitter
+ EventEmitter,
+ Input,
+ ViewChild
} from '@angular/core';
-import { FormGroup, FormBuilder } from '@angular/forms';
-import { MatTabChangeEvent } from '@angular/material';
+import {
+ MatTabChangeEvent,
+ MatTabGroup,
+ MatCheckboxChange,
+ MatSelectChange
+} from '@angular/material';
+import { GeneralSetting } from '../models/settings';
@Component({
selector: 'ucap-settings-general',
@@ -14,17 +21,32 @@ import { MatTabChangeEvent } from '@angular/material';
styleUrls: ['./general.component.scss']
})
export class GeneralComponent implements OnInit {
- loginForm: FormGroup;
+ @Input()
+ setting: GeneralSetting;
@Output()
- selectTheme = new EventEmitter();
+ changed = new EventEmitter();
- constructor(
- private formBuilder: FormBuilder,
- private changeDetectorRef: ChangeDetectorRef
- ) {}
+ @ViewChild('themeTabGroup', { static: true })
+ themeTabGroup: MatTabGroup;
- ngOnInit() {}
+ constructor(private changeDetectorRef: ChangeDetectorRef) {}
+
+ ngOnInit() {
+ let themeIndex;
+ switch (this.setting.appTheme) {
+ case 'theme-default':
+ themeIndex = 0;
+ break;
+ case 'theme-lgRed':
+ themeIndex = 1;
+ break;
+ default:
+ themeIndex = 0;
+ break;
+ }
+ this.themeTabGroup.selectedIndex = themeIndex;
+ }
onSelectedTabChange(e: MatTabChangeEvent) {
let theme = 'theme-default';
@@ -39,8 +61,32 @@ export class GeneralComponent implements OnInit {
break;
}
- this.selectTheme.emit(theme);
+ this.emit({ ...this.setting, appTheme: theme });
}
- onClickLogin() {}
+ onChangeAutoStart(event: MatCheckboxChange) {
+ this.emit({ ...this.setting, autoStart: event.checked });
+ }
+ onChangeStartBackgroudMode(event: MatCheckboxChange) {
+ this.emit({ ...this.setting, startBackgroudMode: event.checked });
+ }
+ onChangeContinueRunWhenClose(event: MatCheckboxChange) {
+ this.emit({ ...this.setting, continueRunWhenClose: event.checked });
+ }
+ onChangeAutoLogin(event: MatCheckboxChange) {
+ this.emit({ ...this.setting, autoLogin: event.checked });
+ }
+
+ onSelectionChangeLocale(event: MatSelectChange) {
+ this.emit({ ...this.setting, locale: event.value });
+ }
+
+ onSelectionChangeTimezone(event: MatSelectChange) {
+ this.emit({ ...this.setting, timezone: event.value });
+ }
+
+ private emit(setting: GeneralSetting) {
+ this.setting = setting;
+ this.changed.emit(this.setting);
+ }
}
diff --git a/projects/ucap-webmessenger-ui-settings/src/lib/components/notification.component.ts b/projects/ucap-webmessenger-ui-settings/src/lib/components/notification.component.ts
index 84675b40..37673ba0 100644
--- a/projects/ucap-webmessenger-ui-settings/src/lib/components/notification.component.ts
+++ b/projects/ucap-webmessenger-ui-settings/src/lib/components/notification.component.ts
@@ -1,5 +1,6 @@
-import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
+import { Component, OnInit, ChangeDetectorRef, Input } from '@angular/core';
import { FormGroup, FormBuilder } from '@angular/forms';
+import { NotificationSetting } from '../models/settings';
@Component({
selector: 'ucap-settings-notification',
@@ -7,6 +8,9 @@ import { FormGroup, FormBuilder } from '@angular/forms';
styleUrls: ['./notification.component.scss']
})
export class NotificationComponent implements OnInit {
+ @Input()
+ setting: NotificationSetting;
+
loginForm: FormGroup;
constructor(
diff --git a/projects/ucap-webmessenger-ui-settings/src/lib/models/settings.ts b/projects/ucap-webmessenger-ui-settings/src/lib/models/settings.ts
new file mode 100644
index 00000000..9552d053
--- /dev/null
+++ b/projects/ucap-webmessenger-ui-settings/src/lib/models/settings.ts
@@ -0,0 +1,18 @@
+export interface GeneralSetting {
+ appTheme: string;
+ autoStart: boolean;
+ startBackgroudMode: boolean;
+ continueRunWhenClose: boolean;
+ autoLogin: boolean;
+ locale: string;
+ timezone: string;
+}
+
+export interface NotificationSetting {
+ chatMessage: boolean;
+}
+
+export interface Settings {
+ general: GeneralSetting;
+ notification: NotificationSetting;
+}
diff --git a/projects/ucap-webmessenger-ui-settings/src/public-api.ts b/projects/ucap-webmessenger-ui-settings/src/public-api.ts
index 93dc960e..f5cc94ab 100644
--- a/projects/ucap-webmessenger-ui-settings/src/public-api.ts
+++ b/projects/ucap-webmessenger-ui-settings/src/public-api.ts
@@ -3,5 +3,6 @@
*/
export * from './lib/components/general.component';
+export * from './lib/models/settings';
export * from './lib/ucap-ui-settings.module';