Skip to content

Commit 1b2002c

Browse files
authored
Sprint 4 (final)
New build tools (Gulp instead of Grunt); QB.Recorder; Stream Managment; Rewrote contributing files (contributors make only pull request into master, a member of team make a release); new commands: npm run develop, npm run build, npm run start; added to 'gitignore' sublime generated files; In build added 'jshint' command, fixed all warnings; remove unminified version of SDK. Uses source maps for debugging. Remove samples 'node_js' as duplicate 'chat_bots'.
1 parent d552887 commit 1b2002c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+89730
-680
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["babel-preset-es2015"]
3+
}

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[*]
2+
charset = utf-8
3+
end_of_line = lf
4+
insert_final_newline = true
5+
6+
[*.{js}]
7+
indent_style = space
8+
indent_size = 4
9+
10+
[*.{json}]
11+
indent_size = 2

.github/CONTRIBUTING.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@ Please follow all rules from our [code style guidelines](https://github.com/Quic
88

99
## Modify and build the library
1010

11-
The quickblox.js library is build from a number of **CommonJS modules** contained in the `js` folder. For example the `js/modules/qbUsers.js` module contains the code that deals with the [Users API](http://quickblox.com/developers/Users).
11+
The quickblox.js library is build from a number of **CommonJS modules** contained in the `src` folder. For example the `src/modules/qbUsers.js` module contains the code that deals with the [Users API](http://quickblox.com/developers/Users).
1212

13-
These modules are combined through [browserify](http://browserify.org/) into a single `quickblox.js` file in the root and so this is the only file that needs to be included in a `<script>` tag OR in a RequireJS application OR in Node.js environment (everywhere). To build the library, use the [Grunt](http://gruntjs.com/) task runner.
13+
These modules are combined through [browserify](http://browserify.org/) into a single `quickblox.js` file in the root and so this is the only file that needs to be included in a `<script>` tag OR in a RequireJS application OR in Node.js environment (everywhere).
14+
To build the library, uses [gulp](http://gulpjs.com/) task runner.
1415

1516
* You need to have the dependencies listed in the package.json available, use `npm install` to load them;
16-
* Install **grunt-cli** `npm install -g grunt-cli`;
17-
* Also you need install **jasmine** global `npm i -g jasmine` for tests;
17+
* Install [gulp](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md#getting-started) and globally;
18+
* Install [jasmine](https://github.com/jasmine/jasmine#installation) globally;
1819
* Change the 'version' properties in next files:
19-
* https://github.com/QuickBlox/quickblox-javascript-sdk/blob/gh-pages/js/qbConfig.js;
20-
* https://github.com/QuickBlox/quickblox-javascript-sdk/blob/gh-pages/bower.json;
21-
* https://github.com/QuickBlox/quickblox-javascript-sdk/blob/gh-pages/package.json;
22-
* Rebuild SDK: `grunt`;
23-
* Update README.md;
24-
* Commit your changes to git repository and create a new "git tag" for new version. This action updates SDK for GIT and also for bower package manager;
25-
* `npm publish`. This action updates SDK for node package manager, but maybe you will be needed some author credentials for it (you should be in owner list);
26-
* Update QuickBlox developers section.
20+
* ./bower.json;
21+
* ./package.json;
22+
* ./src/qbConfig.js;
23+
* Rebuild SDK: `npm run build`, check tests in node / browser env.
24+
* Update ./README.md;
25+
* Make a pull request into gh-pages;

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ npm-debug.log
88
.idea/*
99
.idea/workspace.xml
1010

11-
# Use command grunt for create quickblox.js
12-
quickblox.js
11+
# *Sublime
12+
*.sublime-*
1313

1414
#jasmine-npm generate
1515
.grunt

.jshintrc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
2-
"strict" : false,
3-
"devel" : true,
4-
"browser" : true,
5-
"browserify" : true,
6-
"jasmine" : true,
7-
"jquery" : true,
8-
"esnext" : true,
9-
"globals" : [
2+
"strict": true,
3+
"devel": true,
4+
"esversion": 6,
5+
"browser": true,
6+
"node": true,
7+
"browserify": true,
8+
"jasmine": true,
9+
"jquery": true,
10+
"globals": [
1011
"jasmine",
1112
"describe",
1213
"xdescribe",

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ branches:
88

99
before_script: "npm run-script setDependencies"
1010

11-
script: "grunt"
11+
script: "npm run build"
1212
after_success: "jasmine"

Gruntfile.js

Lines changed: 0 additions & 89 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
[![npm](https://img.shields.io/npm/v/quickblox.svg)](https://www.npmjs.com/package/quickblox)
55
[![npm](https://img.shields.io/npm/dm/quickblox.svg)](https://www.npmjs.com/package/quickblox)
66

7-
The QuickBlox JavaScript SDK provides a JavaScript library making it even
8-
easier to access the QuickBlox cloud communication backend platform.
7+
The QuickBlox JavaScript SDK provides a JavaScript library making it even easier to access the QuickBlox cloud communication backend platform.
98

109
[QuickBlox](https://quickblox.com) is a suite of communication features & data services (APIs, SDKs, code samples, admin panel, tutorials) which help digital agencies, mobile developers and publishers to add great communication functionality to smartphone applications like in Skype, WhatsApp, Viber.
1110

@@ -16,7 +15,7 @@ easier to access the QuickBlox cloud communication backend platform.
1615

1716
For the library to work, you need to include either [jQuery](http://jquery.com/) or [Zepto](http://zeptojs.com/) in your html before `quickblox.min.js`, like so:
1817

19-
For correct work of JS SDK you must include the library in your html before `quickblox.js`, like so:
18+
For correct work of JS SDK you must include the library in your html before `quickblox.min.js`, like so:
2019

2120
```html
2221
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
@@ -68,7 +67,7 @@ You can look at it here http://quickblox.com/developers/Javascript
6867

6968
# Questions and feedback
7069

71-
Please raise questions, requests for help etc. via http://stackoverflow.com/questions/tagged/quickblox
70+
Please raise questions, requests for help etc. via http://stackoverflow.com/questions/tagged/quickbloxjs
7271

7372
Feedback and suggestions for improvement always welcome :)
7473

gulpfile.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
5+
var browserify = require('browserify');
6+
var source = require('vinyl-source-stream');
7+
8+
var connect = require('gulp-connect');
9+
var notify = require('gulp-notify');
10+
11+
gulp.task('build', function () {
12+
var isDevelopment = process.env.NODE_ENV === 'develop',
13+
browserifyOpts = {
14+
debug: isDevelopment,
15+
standalone: 'QB'
16+
};
17+
18+
return browserify('./src/qbMain.js', browserifyOpts)
19+
.bundle()
20+
.on('error', function(error) {
21+
notify('Failed when create a bundle <%= error.message %>')
22+
this.emit('end');
23+
})
24+
.pipe(source('quickblox.min.js'))
25+
.pipe(notify('Build task is finished.'))
26+
.pipe(gulp.dest('./'));
27+
});
28+
29+
gulp.task('connect', function() {
30+
connect.server({
31+
port: 8080,
32+
https: true
33+
});
34+
});
35+
36+
gulp.task('watch', function () {
37+
gulp.watch(['./src/**/*.js'], ['build']);
38+
});
39+
40+
gulp.task('default', ['build', 'connect', 'watch']);

package.json

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "2.3.4",
55
"homepage": "https://quickblox.com/developers/Javascript",
66
"main": "src/qbMain.js",
7-
"license" : "(Apache-2.0)",
7+
"license": "(Apache-2.0)",
88
"keywords": [
99
"quickblox",
1010
"javascript",
@@ -46,34 +46,36 @@
4646
"xml2js": "^0.4.13"
4747
},
4848
"devDependencies": {
49+
"browserify": "^13.1.0",
50+
"cross-env": "^3.1.2",
4951
"ghooks": "^1.3.2",
50-
"grunt": "^0.4.5",
51-
"grunt-browserify": "^3.2.1",
52-
"grunt-contrib-connect": "^0.9.0",
53-
"grunt-contrib-uglify": "^0.6.0",
54-
"grunt-contrib-watch": "^0.6.1",
55-
"grunt-notify": "^0.4.1",
56-
"grunt-parallel": "^0.4.1",
52+
"gulp": "^3.9.1",
53+
"gulp-connect": "^5.0.0",
54+
"gulp-notify": "^2.2.0",
5755
"jasmine": "^2.4.1",
58-
"load-grunt-tasks": "^1.0.0"
56+
"jshint": "^2.9.3",
57+
"jshint-stylish": "^2.2.1",
58+
"vinyl-source-stream": "^1.1.0"
5959
},
6060
"autoupdate": {
6161
"source": "git",
6262
"target": "git://github.com/QuickBlox/quickblox-javascript-sdk.git",
6363
"basePath": "",
6464
"files": [
65-
"quickblox.js",
6665
"quickblox.min.js"
6766
]
6867
},
6968
"config": {
7069
"ghooks": {
70+
"pre-commit": "npm run lint",
7171
"pre-push": "jasmine"
7272
}
7373
},
7474
"scripts": {
75-
"setDependencies": "npm i && npm install -g grunt-cli && npm install -g jasmine",
76-
"build": "grunt",
77-
"test": "jasmine"
75+
"setDependencies": "npm i && npm install -g gulp-cli && npm install -g jasmine",
76+
"lint": "jshint src --reporter=node_modules/jshint-stylish",
77+
"build": "npm run lint && gulp build",
78+
"develop": "cross-env NODE_ENV=develop gulp",
79+
"start": "gulp connect"
7880
}
7981
}

quickblox.min.js

Lines changed: 88426 additions & 20 deletions
Large diffs are not rendered by default.

samples/chat/js/config.js

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
var QBApp = {
2-
appId: 28287,
3-
authKey: 'XydaWcf8OO9xhGT',
4-
authSecret: 'JZfqTspCvELAmnW'
2+
appId: 28287,
3+
authKey: 'XydaWcf8OO9xhGT',
4+
authSecret: 'JZfqTspCvELAmnW'
55
};
66

77
var config = {
8-
chatProtocol: {
9-
active: 2
10-
},
11-
debug: {
12-
mode: 1,
13-
file: null
14-
},
15-
stickerpipe: {
16-
elId: 'stickers_btn',
8+
chatProtocol: {
9+
active: 2
10+
},
11+
streamManagement: {
12+
enable: true
13+
},
14+
debug: {
15+
mode: 1,
16+
file: null
17+
},
18+
stickerpipe: {
19+
elId: 'stickers_btn',
20+
apiKey: '847b82c49db21ecec88c510e377b452c',
21+
enableEmojiTab: false,
22+
enableHistoryTab: true,
23+
enableStoreTab: true,
1724

18-
apiKey: '847b82c49db21ecec88c510e377b452c',
25+
userId: null,
1926

20-
enableEmojiTab: false,
21-
enableHistoryTab: true,
22-
enableStoreTab: true,
23-
24-
userId: null,
25-
26-
priceB: '0.99 $',
27-
priceC: '1.99 $'
28-
}
27+
priceB: '0.99 $',
28+
priceC: '1.99 $'
29+
}
2930
};
3031

3132
var QBUser1 = {
3233
id: 6729114,
3334
name: 'quickuser',
3435
login: 'chatusr11',
3536
pass: 'chatusr11'
36-
},
37+
},
3738
QBUser2 = {
3839
id: 6729119,
3940
name: 'bloxuser',

samples/chat/js/connection.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ function connectToChat(user) {
5252

5353
// setup scroll events handler
5454
setupMsgScrollHandler();
55+
56+
setupStreamManagementListeners();
5557
}
5658
});
5759
}

samples/chat/js/dialogs.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ function updateDialogsList(dialogId, text){
146146

147147
// Choose dialog
148148
function triggerDialog(dialogId){
149-
console.info('Select a dialog with id: ' + dialogId + ', name: ' + dialogs[dialogId].name);
150-
151149
// deselect
152150
var kids = $('#dialogs-list').children();
153151
kids.removeClass('active').addClass('inactive');

0 commit comments

Comments
 (0)