2020-05-19 05:02:56 -04:00
|
|
|
import App from '../base'
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
App.controller(
|
|
|
|
'TranslationsPopupController',
|
|
|
|
function ($scope, ipCookie, localStorage) {
|
|
|
|
function getStoredDismissal() {
|
|
|
|
let 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
|
|
|
|
let 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
|
|
|
|
}
|
2020-06-05 06:14:39 -04:00
|
|
|
}
|
2021-04-14 09:17:21 -04:00
|
|
|
)
|