diff --git a/data/dialog.js b/data/dialog.js index d716fc9..e695e80 100644 --- a/data/dialog.js +++ b/data/dialog.js @@ -177,6 +177,7 @@ function assignTabIndices(modal) { } function askForDataSharingConfirmationDialog(callback) { + console.log("callback in ask for data start sharing", callback); dialog({ "name": dialogNames.startUploadData, "title": "Upload Data", diff --git a/data/lightbeam.js b/data/lightbeam.js index 75f5d37..9d305b9 100644 --- a/data/lightbeam.js +++ b/data/lightbeam.js @@ -141,21 +141,6 @@ function resetAdditionalUI() { } -/**************************************** - * Upload data - */ - - -global.startSharing = function startSharing(askForConfirmation, callback) { - if (askForConfirmation) { - askForDataSharingConfirmationDialog(function (confirmed) { - callback(confirmed); - }); - } else { - callback(true); - } -}; - /**************************************** * Format date string */ diff --git a/data/ui.js b/data/ui.js index 343593e..78a0481 100644 --- a/data/ui.js +++ b/data/ui.js @@ -87,9 +87,10 @@ document.querySelector(".toggle-btn.share-btn").addEventListener("click", } }); -global.confirmStartSharing = function confirmStartSharing(askForConfirmation, elmClicked) { - global.startSharing(askForConfirmation, function (confirmed) { +function confirmStartSharing(askForConfirmation, elmClicked) { + let callback = function (confirmed) { if (confirmed) { + console.log("Sharing confirmed!"); toggleBtnOnEffect(document.querySelector(".share-btn")); global.self.port.emit("prefChanged", { "contributeData": true @@ -97,7 +98,13 @@ global.confirmStartSharing = function confirmStartSharing(askForConfirmation, el } else { elmClicked.checked = false; } - }); + }; + if (askForConfirmation) { + askForDataSharingConfirmationDialog(callback); + } else { + callback(true); + } + }; global.confirmStopSharing = function confirmStopSharing(elmClicked) { diff --git a/lib/persist.js b/lib/persist.js index 3454770..4b2abb1 100644 --- a/lib/persist.js +++ b/lib/persist.js @@ -47,6 +47,7 @@ function getUserAgentData() { } function getAddons() { + const { Cu } = require('chrome'); let { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm"); let addons = []; AddonManager.getAllAddons(function(addonList) { diff --git a/lib/ui.js b/lib/ui.js index 081a1e3..59061e1 100644 --- a/lib/ui.js +++ b/lib/ui.js @@ -157,6 +157,7 @@ function attachToLightbeamPage(worker) { } function onPrefChanged(event) { + console.debug("Received updated prefs", JSON.stringify(event)); if ("contributeData" in event) { prefs.contributeData = event.contributeData; }