2020-05-19 09:02:56 +00:00
|
|
|
import App from '../base'
|
2018-11-05 10:06:39 +00:00
|
|
|
|
2021-04-14 13:17:21 +00:00
|
|
|
App.controller(
|
|
|
|
'TranslationsPopupController',
|
|
|
|
function ($scope, ipCookie, localStorage) {
|
|
|
|
function getStoredDismissal() {
|
2021-05-05 13:05:04 +00:00
|
|
|
const localStore = localStorage('hide-i18n-notification')
|
2020-05-19 09:02:56 +00:00
|
|
|
|
2021-04-14 13:17:21 +00:00
|
|
|
if (localStore === null) {
|
|
|
|
// Not stored in localStorage, check cookie
|
2021-05-05 13:05:04 +00:00
|
|
|
const cookieStore = ipCookie('hidei18nNotification')
|
2020-06-05 10:14:39 +00:00
|
|
|
|
2021-04-14 13:17:21 +00: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 10:14:39 +00:00
|
|
|
}
|
|
|
|
|
2021-04-14 13:17:21 +00:00
|
|
|
return localStore
|
2020-06-05 10:14:39 +00:00
|
|
|
}
|
|
|
|
|
2021-04-14 13:17:21 +00:00
|
|
|
$scope.hidei18nNotification = getStoredDismissal()
|
2020-06-05 10:14:39 +00:00
|
|
|
|
2021-04-14 13:17:21 +00:00
|
|
|
$scope.dismiss = function () {
|
|
|
|
localStorage('hide-i18n-notification', true)
|
|
|
|
$scope.hidei18nNotification = true
|
|
|
|
}
|
2020-06-05 10:14:39 +00:00
|
|
|
}
|
2021-04-14 13:17:21 +00:00
|
|
|
)
|