From f11cfcb9962fb9f9ad6b0c8412b76c476eaa738a Mon Sep 17 00:00:00 2001 From: lilia Date: Sat, 7 Nov 2015 19:43:46 -0800 Subject: [PATCH] Auto-populate device name // FREEBIE --- js/options.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/js/options.js b/js/options.js index 37a89347..eff49224 100644 --- a/js/options.js +++ b/js/options.js @@ -6,9 +6,20 @@ extension.windows.getBackground(function(bg) { bg.storage.onready(function() { $(function() { + var deviceName = bg.textsecure.storage.user.getDeviceName(); + if (!deviceName) { + deviceName = 'Chrome'; + if (navigator.userAgent.match('Mac OS')) { + deviceName += ' on Mac'; + } else if (navigator.userAgent.match('Linux')) { + deviceName += ' on Linux'; + } else if (navigator.userAgent.match('Windows')) { + deviceName += ' on Windows'; + } + } var view = new Whisper.InstallView({ el: $('#install'), - deviceName: bg.textsecure.storage.user.getDeviceName() + deviceName: deviceName }); if (bg.textsecure.registration.isDone()) { view.selectStep(3);