-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gregor Herdmann
committed
Apr 18, 2017
1 parent
2ac8e1a
commit aeefbb5
Showing
20 changed files
with
395 additions
and
345 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* 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.message = z.message || {}; | ||
|
||
/** | ||
* Enum for different call message types. | ||
* @returns {z.message.CALL_MESSAGE_TYPE} Enum of call message types | ||
*/ | ||
z.message.CALL_MESSAGE_TYPE = { | ||
ACTIVATED: 'activated', | ||
DEACTIVATED: 'deactivated', | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* 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.message = z.message || {}; | ||
|
||
/** | ||
* Enum of different ephemeral status types. | ||
* @type {z.message.EphemeralStatusType} Enum of ephemeral status types | ||
*/ | ||
z.message.EphemeralStatusType = { | ||
ACTIVE: 1, | ||
INACTIVE: 2, | ||
NONE: 0, | ||
TIMED_OUT: 3, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* 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.message = z.message || {}; | ||
|
||
z.message.MessageCategorization = (function() { | ||
|
||
const _check_text = function(event) { | ||
if (event.type === z.event.Backend.CONVERSATION.MESSAGE_ADD) { | ||
let category = z.message.MessageCategory.TEXT; | ||
|
||
if (event.data.previews && event.data.previews.length > 0) { | ||
category = category | z.message.MessageCategory.LINK | z.message.MessageCategory.LINK_PREVIEW; | ||
} | ||
|
||
return category; | ||
} | ||
}; | ||
|
||
const _check_image = function(event) { | ||
if (event.type === z.event.Backend.CONVERSATION.ASSET_ADD) { | ||
let category = z.message.MessageCategory.IMAGE; | ||
|
||
if (event.data.content_type === 'image/gif') { | ||
category = category | z.message.MessageCategory.GIF; | ||
} | ||
|
||
return category; | ||
} | ||
}; | ||
|
||
const _check_file = function(event) { | ||
if (event.type === z.event.Client.CONVERSATION.ASSET_META) { | ||
return z.message.MessageCategory.FILE; | ||
} | ||
}; | ||
|
||
const _check_ping = function(event) { | ||
if (event.type === z.event.Backend.CONVERSATION.KNOCK) { | ||
return z.message.MessageCategory.KNOCK; | ||
} | ||
}; | ||
|
||
const _check_location = function(event) { | ||
if (event.type === z.event.Client.CONVERSATION.LOCATION) { | ||
return z.message.MessageCategory.LOCATION; | ||
} | ||
}; | ||
|
||
const _category_from_event = function(event) { | ||
try { | ||
let category = z.message.MessageCategory.NONE; | ||
|
||
if (event.ephemeral_expires) { // String, Number, true | ||
return z.message.MessageCategory.NONE; | ||
} | ||
|
||
for (const check of [_check_text, _check_image, _check_file, _check_ping, _check_location]) { | ||
const temp_category = check(event); | ||
if (temp_category) { | ||
category = temp_category; | ||
break; | ||
} | ||
} | ||
|
||
if (_.isObject(event.reactions) && (Object.keys(event.reactions).length > 0)) { | ||
category = category | z.message.MessageCategory.LIKED; | ||
} | ||
|
||
return category; | ||
|
||
} catch (error) { | ||
return z.message.MessageCategory.UNDEFINED; | ||
} | ||
}; | ||
|
||
return { | ||
category_from_event: _category_from_event, | ||
}; | ||
})(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* 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.message = z.message || {}; | ||
|
||
/** | ||
* Enum for different message categories. | ||
* @returns {z.message.MessageCategory} Enum of message categories | ||
*/ | ||
z.message.MessageCategory = { | ||
AUDIO: 1 << 10, | ||
EXCLUDED: 1 << 1, | ||
FILE: 1 << 9, | ||
GIF: 1 << 8, | ||
IMAGE: 1 << 7, | ||
KNOCK: 1 << 2, | ||
LIKED: 1 << 13, | ||
LINK: 1 << 5, | ||
LINK_PREVIEW: 1 << 6, | ||
LOCATION: 1 << 12, | ||
NONE: 0, | ||
SYSTEM: 1 << 3, | ||
TEXT: 1 << 4, | ||
UNDEFINED: 1 << 0, | ||
VIDEO: 1 << 11, | ||
}; |
Oops, something went wrong.