2020-05-19 05:02:56 -04:00
|
|
|
import App from '../base'
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2023-10-13 05:13:49 -04:00
|
|
|
App.controller('TranslationsPopupController', [
|
|
|
|
'$scope',
|
|
|
|
'ipCookie',
|
|
|
|
'localStorage',
|
2021-04-14 09:17:21 -04:00
|
|
|
function ($scope, ipCookie, localStorage) {
|
|
|
|
function getStoredDismissal() {
|
2021-05-05 09:05:04 -04:00
|
|
|
const localStore = localStorage('hide-i18n-notification')
|
2020-05-19 05:02:56 -04:00
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
if (localStore === null) {
|
|
|
|
// Not stored in localStorage, check cookie
|
2021-05-05 09:05:04 -04:00
|
|
|
const cookieStore = ipCookie('hidei18nNotification')
|
2020-06-05 06:14:39 -04:00
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
// If stored in cookie, set on localStorage for forwards compat
|
|
|
|
if (cookieStore) {
|
|
|
|
localStorage('hide-i18n-notification', cookieStore)
|
|
|
|
ipCookie.remove('hidei18nNotification')
|
|
|
|
}
|
|
|
|
|
|
|
|
return cookieStore
|
2020-06-05 06:14:39 -04:00
|
|
|
}
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
return localStore
|
2020-06-05 06:14:39 -04:00
|
|
|
}
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
$scope.hidei18nNotification = getStoredDismissal()
|
2020-06-05 06:14:39 -04:00
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
$scope.dismiss = function () {
|
|
|
|
localStorage('hide-i18n-notification', true)
|
|
|
|
$scope.hidei18nNotification = true
|
|
|
|
}
|
2023-10-13 05:13:49 -04:00
|
|
|
},
|
|
|
|
])
|