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 11, 2017
1 parent 8b8cf1d commit dcff225
Show file tree
Hide file tree
Showing 11 changed files with 903 additions and 723 deletions.
2 changes: 1 addition & 1 deletion app/script/main/app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class z.main.App
repository.bot = new z.bot.BotRepository @service.bot, repository.conversation
repository.calling = new z.calling.CallingRepository @service.call, @service.calling, repository.conversation, repository.media, repository.user
repository.event_tracker = new z.tracking.EventTrackingRepository repository.user, repository.conversation
repository.system_notification = new z.SystemNotification.SystemNotificationRepository repository.calling, repository.conversation
repository.system_notification = new z.system_notification.SystemNotificationRepository repository.calling, repository.conversation

return repository

Expand Down
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 dcff225

Please sign in to comment.