Skip to content

Commit

Permalink
Merge pull request #2 from yforrest/master
Browse files Browse the repository at this point in the history
add ios 9.1 Shortcut Icon
  • Loading branch information
EddyVerbruggen committed Oct 29, 2015
2 parents cf3bd14 + c778187 commit 1f6a565
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ You can configure up to four icons and they are 'cached' until you pass in a new
So you don't need to do this every time your app loads, but it can't really hurt.

There are two types of icons supported currently" `iconType` and `iconTemplate`. The former is a fixed list
of 'compose'/'play'/'pause'/'add'/'location'/'search'/'share' and have been provided by Apple and look great.
of
Compose/Play/Pause/Add/Location/Search/Share/Prohibit/Contact/Home/MarkLocation/Favorite/Love/Cloud/Invitation/Confirmation/Mail/Message/Date/Time/CapturePhoto/CaptureVideo/Task/TaskCompleted/Alarm/Bookmark/Shuffle/Audio/Update
and have been provided by Apple and look great.
The `iconTemplate` can be used to provide your own icon. It must be a valid name of an icon template in
your Assets catalog.

Expand All @@ -75,18 +77,18 @@ the icon was used to launch your app. So make sure it's unique amongst your icon
type: 'checkin', // optional, but can be used in the onHomeIconPressed callback
title: 'Check in', // mandatory
subtitle: 'Quickly check in', // optional
iconType: 'compose' // optional
iconType: 'Compose' // optional
},
{
type: 'share',
title: 'Share',
subtitle: 'Share like you care',
iconType: 'share'
iconType: 'Share'
},
{
type: 'search',
title: 'Search',
iconType: 'search'
iconType: 'Search'
},
{
title: 'Show favorites',
Expand Down
36 changes: 29 additions & 7 deletions src/ios/app/ThreeDeeTouch.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,35 @@ - (void) configureQuickActions:(CDVInvokedUrlCommand *)command {
}

- (UIApplicationShortcutIconType) UIApplicationShortcutIconTypeFromString:(NSString*)str {
if ([str isEqualToString:@"compose"]) return UIApplicationShortcutIconTypeCompose;
else if ([str isEqualToString:@"play"]) return UIApplicationShortcutIconTypePlay;
else if ([str isEqualToString:@"pause"]) return UIApplicationShortcutIconTypePause;
else if ([str isEqualToString:@"add"]) return UIApplicationShortcutIconTypeAdd;
else if ([str isEqualToString:@"location"]) return UIApplicationShortcutIconTypeLocation;
else if ([str isEqualToString:@"search"]) return UIApplicationShortcutIconTypeSearch;
else if ([str isEqualToString:@"share"]) return UIApplicationShortcutIconTypeShare;
if ([str isEqualToString:@"Compose"]) return UIApplicationShortcutIconTypeCompose;
else if ([str isEqualToString:@"Play"]) return UIApplicationShortcutIconTypePlay;
else if ([str isEqualToString:@"Pause"]) return UIApplicationShortcutIconTypePause;
else if ([str isEqualToString:@"Add"]) return UIApplicationShortcutIconTypeAdd;
else if ([str isEqualToString:@"Location"]) return UIApplicationShortcutIconTypeLocation;
else if ([str isEqualToString:@"Search"]) return UIApplicationShortcutIconTypeSearch;
else if ([str isEqualToString:@"Share"]) return UIApplicationShortcutIconTypeShare;
else if ([str isEqualToString:@"Prohibit"]) return UIApplicationShortcutIconTypeProhibit;
else if ([str isEqualToString:@"Contact"]) return UIApplicationShortcutIconTypeContact;
else if ([str isEqualToString:@"Home"]) return UIApplicationShortcutIconTypeHome;
else if ([str isEqualToString:@"MarkLocation"]) return UIApplicationShortcutIconTypeMarkLocation;
else if ([str isEqualToString:@"Favorite"]) return UIApplicationShortcutIconTypeFavorite;
else if ([str isEqualToString:@"Love"]) return UIApplicationShortcutIconTypeLove;
else if ([str isEqualToString:@"Cloud"]) return UIApplicationShortcutIconTypeCloud;
else if ([str isEqualToString:@"Invitation"]) return UIApplicationShortcutIconTypeInvitation;
else if ([str isEqualToString:@"Confirmation"]) return UIApplicationShortcutIconTypeConfirmation;
else if ([str isEqualToString:@"Mail"]) return UIApplicationShortcutIconTypeMail;
else if ([str isEqualToString:@"Message"]) return UIApplicationShortcutIconTypeMessage;
else if ([str isEqualToString:@"Date"]) return UIApplicationShortcutIconTypeDate;
else if ([str isEqualToString:@"Time"]) return UIApplicationShortcutIconTypeTime;
else if ([str isEqualToString:@"CapturePhoto"]) return UIApplicationShortcutIconTypeCapturePhoto;
else if ([str isEqualToString:@"CaptureVideo"]) return UIApplicationShortcutIconTypeCaptureVideo;
else if ([str isEqualToString:@"Task"]) return UIApplicationShortcutIconTypeTask;
else if ([str isEqualToString:@"TaskCompleted"]) return UIApplicationShortcutIconTypeTaskCompleted;
else if ([str isEqualToString:@"Alarm"]) return UIApplicationShortcutIconTypeAlarm;
else if ([str isEqualToString:@"Bookmark"]) return UIApplicationShortcutIconTypeBookmark;
else if ([str isEqualToString:@"Shuffle"]) return UIApplicationShortcutIconTypeShuffle;
else if ([str isEqualToString:@"Audio"]) return UIApplicationShortcutIconTypeAudio;
else if ([str isEqualToString:@"Update"]) return UIApplicationShortcutIconTypeUpdate;
else {
NSLog(@"Invalid iconType passed to the 3D Touch plugin.");
return 0;
Expand Down

0 comments on commit 1f6a565

Please sign in to comment.