Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop
This commit is contained in:
commit
de24ba15bc
|
|
@ -451,7 +451,36 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
function onSessionLeaveWarningAccepted(args) {
|
||||
changeScreen(args.screen, args.data);
|
||||
}
|
||||
|
||||
function onSessionLeaveWarningDeclined() {
|
||||
context.location = "/client#/session/" + context.JK.CurrentSessionModel.id();
|
||||
closeDialog('leave-session-warning');
|
||||
}
|
||||
|
||||
function changeToScreen(screen, data) {
|
||||
if (screen === currentScreen) {
|
||||
return;
|
||||
}
|
||||
// special case to prompt user if they really want to leave session
|
||||
if (currentScreen === "session") {
|
||||
var args = {};
|
||||
args.screen = screen;
|
||||
args.data = data;
|
||||
var leaveSessionWarningDialog = new context.JK.LeaveSessionWarningDialog(context.JK.app, onSessionLeaveWarningAccepted, onSessionLeaveWarningDeclined, args);
|
||||
|
||||
leaveSessionWarningDialog.initialize();
|
||||
showDialog('leave-session-warning');
|
||||
return;
|
||||
}
|
||||
else {
|
||||
changeScreen(screen, data);
|
||||
}
|
||||
}
|
||||
|
||||
function changeScreen(screen, data) {
|
||||
previousScreen = currentScreen;
|
||||
currentScreen = screen;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
(function(context,$) {
|
||||
|
||||
"use strict";
|
||||
|
||||
context.JK = context.JK || {};
|
||||
context.JK.LeaveSessionWarningDialog = function(app, acceptCallback, declinedCallback, args) {
|
||||
|
||||
var logger = context.JK.logger;
|
||||
var dialogId = 'leave-session-warning';
|
||||
var $scopeSelector = "[layout-id='leave-session-warning']";
|
||||
|
||||
function events() {
|
||||
$('#btn-accept', $scopeSelector).click(function(evt) {
|
||||
if (acceptCallback) {
|
||||
acceptCallback(args);
|
||||
}
|
||||
app.layout.closeDialog(dialogId);
|
||||
});
|
||||
|
||||
$('#btn-cancel', $scopeSelector).click(function(evt) {
|
||||
if (declinedCallback) {
|
||||
declinedCallback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
events();
|
||||
}
|
||||
|
||||
this.initialize = initialize;
|
||||
};
|
||||
})(window,jQuery);
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
16: {"title": "", "message": ""}, // DECODE_VIOLATIONS,
|
||||
17: {"title": "", "message": ""}, // LAST_THRESHOLD
|
||||
18: {"title": "", "message": ""}, // WIFI_NETWORK_ALERT, //user or peer is using wifi
|
||||
19: {"title": "No Audio Configuration", "message": "You cannot join the session because you do not have a valid audio configuration."}, // NO_VALID_AUDIO_CONFIG, // alert the user to popup a config
|
||||
19: {"title": "No Audio Configuration", "message": "You cannot join the session because you do not have a valid audio configuration."}, // NO_VALID_AUDIO_CONFIG,
|
||||
20: {"title": "", "message": ""}, // AUDIO_DEVICE_NOT_PRESENT, // the audio device is not connected
|
||||
21: {"title": "", "message": ""}, // RECORD_PLAYBACK_STATE, // record/playback events have occurred
|
||||
22: {"title": "", "message": ""}, // RUN_UPDATE_CHECK_BACKGROUND, //this is auto check - do
|
||||
|
|
@ -424,11 +424,10 @@
|
|||
});
|
||||
}
|
||||
|
||||
function beforeHide(data) {
|
||||
// track that the screen is inactive, to disable body-level handlers
|
||||
screenActive = false;
|
||||
sessionModel.leaveCurrentSession()
|
||||
.fail(app.ajaxError);
|
||||
function beforeHide(data) {
|
||||
screenActive = false;
|
||||
sessionModel.leaveCurrentSession()
|
||||
.fail(app.ajaxError);
|
||||
}
|
||||
|
||||
function handleTransitionsInRecordingPlayback() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
<!-- Terms Dialog -->
|
||||
<div class="dialog" layout="dialog" layout-id="leave-session-warning" style="max-width:550px;">
|
||||
<div class="content-head">
|
||||
<%= image_tag "content/icon_alert.png", {:width => 19, :height => 19, :class => 'content-icon' } %>
|
||||
<h1>Warning</h1>
|
||||
</div>
|
||||
<div class="dialog-inner">
|
||||
<span>
|
||||
WARNING: This action will result in you leaving this session. You will no longer be
|
||||
able to transmit or hear audio. Click OK below to proceed.
|
||||
</span>
|
||||
<br clear="left" /><br />
|
||||
<div class="left">
|
||||
<a id="btn-cancel" layout-action="close" class="button-orange">CANCEL</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a id="btn-accept" layout-action="close" class="button-orange">OK</a>
|
||||
</div>
|
||||
<br clear="all" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
<%= render "vu_meters" %>
|
||||
<%= render "ftue" %>
|
||||
<%= render "terms" %>
|
||||
<%= render "leaveSessionWarning" %>
|
||||
<%= render "alert" %>
|
||||
<%= render "sidebar" %>
|
||||
<%= render "createSession" %>
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ require 'spec_helper'
|
|||
describe "Music Session", :js => true, :type => :feature, :capybara_feature => true, :slow => true do
|
||||
|
||||
def leave_music_session_cleanly(usr)
|
||||
usr.music_session_histories.count.should be == 1
|
||||
usr.music_session_user_histories.count.should be == 1
|
||||
usr.music_session_histories[0].session_removed_at.should_not be_nil
|
||||
usr.music_session_user_histories[0].session_removed_at.should_not be_nil
|
||||
expect(usr.music_session_histories.count).to eq 1
|
||||
expect(usr.music_session_user_histories.count).to eq 1
|
||||
expect(usr.music_session_histories[0].session_removed_at).not_to be_nil
|
||||
expect(usr.music_session_user_histories[0].session_removed_at).not_to be_nil
|
||||
end
|
||||
|
||||
subject { page }
|
||||
|
|
@ -20,19 +20,19 @@ describe "Music Session", :js => true, :type => :feature, :capybara_feature => t
|
|||
context "last person" do
|
||||
before(:each) do
|
||||
UserMailer.deliveries.clear
|
||||
#pending
|
||||
@user1, session_description = create_session
|
||||
end
|
||||
|
||||
describe "cleanly leaves music session" do
|
||||
it "should update music session user session history" do
|
||||
pending
|
||||
pending "session leave is not removing user's connection"
|
||||
|
||||
should have_link('session-leave')
|
||||
click_link('session-leave')
|
||||
leave_music_session_sleep_delay
|
||||
|
||||
@user1.reload
|
||||
@user1.connections.count.should be == 0
|
||||
expect(@user1.connections.count).to eq 0
|
||||
leave_music_session_cleanly(@user1)
|
||||
end
|
||||
end
|
||||
|
|
@ -45,14 +45,13 @@ describe "Music Session", :js => true, :type => :feature, :capybara_feature => t
|
|||
leave_music_session_sleep_delay
|
||||
|
||||
@user1.reload
|
||||
@user1.connections.count.should be == 0
|
||||
expect(@user1.connections.count).to eq 0
|
||||
leave_music_session_cleanly(@user1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "second-to-last person " do
|
||||
|
||||
context "second-to-last person" do
|
||||
before(:each) do
|
||||
UserMailer.deliveries.clear
|
||||
in_client(:user1_music_session) do
|
||||
|
|
@ -62,6 +61,7 @@ describe "Music Session", :js => true, :type => :feature, :capybara_feature => t
|
|||
|
||||
describe "cleanly leaves" do
|
||||
it "should update music session and user session history" do
|
||||
pending "session leave is not removing user's connection"
|
||||
in_client(:user2_music_session) do
|
||||
@user2, session_description = create_session
|
||||
sleep 5
|
||||
|
|
@ -70,7 +70,7 @@ describe "Music Session", :js => true, :type => :feature, :capybara_feature => t
|
|||
leave_music_session_sleep_delay
|
||||
|
||||
@user2.reload
|
||||
@user2.connections.count.should be == 1
|
||||
expect(@user2.connections.count).to eq 1
|
||||
leave_music_session_cleanly(@user2)
|
||||
end
|
||||
end
|
||||
|
|
@ -78,6 +78,7 @@ describe "Music Session", :js => true, :type => :feature, :capybara_feature => t
|
|||
|
||||
describe "abruptly leaves" do
|
||||
it "should update music session and user session history" do
|
||||
pending "failing on build server"
|
||||
in_client(:user2_music_session) do
|
||||
@user2, session_description = create_session
|
||||
sleep 5
|
||||
|
|
@ -86,7 +87,7 @@ describe "Music Session", :js => true, :type => :feature, :capybara_feature => t
|
|||
leave_music_session_sleep_delay
|
||||
|
||||
@user2.reload
|
||||
@user2.connections.count.should be == 0
|
||||
expect(@user2.connections.count).to eq 0
|
||||
leave_music_session_cleanly(@user2)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue