From 9dee2cf4f01b81f3b897d374a6ad5b20284f5f91 Mon Sep 17 00:00:00 2001 From: Ramiro Saenz Date: Tue, 23 May 2017 15:51:09 -0300 Subject: [PATCH] Enable Cookies --- app.js | 3 +++ app/Application.js | 5 +++++ app/package.json | 3 ++- app/ux/Auth0.js | 6 ++++++ package.json | 3 ++- 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 7cf1c650..0013fec8 100644 --- a/app.js +++ b/app.js @@ -1,4 +1,7 @@ var auth0, lock; // Auth0 vars +// Enable Cookies +var ElectronCookies = require('@exponent/electron-cookies'); +ElectronCookies.enable({ origin: 'http://rambox.pro' }); // Sencha App Ext.setGlyphFontFamily('FontAwesome'); diff --git a/app/Application.js b/app/Application.js index 46a616d3..23253f48 100644 --- a/app/Application.js +++ b/app/Application.js @@ -7,6 +7,7 @@ Ext.define('Rambox.Application', { 'Rambox.ux.Auth0' ,'Rambox.util.MD5' ,'Ext.window.Toast' + ,'Ext.util.Cookies' ] ,stores: [ @@ -33,6 +34,10 @@ Ext.define('Rambox.Application', { // Initialize Auth0 Rambox.ux.Auth0.init(); + // Set cookies to help Tooltip.io messages segmentation + Ext.util.Cookies.set('version', require('electron').remote.app.getVersion()); + if ( Ext.util.Cookies.get('auth0') === null ) Ext.util.Cookies.set('auth0', false); + // Check for updates if ( require('electron').remote.process.argv.indexOf('--without-update') === -1 && process.platform !== 'win32' ) Rambox.app.checkUpdate(true); diff --git a/app/package.json b/app/package.json index 1a7ba831..2b489d15 100644 --- a/app/package.json +++ b/app/package.json @@ -33,6 +33,7 @@ "tmp": "0.0.28", "mime": "^1.3.4", "electron-is-dev": "^0.1.1", - "electron-config": "0.2.1" + "electron-config": "0.2.1", + "@exponent/electron-cookies": "2.0.0" } } diff --git a/app/ux/Auth0.js b/app/ux/Auth0.js index 245bc3c4..f9315246 100644 --- a/app/ux/Auth0.js +++ b/app/ux/Auth0.js @@ -51,6 +51,9 @@ Ext.define('Rambox.ux.Auth0', { // Google Analytics Event ga_storage._trackEvent('Users', 'loggedIn'); + // Set cookies to help Tooltip.io messages segmentation + Ext.util.Cookies.set('auth0', true); + // User is logged in // Save the profile and JWT. localStorage.setItem('profile', JSON.stringify(profile)); @@ -225,5 +228,8 @@ Ext.define('Rambox.ux.Auth0', { localStorage.removeItem('profile'); localStorage.removeItem('id_token'); localStorage.removeItem('refresh_token'); + + // Set cookies to help Tooltip.io messages segmentation + Ext.util.Cookies.set('auth0', false); } }); diff --git a/package.json b/package.json index d6a8fee9..6cce2aaf 100644 --- a/package.json +++ b/package.json @@ -104,6 +104,7 @@ "tmp": "0.0.28", "mime": "^1.3.4", "electron-is-dev": "^0.1.1", - "electron-config": "0.2.1" + "electron-config": "0.2.1", + "@exponent/electron-cookies": "2.0.0" } }