Skip to content

Commit

Permalink
Merge pull request #136 from wireapp/dev
Browse files Browse the repository at this point in the history
release 2016-08-29
  • Loading branch information
Gregor Herdmann authored Aug 29, 2016
2 parents 2189826 + 12cb6be commit 587864a
Show file tree
Hide file tree
Showing 53 changed files with 1,012 additions and 511 deletions.
2 changes: 1 addition & 1 deletion app/page/template/_dist/vendor.htm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<script src="/ext/js/jquery.js"></script>
<script src="/ext/js/jquery.iframetracker.js"></script>
<script src="/ext/js/jquery.mousewheel.js"></script>
<script src="/ext/js/adapter-1.4.0.js"></script>
<script src="/ext/js/adapter.js"></script>
<script src="/ext/js/amplify.js"></script>
<script src="/ext/js/antiscroll-2.js"></script>
<script src="/ext/js/canvas-to-blob.js"></script>
Expand Down
76 changes: 47 additions & 29 deletions app/page/template/conversation/conversation-input.htm
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<!--@formatter:off-->
<div class="conversation-input"
data-bind="with: $root.conversation_input, css: {'conversation-input-separator': $root.conversation_input.list_not_bottom()}">
data-bind="with: $root.conversation_input,
css: {
'conversation-input-separator': $root.conversation_input.list_not_bottom(),
'conversation-input-editing': $root.conversation_input.is_editing()
}">

<!-- ko if: conversation_et() && conversation_et().connection().status() !== z.user.ConnectionStatus.SENT -->
<div class="controls-left">
<!-- ko if: conversation_et().input().length > 0 -->
<!-- ko if: input().length > 0 -->
<user-avatar class="user-avatar-xs cursor-default" params="user: self()"></user-avatar>
<!-- /ko -->
</div>
Expand All @@ -13,12 +17,12 @@
<div class="controls-center">
<textarea id="conversation-input-text"
class="conversation-input-text border-theme"
data-bind="css: {'show-cursor': !conversation_et().input()},
data-bind="event: {'keydown': on_input_key_down},
focus_on_keydown: true,
enter: send_message,
enter: on_input_enter,
hasFocus: blinking_cursor,
textInput: conversation_et().input,
resize: conversation_et().input,
textInput: input,
resize: input,
resize_callback: scroll_message_list,
click: on_input_click,
l10n_placeholder: z.string.tooltip_conversation_input_placeholder"
Expand All @@ -28,33 +32,47 @@

<div class="controls-right">

<!-- ko if: show_giphy_button -->
<span class="controls-right-button button-icon-large icon-gif"
data-bind="click: toggle_extensions_menu, l10n_tooltip: z.string.extensions_bubble_button_gif"
data-uie-name="do-giphy-popover">
</span>
<!-- ko ifnot: is_editing -->

<!-- ko if: show_giphy_button -->
<span class="controls-right-button button-icon-large icon-gif"
data-bind="click: toggle_extensions_menu, l10n_tooltip: z.string.extensions_bubble_button_gif"
data-uie-name="do-giphy-popover">
</span>
<!-- /ko -->

<!-- ko if: input().length === 0 -->
<label id="conversation-input-photo"
class="controls-right-button button-icon-large icon-library"
data-bind="attr: {'title': picture_tooltip}">
<input data-bind="file_select: upload_images" type="file" multiple="multiple"
accept=".jpg-large, image/jpeg, image/png, image/bmp, image/gif" data-uie-name="do-share-image"/>
</label>

<label id="conversation-input-files"
class="controls-right-button button-icon-large icon-attachment"
data-bind="attr: {'title': file_tooltip}">
<input data-bind="file_select: upload_files" type="file" multiple="multiple"
accept="*" data-uie-name="do-share-file"/>
</label>

<span class="controls-right-button button-icon-large icon-ping"
data-bind="click: ping, attr: {'title': ping_tooltip}, css:{'disabled': ping_disabled}"
data-uie-name="do-ping">
</span>
<!-- /ko -->

<!-- /ko -->

<!-- ko if: conversation_et().input().length === 0 -->
<label id="conversation-input-photo"
class="controls-right-button button-icon-large icon-library"
data-bind="attr: {'title': picture_tooltip}">
<input data-bind="file_select: upload_images" type="file" multiple="multiple"
accept=".jpg-large, image/jpeg, image/png, image/bmp, image/gif" data-uie-name="do-share-image"/>
</label>

