forked from ramboxapp/community-edition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
84 lines (79 loc) · 2.19 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Initialize Firebase
var firebase = require('firebase/app');
require('firebase/database');
require('firebase/auth');
// Firebase Config
var config = {
apiKey: firebaseCfg.apiKey
,authDomain: firebaseCfg.authDomain
,databaseURL: firebaseCfg.databaseURL
,storageBucket: firebaseCfg.storageBucket
};
var fireRef = firebase.initializeApp(config); // Firebase Ref
var FirebaseTokenGenerator = require('firebase-token-generator');
var auth0, lock; // Auth0 vars
// Sencha App
Ext.setGlyphFontFamily('FontAwesome');
Ext.application({
name: 'Rambox'
,extend: 'Rambox.Application'
,autoCreateViewport: 'Rambox.view.main.Main'
});
// auto update logic
const ipc = require('electron').ipcRenderer;
ipc.on('showAbout', function(event, message) {
!Ext.cq1('about') ? Ext.create('Rambox.view.main.About') : '';
});
ipc.on('autoUpdater:checking-for-update:', function() {
Ext.Msg.wait('Please wait...', 'Checking for update');
});
ipc.on('autoUpdater:check-update', function() {
Rambox.app.checkUpdate();
});
ipc.on('autoUpdater:update-not-available', function() {
Ext.Msg.show({
title: 'You are up to date!'
,message: 'You have the latest version of Rambox.'
,icon: Ext.Msg.INFO
,buttons: Ext.Msg.OK
});
});
ipc.on('autoUpdater:update-available', function() {
Ext.Msg.show({
title: 'New Version available!'
,message: 'Please wait until Rambox download the new version and ask you for install it.'
,icon: Ext.Msg.INFO
,buttons: Ext.Msg.OK
});
});
ipc.on('autoUpdater:update-downloaded', function(e, releaseNotes, releaseName, releaseDate, updateURL) {
Ext.cq1('app-main').addDocked({
xtype: 'toolbar'
,dock: 'top'
,ui: 'newversion'
,items: [
'->'
,{
xtype: 'label'
,html: '<b>New version is available!</b> ('+releaseName+')'
}
,{
xtype: 'button'
,text: 'Install'
,handler: function(btn) { ipc.send('autoUpdater:quit-and-install'); }
}
,{
xtype: 'button'
,text: 'Changelog'
,href: 'https://github.com/saenzramiro/rambox/releases/tag/'+releaseName
}
,'->'
,{
glyph: 'xf00d@FontAwesome'
,baseCls: ''
,style: 'cursor:pointer;'
,handler: function(btn) { Ext.cq1('app-main').removeDocked(btn.up('toolbar'), true); }
}
]
});
});