Are there bugs?

This commit is contained in:
Zach Fox 2017-05-04 16:05:20 -07:00
parent 946c5e7662
commit 2ad3346697
3 changed files with 32 additions and 25 deletions

View file

@ -198,7 +198,6 @@ input[type=button].naked:active {
font-family: Raleway-Regular; font-family: Raleway-Regular;
font-weight: 500; font-weight: 500;
font-size: 16px; font-size: 16px;
text-align: right;
color: white; color: white;
} }
/* /*

View file

@ -217,8 +217,8 @@ function createShareBar(parentID, isLoggedIn, canShare, isGif, blastButtonDisabl
'' + '' +
'</div>' + '</div>' +
'</div>' + '</div>' +
'<div class="helpTextDiv" id="' + parentID + 'helpTextDiv' + '" style="visibility:hidden">' + '<div class="helpTextDiv" id="' + parentID + 'helpTextDiv' + '" style="visibility:hidden;text-align:left;font-size: 13px;">' +
'Snaps taken in this domain can\'t be shared.' + 'Snaps taken from the pictured domain can\'t be shared.' +
'</div>'; '</div>';
// Add onclick handler to parent DIV's img to toggle share buttons // Add onclick handler to parent DIV's img to toggle share buttons
document.getElementById(parentID + 'img').onclick = function () { selectImageWithHelpText(parentID, true); }; document.getElementById(parentID + 'img').onclick = function () { selectImageWithHelpText(parentID, true); };
@ -230,7 +230,7 @@ function createShareBar(parentID, isLoggedIn, canShare, isGif, blastButtonDisabl
'&#xe019;' + '&#xe019;' +
'</div>' + '</div>' +
'</div>' + '</div>' +
'<div class="helpTextDiv" id="' + parentID + 'helpTextDiv' + '" style="visibility:hidden">' + '<div class="helpTextDiv" id="' + parentID + 'helpTextDiv' + '" style="visibility:hidden;text-align:right;">' +
'Please log in to share snaps' + '<input class="grayButton" style="margin-left:20px;width:95px;height:30px;" type="button" value="LOG IN" onclick="login()" />' + 'Please log in to share snaps' + '<input class="grayButton" style="margin-left:20px;width:95px;height:30px;" type="button" value="LOG IN" onclick="login()" />' +
'</div>'; '</div>';
// Add onclick handler to parent DIV's img to toggle share buttons // Add onclick handler to parent DIV's img to toggle share buttons
@ -249,9 +249,9 @@ function appendShareBar(divID, isLoggedIn, canShare, isGif, blastButtonDisabled,
if (divID === "p0") { if (divID === "p0") {
if (isLoggedIn) { if (isLoggedIn) {
if (canShare) { if (canShare) {
selectImageWithHelpText(divID, true);
} else {
selectImageToShare(divID, true); selectImageToShare(divID, true);
} else {
selectImageWithHelpText(divID, true);
} }
} else { } else {
selectImageWithHelpText(divID, true); selectImageWithHelpText(divID, true);
@ -625,7 +625,7 @@ window.onload = function () {
imageCount = message.image_data.length + 1; // "+1" for the GIF that'll finish processing soon imageCount = message.image_data.length + 1; // "+1" for the GIF that'll finish processing soon
message.image_data.push({ localPath: messageOptions.loadingGifPath }); message.image_data.push({ localPath: messageOptions.loadingGifPath });
message.image_data.forEach(function (element, idx) { message.image_data.forEach(function (element, idx) {
addImage(element, messageOptions.isLoggedIn, idx === 0 && messageOptions.canShare, idx === 1, false); addImage(element, messageOptions.isLoggedIn, idx === 0 && messageOptions.canShare, idx === 1, false, false, false, true);
}); });
document.getElementById("p1").classList.add("processingGif"); document.getElementById("p1").classList.add("processingGif");
} else { } else {
@ -634,16 +634,14 @@ window.onload = function () {
p1img.src = gifPath; p1img.src = gifPath;
paths[1] = gifPath; paths[1] = gifPath;
if (messageOptions.canShare) { shareForUrl("p1");
shareForUrl("p1"); appendShareBar("p1", messageOptions.isLoggedIn, messageOptions.canShare, true, false, false, messageOptions.canBlast);
appendShareBar("p1", messageOptions.isLoggedIn, true, false, false, true); document.getElementById("p1").classList.remove("processingGif");
document.getElementById("p1").classList.remove("processingGif");
}
} }
} else { } else {
imageCount = message.image_data.length; imageCount = message.image_data.length;
message.image_data.forEach(function (element) { message.image_data.forEach(function (element) {
addImage(element, messageOptions.isLoggedIn, messageOptions.canShare, false, false); addImage(element, messageOptions.isLoggedIn, messageOptions.canShare, false, false, false, false, true);
}); });
} }
break; break;

View file

@ -175,14 +175,18 @@ function onMessage(message) {
takeSnapshot(); takeSnapshot();
break; break;
case 'shareSnapshotForUrl': case 'shareSnapshotForUrl':
isLoggedIn = Account.isLoggedIn(); isDomainOpen(Settings.getValue("previousSnapshotDomainID"), function (canShare) {
if (isLoggedIn) { if (canShare) {
print('Sharing snapshot with audience "for_url":', message.data); isLoggedIn = Account.isLoggedIn();
Window.shareSnapshot(message.data, message.href || href); if (isLoggedIn) {
} else { print('Sharing snapshot with audience "for_url":', message.data);
shareAfterLogin = true; Window.shareSnapshot(message.data, message.href || href);
snapshotToShareAfterLogin.push({ path: message.data, href: message.href || href }); } else {
} shareAfterLogin = true;
snapshotToShareAfterLogin.push({ path: message.data, href: message.href || href });
}
}
});
break; break;
case 'blastToConnections': case 'blastToConnections':
isLoggedIn = Account.isLoggedIn(); isLoggedIn = Account.isLoggedIn();
@ -548,7 +552,8 @@ function processingGifCompleted(pathAnimatedSnapshot) {
containsGif: true, containsGif: true,
processingGif: false, processingGif: false,
canShare: canShare, canShare: canShare,
isLoggedIn: isLoggedIn isLoggedIn: isLoggedIn,
canBlast: location.domainId === Settings.getValue("previousSnapshotDomainID"),
}; };
imageData = [{ localPath: pathAnimatedSnapshot, href: href }]; imageData = [{ localPath: pathAnimatedSnapshot, href: href }];
tablet.emitScriptEvent(JSON.stringify({ tablet.emitScriptEvent(JSON.stringify({
@ -596,10 +601,15 @@ function onUsernameChanged() {
}); });
if (isLoggedIn) { if (isLoggedIn) {
if (shareAfterLogin) { if (shareAfterLogin) {
snapshotToShareAfterLogin.forEach(function (element) { isDomainOpen(Settings.getValue("previousSnapshotDomainID"), function (canShare) {
print('Uploading snapshot after login:', element.path); if (canShare) {
Window.shareSnapshot(element.path, element.href); snapshotToShareAfterLogin.forEach(function (element) {
print('Uploading snapshot after login:', element.path);
Window.shareSnapshot(element.path, element.href);
});
}
}); });
shareAfterLogin = false; shareAfterLogin = false;
snapshotToShareAfterLogin = []; snapshotToShareAfterLogin = [];
} }