New file |
| | |
| | | /************************************************************ |
| | | * * Hyphenate CONFIDENTIAL |
| | | * __________________ |
| | | * Copyright (C) 2016 Hyphenate Inc. All rights reserved. |
| | | * |
| | | * NOTICE: All information contained herein is, and remains |
| | | * the property of Hyphenate Inc. |
| | | * Dissemination of this information or reproduction of this material |
| | | * is strictly forbidden unless prior written permission is obtained |
| | | * from Hyphenate Inc. |
| | | */ |
| | | |
| | | #import "EMCDDeviceManager+Remind.h" |
| | | |
| | | void EMSystemSoundFinishedPlayingCallback(SystemSoundID sound_id, void* user_data) |
| | | { |
| | | AudioServicesDisposeSystemSoundID(sound_id); |
| | | } |
| | | |
| | | @implementation EMCDDeviceManager (Remind) |
| | | |
| | | // The system sound for a new message |
| | | - (SystemSoundID)playNewMessageSound |
| | | { |
| | | // Path for the audio file |
| | | NSURL *bundlePath = [[NSBundle mainBundle] URLForResource:@"EaseUIResource" withExtension:@"bundle"]; |
| | | NSURL *audioPath = [[NSBundle bundleWithURL:bundlePath] URLForResource:@"in" withExtension:@"caf"]; |
| | | |
| | | SystemSoundID soundID; |
| | | AudioServicesCreateSystemSoundID((__bridge CFURLRef)(audioPath), &soundID); |
| | | // Register the sound completion callback. |
| | | AudioServicesAddSystemSoundCompletion(soundID, |
| | | NULL, // uses the main run loop |
| | | NULL, // uses kCFRunLoopDefaultMode |
| | | EMSystemSoundFinishedPlayingCallback, // the name of our custom callback function |
| | | NULL // for user data, but we don't need to do that in this case, so we just pass NULL |
| | | ); |
| | | |
| | | AudioServicesPlaySystemSound(soundID); |
| | | |
| | | return soundID; |
| | | } |
| | | |
| | | - (void)playVibration |
| | | { |
| | | // Register the sound completion callback. |
| | | AudioServicesAddSystemSoundCompletion(kSystemSoundID_Vibrate, |
| | | NULL, // uses the main run loop |
| | | NULL, // uses kCFRunLoopDefaultMode |
| | | EMSystemSoundFinishedPlayingCallback, // the name of our custom callback function |
| | | NULL // for user data, but we don't need to do that in this case, so we just pass NULL |
| | | ); |
| | | |
| | | AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); |
| | | } |
| | | @end |