<NME> action-check-updates.cocoascript
<BEF> 
var showUpdateWindow = function(newVersionString) {

	var artboardsWindow = [[NSWindow alloc] init]
	artboardsWindow.setStyleMask(NSTitledWindowMask + NSFullSizeContentViewWindowMask);
	artboardsWindow.setTitlebarAppearsTransparent(true);
	artboardsWindow.setTitleVisibility(NSWindowTitleHidden);
	artboardsWindow.setTitlebarAppearsTransparent(true);
	artboardsWindow.setMovableByWindowBackground(true);
	[artboardsWindow setFrame:NSMakeRect(0, 0, ViewInventory.sizeModalSmall(), 234) display:false];
	[artboardsWindow setBackgroundColor:ViewInventory.colorWindow()];

	var imageView = ViewInventory.addImage(NSMakeRect(16, 133, 180, 84), "modals/update");
	[[artboardsWindow contentView] addSubview:imageView];

	// var updateText = [[NSTextField alloc] initWithFrame:NSMakeRect(measureSettingBlock, measureSettingBlock*4, (measureSettingsWidth - measureSettingBlock*5), measureSettingBlock*7)];
	// [updateText setPreferredMaxLayoutWidth:measureSettingsWidth - measureSettingBlock*2]
  // [updateText setEditable:false];
  // [updateText setBordered:false];
	// [updateText setFont:ViewInventory.fontCheckControls()];
  // [updateText setTextColor:ViewInventory.colorBlack()];
  // [updateText setDrawsBackground:false];
	//
	// var updateTextValue = json.valueForKey("description");
	// if (updateTextValue == nil) { updateTextValue = "Bug fixes and perfomance optimisations" }
  // [updateText setStringValue:updateTextValue];
	// [[artboardsWindow contentView] addSubview:updateText];

	var updateDetailsButton = ViewInventory.addButton( NSMakeRect(62, 83, 88, 24), "modals/update link",
			function(sender){
				var url = [NSURL URLWithString:StatisticsInventory.getUpdateDetailsLink()];
				[[NSWorkspace sharedWorkspace] openURL:url]
	})

	[[artboardsWindow contentView] addSubview:updateDetailsButton];

	var titleVersion = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 114, ViewInventory.sizeModalSmall(), 16)];
	[titleVersion setEditable:false];
	[titleVersion setBordered:false];
	[titleVersion setFont:ViewInventory.fontCheckControls()];
	[titleVersion setTextColor:ViewInventory.colorVersion()];
	[titleVersion setDrawsBackground:false];
	[titleVersion setStringValue:"v" + newVersionString + " available"];
	[titleVersion setAlignment:NSCenterTextAlignment];
	[[artboardsWindow contentView] addSubview:titleVersion];

	var showDuplicatesButton = [[NSButton alloc] initWithFrame:NSMakeRect(16, 34, ViewInventory.sizeModalSmall() - 32, 32)];
	[showDuplicatesButton setTitle:"Download Update"];
	[showDuplicatesButton setBezelStyle:NSRoundedBezelStyle];
	[showDuplicatesButton setFont:ViewInventory.fontActionButton()];
	[showDuplicatesButton setKeyEquivalent:"\r"];
	[showDuplicatesButton setCOSJSTargetFunction:function(sender) {
		[artboardsWindow orderOut:nil]
		[NSApp stopModal]

		var websiteURL = NSURL.URLWithString(json.valueForKey("websiteURL"));
		NSWorkspace.sharedWorkspace().openURL(websiteURL);
	}];
	[showDuplicatesButton setAction:"callAction:"];
	[[artboardsWindow contentView] addSubview:showDuplicatesButton];


	var cancelButton = [[NSButton alloc] initWithFrame:NSMakeRect(16, 8, ViewInventory.sizeModalSmall() - 32, 32)];
	[cancelButton setTitle:"Remind Later"];
	[cancelButton setFont:ViewInventory.fontActionButton()];
	[cancelButton setBezelStyle:NSRoundedBezelStyle];
	[cancelButton setKeyEquivalent:"\033"]
	[cancelButton setCOSJSTargetFunction:function(sender) {
		[artboardsWindow orderOut:nil]
		[NSApp stopModal]
	}];
	[cancelButton setAction:"callAction:"]
	[[artboardsWindow contentView] addSubview:cancelButton];


	[NSApp runModalForWindow:artboardsWindow];
}



// generate code for layers
var runCheckUpdates = function() {
	StatisticsInventory.sendRequest(StatisticsInventory.returnRequestURL(checkUpdatesRequest))

	var json = NSJSONSerialization.JSONObjectWithData_options_error(NSData.dataWithContentsOfURL(NSURL.URLWithString(StatisticsInventory.getVersionLink())), 0, nil)

	var currentVersionAsInt = getVersionNumberFromString(json.valueForKey("version"))
	var installedVersionAsInt = getVersionNumberFromString(pluginVersion)
	if (currentVersionAsInt > installedVersionAsInt) {
			showUpdateWindow(json.valueForKey("version"))
			// var websiteURL = NSURL.URLWithString(json.valueForKey("websiteURL"));
			// NSWorkspace.sharedWorkspace().openURL(websiteURL);
	}
	else {
			currentDocument.showMessage(ViewInventory.smileDone() + "Latest version");
	}

}

var getVersionNumberFromString = function(versionString) {
	var versionNumber = versionString.stringByReplacingOccurrencesOfString_withString(".", "") + ""
	while(versionNumber.length != 3) {
		versionNumber += "0"
	}
	return parseInt(versionNumber)
}

<MSG> Changed Updates done message

<DFF> @@ -92,7 +92,7 @@ var runCheckUpdates = function() {
 			// NSWorkspace.sharedWorkspace().openURL(websiteURL);
 	}
 	else {
-			currentDocument.showMessage(ViewInventory.smileDone() + "Latest version");
+			currentDocument.showMessage(ViewInventory.smileDone() + "Framer Inventory supports Sketch native update");
 	}
 
 }

Changed Updates done message