Skip to content

Commit

Permalink
ES6: migrated "system_notification"
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregor Herdmann committed Apr 10, 2017
1 parent 56db472 commit b12240c
Show file tree
Hide file tree
Showing 8 changed files with 879 additions and 719 deletions.
30 changes: 0 additions & 30 deletions app/script/system_notification/PermissionStatusState.coffee

This file was deleted.

33 changes: 33 additions & 0 deletions app/script/system_notification/PermissionStatusState.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Wire
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

'use strict';

window.z = window.z || {};
window.z.system_notification = z.system_notification || {};

// https://developer.mozilla.org/en-US/docs/Web/API/PermissionStatus/state
z.system_notification.PermissionStatusState = {
DEFAULT: 'default',
DENIED: 'denied',
GRANTED: 'granted',
IGNORED: 'ignored',
PROMPT: 'prompt',
UNSUPPORTED: 'unsupported',
};
38 changes: 0 additions & 38 deletions app/script/system_notification/SystemNotificationError.coffee

This file was deleted.

48 changes: 48 additions & 0 deletions app/script/system_notification/SystemNotificationError.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Wire
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

'use strict';

window.z = window.z || {};
window.z.system_notification = z.system_notification || {};

z.system_notification.SystemNotificationError = class SystemNotificationError extends Error {
constructor(type) {
super();

this.name = this.constructor.name;
this.stack = (new Error()).stack;
this.type = type || z.cryptography.CryptographyError.TYPE.UNKNOWN;

switch (this.type) {
case z.system_notification.SystemNotificationError.TYPE.HIDE_NOTIFICATION:
this.message = 'Do not show notification for this message';
break;
default:
this.message = 'Unknown SystemNotificationError';
}
}

static get TYPE() {
return {
HIDE_NOTIFICATION: 'z.system_notification.SystemNotificationError.TYPE.HIDE_NOTIFICATION',
UNKNOWN: 'z.system_notification.SystemNotificationError.TYPE.UNKNOWN',
};
}
};
27 changes: 0 additions & 27 deletions app/script/system_notification/SystemNotificationPreference.coffee

This file was deleted.

31 changes: 31 additions & 0 deletions app/script/system_notification/SystemNotificationPreference.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Wire
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

'use strict';

window.z = window.z || {};
window.z.system_notification = z.system_notification || {};

// Enum of notification preferences.
z.system_notification.SystemNotificationPreference = {
NONE: 'none',
OBFUSCATE: 'obfuscate',
OBFUSCATE_MESSAGE: 'obfuscate-message',
ON: 'on',
};
Loading

0 comments on commit b12240c

Please sign in to comment.