diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-09-23 15:09:56 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-09-23 15:09:56 +1200 |
commit | 648c7684898f0056f0202b6b43ba9f5f11655703 (patch) | |
tree | 15706f0eeb2b39de63af4aa28825553d59794bf4 /web/app/Application.js | |
parent | 357b4a8c8652d42bd228390bbc337003e059b04c (diff) | |
download | trackermap-web-648c7684898f0056f0202b6b43ba9f5f11655703.tar.gz trackermap-web-648c7684898f0056f0202b6b43ba9f5f11655703.tar.bz2 trackermap-web-648c7684898f0056f0202b6b43ba9f5f11655703.zip |
Implement push notifications
Diffstat (limited to 'web/app/Application.js')
-rw-r--r-- | web/app/Application.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/web/app/Application.js b/web/app/Application.js index d0b6713c..a4cbbf22 100644 --- a/web/app/Application.js +++ b/web/app/Application.js @@ -148,6 +148,19 @@ Ext.define('Traccar.Application', { } }, + updateNotificationToken: function (token) { + var attributes = Ext.clone(this.user.get('attributes')); + if (!attributes.notificationTokens || attributes.notificationTokens.indexOf(token) < 0) { + if (!attributes.notificationTokens) { + attributes.notificationTokens = token; + } else { + attributes.notificationTokens += ',' + token; + } + this.user.set('attributes', attributes); + this.user.save(); + } + }, + setUser: function (data) { var reader = Ext.create('Ext.data.reader.Json', { model: 'Traccar.model.User' |