Commit 615d8891 authored by Eriksson Monteiro's avatar Eriksson Monteiro

increase ad show time to 30s. fix ad module api

parent a2f610e6
...@@ -13,7 +13,7 @@ cr.define('millix_bar', function () { ...@@ -13,7 +13,7 @@ cr.define('millix_bar', function () {
let lastKnownTransaction = undefined; let lastKnownTransaction = undefined;
let reloadTimeout = undefined; let reloadTimeout = undefined;
let fetchAdvertisementTimeout = undefined; let fetchAdvertisementTimeout = undefined;
const ADVERTISEMENT_ROTATION_TIME = 10000; const ADVERTISEMENT_ROTATION_TIME = 30000;
let walletLocked = true; let walletLocked = true;
let unlockFromBar = false; let unlockFromBar = false;
const audioDeposit = new Audio('/deposit.mp3'); const audioDeposit = new Audio('/deposit.mp3');
...@@ -121,10 +121,6 @@ cr.define('millix_bar', function () { ...@@ -121,10 +121,6 @@ cr.define('millix_bar', function () {
$targetPhrase.off('click'); $targetPhrase.off('click');
$headline.on('click', () => chrome.send('showMillixWallet', ['new_tab', advertisement.advertisement_url])); $headline.on('click', () => chrome.send('showMillixWallet', ['new_tab', advertisement.advertisement_url]));
$targetPhrase.on('click', () => chrome.send('showMillixWallet', ['new_tab', advertisement.advertisement_url])); $targetPhrase.on('click', () => chrome.send('showMillixWallet', ['new_tab', advertisement.advertisement_url]));
millixAPIFrame.contentWindow.postMessage({
type: 'request_advertisement_payment',
queue_id: advertisement.queue_id
}, 'chrome-untrusted://millix-ws/');
} }
} }
......
...@@ -169,16 +169,6 @@ class _API { ...@@ -169,16 +169,6 @@ class _API {
return Promise.reject(e) return Promise.reject(e)
} }
} }
requestAdvertisementPayment(queueID) {
try {
return fetch(this.getTangledURL() + `/QYEgbWuFZs5s7Kud?p0=${queueID}`)
.then(response => response.ok ? response.json() : Promise.reject());
}
catch (e) {
return Promise.reject(e);
}
}
} }
const API = new _API(); const API = new _API();
...@@ -268,10 +258,6 @@ window.addEventListener('message', ({ data }) => { ...@@ -268,10 +258,6 @@ window.addEventListener('message', ({ data }) => {
.then(data => window.parent.postMessage({ type: 'next_tangled_advertisement', data }, 'tangled://millix-bar')) .then(data => window.parent.postMessage({ type: 'next_tangled_advertisement', data }, 'tangled://millix-bar'))
.catch(() => window.parent.postMessage({ type: 'next_tangled_advertisement', data: null }, 'tangled://millix-bar')); .catch(() => window.parent.postMessage({ type: 'next_tangled_advertisement', data: null }, 'tangled://millix-bar'));
break; break;
case 'request_advertisement_payment':
API.requestAdvertisementPayment(data.queue_id)
.then(_ => _);
break;
case 'api_check': case 'api_check':
if (!apiCheckHandlerID) { if (!apiCheckHandlerID) {
setTimeout(() => apiCheck(), 15000); // start api check after 15s setTimeout(() => apiCheck(), 15000); // start api check after 15s
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment