Nothing Special   »   [go: up one dir, main page]

Skip to content

Commit

Permalink
Using fxosrate for asking the user to rate the app
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenWapp Developer committed Jun 24, 2014
1 parent 4fdad19 commit b2b9ffc
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ module.exports = function (grunt) {
'components/PhoneNumber.js/PhoneNumberMetaData.js',
'components/coseme/coseme.js',
'components/emoji/lib/*',
'components/fxosRate/locales/*',
'components/fxosRate/l10n.js',
'components/fxosRate/fxosrate.js',
/** END OF COMPONENTS **/
'styles/main.css',
'icons/**/*.{png,jpg}',
Expand Down
3 changes: 3 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<meta name="viewport" content="width=device-width, user-scalable=no">
<link rel="stylesheet" href="styles/main.css">
<link rel="stylesheet" href="components/emoji/lib/emoji.css">
<!-- Once we change our actual l10n framework to l10n.js (or better, l20n.js),
we need to merge fxosrate strings to our new l10n files -->
<link rel="resource" type="application/l10n" href="components/fxosRate/locales/locales.ini" />
</head>

<body>
Expand Down
9 changes: 7 additions & 2 deletions app/scripts/global.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
define([
'vendor/coseme-client/client'
'vendor/coseme-client/client',
'fxosrate'
], function (cosemeClient) {
'use strict';

// Initialize FirefoxOS Rate library
window.fxosRate = Object.create(window.fxosRate);
window.fxosRate.init('openwapp', '1.3.0', 10, 5, 5, 0, 0, 7);

var client = cosemeClient.init();

return {
maxStoredMessages: 300, // Number of messages stored before they are removed
client: client,
mapsAppCode : 'qkRqH6Iz3yKMrcflO44pZA',
mapsAppCode: 'qkRqH6Iz3yKMrcflO44pZA',
mapsAppId: 'CaXtXWGiQ1gicvatQdwy',
gpsTimeout: 60000, //60 sec timeout to get current position
httpTimeout: 30000,
Expand Down
11 changes: 10 additions & 1 deletion app/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ require.config({
rtc: 'vendor/ottcomms-rtc-web/rtc',
libphonenumber: '../components/PhoneNumber.js',
coseme: '../components/coseme/coseme',
emoji: '../components/emoji/lib/emoji'
emoji: '../components/emoji/lib/emoji',
fxosrate: '../components/fxosRate/fxosrate',
l10n: '../components/fxosRate/l10n'
},
shim: {
'zeptojs': {
Expand All @@ -35,6 +37,13 @@ require.config({
'vendor/async-storage/async-storage': {
exports: 'asyncStorage'
},
'l10n': {
exports: 'l10n'
},
'fxosrate': {
deps: ['l10n'],
exports: 'fxosRate'
},
'coseme': {
exports: 'CoSeMe',
init: function () {
Expand Down
3 changes: 3 additions & 0 deletions app/scripts/models/rtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ define([
},

_addSentMessage: function (messageId, callback) {
// Log sent messages
window.fxosRate.logEvent(1);

var _this = this;

if (typeof callback === 'function') {
Expand Down
5 changes: 5 additions & 0 deletions app/scripts/views/inbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ define([
}
});
}
// Ask for rating when everything is settled
this.ratePromptTimeout = window.setTimeout(function () {
window.fxosRate.promptRequired();
}, 2000);
},

_pickContact: function (event) {
Expand Down Expand Up @@ -308,6 +312,7 @@ define([
},

clear: function () {
window.clearTimeout(this.ratePromptTimeout);
this.model.updateInbox = undefined;
this._clearMiniConversations();
},
Expand Down
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"backbone": "~1.0.0",
"handlebars.js": "1.0.0",
"PhoneNumber.js": "~0.5.0",
"emoji": "~0.2.1"
"emoji": "~0.2.1",
"fxosRate": "~0.1.0"
},
"devDependencies": {}
}

0 comments on commit b2b9ffc

Please sign in to comment.