Skip to content

Commit

Permalink
Show error messages from Miro responses
Browse files Browse the repository at this point in the history
  • Loading branch information
rtb40 committed Aug 31, 2021
1 parent bac7d7f commit cdc0251
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
9 changes: 5 additions & 4 deletions RealtimeBoard.sketchplugin/Contents/Sketch/core/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ function Api() {
var artboards = [page artboards];

if (artboards.length == 0) {
return this.UploadEnum.NO_ARTBOARDS;
return { result: this.UploadEnum.NO_ARTBOARDS };
} else {
return this.UploadEnum.NO_ARTBOARDS_SELECTED;
return { result: this.UploadEnum.NO_ARTBOARDS_SELECTED };
}
}

Expand Down Expand Up @@ -375,12 +375,13 @@ function Api() {
if (res != null) {
if (res.error != nil) {
logErr(res.error)
return { result: this.UploadEnum.UPLOAD_FAILED, error: res.error }
} else {
for (var i = 0; i < res.widgets.length; i++) {
var artboard = exportInfoList[i];
context.command.setValue_forKey_onLayer_forPluginIdentifier(res.widgets[i]["resourceId"], boardId, artboard.artboard, "rtb_sync");
}
return this.UploadEnum.SUCCESS;
return { result: this.UploadEnum.SUCCESS };
}
} else {
logErr('res == null')
Expand All @@ -389,7 +390,7 @@ function Api() {
logErr('classNameOfOuput == _NSZeroData')
}

return this.UploadEnum.UPLOAD_FAILED;
return { result: this.UploadEnum.UPLOAD_FAILED };
}

Api.prototype.artboardsToPNG = function(context, exportAll, scale) {
Expand Down
14 changes: 9 additions & 5 deletions RealtimeBoard.sketchplugin/Contents/Sketch/core/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ function UI() {
[syncButton setCOSJSTargetFunction:undefined];
COScript.currentCOScript().setShouldKeepAround_(false);

if (uploadResult == api.UploadEnum.SUCCESS) {
if (uploadResult.result == api.UploadEnum.SUCCESS) {
api.setLastBoardId(boardId);

if (openBoard.state() == 1) {
Expand All @@ -711,12 +711,16 @@ function UI() {

[[NSWorkspace sharedWorkspace] openURL:url];
}
} else if (uploadResult == api.UploadEnum.NO_ARTBOARDS) {
} else if (uploadResult.result == api.UploadEnum.NO_ARTBOARDS) {
showAlert("No artboards on the page?", "Please create an artboard or open another file.", context);
} else if (uploadResult == api.UploadEnum.NO_ARTBOARDS_SELECTED) {
} else if (uploadResult.result == api.UploadEnum.NO_ARTBOARDS_SELECTED) {
showAlert("No artboards selected?", "Please choose an artboard and retry.", context);
} else if (uploadResult == api.UploadEnum.UPLOAD_FAILED) {
showAlert("An error occurred", "There was an error during syncing. Please retry.", context);
} else if (uploadResult.result == api.UploadEnum.UPLOAD_FAILED) {
if (uploadResult.error && uploadResult.error.message) {
showAlert("An error occurred", uploadResult.error.message, context);
} else {
showAlert("An error occurred", "There was an error during syncing. Please retry.", context);
}
}
}
}];
Expand Down
2 changes: 1 addition & 1 deletion RealtimeBoard.sketchplugin/Contents/Sketch/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Miro",
"identifier" : "com.realtimeboard.sketch.plugin",
"version" : "1.6.1",
"version" : "1.6.2",
"description" : "Export and sync your artboards with Miro",
"authorEmail" : "[email protected]",
"author" : "Miro",
Expand Down
5 changes: 4 additions & 1 deletion appcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<item>
<enclosure url="https://github.com/miroapp/sketch_plugin/releases/download/1.6.1/RealtimeBoard.sketchplugin.zip" sparkle:version="1.6.0"/>
<enclosure url="https://github.com/miroapp/sketch_plugin/releases/download/1.6.2/RealtimeBoard.sketchplugin.zip" sparkle:version="1.6.2"/>
</item>
<item>
<enclosure url="https://github.com/miroapp/sketch_plugin/releases/download/1.6.1/RealtimeBoard.sketchplugin.zip" sparkle:version="1.6.1"/>
</item>
<item>
<enclosure url="https://github.com/miroapp/sketch_plugin/releases/download/1.6.0/RealtimeBoard.sketchplugin.zip" sparkle:version="1.6.0"/>
Expand Down

0 comments on commit cdc0251

Please sign in to comment.