diff --git a/src/langs/zh_Hans.txt b/src/langs/zh_Hans.txt index ad3c14f..01f796e 100644 --- a/src/langs/zh_Hans.txt +++ b/src/langs/zh_Hans.txt @@ -196,6 +196,7 @@ Downloading Count=正在下载数量 Waiting Count=正在等待数量 Stopped Count=已停止数量 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.=语言资源已经更新, 请重新加载页面使其生效. Configuration has been modified, please reload the page for the changes to take effect.=配置已经修改, 请重新加载页面使其生效. Reload AriaNg=重新加载 AriaNg diff --git a/src/langs/zh_Hant.txt b/src/langs/zh_Hant.txt index 6adf827..30ca3e3 100644 --- a/src/langs/zh_Hant.txt +++ b/src/langs/zh_Hant.txt @@ -196,6 +196,7 @@ Current RPC Alias=目前 RPC 別名 Waiting Count=正在等待數量 Stopped Count=已停止數量 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.=語言資源已經更新, 請重新載入頁面使其生效. Configuration has been modified, please reload the page for the changes to take effect.=配置已經修改, 請重新載入頁面使其生效. Reload AriaNg=重新載入 AriaNg diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 763f510..8062bac 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -200,6 +200,7 @@ '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.': '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': 'Reload AriaNg', diff --git a/src/scripts/core/root.js b/src/scripts/core/root.js index 2c6f66b..bdd5e21 100644 --- a/src/scripts/core/root.js +++ b/src/scripts/core/root.js @@ -328,6 +328,14 @@ $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 () { ariaNgLocalizationService.notifyInPage('', 'Tap to configure and get started with AriaNg.', { delay: false, diff --git a/src/scripts/services/ariaNgSettingService.js b/src/scripts/services/ariaNgSettingService.js index f553567..56671e6 100644 --- a/src/scripts/services/ariaNgSettingService.js +++ b/src/scripts/services/ariaNgSettingService.js @@ -12,13 +12,25 @@ }; })(); var browserSupportStorage = browserFeatures.localStroage || browserFeatures.cookies; + var browserSupportAppCache = !!$window.applicationCache; + var onAppCacheUpdatedCallbacks = []; var onFirstVisitCallbacks = []; var firstVisitCallbackFired = false; var sessionSettings = { 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 () { if (!browserSupportStorage) { return; @@ -200,6 +212,9 @@ isBrowserSupportStorage: function () { return browserSupportStorage; }, + isBrowserSupportApplicationCache: function () { + return browserSupportAppCache; + }, getBrowserFeatures: function () { return browserFeatures; }, @@ -597,6 +612,13 @@ resetSettings: function () { clearAll(); }, + onApplicationCacheUpdated: function (callback) { + if (!callback) { + return; + } + + onAppCacheUpdatedCallbacks.push(callback); + }, onFirstAccess: function (callback) { if (!callback) { return;