Skip to content

Commit b30ab4a

Browse files
committed
Merge pull request #124 from QuickBlox/develop.bug.QBWEBSDK-247
Fixed bugs for sprint 1
2 parents 368af9a + 0523a7a commit b30ab4a

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

samples/webrtc/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ <h2 class="header__title">JavaScript WebRTC Sample</h2>
3535
<h3 class="join__title">
3636
<p>Please enter your username and chat room name.</p>
3737
<p>You can join existed chat room.</p>
38+
<p class="join__notice">Use several browsers to simulate several users.</p>
3839
</h3>
3940

4041
<div class="join__body">
4142
<div class="join__row">
42-
<input type="text" class="join__input" name="username" placeholder="Username" autofocus required title="Should contain only latin characters and alphanumeric characters in a range from 3 to 20, starts with a letter." pattern="^[a-zA-Z][a-zA-Z0-9-_\.]{1,20}$">
43+
<input type="text" class="join__input" name="username" placeholder="Username" autofocus required title="Should contain only latin characters and alphanumeric characters in a range from 3 to 20, starts with a letter." pattern="^[a-zA-Z\s][a-zA-Z\d-_\.\s]{3,20}$">
4344
</div>
4445

4546
<div class="join__row">
46-
<input type="text" class="join__input" name="room" placeholder="Chat room name" required title="Should contain only latin characters and alphanumeric characters in a range from 3 to 15, without space." pattern="^[a-zA-Z0-9]{3,15}">
47+
<input type="text" class="join__input" name="room" placeholder="Chat room name" required title="Should contain only latin characters and alphanumeric characters in a range from 3 to 15, without space." pattern="^[a-zA-Z\s][a-zA-Z\d\s]{3,15}$">
4748
</div>
4849

4950
<div class="join__row">

samples/webrtc/js/app.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
},
3838
'container': $('.page'),
3939
'relocated': function() {
40-
var path = app.user ? 'dashboard' : 'join';
40+
var path = app.caller ? 'dashboard' : 'join';
4141

4242
app.router.navigate(path, {'trigger': true});
4343
},
@@ -471,13 +471,18 @@
471471

472472
/** LOGOUT */
473473
$(document).on('click', '.j-logout', function() {
474-
app.user = null;
475-
app.users = [];
474+
QB.users.delete(app.caller.id, function(err, user){
475+
if (user) {
476+
app.caller = {};
477+
app.users = [];
476478

477-
QB.chat.disconnect();
478-
app.router.navigate('join', {'trigger': true});
479-
480-
app.helpers.setFooterPosition();
479+
QB.chat.disconnect();
480+
app.router.navigate('join', {'trigger': true});
481+
app.helpers.setFooterPosition();
482+
} else {
483+
console.error('Logout failed:', err);
484+
}
485+
});
481486
});
482487

483488
/**

samples/webrtc/styles.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ b {
235235
text-align: center;
236236
}
237237

238+
.join__notice {
239+
margin: 10px 0 0 0;
240+
font-size: 14px;
241+
}
242+
238243
.join__body {
239244
width: 90%;
240245
max-width: 410px;

0 commit comments

Comments
 (0)