Skip to content

Commit 5ef74b9

Browse files
committed
fixed method and tests
2 parents 89d3a9d + 842bd6d commit 5ef74b9

File tree

19 files changed

+705
-649
lines changed

19 files changed

+705
-649
lines changed

js/modules/qbChat.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ PrivacyListProxy.prototype = {
10841084
},
10851085

10861086
update: function(list, callback) {
1087-
var self = this
1087+
var self = this;
10881088

10891089
self.getList(list.name, function(error, response) {
10901090
if (error) {
@@ -1093,10 +1093,9 @@ PrivacyListProxy.prototype = {
10931093
var copyList = (JSON.parse(JSON.stringify(list))),
10941094
oldArray = response.items,
10951095
newArray = copyList.items,
1096-
updatedArray = [], createdList = {};
1096+
createdList = {};
10971097

1098-
updatedArray = $.merge(oldArray, newArray);
1099-
copyList.items = updatedArray;
1098+
copyList.items = $.merge(oldArray, newArray);
11001099
createdList = copyList;
11011100

11021101
self.create(createdList, function(err, result) {

js/modules/qbData.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
var config = require('../qbConfig'),
99
Utils = require('../qbUtils');
1010

11+
// For server-side applications through using npm package 'quickblox' you should include the following lines
12+
var isBrowser = typeof window !== 'undefined';
13+
1114
function DataProxy(service){
1215
this.service = service;
1316
}
@@ -60,9 +63,17 @@ DataProxy.prototype = {
6063
Utils.QBLog('[DataProxy]', 'uploadFile', className, params);
6164

6265
var formData;
63-
formData = new FormData();
64-
formData.append('field_name', params.field_name);
65-
formData.append('file', params.file);
66+
67+
if(isBrowser){
68+
formData = new FormData();
69+
formData.append('field_name', params.field_name);
70+
formData.append('file', params.file);
71+
}else{
72+
formData = {};
73+
formData['field_name'] = params.field_name;
74+
formData['file'] = params.file;
75+
}
76+
6677
this.service.ajax({url: Utils.getUrl(config.urls.data, className + '/' + params.id + '/file'), data: formData,
6778
contentType: false, processData: false, type:'POST'}, function(err, result){
6879
if (err) { callback(err, null);}

js/modules/qbPushNotifications.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,15 @@ EventsProxy.prototype = {
6767
this.service.ajax({url: Utils.getUrl(config.urls.events), type: 'POST', data: message}, callback);
6868
},
6969

70-
list: function(callback) {
71-
Utils.QBLog('[EventsProxy]', 'list');
72-
73-
this.service.ajax({url: Utils.getUrl(config.urls.events)}, callback);
70+
list: function(params, callback) {
71+
if (typeof params === 'function' && typeof callback ==='undefined') {
72+
callback = params;
73+
params = null;
74+
}
75+
76+
Utils.QBLog('[EventsProxy]', 'list', params);
77+
78+
this.service.ajax({url: Utils.getUrl(config.urls.events), data: params}, callback);
7479
},
7580

7681
get: function(id, callback) {
@@ -85,13 +90,6 @@ EventsProxy.prototype = {
8590
this.service.ajax({url: Utils.getUrl(config.urls.events, id + '/status')}, callback);
8691
},
8792

88-
update: function(params, callback) {
89-
Utils.QBLog('[EventsProxy]', 'update', params);
90-
91-
var message = {event: params};
92-
this.service.ajax({url: Utils.getUrl(config.urls.events, params.id), type: 'PUT', data: message}, callback);
93-
},
94-
9593
delete: function(id, callback) {
9694
Utils.QBLog('[EventsProxy]', 'delete', id);
9795

js/modules/qbWebRTC.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ WebRTCProxy.prototype.attachMediaStream = function(id, stream, options) {
297297
elem.style.transform = 'scaleX(-1)';
298298
}
299299
elem.play();
300+
} else {
301+
throw new Error('Unable to attach media stream, element ' + id + ' is undefined');
300302
}
301303
};
302304

quickblox.min.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/chat/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<title>QuickBlox JavaScript Chat code sample</title>
7-
<link rel="shortcut icon" href="http://quickblox.com/favicon.ico">
7+
<link rel="shortcut icon" href="https://quickblox.com/favicon.ico">
88
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css">
99
<link rel="stylesheet" href="css/style.css">
1010
</head>
@@ -17,7 +17,7 @@
1717
<span class="sr-only">Toggle navigation</span>
1818
<span class="glyphicon glyphicon-cog"></span>
1919
</button>
20-
<a href="http://quickblox.com/developers/Chat"><img src="images/logo-quickblox.png" id="logo"></a>
20+
<a href="https://quickblox.com/developers/Chat"><img src="images/logo-quickblox.png" id="logo"></a>
2121
</div>
2222
<div class="collapse navbar-collapse">
2323
<ul class="nav navbar-nav">

samples/chat/js/config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ var QBApp = {
55
};
66

77
var config = {
8-
debug: true
8+
chatProtocol: {
9+
active: 2
10+
},
11+
debug: {
12+
mode: 0,
13+
file: null
14+
}
915
};
1016

1117
var QBUser1 = {

samples/content/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<title>QuickBlox JavaScript content sample</title>
88
<link href="css/style.css" rel="stylesheet">
9-
<link rel="shortcut icon" href="http://quickblox.com/favicon.ico">
9+
<link rel="shortcut icon" href="https://quickblox.com/favicon.ico">
1010
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css">
1111
</head>
1212

1313
<body>
1414
<div class="container">
1515
<div class="row site-head">
1616
<div id="logo" class="">
17-
<a href="http://quickblox.com/"><img class="logo" src="images/logo-quickblox.png" alt="QuickBlox Samples"></a>
17+
<a href="https://quickblox.com/"><img class="logo" src="images/logo-quickblox.png" alt="QuickBlox Samples"></a>
1818
<a href="https://github.com/QuickBlox/quickblox-javascript-sdk/tree/master/samples/content"
1919
style="position:absolute;top:20px;right:7%;font-size:0.85em;color:grey;">View source on GitHub</a>
2020
</div>

samples/customobjects/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<title>QuickBlox Sample Web Blog</title>
8-
<link rel="shortcut icon" href="http://quickblox.com/favicon.ico">
8+
<link rel="shortcut icon" href="https://quickblox.com/favicon.ico">
99
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css">
1010
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap-theme.min.css">
1111
<link rel="stylesheet" href="css/style.css">
@@ -22,7 +22,7 @@
2222
<span class="icon-bar"></span>
2323
<span class="icon-bar"></span>
2424
</button>
25-
<a class="navbar-brand" href="http://quickblox.com/developers/Custom_Objects">
25+
<a class="navbar-brand" href="https://quickblox.com/developers/Custom_Objects">
2626
<img class="logo" src="images/logo-quickblox.png" alt="QuickBlox Samples" class="img-responsive"></a>
2727
</div>
2828
<div class="collapse navbar-collapse">

samples/roster/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<title>QuickBlox JavaScript Roster code sample</title>
7-
<link rel="shortcut icon" href="http://quickblox.com/favicon.ico">
7+
<link rel="shortcut icon" href="https://quickblox.com/favicon.ico">
88
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css">
99
</head>
1010
<body>

0 commit comments

Comments
 (0)