mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-09 04:46:35 +10:00
Resume background music
This commit is contained in:
@@ -1533,6 +1533,7 @@
|
||||
0A8F54A31AB67D11004AD60E /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0630;
|
||||
ORGANIZATIONNAME = "Catch Inc";
|
||||
TargetAttributes = {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "F957B893D3C5E641248DF05092C80954FE9803E8",
|
||||
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
|
||||
|
||||
},
|
||||
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
|
||||
"AD419F7F93A7DCDB6BCEF67C9BDF3271E84453B3" : 0,
|
||||
"F957B893D3C5E641248DF05092C80954FE9803E8" : 0
|
||||
},
|
||||
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "C7AB340A-CC24-4E1A-9720-213C5CAC149C",
|
||||
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
|
||||
"AD419F7F93A7DCDB6BCEF67C9BDF3271E84453B3" : "CatchLib-iOS",
|
||||
"F957B893D3C5E641248DF05092C80954FE9803E8" : "Yep"
|
||||
},
|
||||
"DVTSourceControlWorkspaceBlueprintNameKey" : "Yep",
|
||||
"DVTSourceControlWorkspaceBlueprintVersion" : 203,
|
||||
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Yep.xcworkspace",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
|
||||
{
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/CatchChat\/CatchLib-iOS.git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "AD419F7F93A7DCDB6BCEF67C9BDF3271E84453B3"
|
||||
},
|
||||
{
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/CatchChat\/Yep.git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
|
||||
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "F957B893D3C5E641248DF05092C80954FE9803E8"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -22,8 +22,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
var isColdLaunch = true
|
||||
|
||||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
|
||||
|
||||
println("App is On \(DEBUG)")
|
||||
|
||||
setSchemaVersion(13, Realm.defaultPath, { migration, oldSchemaVersion in
|
||||
// We haven’t migrated anything yet, so oldSchemaVersion == 0
|
||||
@@ -70,10 +68,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
})
|
||||
|
||||
Crashlytics.startWithAPIKey("3030ba006e21bcf8eb4a2127b6a7931ea6667486")
|
||||
|
||||
AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: AVAudioSessionCategoryOptions.DefaultToSpeaker, error: nil)
|
||||
// AVAudioSession.sharedInstance().setActive(true, error: nil)
|
||||
|
||||
|
||||
AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: AVAudioSessionCategoryOptions.DefaultToSpeaker,error: nil)
|
||||
|
||||
application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
|
||||
// 推送初始化
|
||||
APService.setupWithOption(launchOptions)
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>48</string>
|
||||
<string>49</string>
|
||||
<key>Fabric</key>
|
||||
<dict>
|
||||
<key>APIKey</key>
|
||||
|
||||
@@ -14,6 +14,8 @@ import Proposer
|
||||
class YepAudioService: NSObject {
|
||||
|
||||
static let sharedManager = YepAudioService()
|
||||
|
||||
let queue = dispatch_queue_create("YepAudioService", DISPATCH_QUEUE_SERIAL)
|
||||
|
||||
var audioFileURL: NSURL?
|
||||
var audioRecorder: AVAudioRecorder?
|
||||
@@ -73,41 +75,56 @@ class YepAudioService: NSObject {
|
||||
}
|
||||
|
||||
func beginRecordWithFileURL(fileURL: NSURL, audioRecorderDelegate: AVAudioRecorderDelegate) {
|
||||
|
||||
proposeToAccess(.Microphone, agreed: {
|
||||
|
||||
self.prepareAudioRecorderWithFileURL(fileURL, audioRecorderDelegate: audioRecorderDelegate)
|
||||
|
||||
if let audioRecorder = self.audioRecorder {
|
||||
|
||||
if (audioRecorder.recording){
|
||||
audioRecorder.stop()
|
||||
|
||||
} else {
|
||||
audioRecorder.record()
|
||||
println("Audio Record did begin")
|
||||
|
||||
// dispatch_async(queue, { () -> Void in
|
||||
// AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: AVAudioSessionCategoryOptions.DefaultToSpeaker,error: nil)
|
||||
// AVAudioSession.sharedInstance().setActive(true, error: nil)
|
||||
|
||||
proposeToAccess(.Microphone, agreed: {
|
||||
|
||||
self.prepareAudioRecorderWithFileURL(fileURL, audioRecorderDelegate: audioRecorderDelegate)
|
||||
|
||||
if let audioRecorder = self.audioRecorder {
|
||||
|
||||
if (audioRecorder.recording){
|
||||
audioRecorder.stop()
|
||||
|
||||
} else {
|
||||
audioRecorder.record()
|
||||
println("Audio Record did begin")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}, rejected: {
|
||||
if let
|
||||
appDelegate = UIApplication.sharedApplication().delegate as? AppDelegate,
|
||||
viewController = appDelegate.window?.rootViewController {
|
||||
viewController.alertCanNotAccessMicrophone()
|
||||
}
|
||||
})
|
||||
// })
|
||||
|
||||
|
||||
}, rejected: {
|
||||
if let
|
||||
appDelegate = UIApplication.sharedApplication().delegate as? AppDelegate,
|
||||
viewController = appDelegate.window?.rootViewController {
|
||||
viewController.alertCanNotAccessMicrophone()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func endRecord() {
|
||||
if let audioRecorder = audioRecorder {
|
||||
if (audioRecorder.recording){
|
||||
audioRecorder.stop()
|
||||
|
||||
|
||||
if let audioRecorder = self.audioRecorder {
|
||||
if (audioRecorder.recording){
|
||||
audioRecorder.stop()
|
||||
}
|
||||
}
|
||||
}
|
||||
dispatch_async(queue, { () -> Void in
|
||||
// AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: AVAudioSessionCategoryOptions.DefaultToSpeaker,error: nil)
|
||||
AVAudioSession.sharedInstance().setActive(false, withOptions: AVAudioSessionSetActiveOptions.OptionNotifyOthersOnDeactivation, error: nil)
|
||||
})
|
||||
self.checkRecordTimeoutTimer?.invalidate()
|
||||
|
||||
self.checkRecordTimeoutTimer = nil
|
||||
|
||||
checkRecordTimeoutTimer?.invalidate()
|
||||
|
||||
|
||||
checkRecordTimeoutTimer = nil
|
||||
}
|
||||
|
||||
// MARK: Audio Player
|
||||
|
||||
@@ -200,6 +200,7 @@ class ConversationViewController: BaseViewController {
|
||||
navigationController?.delegate = delegate
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@@ -481,6 +482,7 @@ class ConversationViewController: BaseViewController {
|
||||
}
|
||||
|
||||
messageToolbar.voiceSendCancelAction = { [weak self] messageToolbar in
|
||||
|
||||
self?.swipeUpView.hidden = true
|
||||
self?.waverView.removeFromSuperview()
|
||||
|
||||
@@ -489,6 +491,7 @@ class ConversationViewController: BaseViewController {
|
||||
YepAudioService.sharedManager.recordTimeoutAction = nil
|
||||
}
|
||||
|
||||
|
||||
messageToolbar.voiceSendEndAction = { [weak self] messageToolbar in
|
||||
|
||||
hideWaver()
|
||||
@@ -1957,6 +1960,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi
|
||||
})
|
||||
|
||||
}, cancelAction: {
|
||||
|
||||
})
|
||||
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user