Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
46 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Nothing to see here. Uglified. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1 @@ | ||
function selectDevices() { | ||
chrome.usb.getUserSelectedDevices({ | ||
multiple: true, | ||
filters: [ | ||
{ | ||
interfaceClass: 0xff, | ||
interfaceSubclass: 0x42, | ||
interfaceProtocol: 0x1, | ||
} | ||
] | ||
}, function(devices) { | ||
$.each(devices, function(key, device) { | ||
var vidpid = device.vendorId.toString(16) + ':' + device.productId.toString(16); | ||
tracker.sendEvent('select-device', vidpid); | ||
|
||
adbServer.refreshDevice(device, function(adb) { | ||
if (adb) { | ||
tracker.sendEvent('connect-device', adb.properties['ro.product.name'], device.vendorId.toString(16) + ':' + device.productId.toString(16), vidpid); | ||
} | ||
else { | ||
|
||
var appName = chrome.runtime.getManifest().name; | ||
chrome.notifications.create("reload", { | ||
type: "basic", | ||
iconUrl: "/icon.png", | ||
title: appName, | ||
message: "An error occurred while connecting to the Android device. Restarting the Vysor app, or disconnecting and reconnecting the Android may resolve this issue.", | ||
buttons: [ | ||
{ | ||
title: "Reload" | ||
} | ||
] | ||
}); | ||
} | ||
}); | ||
}) | ||
}); | ||
} | ||
|
||
$(document).ready(function() { | ||
$('#logging-in').hide(); | ||
$('#login-container').hide(); | ||
$('#connect-android').click(selectDevices); | ||
$('#vysor-version').text('Vysor Version ' + chrome.runtime.getManifest().version) | ||
$('#reload-vysor').click(function() { | ||
chrome.runtime.reload(); | ||
}) | ||
|
||
function checkUsage() { | ||
chrome.storage.local.get(['vysorUsage'], function(d) { | ||
var vysorUsage = d.vysorUsage; | ||
if (!vysorUsage) | ||
vysorUsage = 0; | ||
var hoursUsed = vysorUsage / (60 * 60 * 1000); | ||
// half hour | ||
hoursUsed = Math.round(hoursUsed * 2) / 2; | ||
console.log('hours used', hoursUsed); | ||
$('#used').html("You've used Vysor for " + hoursUsed + " hours. Support Vysor. Go Pro.") | ||
}); | ||
|
||
setTimeout(checkUsage, 60 * 60 * 1000) | ||
} | ||
|
||
checkUsage(); | ||
}); | ||
|
||
function goModal() { | ||
$('#notificationModal').modal(); | ||
} | ||
|
||
function hideModal() { | ||
$('#notificationModal').modal('hide'); | ||
} | ||
|
||
function showConnect() { | ||
$('#connectModal').modal(); | ||
|
||
} | ||
|
||
function hideConnect() { | ||
$('#connectModal').modal('hide'); | ||
} | ||
// Nothing to see here. Uglified. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1 @@ | ||
$(document).ready(function() { | ||
$('#purchase-options').hide(); | ||
chrome.storage.local.get(['vysorUsage'], function(d) { | ||
var vysorUsage = d.vysorUsage; | ||
if (!vysorUsage) | ||
vysorUsage = 0; | ||
var hoursUsed = vysorUsage / (60 * 60 * 1000); | ||
// half hour | ||
hoursUsed = Math.round(hoursUsed * 2) / 2; | ||
$('#used').html("<span class='time-highlight'>You've used Vysor for " + hoursUsed + " hours. Support Vysor. Go Pro.</span>") | ||
}); | ||
|
||
function onSkuDetails(response) { | ||
$.each(response.response.details.inAppProducts, function(index, product) { | ||
var sku = product.sku; | ||
var name = product.localeData[0].title; | ||
var price = product.prices[0]; | ||
var priceText = (price.valueMicros / 1000000) + ' ' + price.currencyCode; | ||
var ele = $('<tr><td id="sub"></td><td id="price"></td><td><a id="purchase" class="green-icon fa fa-shopping-cart"> Google Wallet</a></td></tr>'); | ||
ele.find('#sub').text(name) | ||
ele.find('#price').text(priceText); | ||
ele.find('#purchase').click(function() { | ||
google.payments.inapp.buy({ | ||
'parameters': {'env': 'prod'}, | ||
'sku': sku, | ||
'success': function() { | ||
refreshLicenseManager(); | ||
console.log('success', arguments); | ||
}, | ||
'failure': function() { | ||
refreshLicenseManager(); | ||
console.log('failure', arguments); | ||
} | ||
}); | ||
}) | ||
$('#prices').append(ele); | ||
}); | ||
|
||
var ele = $('<tr><td id="sub"></td><td id="price"></td><td></td></tr>'); | ||
$('#prices').append(ele); | ||
addPaypal(); | ||
addEnterprise(); | ||
$('#purchase-options-loading h4').hide(); | ||
$('#purchase-options').show(); | ||
} | ||
|
||
function addPaypal() { | ||
|
||
var ele = $('<tr><td id="sub"></td><td id="price"></td><td><a id="purchase" class="green-icon fa fa-shopping-cart"> PayPal</a></td></tr>'); | ||
ele.find('#sub').text('Lifetime Pass') | ||
ele.find('#price').text('39.99 USD'); | ||
ele.find('#purchase').click(function() { | ||
chrome.identity.getAuthToken({ | ||
interactive: true, | ||
scopes: ['https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/userinfo.email'] | ||
}, function(token) { | ||
if (!token) { | ||
showNotification('Unable to retrieve Google auth token. Are you behind a firewall or using a VPN?') | ||
return; | ||
} | ||
var url = 'https://clockworkbilling.appspot.com/api/v1/paypalorder/koushd@gmail.com/vysor.lifetime?return_url=https://vysor.clockworkmod.com/purchase&sandbox=false&token=' + token; | ||
chrome.browser.openTab({url: url}); | ||
chrome.app.window.current().close(); | ||
}.bind(this)); | ||
}) | ||
$('#prices').append(ele); | ||
} | ||
|
||
function addEnterprise() { | ||
var ele = $('<tr><td id="sub"></td><td id="price"></td><td><a id="purchase">Learn More</a></td></tr>'); | ||
ele.find('#sub').text('Enterprise Licensing') | ||
ele.find('#price').text('$2 per user per month'); | ||
ele.find('#purchase').click(function() { | ||
var url = 'https://billing.vysor.io/'; | ||
chrome.browser.openTab({url: url}); | ||
chrome.app.window.current().close(); | ||
}) | ||
$('#prices').append(ele); | ||
} | ||
|
||
function onSkuDetailsFail() { | ||
console.log(arguments); | ||
$('#purchase-options-loading h4').html('Chrome Web Store subscription pricing unavailable.<br/>This may be caused when behind a VPN or firewall.<br/>Please make ensure you are <a href="https://www.google.com/chrome/browser/signin.html" target="_blank">logged into Chrome</a><br/>and <a href="https://developer.chrome.com/webstore/pricing#seller" target="_blank">your country supports Chrome Web Store payments</a>.<br/>Alternatively, you may purchase the Lifetime Pass through PayPal.') | ||
$('#purchase-options').show(); | ||
|
||
addPaypal(); | ||
addEnterprise(); | ||
} | ||
|
||
google.payments.inapp.getSkuDetails({ | ||
'parameters': {'env': 'prod'}, | ||
'success': onSkuDetails, | ||
'failure': onSkuDetailsFail | ||
}); | ||
|
||
$('#retrieve').click(function() { | ||
chrome.identity.getAuthToken({ | ||
interactive: true, | ||
// must use the exact same scopes used to submit the license or the token shits | ||
scopes: ['https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/userinfo.email'] | ||
}, function(token) { | ||
if (!token) { | ||
console.log('Unable to get token for retrieve?') | ||
return; | ||
} | ||
|
||
refreshLicenseManager(); | ||
}); | ||
}) | ||
}) | ||
// Nothing to see here. Uglified. |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.