Browse Source

Update 2016-12-16T16:16:58.509Z

gh-pages
Igor Zhukov 8 years ago
parent
commit
97435480af
  1. 38
      js/app.js
  2. 72
      js/lib/push_worker.js
  3. 10
      js/locales/de-de.json
  4. 16
      js/locales/es-es.json
  5. 6
      js/locales/it-it.json
  6. 10
      js/locales/pt-br.json
  7. 2
      service_worker.js
  8. 10
      webogram.appcache

38
js/app.js

File diff suppressed because one or more lines are too long

72
js/lib/push_worker.js

@ -1,5 +1,3 @@
'use strict';
console.log('[SW] Push worker started')
@ -27,22 +25,23 @@ self.addEventListener('push', function(event) {
var obj = event.data.json()
console.log('[SW] push', obj)
if (!obj.badge) {
event.waitUntil(self.registration.showNotification('Telegram').then(function () {
var promise = self.registration.showNotification('Telegram').then(function () {
return closeAllNotifications(obj)
}))
}).catch(function (error) {
console.error('Show notification error', error)
})
if ('waitUntil' in event) {
event.waitUntil(promise)
}
} else {
fireNotification(obj, event)
}
})
self.addEventListener('activate', function(event) {
event.waitUntil(clients.claim())
})
self.addEventListener('message', function(event) {
console.log('[SW] on message', event.data)
var client = event.ports[0] || event.source
var client = event.ports && event.ports[0] || event.source
if (event.data.type == 'ping') {
if (event.data.localNotifications) {
lastAliveTime = +(new Date())
@ -76,7 +75,7 @@ function fireNotification(obj, event) {
var nowTime = +(new Date())
if (nowTime - lastAliveTime < 60000) {
console.log('Supress notification because some instance is alive')
return false
// return false
}
if (muteUntil && nowTime < muteUntil) {
console.log('Supress notification because mute for ', (muteUntil - nowTime) / 60000, 'min')
@ -114,7 +113,7 @@ function fireNotification(obj, event) {
actions: [
{
action: 'mute1d',
title: lang.push_action_mute1d || 'Mute for 1D'
title: lang.push_action_mute1d || 'Mute for 24H'
},
{
action: 'push_settings',
@ -127,9 +126,13 @@ function fireNotification(obj, event) {
if (event && event.notification) {
pushToNotifications(event.notification)
}
}).catch(function (error) {
console.error('Show notification promise', error)
})
event.waitUntil(finalPromise)
if ('waitUntil' in event) {
event.waitUntil(finalPromise)
}
return true
}
@ -163,17 +166,24 @@ function closeAllNotifications(obj) {
} catch (e) {}
}
var p = self.registration.getNotifications({}).then(function(notifications) {
for (var i = 0, len = notifications.length; i < len; i++) {
try {
notifications[i].close()
} catch (e) {}
}
})
var promise
if ('getNotifications' in self.registration) {
promise = self.registration.getNotifications({}).then(function(notifications) {
for (var i = 0, len = notifications.length; i < len; i++) {
try {
notifications[i].close()
} catch (e) {}
}
}).catch(function (error) {
console.error('Offline register SW error', error)
})
} else {
promise = Promise.resolve()
}
notifications = []
return p
return promise
}
@ -193,7 +203,7 @@ self.addEventListener('notificationclick', function(event) {
return
}
event.waitUntil(clients.matchAll({
var promise = clients.matchAll({
type: 'window'
}).then(function(clientList) {
notification.data.action = action
@ -210,7 +220,13 @@ self.addEventListener('notificationclick', function(event) {
if (clients.openWindow) {
return clients.openWindow(baseUrl)
}
}))
}).catch(function (error) {
console.error('Clients.matchAll error', error)
})
if ('waitUntil' in event) {
event.waitUntil(promise)
}
})
self.addEventListener('notificationclose', onCloseNotification)
@ -242,12 +258,12 @@ self.addEventListener('notificationclose', onCloseNotification)
db.createObjectStore(dbStoreName)
}
if (!request) {
throw new Exception()
return reject()
}
} catch (error) {
console.error('error opening db', error.message)
idbIsAvailable = false
return $q.reject(error)
return reject(error)
}
var finished = false
@ -320,7 +336,7 @@ self.addEventListener('notificationclose', onCloseNotification)
request.onsuccess = function (event) {
var result = event.target.result
if (result === undefined) {
reject()
resolve()
} else {
resolve(result)
}
@ -348,12 +364,18 @@ self.addEventListener('notificationclose', onCloseNotification)
IDBManager.getItem('push_mute_until').then(function (newMuteUntil) {
muteUntil = Math.max(muteUntil || 0, newMuteUntil || 0) || false
}).catch(function (error) {
console.error('IDB error', error)
})
IDBManager.getItem('push_lang').then(function (newLang) {
lang = newLang || {}
}).catch(function (error) {
console.error('IDB error', error)
})
IDBManager.getItem('push_settings').then(function (newSettings) {
settings = newSettings || {}
}).catch(function (error) {
console.error('IDB error', error)
})

10
js/locales/de-de.json

@ -542,11 +542,11 @@
"inactive_title": "Oh-oh, so viele Tabs....",
"inactive_description_md": "Telegram unterstützt nur jeweils einen aktiven Tab.\nBitte lade die Seite neu oder schließe den Tab.",
"inactive_reload_btn": "Neu laden",
"push_action_mute1d": "Mute background alerts for 1 day",
"push_action_settings": "Background alerts settings",
"push_action_mute1d_mobile": "Mute for 24H",
"push_action_settings_mobile": "Alerts settings",
"push_message_nopreview": "You have a new message",
"push_action_mute1d": "Hintergr.-Benachrichtigungen 1 Tag stumm",
"push_action_settings": "Hintergr.-Benachrichtigungseinstellungen",
"push_action_mute1d_mobile": "Stumm für 24h",
"push_action_settings_mobile": "Einstellungen",
"push_message_nopreview": "Du hast eine neue Nachricht",
"country_select_modal_country_ab": "Abchasien",
"country_select_modal_country_af": "Afghanistan",
"country_select_modal_country_ax": "Åland-Inseln",

16
js/locales/es-es.json

@ -214,9 +214,9 @@
"confirm_modal_invite_peer": "¿Invitar a {peer}?",
"confirm_modal_share_game": "¿Compartir el juego con {peer}?",
"confirm_modal_apply_lang_with_reload_md": "¿Quieres recargar la aplicación para usar el nuevo idioma?",
"confirm_modal_migrate_to_https_md": "Telegram Web soporta ahora encriptación SSL adicional. ¿Deseas cambiar a HTTPS?\nLa versión HTTP será inhabilitada pronto.",
"confirm_modal_resize_desktop_md": "¿Deseas cambiar a la versión de escritorio?",
"confirm_modal_resize_mobile_md": "¿Deseas cambiar a la versión móvil?",
"confirm_modal_migrate_to_https_md": "Telegram Web ahora soporta cifrado SSL adicional. ¿Quieres cambiar a HTTPS?\nLa versión HTTP será inhabilitada pronto.",
"confirm_modal_resize_desktop_md": "¿Quieres cambiar a la versión de escritorio?",
"confirm_modal_resize_mobile_md": "¿Quieres cambiar a la versión móvil?",
"confirm_modal_recovery_email_empty_md": "¡Advertencia! ¿No quieres añadir un e-mail de recuperación para la contraseña?\n\nSi olvidas tu contraseña, perderás el acceso a tu cuenta de Telegram.",
"confirm_modal_abort_password_setup": "¿Anular la configuración de la verificación en dos pasos?",
"confirm_modal_reset_account_md": "¿Quieres hacerlo?\nEsta acción no se puede deshacer.\n\nSi continúas con el reinicio de tu cuenta, perderás todos tus chats y mensajes, junto con toda la multimedia y archivos que compartiste. ",
@ -542,11 +542,11 @@
"inactive_title": "Wow. Muchas pestañas.",
"inactive_description_md": "Sólo puedes usar una pestaña activa con la app.\nRecarga esta página para seguir usándola o ciérrala.",
"inactive_reload_btn": "Recargar app",
"push_action_mute1d": "Mute background alerts for 1 day",
"push_action_settings": "Background alerts settings",
"push_action_mute1d_mobile": "Mute for 24H",
"push_action_settings_mobile": "Alerts settings",
"push_message_nopreview": "You have a new message",
"push_action_mute1d": "Silenciar 1 día las alertas en segundo plano",
"push_action_settings": "Ajustes de alertas en segundo plano",
"push_action_mute1d_mobile": "Silenciar 24 h",
"push_action_settings_mobile": "Ajustes de alertas",
"push_message_nopreview": "Tienes un mensaje nuevo",
"country_select_modal_country_ab": "Abjasia",
"country_select_modal_country_af": "Afganistán",
"country_select_modal_country_ax": "Islas Åland",

6
js/locales/it-it.json

@ -542,10 +542,10 @@
"inactive_title": "Oh no, troppe pagine",
"inactive_description_md": "Telegram supporta solo una scheda attiva con l'app.\nPer favore ricarica questa scheda per usarla o chiudila.",
"inactive_reload_btn": "Ricarica l'app",
"push_action_mute1d": "Mute background alerts for 1 day",
"push_action_settings": "Background alerts settings",
"push_action_mute1d": "Silenzia gli avvisi in background per 1 giorno",
"push_action_settings": "Impostazioni avvisi in background",
"push_action_mute1d_mobile": "Silenzia per 24H",
"push_action_settings_mobile": "Alerts settings",
"push_action_settings_mobile": "Impostazioni avvisi",
"push_message_nopreview": "Hai un nuovo messaggio",
"country_select_modal_country_ab": "Abkhazia",
"country_select_modal_country_af": "Afghanistan",

10
js/locales/pt-br.json

@ -542,11 +542,11 @@
"inactive_title": "Erro, muitas abas",
"inactive_description_md": "Telegram suporta apenas uma aba ativa com o app.\nPor favor, recarregue para continuar usando essa aba ou feche-a.",
"inactive_reload_btn": "Recarregar App",
"push_action_mute1d": "Mute background alerts for 1 day",
"push_action_settings": "Background alerts settings",
"push_action_mute1d_mobile": "Mute for 24H",
"push_action_settings_mobile": "Alerts settings",
"push_message_nopreview": "You have a new message",
"push_action_mute1d": "Silenciar alertas em segundo plano por 1 dia",
"push_action_settings": "Configurações de alertas em segundo plano",
"push_action_mute1d_mobile": "Silenciar por 24H",
"push_action_settings_mobile": "Configurações de alerta",
"push_message_nopreview": "Você tem uma nova mensagem",
"country_select_modal_country_ab": "Abcássia",
"country_select_modal_country_af": "Afeganistão",
"country_select_modal_country_ax": "Ilhas Aland",

2
service_worker.js

File diff suppressed because one or more lines are too long

10
webogram.appcache

@ -1,5 +1,5 @@
CACHE MANIFEST
# Time: Fri Dec 16 2016 17:18:30 GMT+0300 (MSK)
# Time: Fri Dec 16 2016 19:16:31 GMT+0300 (MSK)
CACHE:
@ -63,10 +63,6 @@ img/placeholders/UserAvatar7@2x.png
img/placeholders/UserAvatar8@2x.png
img/placeholders/VideoThumbConversation.gif
img/placeholders/VideoThumbModal.gif
js/lib/bin_utils.js
js/lib/crypto_worker.js
js/lib/polyfill.js
js/lib/push_worker.js
js/locales/de-de.json
js/locales/en-us.json
js/locales/es-es.json
@ -74,6 +70,10 @@ js/locales/it-it.json
js/locales/nl-nl.json
js/locales/pt-br.json
js/locales/ru-ru.json
js/lib/bin_utils.js
js/lib/crypto_worker.js
js/lib/polyfill.js
js/lib/push_worker.js
vendor/closure/long.js
vendor/cryptoJS/crypto.js
vendor/jsbn/jsbn_combined.js

Loading…
Cancel
Save