Преглед изворни кода

Fix about dialog (#883)

Fixes #849
Danilo Bargen пре 6 година
родитељ
комит
0239108cbc
3 измењених фајлова са 33 додато и 4 уклоњено
  1. 1 1
      src/partials/dialog.about.html
  2. 14 3
      src/partials/messenger.ts
  3. 18 0
      src/types/helpers.d.ts

+ 1 - 1
src/partials/dialog.about.html

@@ -32,7 +32,7 @@
                 <h2 translate>about.LICENSES</h2>
                 <ul>
                     <li translate>about.EMOJI_ART</li>
-                    <li translate translate-values="{ url: 'https://github.com/threema-ch/threema-web/blob/{{ ctrl.config.GIT_BRANCH }}/LICENSE-3RD-PARTY.txt' }">about.LICENSE_LINK</li>
+                    <li translate translate-values="{ url: 'https://github.com/threema-ch/threema-web/blob/{{ ctrl.config.GIT_BRANCH }}/LICENSE-3RD-PARTY.txt' }">about.LICENSE_TEXT</li>
                     <li translate>about.NOTIFICATION_SOUNDS</li>
                 </ul>
 

+ 14 - 3
src/partials/messenger.ts

@@ -44,6 +44,7 @@ import {TimeoutService} from '../services/timeout';
 import {VersionService} from '../services/version';
 import {WebClientService} from '../services/webclient';
 import {controllerModelHasMembers, isContactReceiver} from '../typeguards';
+import {Type} from '../types/helpers';
 
 // Type aliases
 import ControllerModelMode = threema.ControllerModelMode;
@@ -906,6 +907,16 @@ class ConversationController {
     }
 }
 
+class AboutDialogController extends DialogController {
+    public readonly config: threema.Config;
+
+    public static readonly $inject = ['$mdDialog', 'CONFIG'];
+    constructor($mdDialog: ng.material.IDialogService, config: threema.Config) {
+        super($mdDialog);
+        this.config = config;
+    }
+}
+
 class NavigationController {
 
     public name = 'navigation';
@@ -1031,9 +1042,9 @@ class NavigationController {
     /**
      * Show dialog.
      */
-    public showDialog(name, ev) {
+    public showDialog(name: string, ev: Event, controller: Type<DialogController> = DialogController) {
         this.$mdDialog.show({
-            controller: DialogController,
+            controller: controller,
             controllerAs: 'ctrl',
             templateUrl: 'partials/dialog.' + name + '.html',
             parent: angular.element(document.body),
@@ -1047,7 +1058,7 @@ class NavigationController {
      * Show about dialog.
      */
     public about(ev): void {
-        this.showDialog('about', ev);
+        this.showDialog('about', ev, AboutDialogController);
     }
 
     /**

+ 18 - 0
src/types/helpers.d.ts

@@ -0,0 +1,18 @@
+/**
+ * This file is part of Threema Web.
+ *
+ * Threema Web is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Threema Web. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+export type Type<T> = new (...args: any[]) => T;