lazy var sendMessageSoundEffect

This commit is contained in:
nixzhu
2015-09-23 12:27:31 +08:00
committed by nixzhu
parent 85fece3ed7
commit ebec10ff57
3 changed files with 10 additions and 10 deletions
+4 -4
View File
@@ -229,7 +229,7 @@
50F2B9781B2EDF3D00F840CC /* BorderTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50F2B9771B2EDF3D00F840CC /* BorderTextField.swift */; };
50F2B97B1B2EEAF800F840CC /* NavigationTitleLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50F2B97A1B2EEAF800F840CC /* NavigationTitleLabel.swift */; };
50FA9A441B661698009BF2A0 /* UIViewController+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50FA9A431B661698009BF2A0 /* UIViewController+Yep.swift */; };
6A649A9B1BB259CB00EE4FB5 /* YepSoundEffectHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A649A9A1BB259CB00EE4FB5 /* YepSoundEffectHelper.swift */; settings = {ASSET_TAGS = (); }; };
6A649A9B1BB259CB00EE4FB5 /* YepSoundEffect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A649A9A1BB259CB00EE4FB5 /* YepSoundEffect.swift */; settings = {ASSET_TAGS = (); }; };
6A649A9D1BB25BF100EE4FB5 /* bub3.caf in Resources */ = {isa = PBXBuildFile; fileRef = 6A649A9C1BB25BF100EE4FB5 /* bub3.caf */; settings = {ASSET_TAGS = (); }; };
6ADDB4501B848C600012877A /* 1Password.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6ADDB44F1B848C600012877A /* 1Password.xcassets */; };
8409137D1B7DB173001C89D6 /* FriendRequestView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8409137C1B7DB173001C89D6 /* FriendRequestView.swift */; };
@@ -489,7 +489,7 @@
50F2B9771B2EDF3D00F840CC /* BorderTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BorderTextField.swift; path = Views/TextFields/BorderTextField.swift; sourceTree = "<group>"; };
50F2B97A1B2EEAF800F840CC /* NavigationTitleLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = NavigationTitleLabel.swift; path = Views/Labels/NavigationTitleLabel.swift; sourceTree = "<group>"; };
50FA9A431B661698009BF2A0 /* UIViewController+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIViewController+Yep.swift"; path = "Extensions/UIViewController+Yep.swift"; sourceTree = "<group>"; };
6A649A9A1BB259CB00EE4FB5 /* YepSoundEffectHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YepSoundEffectHelper.swift; path = Helpers/YepSoundEffectHelper.swift; sourceTree = "<group>"; };
6A649A9A1BB259CB00EE4FB5 /* YepSoundEffect.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YepSoundEffect.swift; path = Helpers/YepSoundEffect.swift; sourceTree = "<group>"; };
6A649A9C1BB25BF100EE4FB5 /* bub3.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = bub3.caf; sourceTree = "<group>"; };
6ADDB44F1B848C600012877A /* 1Password.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = 1Password.xcassets; sourceTree = "<group>"; };
8409137C1B7DB173001C89D6 /* FriendRequestView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FriendRequestView.swift; path = Views/FriendRequest/FriendRequestView.swift; sourceTree = "<group>"; };
@@ -1027,7 +1027,7 @@
50EB8C5D1AE78AB9001AC1EE /* YepAsset.swift */,
50894D0F1AEE3C25000981AF /* YepHUD.swift */,
508DF62A1B9985F300B194A4 /* YepLog.swift */,
6A649A9A1BB259CB00EE4FB5 /* YepSoundEffectHelper.swift */,
6A649A9A1BB259CB00EE4FB5 /* YepSoundEffect.swift */,
);
name = Helpers;
sourceTree = "<group>";
@@ -1975,7 +1975,7 @@
500A0B1C1B450C2100D49358 /* EditNicknameAndBadgeViewController.swift in Sources */,
501560D71B427FD6000933F0 /* Results+Yep.swift in Sources */,
0AEB1CC61B0E742400178C9C /* Double+Yep.swift in Sources */,
6A649A9B1BB259CB00EE4FB5 /* YepSoundEffectHelper.swift in Sources */,
6A649A9B1BB259CB00EE4FB5 /* YepSoundEffect.swift in Sources */,
508D174C1ACCF49B0092D666 /* ChatRightAudioCell.swift in Sources */,
502AE53D1AB87C0D005BD199 /* YepUserDefaults.swift in Sources */,
50EB8CC41AE89F12001AC1EE /* ChatRightVideoCell.swift in Sources */,
@@ -6,10 +6,10 @@
// Copyright © 2015 Catch Inc. All rights reserved.
//
import UIKit
import AudioToolbox.AudioServices
class YepSoundEffectHelper: NSObject {
class YepSoundEffect: NSObject {
var soundID: SystemSoundID?
init(soundName: String) {
@@ -21,9 +21,8 @@ class YepSoundEffectHelper: NSObject {
if (error == kAudioServicesNoError) {
soundID = theSoundID
} else {
print("Sound Init Error")
println("YepSoundEffect Init Error")
}
}
}
@@ -39,3 +38,4 @@ class YepSoundEffectHelper: NSObject {
}
}
}
@@ -24,7 +24,7 @@ class ConversationViewController: BaseViewController {
var realm: Realm!
var sendMessageSound = YepSoundEffectHelper(soundName: "bub3")
lazy var sendMessageSoundEffect: YepSoundEffect = YepSoundEffect(soundName: "bub3")
lazy var messages: Results<Message> = {
return messagesOfConversation(self.conversation, inRealm: self.realm)
@@ -476,7 +476,7 @@ class ConversationViewController: BaseViewController {
messageToolbar.textSendAction = { [weak self] messageToolbar in
self?.sendMessageSound.play()
self?.sendMessageSoundEffect.play()
let text = messageToolbar.messageTextView.text!.trimming(.WhitespaceAndNewline)