show welcome tip when first access AriaNg
This commit is contained in:
parent
476537c2ba
commit
624f9617e2
|
@ -149,6 +149,7 @@
|
|||
"Input number is below min value!": "输入的数字小于最小值 {{value}} !",
|
||||
"Input number is above max value!": "输入的数字大于最大值 {{value}} !",
|
||||
"Input value is invalid!": "输入的内容无效!",
|
||||
"Tap to configure and get started with AriaNg.": "您还没有进行过设置, 点击这里进行设置.",
|
||||
"format": {
|
||||
"longdate": "YYYY年MM月DD日 HH:mm:ss",
|
||||
"time.millisecond": "{{value}} 毫秒",
|
||||
|
|
|
@ -153,6 +153,7 @@
|
|||
'Input number is below min value!': 'Input number is below min value {{value}}!',
|
||||
'Input number is above max value!': 'Input number is above max value {{value}}!',
|
||||
'Input value is invalid!': 'Input value is invalid!',
|
||||
'Tap to configure and get started with AriaNg.': 'Tap to configure and get started with AriaNg.',
|
||||
'format': {
|
||||
'longdate': 'MM/DD/YYYY HH:mm:ss',
|
||||
'time.millisecond': '{{value}} Millisecond',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('ariaNg').run(['$rootScope', '$location', '$document', 'SweetAlert', 'ariaNgNotificationService', 'aria2TaskService', function ($rootScope, $location, $document, SweetAlert, ariaNgNotificationService, aria2TaskService) {
|
||||
angular.module('ariaNg').run(['$rootScope', '$location', '$document', 'SweetAlert', 'ariaNgNotificationService', 'ariaNgSettingService', 'aria2TaskService', function ($rootScope, $location, $document, SweetAlert, ariaNgNotificationService, ariaNgSettingService, aria2TaskService) {
|
||||
var isUrlMatchUrl2 = function (url, url2) {
|
||||
if (url === url2) {
|
||||
return true;
|
||||
|
@ -154,6 +154,15 @@
|
|||
}
|
||||
};
|
||||
|
||||
ariaNgSettingService.onFirstAccess(function () {
|
||||
ariaNgNotificationService.notifyInPage('', 'Tap to configure and get started with AriaNg.', {
|
||||
delay: false,
|
||||
onClose: function () {
|
||||
$location.path('/settings/ariang');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
aria2TaskService.onFirstSuccess(function () {
|
||||
ariaNgNotificationService.notifyInPage('', 'Connection Succeeded', {
|
||||
type: 'success'
|
||||
|
|
|
@ -2,6 +2,19 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ariaNg').factory('ariaNgSettingService', ['$window', '$location', '$filter', '$translate', 'base64', 'amMoment', 'localStorageService', 'ariaNgConstants', 'ariaNgDefaultOptions', 'ariaNgLanguages', function ($window, $location, $filter, $translate, base64, amMoment, localStorageService, ariaNgConstants, ariaNgDefaultOptions, ariaNgLanguages) {
|
||||
var onFirstVisitCallbacks = [];
|
||||
|
||||
var fireFirstVisitEvent = function () {
|
||||
if (!angular.isArray(onFirstVisitCallbacks) || onFirstVisitCallbacks.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < onFirstVisitCallbacks.length; i++) {
|
||||
var callback = onFirstVisitCallbacks[i];
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
var getDefaultLanguage = function () {
|
||||
var browserLang = $window.navigator.browserLanguage ? $window.navigator.browserLanguage : $window.navigator.language;
|
||||
|
||||
|
@ -34,6 +47,7 @@
|
|||
options.language = getDefaultLanguage();
|
||||
|
||||
setOptions(options);
|
||||
fireFirstVisitEvent();
|
||||
}
|
||||
|
||||
return options;
|
||||
|
@ -215,6 +229,13 @@
|
|||
},
|
||||
setPeerListDisplayOrder: function (value) {
|
||||
setOption('peerListDisplayOrder', value);
|
||||
},
|
||||
onFirstAccess: function (callback) {
|
||||
if (!callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
onFirstVisitCallbacks.push(callback);
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
|
Reference in a new issue