Skip to content

Commit a4c9b8e

Browse files
committed
Support Sketch v45
1 parent 917f44c commit a4c9b8e

9 files changed

Lines changed: 39 additions & 46 deletions

File tree

Sketch Measure.sketchplugin/Contents/Sketch/SMFramework.framework/Versions/A/Resources/Info.plist

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plist version="1.0">
44
<dict>
55
<key>BuildMachineOSBuild</key>
6-
<string>16E195</string>
6+
<string>16F73</string>
77
<key>CFBundleDevelopmentRegion</key>
88
<string>en</string>
99
<key>CFBundleExecutable</key>
@@ -27,17 +27,17 @@
2727
<key>DTCompiler</key>
2828
<string>com.apple.compilers.llvm.clang.1_0</string>
2929
<key>DTPlatformBuild</key>
30-
<string>8C38</string>
30+
<string>8A218a</string>
3131
<key>DTPlatformVersion</key>
3232
<string>GM</string>
3333
<key>DTSDKBuild</key>
34-
<string>16C58</string>
34+
<string>16A300</string>
3535
<key>DTSDKName</key>
3636
<string>macosx10.12</string>
3737
<key>DTXcode</key>
38-
<string>0820</string>
38+
<string>0800</string>
3939
<key>DTXcodeBuild</key>
40-
<string>8C38</string>
40+
<string>8A218a</string>
4141
<key>NSHumanReadableCopyright</key>
4242
<string>Copyright © 2017 UTOMBOX. All rights reserved.</string>
4343
</dict>
Binary file not shown.

Sketch Measure.sketchplugin/Contents/Sketch/library/common.js

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var SM = {
4646
coscript.setShouldKeepAround(true);
4747

4848
if(command && command == "init"){
49-
this.checkUpdate();
49+
this.checkVersion();
5050
return false;
5151
}
5252

@@ -139,41 +139,29 @@ var SM = {
139139
TextAligns = ["left", "right", "center", "justify", "left"],
140140
ResizingType = ["stretch", "corner", "resize", "float"];
141141
SM.extend({
142-
checkUpdate: function(){
143-
var self = this,
144-
webView = WebView.new(),
145-
windowObject = webView.windowScriptObject(),
146-
timestamp = new Date().getTime(),
147-
delegate = new MochaJSDelegate({
148-
"webView:didFinishLoadForFrame:": (function(webView, webFrame){
149-
var packageJSON = JSON.parse(self.toJSString(windowObject.evaluateWebScript("document.body.innerText"))),
150-
currentVersion = self.toJSString( self.context.plugin.version() ),
151-
lastestVersion = self.toJSString( packageJSON.version ),
152-
updated = self.prefs.integerForKey("SMUpdated") || 0;
153-
154-
if( lastestVersion > currentVersion && timestamp > (updated + 1000 * 60 * 60 * 24) ){
155-
self.prefs.setInteger_forKey(timestamp, "SMUpdated");
156-
self.SMPanel({
157-
url: self.pluginSketch + "/panel/update.html",
158-
width: 480,
159-
height: 229,
160-
hiddenClose: true,
161-
data: {
162-
title: _("New Version!"),
163-
content: _("Just checked Sketch Measure has a new version (%@)", [packageJSON.version]),
164-
donate: _("Donate"),
165-
cancel: _("Cancel"),
166-
download: _("Download")
167-
},
168-
callback: function( data ){
169-
NSWorkspace.sharedWorkspace().openURL(NSURL.URLWithString("http://utom.design/measure/?ref=update"));
170-
}
171-
});
172-
}
173-
})
174-
});
175-
webView.setFrameLoadDelegate_(delegate.getClassInstance());
176-
webView.setMainFrameURL_("http://utom.design/measure/package.json?" + timestamp);
142+
checkVersion: function(){
143+
var self = this;
144+
145+
if( this.SMVersion && this.SMVersion < this.version ){
146+
147+
this.prefs.setObject_forKey(this.version, "SMVersion");
148+
this.SMPanel({
149+
url: this.pluginSketch + "/panel/update.html",
150+
width: 480,
151+
height: 229,
152+
hiddenClose: true,
153+
data: {
154+
title: _("New Version!"),
155+
content: _("You need to restart the Sketch.app"),
156+
donate: _("Donate"),
157+
download: _("Restart the Sketch.app")
158+
},
159+
callback: function( data ){
160+
var manifestCore = new manifestMaster(self.context);
161+
manifestCore.restartSketch();
162+
}
163+
});
164+
}
177165
}
178166
});
179167

Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,9 @@
175175
"title" : "Sketch Measure"
176176
},
177177
"identifier": "com.utom.measure",
178+
"appcast": "https://api.sketchpacks.com/v1/plugins/com.utom.measure/appcast",
178179
"homepage": "http://utom.design/measure/",
179-
"version": "2.6.3",
180+
"version": "2.6.4",
180181
"description" : "Make it a fun to create spec for developers and teammates",
181182
"authorEmail" : "utombox@gmail.com",
182183
"name" : "Sketch Measure"

Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-zh-Hans.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@
178178
"title" : "Sketch Measure"
179179
},
180180
"identifier": "com.utom.measure",
181+
"appcast": "https://api.sketchpacks.com/v1/plugins/com.utom.measure/appcast",
181182
"homepage": "http://utom.design/measure/",
182-
"version": "2.6.3",
183+
"version": "2.6.4",
183184
"description" : "Make it a fun to create spec for developers and teammates",
184185
"authorEmail" : "utombox@gmail.com",
185186
"name" : "Sketch Measure"

Sketch Measure.sketchplugin/Contents/Sketch/library/i18n/manifest-zh-Hant.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@
178178
"title" : "Sketch Measure"
179179
},
180180
"identifier": "com.utom.measure",
181+
"appcast": "https://api.sketchpacks.com/v1/plugins/com.utom.measure/appcast",
181182
"homepage": "http://utom.design/measure/",
182-
"version": "2.6.3",
183+
"version": "2.6.4",
183184
"description" : "Make it a fun to create spec for developers and teammates",
184185
"authorEmail" : "utombox@gmail.com",
185186
"name" : "Sketch Measure"

Sketch Measure.sketchplugin/Contents/Sketch/library/panel/update.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<div class="update-inner">
3838
<h1 class="update-title">New version!</h1>
3939
<p class="update-content">Just checked Sketch Measure has a new version 2.3.</p>
40-
<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>
40+
<p class="update-footer"><a id="donate" href="#donate">Donate</a><button id="submit" class="submit">Download Now</button></p>
4141
</div>
4242
</div>
4343
</body>

Sketch Measure.sketchplugin/Contents/Sketch/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,9 @@
175175
"title" : "Sketch Measure"
176176
},
177177
"identifier": "com.utom.measure",
178+
"appcast": "https://api.sketchpacks.com/v1/plugins/com.utom.measure/appcast",
178179
"homepage": "http://utom.design/measure/",
179-
"version": "2.6.3",
180+
"version": "2.6.4",
180181
"description" : "Make it a fun to create spec for developers and teammates",
181182
"authorEmail" : "utombox@gmail.com",
182183
"name" : "Sketch Measure"

Sketch Measure.sketchplugin/Contents/Sketch/mark.sketchscript

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
var threadDictionary = NSThread.mainThread().threadDictionary();
66
var Sketch, Configs, Settings, Toolbar, Mark, Properties, ga;
77
var Core = SMFramework.core();
8+
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');
89
Core.execute();
910

1011
function commandOverlays(context) {

0 commit comments

Comments
 (0)