Skip to content

Commit

Permalink
Merge branch 'pullreq/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
uasi committed Apr 1, 2011
2 parents d9c7b0e + ec6d1f9 commit dd03e08
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
7 changes: 7 additions & 0 deletions GrowlSafariBridge.xcodeproj/project.pbxproj
Expand Up @@ -139,7 +139,14 @@
isa = PBXProject;
buildConfigurationList = C027D11D08A954E7001699E2 /* Build configuration list for PBXProject "GrowlSafariBridge" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 0259C574FE90428111CA0C5A /* GrowlSafariBridge */;
projectDirPath = "";
projectRoot = "";
Expand Down
16 changes: 13 additions & 3 deletions GrowlSafariBridgeView.m
Expand Up @@ -112,24 +112,34 @@ - (void)notifyWithTitle:(NSString *)title
description:(NSString *)description
options:(id)options
{

NSNumber *isSticky = nil;
NSNumber *priority = nil;
if (options != nil && [options isEqual:[WebUndefined undefined]]) {
NSString *imageURL = nil;
NSData *iconData = nil;

if (options != nil && ![options isEqual:[WebUndefined undefined]]) {
isSticky = [options valueForKey:@"isSticky"];
priority = [options valueForKey:@"priority"];
imageURL = [options valueForKey:@"imageUrl"];
}

if (isSticky == nil) {
isSticky = [NSNumber numberWithBool:NO];
}
if (priority == nil) {
priority = [NSNumber numberWithInt:0];
}

if (imageURL != nil) {
NSImage *image = [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:imageURL]];
iconData = [image TIFFRepresentation];
[image release];
}

[GrowlApplicationBridge notifyWithTitle:title
description:description
notificationName:GSBNotification
iconData:nil
iconData:iconData
priority:[priority intValue]
isSticky:[isSticky boolValue]
clickContext:nil];
Expand Down
2 changes: 1 addition & 1 deletion Test.html
Expand Up @@ -9,6 +9,6 @@
window.GrowlSafariBridge = document.getElementById('growl-safari-bridge');
GrowlSafariBridge.notify('Hello', 'This is Growl Safari Bridge.');
</script>
<a href="#" onclick="javascript:GrowlSafariBridge.notifyWithOptions('Notification', 'Link was clicked.', {isSticky: false, priority: -1})">Click here</a>
<a href="#" onclick="javascript:GrowlSafariBridge.notifyWithOptions('Notification', 'Link was clicked.',{isSticky: false, priority: -1, imageUrl: 'http://a1.twimg.com/sticky/default_profile_images/default_profile_0_bigger.png'})">Click here</a>
</body>
</html>

0 comments on commit dd03e08

Please sign in to comment.