Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit f22b260

Browse files
author
Andreas Adler
committed
Merge pull request #2 from RainLoop/master
Merge with base
2 parents 871a25b + 3956629 commit f22b260

File tree

103 files changed

+2557
-1269
lines changed

Some content is hidden

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

103 files changed

+2557
-1269
lines changed

dev/App/User.js

Lines changed: 157 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,6 @@
209209
Remote.messageList(Utils.emptyFunction, Cache.getFolderInboxName(), 0, SettingsStore.messagesPerPage(), '', true);
210210
};
211211

212-
AppUser.prototype.reloadMessageListHelper = function (bEmptyList)
213-
{
214-
this.reloadMessageList(bEmptyList);
215-
};
216-
217212
/**
218213
* @param {Function} fResultFunc
219214
* @returns {boolean}
@@ -316,7 +311,7 @@
316311
}
317312
}
318313

319-
this.reloadMessageListHelper(0 === MessageStore.messageList().length);
314+
this.reloadMessageList(0 === MessageStore.messageList().length);
320315
this.quotaDebounce();
321316
}
322317
};
@@ -1219,15 +1214,23 @@
12191214
});
12201215
};
12211216

1217+
AppUser.prototype.bootstartTwoFactorScreen = function ()
1218+
{
1219+
kn.showScreenPopup(require('View/Popup/TwoFactorConfiguration'), [true]);
1220+
};
1221+
1222+
AppUser.prototype.bootstartWelcomePopup = function (sUrl)
1223+
{
1224+
kn.showScreenPopup(require('View/Popup/WelcomePage'), [sUrl]);
1225+
};
1226+
12221227
AppUser.prototype.bootstartLoginScreen = function ()
12231228
{
12241229
Globals.$html.removeClass('rl-user-auth').addClass('rl-user-no-auth');
12251230

12261231
var sCustomLoginLink = Utils.pString(Settings.settingsGet('CustomLoginLink'));
12271232
if (!sCustomLoginLink)
12281233
{
1229-
kn.hideLoading();
1230-
12311234
kn.startScreens([
12321235
require('Screen/User/Login')
12331236
]);
@@ -1247,6 +1250,16 @@
12471250
}
12481251
};
12491252

1253+
AppUser.prototype.bootend = function ()
1254+
{
1255+
kn.hideLoading();
1256+
1257+
if (SimplePace)
1258+
{
1259+
SimplePace.set(100);
1260+
}
1261+
};
1262+
12501263
AppUser.prototype.bootstart = function ()
12511264
{
12521265
AbstractApp.prototype.bootstart.call(this);
@@ -1277,183 +1290,193 @@
12771290
Events.pub('left-panel.' + (bValue ? 'off' : 'on'));
12781291
});
12791292

1293+
this.setWindowTitle('');
12801294
if (!!Settings.settingsGet('Auth'))
12811295
{
12821296
Globals.$html.addClass('rl-user-auth');
12831297

1284-
this.setWindowTitle(Translator.i18n('TITLES/LOADING'));
1298+
if (Settings.capa(Enums.Capa.TwoFactor) &&
1299+
Settings.capa(Enums.Capa.TwoFactorForce) &&
1300+
Settings.settingsGet('RequireTwoFactor'))
1301+
{
1302+
1303+
this.bootend();
1304+
this.bootstartTwoFactorScreen();
1305+
}
1306+
else
1307+
{
1308+
this.setWindowTitle(Translator.i18n('TITLES/LOADING'));
12851309

12861310
//require.ensure([], function() { // require code splitting
12871311

1288-
self.foldersReload(_.bind(function (bValue) {
1312+
self.foldersReload(_.bind(function (bValue) {
12891313

1290-
kn.hideLoading();
1314+
this.bootend();
12911315

1292-
if (bValue)
1293-
{
1294-
if ($LAB && window.crypto && window.crypto.getRandomValues && Settings.capa(Enums.Capa.OpenPGP))
1316+
if (bValue)
12951317
{
1296-
var fOpenpgpCallback = function (openpgp) {
1297-
PgpStore.openpgp = openpgp;
1298-
PgpStore.openpgpKeyring = new openpgp.Keyring();
1299-
PgpStore.capaOpenPGP(true);
1318+
if ($LAB && window.crypto && window.crypto.getRandomValues && Settings.capa(Enums.Capa.OpenPGP))
1319+
{
1320+
var fOpenpgpCallback = function (openpgp) {
1321+
PgpStore.openpgp = openpgp;
1322+
PgpStore.openpgpKeyring = new openpgp.Keyring();
1323+
PgpStore.capaOpenPGP(true);
13001324

1301-
Events.pub('openpgp.init');
1325+
Events.pub('openpgp.init');
13021326

1303-
self.reloadOpenPgpKeys();
1304-
};
1327+
self.reloadOpenPgpKeys();
1328+
};
13051329

1306-
if (window.openpgp)
1307-
{
1308-
fOpenpgpCallback(window.openpgp);
1330+
if (window.openpgp)
1331+
{
1332+
fOpenpgpCallback(window.openpgp);
1333+
}
1334+
else
1335+
{
1336+
$LAB.script(Links.openPgpJs()).wait(function () {
1337+
if (window.openpgp)
1338+
{
1339+
fOpenpgpCallback(window.openpgp);
1340+
}
1341+
});
1342+
}
13091343
}
13101344
else
13111345
{
1312-
$LAB.script(Links.openPgpJs()).wait(function () {
1313-
if (window.openpgp)
1314-
{
1315-
fOpenpgpCallback(window.openpgp);
1316-
}
1317-
});
1346+
PgpStore.capaOpenPGP(false);
13181347
}
1319-
}
1320-
else
1321-
{
1322-
PgpStore.capaOpenPGP(false);
1323-
}
13241348

1325-
kn.startScreens([
1326-
require('Screen/User/MailBox'),
1327-
require('Screen/User/Settings'),
1328-
require('Screen/User/About')
1329-
]);
1349+
kn.startScreens([
1350+
require('Screen/User/MailBox'),
1351+
require('Screen/User/Settings'),
1352+
require('Screen/User/About')
1353+
]);
13301354

1331-
if (bGoogle || bFacebook || bTwitter)
1332-
{
1333-
self.socialUsers(true);
1334-
}
1335-
1336-
Events.sub('interval.2m', function () {
1337-
self.folderInformation(Cache.getFolderInboxName());
1338-
});
1339-
1340-
Events.sub('interval.3m', function () {
1341-
var sF = FolderStore.currentFolderFullNameRaw();
1342-
if (Cache.getFolderInboxName() !== sF)
1355+
if (bGoogle || bFacebook || bTwitter)
13431356
{
1344-
self.folderInformation(sF);
1357+
self.socialUsers(true);
13451358
}
1346-
});
1347-
1348-
Events.sub('interval.5m-after5m', function () {
1349-
self.folderInformationMultiply();
1350-
});
1351-
1352-
Events.sub('interval.15m', function () {
1353-
self.quota();
1354-
});
13551359

1356-
Events.sub('interval.20m', function () {
1357-
self.foldersReload();
1358-
});
1359-
1360-
iContactsSyncInterval = 5 <= iContactsSyncInterval ? iContactsSyncInterval : 20;
1361-
iContactsSyncInterval = 320 >= iContactsSyncInterval ? iContactsSyncInterval : 320;
1360+
Events.sub('interval.2m', function () {
1361+
self.folderInformation(Cache.getFolderInboxName());
1362+
});
13621363

1363-
_.delay(function () {
1364-
self.contactsSync();
1365-
}, 10000);
1364+
Events.sub('interval.3m', function () {
1365+
var sF = FolderStore.currentFolderFullNameRaw();
1366+
if (Cache.getFolderInboxName() !== sF)
1367+
{
1368+
self.folderInformation(sF);
1369+
}
1370+
});
13661371

1367-
_.delay(function () {
1368-
self.folderInformationMultiply(true);
1369-
}, 2000);
1372+
Events.sub('interval.5m-after5m', function () {
1373+
self.folderInformationMultiply();
1374+
});
13701375

1371-
window.setInterval(function () {
1372-
self.contactsSync();
1373-
}, iContactsSyncInterval * 60000 + 5000);
1376+
Events.sub('interval.15m', function () {
1377+
self.quota();
1378+
});
13741379

1375-
self.accountsAndIdentities(true);
1380+
Events.sub('interval.20m', function () {
1381+
self.foldersReload();
1382+
});
13761383

1377-
_.delay(function () {
1378-
var sF = FolderStore.currentFolderFullNameRaw();
1379-
if (Cache.getFolderInboxName() !== sF)
1380-
{
1381-
self.folderInformation(sF);
1382-
}
1383-
}, 1000);
1384+
iContactsSyncInterval = 5 <= iContactsSyncInterval ? iContactsSyncInterval : 20;
1385+
iContactsSyncInterval = 320 >= iContactsSyncInterval ? iContactsSyncInterval : 320;
13841386

1385-
_.delay(function () {
1386-
self.quota();
1387-
}, 5000);
1387+
_.delay(function () {
1388+
self.contactsSync();
1389+
}, 10000);
13881390

1389-
_.delay(function () {
1390-
Remote.appDelayStart(Utils.emptyFunction);
1391-
}, 35000);
1391+
_.delay(function () {
1392+
self.folderInformationMultiply(true);
1393+
}, 2000);
13921394

1393-
Events.sub('rl.auto-logout', function () {
1394-
self.logout();
1395-
});
1395+
window.setInterval(function () {
1396+
self.contactsSync();
1397+
}, iContactsSyncInterval * 60000 + 5000);
13961398

1397-
Plugins.runHook('rl-start-user-screens');
1398-
Events.pub('rl.bootstart-user-screens');
1399+
self.accountsAndIdentities(true);
13991400

1400-
if (!!Settings.settingsGet('AccountSignMe') && window.navigator.registerProtocolHandler)
1401-
{
14021401
_.delay(function () {
1403-
try {
1404-
window.navigator.registerProtocolHandler('mailto',
1405-
window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s',
1406-
'' + (Settings.settingsGet('Title') || 'RainLoop'));
1407-
} catch(e) {}
1408-
1409-
if (Settings.settingsGet('MailToEmail'))
1402+
var sF = FolderStore.currentFolderFullNameRaw();
1403+
if (Cache.getFolderInboxName() !== sF)
14101404
{
1411-
Utils.mailToHelper(Settings.settingsGet('MailToEmail'), require('View/Popup/Compose'));
1405+
self.folderInformation(sF);
14121406
}
1413-
}, 500);
1414-
}
1407+
}, 1000);
14151408

1416-
if (!Globals.bMobileDevice)
1417-
{
1418-
_.defer(function () {
1419-
self.initVerticalLayoutResizer(Enums.ClientSideKeyName.FolderListSize);
1409+
_.delay(function () {
1410+
self.quota();
1411+
}, 5000);
1412+
1413+
_.delay(function () {
1414+
Remote.appDelayStart(Utils.emptyFunction);
1415+
}, 35000);
1416+
1417+
Events.sub('rl.auto-logout', function () {
1418+
self.logout();
14201419
});
14211420

1422-
if (Tinycon)
1421+
Plugins.runHook('rl-start-user-screens');
1422+
Events.pub('rl.bootstart-user-screens');
1423+
1424+
if (Settings.settingsGet('WelcomePageUrl'))
14231425
{
1424-
Tinycon.setOptions({
1425-
fallback: false
1426-
});
1426+
_.delay(function () {
1427+
self.bootstartWelcomePopup(Settings.settingsGet('WelcomePageUrl'));
1428+
}, 1000);
1429+
}
14271430

1428-
Events.sub('mailbox.inbox-unread-count', function (iCount) {
1429-
Tinycon.setBubble(0 < iCount ? (99 < iCount ? 99 : iCount) : 0);
1431+
if (!!Settings.settingsGet('AccountSignMe') && window.navigator.registerProtocolHandler)
1432+
{
1433+
_.delay(function () {
1434+
try {
1435+
window.navigator.registerProtocolHandler('mailto',
1436+
window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s',
1437+
'' + (Settings.settingsGet('Title') || 'RainLoop'));
1438+
} catch(e) {}
1439+
1440+
if (Settings.settingsGet('MailToEmail'))
1441+
{
1442+
Utils.mailToHelper(Settings.settingsGet('MailToEmail'), require('View/Popup/Compose'));
1443+
}
1444+
}, 500);
1445+
}
1446+
1447+
if (!Globals.bMobileDevice)
1448+
{
1449+
_.defer(function () {
1450+
self.initVerticalLayoutResizer(Enums.ClientSideKeyName.FolderListSize);
14301451
});
1452+
1453+
if (Tinycon)
1454+
{
1455+
Tinycon.setOptions({
1456+
fallback: false
1457+
});
1458+
1459+
Events.sub('mailbox.inbox-unread-count', function (iCount) {
1460+
Tinycon.setBubble(0 < iCount ? (99 < iCount ? 99 : iCount) : 0);
1461+
});
1462+
}
14311463
}
14321464
}
1433-
}
1434-
else
1435-
{
1436-
this.bootstartLoginScreen();
1437-
}
1438-
1439-
if (SimplePace)
1440-
{
1441-
SimplePace.set(100);
1442-
}
1465+
else
1466+
{
1467+
this.bootstartLoginScreen();
1468+
}
14431469

1444-
}, self));
1470+
}, self));
14451471

14461472
//}); // require code splitting
14471473

1474+
}
14481475
}
14491476
else
14501477
{
1478+
this.bootend();
14511479
this.bootstartLoginScreen();
1452-
1453-
if (SimplePace)
1454-
{
1455-
SimplePace.set(100);
1456-
}
14571480
}
14581481

14591482
if (bGoogle)

0 commit comments

Comments
 (0)