Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to play sound when message is displayed #158

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions ExampleProject/Example.xcodeproj/project.pbxproj
Expand Up @@ -8,6 +8,10 @@

/* Begin PBXBuildFile section */
0C9D527520AF4EAA93E80BC5 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A64AE23935D5499BAF0AC8C1 /* libPods.a */; };
69EED4261924737600C1510F /* error.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 69EED4221924737600C1510F /* error.mp3 */; };
69EED4271924737600C1510F /* message.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 69EED4231924737600C1510F /* message.mp3 */; };
69EED4281924737600C1510F /* success.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 69EED4241924737600C1510F /* success.mp3 */; };
69EED4291924737600C1510F /* warning.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 69EED4251924737600C1510F /* warning.mp3 */; };
CA0B97051719CD6800E06F84 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA0B97041719CD6800E06F84 /* UIKit.framework */; };
CA0B97071719CD6800E06F84 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA0B97061719CD6800E06F84 /* Foundation.framework */; };
CA0B97091719CD6800E06F84 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA0B97081719CD6800E06F84 /* CoreGraphics.framework */; };
Expand All @@ -23,6 +27,10 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
69EED4221924737600C1510F /* error.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = error.mp3; sourceTree = "<group>"; };
69EED4231924737600C1510F /* message.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = message.mp3; sourceTree = "<group>"; };
69EED4241924737600C1510F /* success.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = success.mp3; sourceTree = "<group>"; };
69EED4251924737600C1510F /* warning.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = warning.mp3; sourceTree = "<group>"; };
8B33F75B47A447C8B36A0061 /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = SOURCE_ROOT; };
A64AE23935D5499BAF0AC8C1 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
CA0B97011719CD6800E06F84 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -105,6 +113,10 @@
CA0B970B1719CD6800E06F84 /* Supporting Files */ = {
isa = PBXGroup;
children = (
69EED4221924737600C1510F /* error.mp3 */,
69EED4231924737600C1510F /* message.mp3 */,
69EED4241924737600C1510F /* success.mp3 */,
69EED4251924737600C1510F /* warning.mp3 */,
CA0B970C1719CD6800E06F84 /* Example-Info.plist */,
CA0B970D1719CD6800E06F84 /* InfoPlist.strings */,
CA0B97101719CD6800E06F84 /* main.m */,
Expand Down Expand Up @@ -170,10 +182,14 @@
buildActionMask = 2147483647;
files = (
CA0B970F1719CD6800E06F84 /* InfoPlist.strings in Resources */,
69EED4281924737600C1510F /* success.mp3 in Resources */,
CA0B97171719CD6800E06F84 /* Default.png in Resources */,
CA0B97191719CD6800E06F84 /* Default@2x.png in Resources */,
CA0B971B1719CD6800E06F84 /* Default-568h@2x.png in Resources */,
69EED4291924737600C1510F /* warning.mp3 in Resources */,
CA0B971E1719CD6800E06F84 /* MainStoryboard.storyboard in Resources */,
69EED4261924737600C1510F /* error.mp3 in Resources */,
69EED4271924737600C1510F /* message.mp3 in Resources */,
CAA3C9E817C3CD180085E06E /* AlternativeDesign.json in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
2 changes: 1 addition & 1 deletion ExampleProject/Example/TSDemoViewController.h
Expand Up @@ -9,5 +9,5 @@
#import <UIKit/UIKit.h>
#import "TSMessageView.h"

@interface TSDemoViewController : UIViewController <TSMessageViewProtocol>
@interface TSDemoViewController : UIViewController <TSMessageViewProtocol, TSMessageDelegate>
@end
40 changes: 39 additions & 1 deletion ExampleProject/Example/TSDemoViewController.m
Expand Up @@ -10,6 +10,7 @@
#import "TSDemoViewController.h"
#import "TSMessage.h"
#import "TSMessageView.h"
#import "TSMessage+Sounds.h"

@interface TSDemoViewController ()

Expand All @@ -29,7 +30,7 @@ - (void)viewDidLoad
[super viewDidLoad];

[TSMessage setDefaultViewController:self];

[TSMessage sharedMessage].delegate = self;
[self.navigationController.navigationBar setTranslucent:YES];
}

Expand Down Expand Up @@ -219,4 +220,41 @@ - (IBAction)didTapCustomDesign:(id)sender
type:TSMessageTypeSuccess];
}

#pragma mark - TSMessageDelegate Methods

- (void)willDisplayNotification:(TSMessageView *)notification {
self.view.backgroundColor = [UIColor yellowColor];
}
- (void)didDisplayNotification:(TSMessageView *)notification {
self.view.backgroundColor = [UIColor greenColor];
}

- (void)didDismissNotification:(TSMessageView *)notification {
self.view.backgroundColor = [UIColor whiteColor];
}

#pragma mark - TSMessageSoundDelegate Methods
- (NSString *)soundForNotificationType:(TSMessageType)type {
NSString *sound;
switch (type) {
case TSMessageTypeDefault:
sound = [NSString stringWithFormat:@"message.mp3"];
break;
case TSMessageTypeError:
sound = [NSString stringWithFormat:@"error.mp3"];
break;
case TSMessageTypeSuccess:
sound = [NSString stringWithFormat:@"success.mp3"];
break;
case TSMessageTypeWarning:
sound = [NSString stringWithFormat:@"warning.mp3"];
break;
default:
sound = nil;
break;
}

return sound;
}

@end
Binary file added ExampleProject/Example/error.mp3
Binary file not shown.
Binary file added ExampleProject/Example/message.mp3
Binary file not shown.
Binary file added ExampleProject/Example/success.mp3
Binary file not shown.
Binary file added ExampleProject/Example/warning.mp3
Binary file not shown.
2 changes: 1 addition & 1 deletion ExampleProject/Podfile
Expand Up @@ -2,4 +2,4 @@ platform :ios, '5.1'

xcodeproj 'Example.xcodeproj'

pod 'TSMessages', :path => '..'
pod 'TSMessages/Sounds', :path => '..'
12 changes: 7 additions & 5 deletions ExampleProject/Podfile.lock
@@ -1,17 +1,19 @@
PODS:
- HexColors (2.2.1)
- TSMessages (0.9.4):
- TSMessages/Sounds (0.9.4):
- TSMessages/TSMessages
- TSMessages/TSMessages (0.9.4):
- HexColors

DEPENDENCIES:
- TSMessages (from `..`)
- TSMessages/Sounds (from `..`)

EXTERNAL SOURCES:
TSMessages:
:path: ..

SPEC CHECKSUMS:
HexColors: 3a68db077cd6572a8f7d4aa1add284dd2436a934
TSMessages: 5ab92604b02e49a755d2cc2baf114d2248a90977
HexColors: 99211502e17904af7891fc8f687d0e4958a6d66e
TSMessages: 353bd5e5e91a5407eb9ff7662a0337527dfbbc18

COCOAPODS: 0.25.0
COCOAPODS: 0.32.1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ExampleProject/Pods/Headers/TSMessages/TSMessage+Private.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ExampleProject/Pods/Headers/TSMessages/TSMessage+Sounds.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 15 additions & 8 deletions ExampleProject/Pods/Local Podspecs/TSMessages.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions ExampleProject/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ExampleProject/Pods/Pods-TSMessages-Private.xcconfig

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ExampleProject/Pods/Pods-TSMessages.xcconfig

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions ExampleProject/Pods/Pods-environment.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 23 additions & 2 deletions ExampleProject/Pods/Pods-resources.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ExampleProject/Pods/Pods.xcconfig

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.