<label id="conversation-input-files"
class="controls-right-button button-icon-large icon-attachment"
data-bind="attr: {'title': file_tooltip}">
<input data-bind="file_select: upload_files" type="file" multiple="multiple"
accept="*" data-uie-name="do-share-file"/>
</label>

<span class="controls-right-button button-icon-large icon-ping"
data-bind="click: ping, attr: {'title': ping_tooltip}, css:{'disabled': ping_disabled}"
data-uie-name="do-ping">
<!-- ko if: is_editing -->

<span class="controls-right-button button-icon-large icon-close"
data-bind="click: cancel_edit"
data-uie-name="do-cancel-edit">
</span>

<!-- /ko -->

</div>
<!-- /ko -->
<!-- /ko -->
Expand Down
24 changes: 12 additions & 12 deletions app/page/template/list/conversation-list.htm
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,20 @@
data-bind="click: $root.on_ignore_call, l10n_text: z.string.call_decline">
</div>
<!-- ko if: call().is_remote_videod() -->
<div class="button button-pill button-full button-sm button-theme-green"
data-uie-name="do-call-controls-call-accept"
data-bind="click: $root.on_accept_video">
<span class="icon-video"></span>
<span data-bind="l10n_text: z.string.call_accept"></span>
</div>
<div class="button button-pill button-full button-sm button-theme-green"
data-uie-name="do-call-controls-call-accept"
data-bind="click: $root.on_accept_video">
<span class="icon-video"></span>
<span data-bind="l10n_text: z.string.call_accept"></span>
</div>
<!-- /ko -->
<!-- ko ifnot: call().is_remote_videod() -->
<div class="button button-pill button-full button-sm button-theme-green"
data-uie-name="do-call-controls-call-accept"
data-bind="click: $root.on_accept_call">
<span class="icon-call"></span>
<span data-bind="l10n_text: z.string.call_accept"></span>
</div>
<div class="button button-pill button-full button-sm button-theme-green"
data-uie-name="do-call-controls-call-accept"
data-bind="click: $root.on_accept_call">
<span class="icon-call"></span>
<span data-bind="l10n_text: z.string.call_accept"></span>
</div>
<!-- /ko -->
</div>
<!-- /ko -->
Expand Down
17 changes: 12 additions & 5 deletions app/page/template/partials/template-message.htm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</div>
<div class="message-header-label label-semibold text-graphite">
<span data-bind='text: message.sender_name()'></span>
<span class="message-delete-label-icon icon-trash"></span>
<span class="message-header-label-icon icon-trash" data-bind="attr: {title: message.display_deleted_timestamp()}"></span>
</div>
<time class="time" data-bind="text: message.display_deleted_timestamp(), attr: {'data-timestamp': message.deleted_timestamp, 'data-uie-uid': message.id}" data-uie-name="item-message-delete-timestamp"></time>
</div>
Expand All @@ -61,7 +61,12 @@
<div class="message-header-icon">
<user-avatar class="sender-avatar user-avatar-xs" data-bubble="#participants-bubble" data-placement="vertical" params="user: message.user(), click: $parent.on_message_user_click"></user-avatar>
</div>
<div class="message-header-label label-semibold text-graphite" data-bind='text: message.user().first_name'></div>
<div class="message-header-label label-semibold text-graphite">
<span data-bind='text: message.user().first_name()'></span>
<!-- ko if: was_edited() -->
<span class="message-header-label-icon icon-edit" data-bind="attr: {title: message.display_edited_timestamp()}"></span>
<!-- /ko -->
</div>
</div>
<div class="message-body">
<!-- ko foreach: {data: message.assets, as: 'asset'} -->
Expand All @@ -81,7 +86,7 @@
<!-- /ko -->
<!-- ko if: asset.is_text() -->
<!-- ko if: asset.should_render_text -->
<div class="text" data-bind="html: asset.render()"></div>
<div class="text" data-bind="html: asset.render(), css: {'message-is-editing': $parent.is_editing}"></div>
<!-- /ko -->
<!-- ko foreach: asset.previews() -->
<link-preview-asset params="preview: $data, viewport_changed: $parents[2].viewport_changed"></link-preview-asset>
Expand All @@ -101,7 +106,8 @@
<!-- /ko -->

