Skip to content

Commit

Permalink
Support Sketch v45
Browse files Browse the repository at this point in the history
  • Loading branch information
utom committed Jun 15, 2017
1 parent 917f44c commit a4c9b8e
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>16E195</string>
<string>16F73</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -27,17 +27,17 @@
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>8C38</string>
<string>8A218a</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>16C58</string>
<string>16A300</string>
<key>DTSDKName</key>
<string>macosx10.12</string>
<key>DTXcode</key>
<string>0820</string>
<string>0800</string>
<key>DTXcodeBuild</key>
<string>8C38</string>
<string>8A218a</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017 UTOMBOX. All rights reserved.</string>
</dict>
Expand Down
Binary file not shown.
60 changes: 24 additions & 36 deletions Sketch Measure.sketchplugin/Contents/Sketch/library/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var SM = {
coscript.setShouldKeepAround(true);

if(command && command == "init"){
this.checkUpdate();
this.checkVersion();
return false;
}

Expand Down Expand Up @@ -139,41 +139,29 @@ var SM = {
TextAligns = ["left", "right", "center", "justify", "left"],
ResizingType = ["stretch", "corner", "resize", "float"];
SM.extend({
checkUpdate: function(){
var self = this,
webView = WebView.new(),
windowObject = webView.windowScriptObject(),
timestamp = new Date().getTime(),
delegate = new MochaJSDelegate({
"webView:didFinishLoadForFrame:": (function(webView, webFrame){
var packageJSON = JSON.parse(self.toJSString(windowObject.evaluateWebScript("document.body.innerText"))),
currentVersion = self.toJSString( self.context.plugin.version() ),
lastestVersion = self.toJSString( packageJSON.version ),
updated = self.prefs.integerForKey("SMUpdated") || 0;

if( lastestVersion > currentVersion && timestamp > (updated + 1000 * 60 * 60 * 24) ){
self.prefs.setInteger_forKey(timestamp, "SMUpdated");
self.SMPanel({
url: self.pluginSketch + "/panel/update.html",
width: 480,
height: 229,
hiddenClose: true,
data: {
title: _("New Version!"),
content: _("Just checked Sketch Measure has a new version (%@)", [packageJSON.version]),
donate: _("Donate"),
cancel: _("Cancel"),
download: _("Download")
},
callback: function( data ){
NSWorkspace.sharedWorkspace().openURL(NSURL.URLWithString("http://utom.design/measure/?ref=update"));
}
});
}
})
});
webView.setFrameLoadDelegate_(delegate.getClassInstance());
webView.setMainFrameURL_("http://utom.design/measure/package.json?" + timestamp);
checkVersion: function(){
var self = this;

if( this.SMVersion && this.SMVersion < this.version ){

this.prefs.setObject_forKey(this.version, "SMVersion");
this.SMPanel({
url: this.pluginSketch + "/panel/update.html",
width: 480,
height: 229,
hiddenClose: true,
data: {
title: _("New Version!"),
content: _("You need to restart the Sketch.app"),
donate: _("Donate"),
download: _("Restart the Sketch.app")
},
callback: function( data ){
var manifestCore = new manifestMaster(self.context);
manifestCore.restartSketch();
}
});
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@
"title" : "Sketch Measure"
},
"identifier": "com.utom.measure",
"appcast": "https://api.sketchpacks.com/v1/plugins/com.utom.measure/appcast",
"homepage": "http://utom.design/measure/",
"version": "2.6.3",
"version": "2.6.4",
"description" : "Make it a fun to create spec for developers and teammates",
"authorEmail" : "[email protected]",
"name" : "Sketch Measure"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@
"title" : "Sketch Measure"
},
"identifier": "com.utom.measure",
"appcast": "https://api.sketchpacks.com/v1/plugins/com.utom.measure/appcast",
"homepage": "http://utom.design/measure/",
"version": "2.6.3",
"version": "2.6.4",
"description" : "Make it a fun to create spec for developers and teammates",
"authorEmail" : "[email protected]",
"name" : "Sketch Measure"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@
"title" : "Sketch Measure"
},
"identifier": "com.utom.measure",
"appcast": "https://api.sketchpacks.com/v1/plugins/com.utom.measure/appcast",
"homepage": "http://utom.design/measure/",
"version": "2.6.3",
"version": "2.6.4",
"description" : "Make it a fun to create spec for developers and teammates",
"authorEmail" : "[email protected]",
"name" : "Sketch Measure"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<div class="update-inner">
<h1 class="update-title">New version!</h1>
<p class="update-content">Just checked Sketch Measure has a new version 2.3.</p>
<p class="update-footer"><a id="donate" href="#donate">Donate</a><button id="cancel" class="cancel">Cancel</button><button id="submit" class="submit">Download Now</button></p>
<p class="update-footer"><a id="donate" href="#donate">Donate</a><button id="submit" class="submit">Download Now</button></p>
</div>
</div>
</body>
Expand Down
3 changes: 2 additions & 1 deletion Sketch Measure.sketchplugin/Contents/Sketch/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@
"title" : "Sketch Measure"
},
"identifier": "com.utom.measure",
"appcast": "https://api.sketchpacks.com/v1/plugins/com.utom.measure/appcast",
"homepage": "http://utom.design/measure/",
"version": "2.6.3",
"version": "2.6.4",
"description" : "Make it a fun to create spec for developers and teammates",
"authorEmail" : "[email protected]",
"name" : "Sketch Measure"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
var threadDictionary = NSThread.mainThread().threadDictionary();
var Sketch, Configs, Settings, Toolbar, Mark, Properties, ga;
var Core = SMFramework.core();
var emojiRegExp = new RegExp('(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])', 'g');
Core.execute();

function commandOverlays(context) {
Expand Down

0 comments on commit a4c9b8e

Please sign in to comment.