Skip to content

Commit

Permalink
v0.1.1 Handle repeat messages better, claim uses the correct link and…
Browse files Browse the repository at this point in the history
… opens in another tab, device in Octoblu Things view now has a link to view Kiosk
  • Loading branch information
virgilvox committed Jun 6, 2017
1 parent f6b9c64 commit a87c7e5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h3 class="save-token">...</h3>
<div class="step-container">
<h2 class="step-number">Step 1</h2>
<div class="step-content">
<a class="claim-button" href="https://app.octoblu.com/node-wizard/add-device/557efb9a2c221fe2d1f01d17">
<a class="claim-button" href="https://app.octoblu.com/node-wizard/add-device/557efb9a2c221fe2d1f01d17" target="_blank">
<h3>Claim The Kiosk Device On Octoblu</h2>
</a>
<p>Copy the uuid and token and claim as existing device</p>
Expand All @@ -40,6 +40,9 @@ <h3 class="save-url">...</h3>
<div class="step-container">
<h2 class="step-number">Step 3</h2>
<div class="step-content">
In the Octoblu Designer this device has a message UI, but if you'd like to message it directly, the message structure is defined below.

<br />
<div class="examples">
<p>In order to change the url, send this device a message format like this.</p>
<div class="example-code">
Expand Down
15 changes: 8 additions & 7 deletions js/kiosk.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,35 @@ function getProperty(message, key){

function updateKiosk(object){
object = object || {};
resetKioskElements();

if(object.url && currentUrl !== object.url){
resetKioskElements();
console.log('Opening URL', object.url);
currentUrl = object.url;

prepStageForRender();
renderIframe(object.url);

return;
}

if(object.text){
} else if(object.text){
resetKioskElements();
console.log('Showing Text', object.text, 'with styles', object.textStyles);

prepStageForRender();
renderText(object.text);
updateStyles(object.textStyles);

return;
}

if(object.html){
} else if(object.html){
resetKioskElements();
console.log('Showing HTML', object.html);

prepStageForRender();
renderHtml(object.html);
updateStyles(object.textStyles);

return;
} else {
return;
}
}
Expand Down Expand Up @@ -110,6 +110,7 @@ function updateStyles(styles) {

function resetKioskElements() {
console.log('Reseting Kiosk Elements');
currentUrl = null;
$('.kiosk-element')
.hide()
.empty();
Expand Down
17 changes: 15 additions & 2 deletions js/master.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ $(document).ready(function(){
var conn = meshblu.createConnection({});
conn.on('ready', function(data){
console.log('Ready', data);

var baseUrl = location.protocol + "//" + location.host;
var url = baseUrl + '/kiosk.html#!' + data.uuid + '/' + data.token;
var claimUrl = "https://app.octoblu.com/node-wizard/claim/" + data.uuid + "/" + data.token;

data.type = 'device:kiosk';
data.discoverWhitelist = [data.uuid];
data.messageSchema = {
Expand All @@ -25,9 +30,17 @@ $(document).ready(function(){
}
}
};
data.octoblu = {
"links": [
{
"title": "View Kiosk",
"url": url
}
]
};
conn.update(data);
var baseUrl = location.protocol + "//" + location.host;
var url = baseUrl + '/kiosk.html#!' + data.uuid + '/' + data.token;

$('.claim-button').attr("href", claimUrl);
$('.save-uuid').text(data.uuid);
$('.save-token').text(data.token);
$('.save-url').html('<a href="'+url+'">'+url+'</a>');
Expand Down

0 comments on commit a87c7e5

Please sign in to comment.