show tip when application cache is updated

This commit is contained in:
MaysWind 2019-08-20 21:48:32 +08:00
parent ce1c2fed4b
commit 612c652a2b
5 changed files with 33 additions and 0 deletions

View file

@ -196,6 +196,7 @@ Downloading Count=正在下载数量
Waiting Count=正在等待数量 Waiting Count=正在等待数量
Stopped Count=已停止数量 Stopped Count=已停止数量
You have disabled notification in your browser. You should change your browser's settings before you enable this function.=您已经在浏览器中禁用通知功能. 如需使用此功能, 请修改您浏览器的设置. You have disabled notification in your browser. You should change your browser's settings before you enable this function.=您已经在浏览器中禁用通知功能. 如需使用此功能, 请修改您浏览器的设置.
Application cache has been updated, please reload the page for the changes to take effect.=应用缓存已经更新, 请重新加载页面使其生效.
Language resource has been updated, please reload the page for the changes to take effect.=语言资源已经更新, 请重新加载页面使其生效. Language resource has been updated, please reload the page for the changes to take effect.=语言资源已经更新, 请重新加载页面使其生效.
Configuration has been modified, please reload the page for the changes to take effect.=配置已经修改, 请重新加载页面使其生效. Configuration has been modified, please reload the page for the changes to take effect.=配置已经修改, 请重新加载页面使其生效.
Reload AriaNg=重新加载 AriaNg Reload AriaNg=重新加载 AriaNg

View file

@ -196,6 +196,7 @@ Current RPC Alias=目前 RPC 別名
Waiting Count=正在等待數量 Waiting Count=正在等待數量
Stopped Count=已停止數量 Stopped Count=已停止數量
You have disabled notification in your browser. You should change your browser's settings before you enable this function.=您已經在瀏覽器中停用通知功能. 如需使用此功能, 請修改您瀏覽器的設定. You have disabled notification in your browser. You should change your browser's settings before you enable this function.=您已經在瀏覽器中停用通知功能. 如需使用此功能, 請修改您瀏覽器的設定.
Application cache has been updated, please reload the page for the changes to take effect.=應用快取已經更新, 請重新載入頁面使其生效.
Language resource has been updated, please reload the page for the changes to take effect.=語言資源已經更新, 請重新載入頁面使其生效. Language resource has been updated, please reload the page for the changes to take effect.=語言資源已經更新, 請重新載入頁面使其生效.
Configuration has been modified, please reload the page for the changes to take effect.=配置已經修改, 請重新載入頁面使其生效. Configuration has been modified, please reload the page for the changes to take effect.=配置已經修改, 請重新載入頁面使其生效.
Reload AriaNg=重新載入 AriaNg Reload AriaNg=重新載入 AriaNg

View file

@ -200,6 +200,7 @@
'Waiting Count': 'Waiting Count', 'Waiting Count': 'Waiting Count',
'Stopped Count': 'Stopped Count', 'Stopped Count': 'Stopped Count',
'You have disabled notification in your browser. You should change your browser\'s settings before you enable this function.': 'You have disabled notification in your browser. You should change your browser\'s settings before you enable this function.', 'You have disabled notification in your browser. You should change your browser\'s settings before you enable this function.': 'You have disabled notification in your browser. You should change your browser\'s settings before you enable this function.',
'Application cache has been updated, please reload the page for the changes to take effect.': 'Application cache has been updated, please reload the page for the changes to take effect.',
'Language resource has been updated, please reload the page for the changes to take effect.': 'Language resource has been updated, please reload the page for the changes to take effect.', 'Language resource has been updated, please reload the page for the changes to take effect.': 'Language resource has been updated, please reload the page for the changes to take effect.',
'Configuration has been modified, please reload the page for the changes to take effect.': 'Configuration has been modified, please reload the page for the changes to take effect.', 'Configuration has been modified, please reload the page for the changes to take effect.': 'Configuration has been modified, please reload the page for the changes to take effect.',
'Reload AriaNg': 'Reload AriaNg', 'Reload AriaNg': 'Reload AriaNg',

View file

@ -328,6 +328,14 @@
$window.location.reload(); $window.location.reload();
}; };
ariaNgSettingService.onApplicationCacheUpdated(function () {
ariaNgLocalizationService.notifyInPage('', 'Application cache has been updated, please reload the page for the changes to take effect.', {
delay: false,
type: 'info',
templateUrl: 'views/notification-reloadable.html'
});
});
ariaNgSettingService.onFirstAccess(function () { ariaNgSettingService.onFirstAccess(function () {
ariaNgLocalizationService.notifyInPage('', 'Tap to configure and get started with AriaNg.', { ariaNgLocalizationService.notifyInPage('', 'Tap to configure and get started with AriaNg.', {
delay: false, delay: false,

View file

@ -12,13 +12,25 @@
}; };
})(); })();
var browserSupportStorage = browserFeatures.localStroage || browserFeatures.cookies; var browserSupportStorage = browserFeatures.localStroage || browserFeatures.cookies;
var browserSupportAppCache = !!$window.applicationCache;
var onAppCacheUpdatedCallbacks = [];
var onFirstVisitCallbacks = []; var onFirstVisitCallbacks = [];
var firstVisitCallbackFired = false; var firstVisitCallbackFired = false;
var sessionSettings = { var sessionSettings = {
debugMode: false debugMode: false
}; };
if (browserSupportAppCache) {
var appCache = $window.applicationCache;
appCache.addEventListener('updateready', function (e) {
for (var i = 0; i < onAppCacheUpdatedCallbacks.length; i++) {
var callback = onAppCacheUpdatedCallbacks[i];
callback();
}
}, false);
}
var fireFirstVisitEvent = function () { var fireFirstVisitEvent = function () {
if (!browserSupportStorage) { if (!browserSupportStorage) {
return; return;
@ -200,6 +212,9 @@
isBrowserSupportStorage: function () { isBrowserSupportStorage: function () {
return browserSupportStorage; return browserSupportStorage;
}, },
isBrowserSupportApplicationCache: function () {
return browserSupportAppCache;
},
getBrowserFeatures: function () { getBrowserFeatures: function () {
return browserFeatures; return browserFeatures;
}, },
@ -597,6 +612,13 @@
resetSettings: function () { resetSettings: function () {
clearAll(); clearAll();
}, },
onApplicationCacheUpdated: function (callback) {
if (!callback) {
return;
}
onAppCacheUpdatedCallbacks.push(callback);
},
onFirstAccess: function (callback) { onFirstAccess: function (callback) {
if (!callback) { if (!callback) {
return; return;