<context-menu params="entries: function() {return $parents[1].get_context_menu_entries(message)}, tag: 'message', data: message.id"
class="context-menu icon-more"></context-menu>
class="context-menu icon-more"
tabindex="-1"></context-menu>
<!-- ko ifnot: message.timestamp == '' -->
<time class="time" data-bind="text: message.display_timestamp_short(), attr: {'data-timestamp': message.timestamp, 'data-uie-uid': message.id}" data-uie-name="item-message-timestamp"></time>
<!-- /ko -->
Expand Down Expand Up @@ -183,7 +189,8 @@
</div>
</div>
<context-menu params="entries: function() {return $parent.get_context_menu_entries($data)}, tag: 'message', data: message.id"
class="context-menu icon-more"></context-menu>
class="context-menu icon-more"
tabindex="-1"></context-menu>
<!-- ko ifnot: message.timestamp == '' -->
<time class="time" data-bind="text: message.display_timestamp_short(), attr: {'data-timestamp': message.timestamp}"></time>
<!-- /ko -->
Expand Down
6 changes: 3 additions & 3 deletions app/page/template/video-calling.htm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!-- /ko -->
<!-- ko if: show_remote_participant() -->
<div class="video-element-remote-participant">
<!-- ko ifnot: joined_call().is_group() -->
<!-- ko ifnot: videod_call().is_group() -->
<user-avatar class="video-element-remote-participant user-avatar-xl user-avatar-no-badge"
params="user: remote_user()"></user-avatar>
<!-- /ko -->
Expand Down Expand Up @@ -44,8 +44,8 @@
<div id="video-title" class="video-title"
data-bind="css: {'hide-controls-hidden': !show_remote_participant() && !is_choosing_screen(),
'video-element-dark': show_remote_participant()}">
<div class="video-remote-name" data-bind="text: joined_call().conversation_et.display_name()"></div>
<div class="video-timer label-xs" data-bind="text: z.util.format_seconds(joined_call().duration_time())"></div>
<div class="video-remote-name" data-bind="text: videod_call().conversation_et.display_name()"></div>
<div class="video-timer label-xs" data-bind="text: z.util.format_seconds(videod_call().duration_time())"></div>
</div>
<!-- /ko -->

Expand Down
6 changes: 3 additions & 3 deletions app/script/audio/AudioRepository.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class z.audio.AudioRepository
if @audio_context
@logger.log @logger.levels.INFO, 'Reusing existing AudioContext', @audio_context
return @audio_context
else if window.AudioContext
else if window.AudioContext and window.AudioContext::createMediaStreamSource
@audio_context = new window.AudioContext()
@logger.log @logger.levels.INFO, 'Initialized a new AudioContext', @audio_context
return @audio_context
Expand Down Expand Up @@ -80,14 +80,14 @@ class z.audio.AudioRepository
@param audio_id [z.audio.AudioType] Sound identifier
@param play_in_loop [Boolean] Play sound in loop
###
play: (audio_id, play_in_loop) =>
play: (audio_id, play_in_loop = false) =>
@_check_sound_setting audio_id
.then =>
@_get_sound_by_id audio_id
.then (audio_element) =>
@_play audio_id, audio_element, play_in_loop
.then (audio_element) =>
@logger.log @logger.levels.INFO, "Playing sound '#{audio_id}' (in loop: '#{play_in_loop}')", audio_element
@logger.log @logger.levels.INFO, "Playing sound '#{audio_id}' (loop: '#{play_in_loop}')", audio_element
.catch (error) =>
switch error.type
when z.audio.AudioError::TYPE.FAILED_TO_PLAY
Expand Down
2 changes: 1 addition & 1 deletion app/script/auth/AuthRepository.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class z.auth.AuthRepository
access_token_type = z.storage.get_value z.storage.StorageKey.AUTH.ACCESS_TOKEN.TYPE

