Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Always start in testing mode!
Browse files Browse the repository at this point in the history
and fix test on setting UUID for reporting

Cherry-pick one fix from the master branch!

#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
  • Loading branch information
mrose17 authored and NejcZdovc committed Jul 3, 2018
1 parent 39cd22e commit d0a5f1a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
11 changes: 6 additions & 5 deletions app/browser/api/userModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand All @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions app/browser/reducers/userModelReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down
17 changes: 7 additions & 10 deletions app/renderer/lib/notificationUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

Expand All @@ -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)
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit d0a5f1a

Please sign in to comment.