From d0a5f1ada288ca8984c968333018af46cfa81f7c Mon Sep 17 00:00:00 2001 From: "Marshall T. Rose" Date: Thu, 21 Jun 2018 15:34:47 -0700 Subject: [PATCH] Always start in testing mode! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and fix test on setting UUID for reporting Cherry-pick one fix from the master branch! https://github.com/brave/browser-laptop/pull/14485 S/ads-goodbye/ads-user-trials-goodbye Track down macOS notification errors And *really* make sure the unique-identifier is defined… Revert label More debug --- app/browser/api/userModel.js | 11 ++++++----- app/browser/reducers/userModelReducer.js | 4 ++-- app/renderer/lib/notificationUtil.js | 17 +++++++---------- package.json | 2 +- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/app/browser/api/userModel.js b/app/browser/api/userModel.js index 1ad9a4e8025..5bd5b77e2a4 100644 --- a/app/browser/api/userModel.js +++ b/app/browser/api/userModel.js @@ -33,7 +33,8 @@ const Immutable = require('immutable') const urlParse = require('../../common/urlParse') const roundtrip = require('./ledger').roundtrip -const testingP = (process.env.NODE_ENV === 'test') || (process.env.LEDGER_VERBOSE === 'true') +const debugP = (process.env.NODE_ENV === 'test') || (process.env.LEDGER_VERBOSE === 'true') +const testingP = true let nextEasterEgg = 0 let initP @@ -614,13 +615,13 @@ const generateAndSetAdUUIDRegardless = (state) => { } const generateAndSetAdUUIDButOnlyIfDNE = (state) => { - if (userModelState.getAdUUID(state) === 'undefined') state = generateAndSetAdUUIDRegardless(state) + if (userModelState.getAdUUID(state) === undefined) state = generateAndSetAdUUIDRegardless(state) return state } const confirmAdUUIDIfAdEnabled = (state, adEnabled) => { - if (adEnabled == null) adEnabled = userModelState.getAdEnabledValue(state) + if (adEnabled === undefined) adEnabled = userModelState.getAdEnabledValue(state) if (adEnabled) state = generateAndSetAdUUIDButOnlyIfDNE(state) @@ -629,8 +630,8 @@ const confirmAdUUIDIfAdEnabled = (state, adEnabled) => { let collectActivityId -const oneDay = (testingP ? 600 : 86400) * 1000 -const oneHour = (testingP ? 25 : 3600) * 1000 +const oneDay = (debugP ? 600 : 86400) * 1000 +const oneHour = (debugP ? 25 : 3600) * 1000 const hackStagingOn = true const roundTripOptions = { debugP: process.env.LEDGER_DEBUG === 'true', diff --git a/app/browser/reducers/userModelReducer.js b/app/browser/reducers/userModelReducer.js index 36325b95830..e04b9413b07 100644 --- a/app/browser/reducers/userModelReducer.js +++ b/app/browser/reducers/userModelReducer.js @@ -131,7 +131,7 @@ const userModelReducer = (state, action, immutableAction) => { state = userModel.initialize(state, value) if (!value) { appActions.createTabRequested({ - url: 'https://brave.com/ads-goodbye' + url: 'https://brave.com/ads-user-trials-goodbye' }) } break @@ -196,7 +196,7 @@ const userModelReducer = (state, action, immutableAction) => { { appActions.changeSetting(settings.ADS_ENABLED, false) appActions.createTabRequested({ - url: 'https://brave.com/ads-goodbye' + url: 'https://brave.com/ads-user-trials-goodbye' }) appActions.showNotification({ position: 'global', diff --git a/app/renderer/lib/notificationUtil.js b/app/renderer/lib/notificationUtil.js index a30741ec667..60c11c7c84c 100644 --- a/app/renderer/lib/notificationUtil.js +++ b/app/renderer/lib/notificationUtil.js @@ -69,15 +69,11 @@ const notificationUtil = { if (!notificationUtil.onClick) { notificationUtil.onClick = notifier.on('click', function (notifierObject, options) { - if (typeof options === 'object' && options.data) { - notificationUtil.clickHandler(options) - } + if (typeof options === 'object' && options.data) notificationUtil.clickHandler(options) }) notifier.on('timeout', () => { - if (typeof options === 'object' && options.data) { - notificationUtil.timeoutHandler(options) - } + if (typeof options === 'object' && options.data) notificationUtil.timeoutHandler(options) }) } @@ -94,15 +90,16 @@ const notificationUtil = { 'the user dismissed the notification.': 'closed' }[arguments[1]] } - if (!result) result = 'unknown' + if (!result) { + console.error(JSON.stringify(arguments, null, 2)) + result = 'unknown' + } if (result.indexOf('Clicked') !== -1) result = 'clicked' if (result === 'timeout') result = 'ignored' let payload = { result: result } - if (typeof options === 'object' && options.uuid) { - payload.uuid = options.uuid - } + if (typeof options === 'object' && options.uuid) payload.uuid = options.uuid appActions.onUserModelLog(notificationTypes.NOTIFICATION_RESULT, payload) }) diff --git a/package.json b/package.json index f2715f91b3c..7397b2b63bd 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "bat-publisher": "^2.0.18", "bignumber.js": "^4.0.4", "bloodhound-js": "brave/bloodhound", - "brave-ads-notifier": "5.6.0", + "brave-ads-notifier": "5.6.1", "chromium-net-errors": "^3.3.0", "clipboard-copy": "^1.0.0", "compare-versions": "^3.0.1",