Skip to content
Browse files

Moved off deprecated NSWorkstation API.

Closes #38.
  • Loading branch information...
1 parent fbc6ca7 commit 9d2998603ee524e71283048e4ba77af6d70398df @eofster committed
View
21 PlugIns/AddressBook/AKAddressBookPhonePlugIn.m
@@ -83,17 +83,11 @@ - (NSString *)titleForPerson:(ABPerson *)person
- (void)performActionForPerson:(ABPerson *)person
identifier:(NSString *)identifier {
- NSArray *applications = [[NSWorkspace sharedWorkspace] launchedApplications];
- BOOL isTelephoneLaunched = NO;
- for (NSDictionary *anApplication in applications) {
- NSString *bundleIdentifier
- = [anApplication objectForKey:@"NSApplicationBundleIdentifier"];
-
- if ([bundleIdentifier isEqualToString:@"com.tlphn.Telephone"]) {
- isTelephoneLaunched = YES;
- break;
- }
- }
+ NSArray *applications = [[NSWorkspace sharedWorkspace] runningApplications];
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:
+ @"bundleIdentifier == 'com.tlphn.Telephone'"];
+ applications = [applications filteredArrayUsingPredicate:predicate];
+ BOOL isTelephoneLaunched = [applications count] > 0;
ABMultiValue *phones = [person valueForProperty:[self actionProperty]];
NSString *phoneNumber = [phones valueForIdentifier:identifier];
@@ -124,8 +118,9 @@ - (BOOL)shouldEnableActionForPerson:(ABPerson *)person
}
- (void)workspaceDidLaunchApplication:(NSNotification *)notification {
- NSString *bundleIdentifier
- = [[notification userInfo] objectForKey:@"NSApplicationBundleIdentifier"];
+ NSRunningApplication *application
+ = [[notification userInfo] objectForKey:NSWorkspaceApplicationKey];
+ NSString *bundleIdentifier = [application bundleIdentifier];
if ([bundleIdentifier isEqualToString:@"com.tlphn.Telephone"] &&
[self shouldDial]) {
View
21 PlugIns/AddressBook/AKAddressBookSIPAddressPlugIn.m
@@ -85,17 +85,11 @@ - (NSString *)titleForPerson:(ABPerson *)person
- (void)performActionForPerson:(ABPerson *)person
identifier:(NSString *)identifier {
- NSArray *applications = [[NSWorkspace sharedWorkspace] launchedApplications];
- BOOL isTelephoneLaunched = NO;
- for (NSDictionary *anApplication in applications) {
- NSString *bundleIdentifier
- = [anApplication objectForKey:@"NSApplicationBundleIdentifier"];
-
- if ([bundleIdentifier isEqualToString:@"com.tlphn.Telephone"]) {
- isTelephoneLaunched = YES;
- break;
- }
- }
+ NSArray *applications = [[NSWorkspace sharedWorkspace] runningApplications];
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:
+ @"bundleIdentifier == 'com.tlphn.Telephone'"];
+ applications = [applications filteredArrayUsingPredicate:predicate];
+ BOOL isTelephoneLaunched = [applications count] > 0;
ABMultiValue *emails = [person valueForProperty:[self actionProperty]];
NSString *anEmail = [emails valueForIdentifier:identifier];
@@ -135,8 +129,9 @@ - (BOOL)shouldEnableActionForPerson:(ABPerson *)person
}
- (void)workspaceDidLaunchApplication:(NSNotification *)notification {
- NSString *bundleIdentifier
- = [[notification userInfo] objectForKey:@"NSApplicationBundleIdentifier"];
+ NSRunningApplication *application
+ = [[notification userInfo] objectForKey:NSWorkspaceApplicationKey];
+ NSString *bundleIdentifier = [application bundleIdentifier];
if ([bundleIdentifier isEqualToString:@"com.tlphn.Telephone"] &&
[self shouldDial]) {
View
2 PlugIns/AddressBook/TelephoneAddressBookPhonePlugIn-Info.plist
@@ -15,6 +15,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>2</string>
+ <string>3</string>
</dict>
</plist>
View
2 PlugIns/AddressBook/TelephoneAddressBookSIPAddressPlugIn-Info.plist
@@ -15,6 +15,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>2</string>
+ <string>3</string>
</dict>
</plist>

0 comments on commit 9d29986

Please sign in to comment.
Something went wrong with that request. Please try again.