if access_token
@logger.log @logger.levels.INFO, 'Cached access token found in Local Storage', access_token
@logger.log @logger.levels.INFO, 'Cached access token found in Local Storage', {access_token: access_token}
@auth_service.save_access_token_in_client access_token_type, access_token
@_schedule_token_refresh z.storage.get_value z.storage.StorageKey.AUTH.ACCESS_TOKEN.EXPIRATION
resolve()
Expand Down
4 changes: 2 additions & 2 deletions app/script/calling/CallCenter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ class z.calling.CallCenter
if conversation_id
for call_et in @calls() when call_et.id is conversation_id
return call_et
throw new z.calling.CallError 'No call for conversation ID found', z.calling.CallError::TYPE.CALL_NOT_FOUND
throw new z.calling.CallError 'No conversation ID given', z.calling.CallError::TYPE.NO_CONVERSATION_ID
throw new z.calling.CallError z.calling.CallError::TYPE.CALL_NOT_FOUND
throw new z.calling.CallError z.calling.CallError::TYPE.NO_CONVERSATION_ID

###
Helper to identify the creator of a call or choose the first joined one.
Expand Down
31 changes: 17 additions & 14 deletions app/script/calling/CallError.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,27 @@ window.z ?= {}
z.calling ?= {}

class z.calling.CallError
constructor: (message, type) ->
constructor: (message) ->
@name = @constructor.name
@message = message
@type = type
@message = message or z.calling.CallError::TYPE.UNKNOWN
@stack = (new Error()).stack

@:: = new Error()
@::constructor = @
@::TYPE = {
CALL_NOT_FOUND: 'z.calling.CallError::TYPE.CALL_NOT_FOUND'
CONVERSATION_EMPTY: 'z.calling.CallError::TYPE.CONVERSATION_EMPTY'
CONVERSATION_TOO_BIG: 'z.calling.CallError::TYPE.CONVERSATION_TOO_BIG'
FLOW_NOT_FOUND: 'z.calling.CallError::TYPE.FLOW_NOT_FOUND'
NO_AUDIO_STREAM_FOUND: 'z.calling.CallError::TYPE.NO_AUDIO_STREAM_FOUND'
NO_CAMERA_FOUND: 'z.calling.CallError::TYPE.NO_CAMERA_FOUND'
NO_CONVERSATION_ID: 'z.calling.CallError::TYPE.NO_CONVERSATION_ID'
NO_DEVICES_FOUND: 'z.calling.CallError::TYPE.NO_DEVICES_FOUND'
NO_MICROPHONE_FOUND: 'z.calling.CallError::TYPE.NO_MICROPHONE_FOUND'
NOT_SUPPORTED: 'z.calling.CallError::TYPE.NOT_SUPPORTED'
VOICE_CHANNEL_FULL: 'z.calling.CallError::TYPE.VOICE_CHANNEL_FULL'
CALL_NOT_FOUND: 'No call for conversation ID found'
CONVERSATION_EMPTY: 'No users in conversation'
CONVERSATION_TOO_BIG: 'Too many participants in conversation'
FLOW_NOT_FOUND: 'Flow not found'
NO_AUDIO_STREAM_FOUND: 'No audio stream found to toggle mute state'
NO_CAMERA_FOUND: 'No camera found'
NO_CONVERSATION_ID: 'No conversation ID given'
NO_DEVICES_FOUND: 'No MediaDevices found'
NO_MICROPHONE_FOUND: 'No microphone found'
NO_REPLACEABLE_TRACK: 'No replaceable MediaStreamTrack found'
NOT_SUPPORTED: 'Not supported'
RTP_SENDER_NOT_SUPPORTED: 'PeerConnection does not support getSenders()'
SCREEN_NOT_SUPPORTED: 'Screen sharing is not yet supported by this browser'
UNKNOWN: 'Unknown CallError'
VOICE_CHANNEL_FULL: 'Too many participants in call'
}
2 changes: 2 additions & 0 deletions app/script/calling/entities/Call.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ class z.calling.entities.Call
@return [Boolean] Has the participant been removed
###
delete_participant: (participant_et, delete_on_backend = true) =>
@interrupted_participants.remove @participant_et
return false if not @get_participant_by_id participant_et.user.id

# Delete participant
Expand Down Expand Up @@ -485,6 +486,7 @@ class z.calling.entities.Call
@session_id undefined
@self_user_joined false
@is_declined false
amplify.publish z.event.WebApp.AUDIO.STOP, z.audio.AudioType.NETWORK_INTERRUPTION

###
Reset the call timers.
Expand Down
Loading

0 comments on commit 587864a

Please sign in to comment.