Skip to content
Browse files

Play message received sound based on notification

  • Loading branch information...
1 parent e2b9939 commit 059ee5a1907e3957ab723c4ca902a481adc7f244 @benlangfeld committed Nov 8, 2010
Showing with 10 additions and 2 deletions.
  1. +10 −2 Controllers/AccountsController.j
View
12 Controllers/AccountsController.j
@@ -20,6 +20,7 @@
@import <AppKit/CPViewController.j>
@import <AppKit/CPScrollView.j>
+@import <AppKit/CPSound.j>
@import <Foundation/CPUserDefaults.j>
@import "../Models/Account.j"
@@ -38,6 +39,7 @@ RosterViewDragType = @"RosterViewDragType";
@outlet CPScrollView scrollView @accessors;
@outlet CPOutlineView rosterView @accessors;
CPArray draggedItems;
+ CPSound messageReceivedSound;
}
+ (AccountsController)sharedController
@@ -52,8 +54,9 @@ RosterViewDragType = @"RosterViewDragType";
{
if (self = [super init])
{
- accounts = [CPArray array];
- chatWindows = [CPDictionary dictionary];
+ accounts = [CPArray array];
+ chatWindows = [CPDictionary dictionary];
+ messageReceivedSound = [[CPSound alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[self class]] pathForResource:@"Receive.mp3"] byReference:NO];
[self listenForReloadNotifications];
[[CPNotificationCenter defaultCenter]
addObserver:self
@@ -75,6 +78,11 @@ RosterViewDragType = @"RosterViewDragType";
selector:@selector(storeAccounts)
name:AccountWasDeletedNotification
object:nil];
+ [[CPNotificationCenter defaultCenter]
+ addObserver:messageReceivedSound
+ selector:@selector(play)
+ name:TNStropheContactMessageReceivedNotification
+ object:nil];
[self setupStoredAccounts];
}
return self;

0 comments on commit 059ee5a

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