|
@@ -18,6 +18,7 @@
|
|
|
import {ContactControllerModel} from '../controller_model/contact';
|
|
|
import {supportsPassive, throttle} from '../helpers';
|
|
|
import {ExecuteService} from '../services/execute';
|
|
|
+import {SettingsService} from '../services/settings';
|
|
|
import {ControllerModelMode} from '../types/enums';
|
|
|
|
|
|
abstract class DialogController {
|
|
@@ -79,6 +80,55 @@ class SendFileController extends DialogController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Handle settings
|
|
|
+ */
|
|
|
+class SettingsController {
|
|
|
+
|
|
|
+ public static $inject = ['$mdDialog', 'SettingsService', '$window'];
|
|
|
+
|
|
|
+ public $mdDialog: ng.material.IDialogService;
|
|
|
+ public $window: ng.IWindowService;
|
|
|
+ public settingsService: threema.SettingsService;
|
|
|
+ public activeElement: HTMLElement | null;
|
|
|
+
|
|
|
+ // Setting Variables
|
|
|
+
|
|
|
+ constructor($mdDialog: ng.material.IDialogService , settingsService: threema.SettingsService,
|
|
|
+ $window: ng.IWindowService) {
|
|
|
+
|
|
|
+ this.$mdDialog = $mdDialog;
|
|
|
+ this.$window = $window;
|
|
|
+ this.activeElement = document.activeElement as HTMLElement;
|
|
|
+ this.settingsService = settingsService;
|
|
|
+
|
|
|
+ // Init Setting Variables
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // SettingsServices Methods
|
|
|
+
|
|
|
+ // Dialog Methods
|
|
|
+ public cancel(): void {
|
|
|
+ this.$mdDialog.cancel();
|
|
|
+ this.done();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected hide(data: any): void {
|
|
|
+ this.$mdDialog.hide(data);
|
|
|
+ this.done();
|
|
|
+ }
|
|
|
+
|
|
|
+ private done(): void {
|
|
|
+ if (this.activeElement !== null) {
|
|
|
+ // reset focus
|
|
|
+ // this.$window.location.reload();
|
|
|
+ this.activeElement.focus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
class ConversationController {
|
|
|
public name = 'navigation';
|
|
|
|
|
@@ -625,6 +675,21 @@ class NavigationController {
|
|
|
this.showDialog('about', ev);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Show settings dialog.
|
|
|
+ */
|
|
|
+ public settings(ev): void {
|
|
|
+ this.$mdDialog.show({
|
|
|
+ controller: SettingsController,
|
|
|
+ controllerAs: 'ctrl',
|
|
|
+ templateUrl: 'partials/dialog.settings.html',
|
|
|
+ parent: angular.element(document.body),
|
|
|
+ targetEvent: ev,
|
|
|
+ clickOutsideToClose: true,
|
|
|
+ fullscreen: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Return whether a trusted key is available.
|
|
|
*/
|
|
@@ -1130,5 +1195,4 @@ angular.module('3ema.messenger', ['ngMaterial'])
|
|
|
.controller('ReceiverDetailController', ReceiverDetailController)
|
|
|
.controller('ReceiverEditController', ReceiverEditController)
|
|
|
.controller('ReceiverCreateController', ReceiverCreateController)
|
|
|
-
|
|
|
;
|