Commit 098f06b8 by SunARcTech2

fix audio progress

parent e7d846fe
No preview for this file type
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0</string> <string>1.0</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2</string> <string>18</string>
<key>Fabric</key> <key>Fabric</key>
<dict> <dict>
<key>APIKey</key> <key>APIKey</key>
......
...@@ -17,6 +17,7 @@ class PlayAudioCell: UITableViewCell { ...@@ -17,6 +17,7 @@ class PlayAudioCell: UITableViewCell {
// var audioRecording: AudioRecording? // var audioRecording: AudioRecording?
var delegate: PlayAudioCellDelegate! var delegate: PlayAudioCellDelegate!
@IBOutlet var btnPlay: UIButton! @IBOutlet var btnPlay: UIButton!
@IBOutlet var audioSlider: UISlider!
var audioRecording: AudioRecording? { var audioRecording: AudioRecording? {
...@@ -35,6 +36,7 @@ class PlayAudioCell: UITableViewCell { ...@@ -35,6 +36,7 @@ class PlayAudioCell: UITableViewCell {
@IBAction func playAudio() { @IBAction func playAudio() {
if audioRecording?.isPlaying == true { if audioRecording?.isPlaying == true {
Audio.pause() Audio.pause()
delegate.audioPlayingAt(index: 10000)
} else { } else {
playAudioFile() playAudioFile()
delegate.audioPlayingAt(index: audioRecording!.audioIndex) delegate.audioPlayingAt(index: audioRecording!.audioIndex)
...@@ -49,7 +51,13 @@ class PlayAudioCell: UITableViewCell { ...@@ -49,7 +51,13 @@ class PlayAudioCell: UITableViewCell {
}, failure: { (errorMesaage) in }, failure: { (errorMesaage) in
self.viewController()?.view.showToast(errorMesaage, position: .bottom, popTime: 2.0, dismissOnTap: false) self.viewController()?.view.showToast(errorMesaage, position: .bottom, popTime: 2.0, dismissOnTap: false)
}) { (progress, duration) in }) { (progress, duration) in
print("progress = \(progress) duration = \(duration)") self.audioSlider.maximumValue = duration
self.audioSlider.value = progress
if Int(duration) == Int(progress) {
self.delegate.audioPlayingAt(index: 10000)
}
} }
} }
......
...@@ -108,14 +108,16 @@ extension CompletedServicesViewController: UITableViewDelegate, UITableViewDataS ...@@ -108,14 +108,16 @@ extension CompletedServicesViewController: UITableViewDelegate, UITableViewDataS
let selectedService = service.services[indexPath.row] let selectedService = service.services[indexPath.row]
if selectedService.serviceType == .BOOKING { if selectedService.typeId == "booking" {
// if selectedService.serviceType == .BOOKING {
let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self) let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self)
appointmentdetails.orderStatus = .COMPLETE appointmentdetails.orderStatus = .COMPLETE
// appointmentdetails.serviceStatus = .completed // appointmentdetails.serviceStatus = .completed
appointmentdetails.incrementId = selectedService.incrementId appointmentdetails.incrementId = selectedService.incrementId
appointmentdetails.orderId = selectedService.orderId appointmentdetails.orderId = selectedService.orderId
self.navigationController?.pushViewController(appointmentdetails, animated: true) self.navigationController?.pushViewController(appointmentdetails, animated: true)
} else if selectedService.serviceType == .FAQ { } else if selectedService.typeId == "faq" {
// } else if selectedService.serviceType == .FAQ {
if selectedService.status == .PROCESSING { if selectedService.status == .PROCESSING {
let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self) let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self)
...@@ -130,8 +132,8 @@ extension CompletedServicesViewController: UITableViewDelegate, UITableViewDataS ...@@ -130,8 +132,8 @@ extension CompletedServicesViewController: UITableViewDelegate, UITableViewDataS
enquiryDetailsViewController.orderId = selectedService.orderId! enquiryDetailsViewController.orderId = selectedService.orderId!
self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true) self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true)
} }
} else if selectedService.typeId == "forms"{
} else if selectedService.serviceType == .FORM{ // } else if selectedService.serviceType == .FORM{
if let form = Form.VC(with: selectedService.incrementId!, orderId: selectedService.orderId!, categoryType: selectedService.categoryType){ if let form = Form.VC(with: selectedService.incrementId!, orderId: selectedService.orderId!, categoryType: selectedService.categoryType){
self.navigationController?.pushViewController(form, animated: true) self.navigationController?.pushViewController(form, animated: true)
} }
......
...@@ -22,10 +22,9 @@ class EditResultViewController: BaseViewController { ...@@ -22,10 +22,9 @@ class EditResultViewController: BaseViewController {
var recommendedProducts = [RecommendProduct]() var recommendedProducts = [RecommendProduct]()
var isAllowAccessMicrophone = true var isAllowAccessMicrophone = true
var orderId = "0" var orderId = "0"
var editResult = EditResult() var editResult = EditResult()
var audioPlayedAtIndex = 10000
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -67,6 +66,10 @@ extension EditResultViewController { ...@@ -67,6 +66,10 @@ extension EditResultViewController {
let alertActionNo = UIAlertAction(title: "No", style: .default) { (action) in } let alertActionNo = UIAlertAction(title: "No", style: .default) { (action) in }
let alertActionYes = UIAlertAction(title: "Yes", style: .default) { (action) in let alertActionYes = UIAlertAction(title: "Yes", style: .default) { (action) in
print(self.imagesForResult.count)
print(self.audioRecordings.count)
self.editResult.images = self.imagesForResult self.editResult.images = self.imagesForResult
self.editResult.audios = self.audioRecordings self.editResult.audios = self.audioRecordings
self.editResult.products = self.recommendedProducts self.editResult.products = self.recommendedProducts
...@@ -181,6 +184,15 @@ extension EditResultViewController: UITableViewDelegate, UITableViewDataSource { ...@@ -181,6 +184,15 @@ extension EditResultViewController: UITableViewDelegate, UITableViewDataSource {
audioRecordings[indexPath.row].audioIndex = indexPath.row audioRecordings[indexPath.row].audioIndex = indexPath.row
playAudioCell.audioRecording = audioRecordings[indexPath.row] playAudioCell.audioRecording = audioRecordings[indexPath.row]
playAudioCell.delegate = self playAudioCell.delegate = self
playAudioCell.audioSlider.value = 0
playAudioCell.btnPlay.tag = indexPath.row
if audioPlayedAtIndex == indexPath.row {
playAudioCell.btnPlay.setBackgroundImage(UIImage(named: "pause"), for: .normal)
} else {
playAudioCell.btnPlay.setBackgroundImage(UIImage(named: "play"), for: .normal)
}
return playAudioCell return playAudioCell
default: default:
return UITableViewCell() return UITableViewCell()
...@@ -283,13 +295,16 @@ extension EditResultViewController: PlayAudioCellDelegate { ...@@ -283,13 +295,16 @@ extension EditResultViewController: PlayAudioCellDelegate {
func audioPlayingAt(index: Int) { func audioPlayingAt(index: Int) {
for (arrayIndex, audioRecording) in audioRecordings.enumerated() {
if arrayIndex == index { audioPlayedAtIndex = index
audioRecording.isPlaying = true
} else { // for (arrayIndex, audioRecording) in audioRecordings.enumerated() {
audioRecording.isPlaying = false // if arrayIndex == index {
} // audioRecording.isPlaying = true
} // } else {
// audioRecording.isPlaying = false
// }
// }
tblresult.reloadData() tblresult.reloadData()
} }
......
...@@ -108,14 +108,16 @@ extension InvalidServicesViewController: UITableViewDelegate, UITableViewDataSou ...@@ -108,14 +108,16 @@ extension InvalidServicesViewController: UITableViewDelegate, UITableViewDataSou
let selectedService = service.services[indexPath.row] let selectedService = service.services[indexPath.row]
if selectedService.serviceType == .BOOKING { if selectedService.typeId == "booking"{
// if selectedService.serviceType == .BOOKING {
let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self) let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self)
appointmentdetails.orderStatus = .CLOSED appointmentdetails.orderStatus = .CLOSED
// appointmentdetails.serviceStatus = .completed // appointmentdetails.serviceStatus = .completed
appointmentdetails.incrementId = selectedService.incrementId appointmentdetails.incrementId = selectedService.incrementId
appointmentdetails.orderId = selectedService.orderId appointmentdetails.orderId = selectedService.orderId
self.navigationController?.pushViewController(appointmentdetails, animated: true) self.navigationController?.pushViewController(appointmentdetails, animated: true)
} else if selectedService.serviceType == .FAQ { } else if selectedService.typeId == "faq" {
// } else if selectedService.serviceType == .FAQ {
if selectedService.status == .PROCESSING { if selectedService.status == .PROCESSING {
let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self) let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self)
...@@ -130,8 +132,8 @@ extension InvalidServicesViewController: UITableViewDelegate, UITableViewDataSou ...@@ -130,8 +132,8 @@ extension InvalidServicesViewController: UITableViewDelegate, UITableViewDataSou
enquiryDetailsViewController.orderId = selectedService.orderId! enquiryDetailsViewController.orderId = selectedService.orderId!
self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true) self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true)
} }
} else if selectedService.typeId == "forms"{
} else if selectedService.serviceType == .FORM{ // } else if selectedService.serviceType == .FORM{
if let form = Form.VC(with: selectedService.incrementId!, orderId: selectedService.orderId!, categoryType: selectedService.categoryType){ if let form = Form.VC(with: selectedService.incrementId!, orderId: selectedService.orderId!, categoryType: selectedService.categoryType){
self.navigationController?.pushViewController(form, animated: true) self.navigationController?.pushViewController(form, animated: true)
} }
......
...@@ -107,8 +107,8 @@ extension OnGoingServicesViewController: UITableViewDelegate, UITableViewDataSou ...@@ -107,8 +107,8 @@ extension OnGoingServicesViewController: UITableViewDelegate, UITableViewDataSou
let selectedService = service.services[indexPath.row] let selectedService = service.services[indexPath.row]
if selectedService.typeId! == "booking" {
if selectedService.serviceType == .BOOKING { // if selectedService.serviceType == .BOOKING {
if selectedService.status == .SERVICE_ONGOING { if selectedService.status == .SERVICE_ONGOING {
let videoCallVC = Utils.viewController(storyboardName: "Appointment", ofType: VideoCallingViewController.self) let videoCallVC = Utils.viewController(storyboardName: "Appointment", ofType: VideoCallingViewController.self)
videoCallVC.orderId = selectedService.orderId! videoCallVC.orderId = selectedService.orderId!
...@@ -120,7 +120,8 @@ extension OnGoingServicesViewController: UITableViewDelegate, UITableViewDataSou ...@@ -120,7 +120,8 @@ extension OnGoingServicesViewController: UITableViewDelegate, UITableViewDataSou
// appointmentdetails.incrementId = selectedService.incrementId // appointmentdetails.incrementId = selectedService.incrementId
// appointmentdetails.orderId = selectedService.orderId // appointmentdetails.orderId = selectedService.orderId
// self.navigationController?.pushViewController(appointmentdetails, animated: true) // self.navigationController?.pushViewController(appointmentdetails, animated: true)
} else if selectedService.serviceType == .FAQ { } else if selectedService.typeId == "faq" {
// } else if selectedService.serviceType == .FAQ {
if selectedService.status == .PROCESSING { if selectedService.status == .PROCESSING {
let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self) let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self)
...@@ -135,8 +136,8 @@ extension OnGoingServicesViewController: UITableViewDelegate, UITableViewDataSou ...@@ -135,8 +136,8 @@ extension OnGoingServicesViewController: UITableViewDelegate, UITableViewDataSou
enquiryDetailsViewController.orderId = selectedService.orderId! enquiryDetailsViewController.orderId = selectedService.orderId!
self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true) self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true)
} }
} else if selectedService.typeId == "forms"{
} else if selectedService.serviceType == .FORM{ // } else if selectedService.serviceType == .FORM{
if let form = Form.VC(with: selectedService.incrementId!, orderId: selectedService.orderId!, categoryType: selectedService.categoryType) { if let form = Form.VC(with: selectedService.incrementId!, orderId: selectedService.orderId!, categoryType: selectedService.categoryType) {
self.navigationController?.pushViewController(form, animated: true) self.navigationController?.pushViewController(form, animated: true)
......
...@@ -107,15 +107,16 @@ extension ProcessingViewController: UITableViewDelegate, UITableViewDataSource { ...@@ -107,15 +107,16 @@ extension ProcessingViewController: UITableViewDelegate, UITableViewDataSource {
let selectedService = service.services[indexPath.row] let selectedService = service.services[indexPath.row]
if selectedService.typeId == "booking"{
if selectedService.serviceType == .BOOKING { // if selectedService.serviceType == .BOOKING {
let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self) let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self)
appointmentdetails.orderStatus = .PROCESSING appointmentdetails.orderStatus = .PROCESSING
// appointmentdetails.serviceStatus = .tbc // appointmentdetails.serviceStatus = .tbc
appointmentdetails.incrementId = selectedService.incrementId appointmentdetails.incrementId = selectedService.incrementId
appointmentdetails.orderId = selectedService.orderId appointmentdetails.orderId = selectedService.orderId
self.navigationController?.pushViewController(appointmentdetails, animated: true) self.navigationController?.pushViewController(appointmentdetails, animated: true)
} else if selectedService.serviceType == .FAQ { } else if selectedService.typeId == "faq"{
// } else if selectedService.serviceType == .FAQ {
if selectedService.status == .PROCESSING { if selectedService.status == .PROCESSING {
let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self) let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self)
...@@ -130,8 +131,8 @@ extension ProcessingViewController: UITableViewDelegate, UITableViewDataSource { ...@@ -130,8 +131,8 @@ extension ProcessingViewController: UITableViewDelegate, UITableViewDataSource {
enquiryDetailsViewController.orderId = selectedService.orderId! enquiryDetailsViewController.orderId = selectedService.orderId!
self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true) self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true)
} }
} else if selectedService.typeId == "forms"{
} else if selectedService.serviceType == .FORM{ // } else if selectedService.serviceType == .FORM{
if let form = Form.VC(with: selectedService.incrementId!, orderId: selectedService.orderId!, categoryType: selectedService.categoryType) { if let form = Form.VC(with: selectedService.incrementId!, orderId: selectedService.orderId!, categoryType: selectedService.categoryType) {
self.navigationController?.pushViewController(form, animated: true) self.navigationController?.pushViewController(form, animated: true)
......
...@@ -425,15 +425,16 @@ extension MasterReplyCell: UITableViewDelegate, UITableViewDataSource, ResultAud ...@@ -425,15 +425,16 @@ extension MasterReplyCell: UITableViewDelegate, UITableViewDataSource, ResultAud
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let audioCell = tableView.dequeueReusableCell(withIdentifier: "ResultAudioCell", for: indexPath) as! ResultAudioCell let audioCell = tableView.dequeueReusableCell(withIdentifier: "ResultAudioCell", for: indexPath) as! ResultAudioCell
audioCell.audioPath = arrayOfAudios[indexPath.row] audioCell.audioPath = arrayOfAudios[indexPath.row]
audioCell.cellIndex = indexPath.row
audioCell.delegate = self audioCell.delegate = self
audioCell.btnPlay.tag = 0 audioCell.btnPlay.tag = indexPath.row
audioCell.audioSlider.value = 0
if indexPath.row == playingAudioAtIndex { if indexPath.row == playingAudioAtIndex {
audioCell.btnPlay.setBackgroundImage(UIImage(named: "pause"), for: .normal) audioCell.btnPlay.setBackgroundImage(UIImage(named: "pause"), for: .normal)
audioCell.btnPlay.tag = 8080 audioCell.isPlayingAudio = true
} else { } else {
audioCell.btnPlay.setBackgroundImage(UIImage(named: "play"), for: .normal) audioCell.btnPlay.setBackgroundImage(UIImage(named: "play"), for: .normal)
audioCell.isPlayingAudio = false
} }
return audioCell return audioCell
} }
...@@ -456,16 +457,16 @@ protocol ResultAudioCellDelegate { ...@@ -456,16 +457,16 @@ protocol ResultAudioCellDelegate {
class ResultAudioCell: UITableViewCell { class ResultAudioCell: UITableViewCell {
@IBOutlet var btnPlay: UIButton! @IBOutlet var btnPlay: UIButton!
@IBOutlet var audioSlider: UISlider!
var audioPath: String? var audioPath: String?
var delegate: ResultAudioCellDelegate? var delegate: ResultAudioCellDelegate?
var cellIndex = 0 var cellIndex = 0
var isPlayingAudio = false
@IBAction func play() { @IBAction func play() {
print("tag = \(btnPlay.tag)")
if btnPlay.tag == 8080 { if isPlayingAudio == true {
Audio.pause() Audio.pause()
btnPlay.tag = 0 btnPlay.tag = 0
delegate?.playingAudioAtIndex(index: 1000) delegate?.playingAudioAtIndex(index: 1000)
...@@ -473,14 +474,15 @@ class ResultAudioCell: UITableViewCell { ...@@ -473,14 +474,15 @@ class ResultAudioCell: UITableViewCell {
} }
if let audioPath = audioPath { if let audioPath = audioPath {
delegate?.playingAudioAtIndex(index: btnPlay.tag)
Audio.playAudio(audioPath: audioPath, success: { Audio.playAudio(audioPath: audioPath, success: {
}, failure: { (errorMesaage) in }, failure: { (errorMesaage) in
self.viewController()?.view.showToast(errorMesaage, position: .bottom, popTime: 2.0, dismissOnTap: false) self.viewController()?.view.showToast(errorMesaage, position: .bottom, popTime: 2.0, dismissOnTap: false)
}) { (progress, duration) in }) { (progress, duration) in
print("progress = \(progress) duration = \(duration)") self.audioSlider.maximumValue = duration
self.audioSlider.value = progress
} }
} else { } else {
......
...@@ -145,7 +145,8 @@ extension HomePageViewController: UITableViewDelegate, UITableViewDataSource { ...@@ -145,7 +145,8 @@ extension HomePageViewController: UITableViewDelegate, UITableViewDataSource {
let order = dashboard.orders[indexPath.row-1] let order = dashboard.orders[indexPath.row-1]
if order.products.first?.serviceType == .BOOKING { if order.products.first?.typeId == "booking" {
// if order.products.first?.serviceType == .BOOKING {
if order.status == .SERVICE_ONGOING { if order.status == .SERVICE_ONGOING {
let videoCallVC = Utils.viewController(storyboardName: "Appointment", ofType: VideoCallingViewController.self) let videoCallVC = Utils.viewController(storyboardName: "Appointment", ofType: VideoCallingViewController.self)
...@@ -159,7 +160,8 @@ extension HomePageViewController: UITableViewDelegate, UITableViewDataSource { ...@@ -159,7 +160,8 @@ extension HomePageViewController: UITableViewDelegate, UITableViewDataSource {
self.navigationController?.pushViewController(appointmentdetails, animated: true) self.navigationController?.pushViewController(appointmentdetails, animated: true)
} }
} else if order.products.first?.serviceType == .FAQ { } else if order.products.first?.typeId == "faq" {
// } else if order.products.first?.serviceType == .FAQ {
if order.status == .PROCESSING { if order.status == .PROCESSING {
let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self) let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self)
...@@ -178,7 +180,8 @@ extension HomePageViewController: UITableViewDelegate, UITableViewDataSource { ...@@ -178,7 +180,8 @@ extension HomePageViewController: UITableViewDelegate, UITableViewDataSource {
self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true) self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true)
} }
} else if order.products.first?.serviceType == .FORM{ } else if order.products.first?.typeId == "forms" {
// } else if order.products.first?.serviceType == .FORM{
if order.status == .COMPLETE { if order.status == .COMPLETE {
......
...@@ -32,6 +32,7 @@ class OnlineEnquiryViewController: BaseViewController { ...@@ -32,6 +32,7 @@ class OnlineEnquiryViewController: BaseViewController {
var customerId: String? var customerId: String?
var chatCountId = "" var chatCountId = ""
var recordingPermissionGranted = false var recordingPermissionGranted = false
var playAudioAtIndex: Int64 = 10000
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -277,11 +278,27 @@ extension OnlineEnquiryViewController: UITableViewDelegate, UITableViewDataSourc ...@@ -277,11 +278,27 @@ extension OnlineEnquiryViewController: UITableViewDelegate, UITableViewDataSourc
if chat.name == "Seller" { if chat.name == "Seller" {
let masterAudioCell = tableView.dequeueReusableCell(withIdentifier: "masterAudio") as! OnlineEnquiryMasterAudioCell let masterAudioCell = tableView.dequeueReusableCell(withIdentifier: "masterAudio") as! OnlineEnquiryMasterAudioCell
masterAudioCell.audioPath = chat.msg masterAudioCell.audioPath = chat.msg
masterAudioCell.delegate = self
masterAudioCell.btnPlay.tag = indexPath.row
masterAudioCell.progressSlider.value = 0.0
if playAudioAtIndex == indexPath.row {
masterAudioCell.btnPlay.setBackgroundImage(UIImage(named: "pause"), for: .normal)
} else {
masterAudioCell.btnPlay.setBackgroundImage(UIImage(named: "play"), for: .normal)
}
return masterAudioCell return masterAudioCell
} else { } else {
let customerAudioCell = tableView.dequeueReusableCell(withIdentifier: "customerAudio") as! OnlineEnquiryCustomerAudioCell let customerAudioCell = tableView.dequeueReusableCell(withIdentifier: "customerAudio") as! OnlineEnquiryCustomerAudioCell
customerAudioCell.audioPath = chat.msg customerAudioCell.audioPath = chat.msg
customerAudioCell.customerProfileImage = customerProfileImage customerAudioCell.customerProfileImage = customerProfileImage
customerAudioCell.delegate = self
customerAudioCell.btnPlay.tag = indexPath.row
customerAudioCell.progressSlider.value = 0.0
if playAudioAtIndex == indexPath.row {
customerAudioCell.btnPlay.setBackgroundImage(UIImage(named: "pause"), for: .normal)
} else {
customerAudioCell.btnPlay.setBackgroundImage(UIImage(named: "play"), for: .normal)
}
return customerAudioCell return customerAudioCell
} }
} }
...@@ -290,6 +307,12 @@ extension OnlineEnquiryViewController: UITableViewDelegate, UITableViewDataSourc ...@@ -290,6 +307,12 @@ extension OnlineEnquiryViewController: UITableViewDelegate, UITableViewDataSourc
} }
} }
extension OnlineEnquiryViewController: OnlineEnquiryMasterAudioCellDelegate, OnlineEnquiryCustomerAudioCellDelegate {
func playPausTapped(atIndex: Int64) {
playAudioAtIndex = atIndex
self.tblChat.reloadData()
}
}
extension OnlineEnquiryViewController: UITextViewDelegate { extension OnlineEnquiryViewController: UITextViewDelegate {
...@@ -352,16 +375,24 @@ class OnlineEnquiryCustomerCell: UITableViewCell { ...@@ -352,16 +375,24 @@ class OnlineEnquiryCustomerCell: UITableViewCell {
} }
} }
protocol OnlineEnquiryMasterAudioCellDelegate {
func playPausTapped(atIndex: Int64)
}
class OnlineEnquiryMasterAudioCell: UITableViewCell { class OnlineEnquiryMasterAudioCell: UITableViewCell {
@IBOutlet var btnPlay: UIButton! @IBOutlet var btnPlay: UIButton!
var audioPath: String?
@IBOutlet var imgMaster: UIImageView! @IBOutlet var imgMaster: UIImageView!
@IBOutlet var progressSlider: UISlider! @IBOutlet var progressSlider: UISlider!
var audioPath: String?
var delegate: OnlineEnquiryMasterAudioCellDelegate?
var isAudioPlaying = false
@IBAction func play() { @IBAction func play() {
delegate?.playPausTapped(atIndex: Int64(btnPlay!.tag))
if let audioPath = audioPath { if let audioPath = audioPath {
Audio.playAudio(audioPath: audioPath, success: { Audio.playAudio(audioPath: audioPath, success: {
...@@ -389,16 +420,24 @@ class OnlineEnquiryMasterAudioCell: UITableViewCell { ...@@ -389,16 +420,24 @@ class OnlineEnquiryMasterAudioCell: UITableViewCell {
} }
protocol OnlineEnquiryCustomerAudioCellDelegate {
func playPausTapped(atIndex: Int64)
}
class OnlineEnquiryCustomerAudioCell: UITableViewCell { class OnlineEnquiryCustomerAudioCell: UITableViewCell {
@IBOutlet var btnPlay: UIButton! @IBOutlet var btnPlay: UIButton!
var audioPath: String?
var customerProfileImage: String?
@IBOutlet var imgCostomer: UIImageView! @IBOutlet var imgCostomer: UIImageView!
@IBOutlet var progressSlider: UISlider! @IBOutlet var progressSlider: UISlider!
var audioPath: String?
var customerProfileImage: String?
var delegate: OnlineEnquiryCustomerAudioCellDelegate?
@IBAction func play() { @IBAction func play() {
delegate?.playPausTapped(atIndex: Int64(btnPlay!.tag))
if let audioPath = audioPath { if let audioPath = audioPath {
Audio.playAudio(audioPath: audioPath, success: { Audio.playAudio(audioPath: audioPath, success: {
......
...@@ -123,8 +123,8 @@ extension MyAllServiceOrderViewController: UITableViewDelegate, UITableViewDataS ...@@ -123,8 +123,8 @@ extension MyAllServiceOrderViewController: UITableViewDelegate, UITableViewDataS
let selectedService = service.services[indexPath.row] let selectedService = service.services[indexPath.row]
if selectedService.typeId == "booking" {
if selectedService.serviceType == .BOOKING { // if selectedService.serviceType == .BOOKING {
let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self) let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self)
switch service.services[indexPath.row].status { switch service.services[indexPath.row].status {
case .CANCELED: case .CANCELED:
...@@ -151,7 +151,8 @@ extension MyAllServiceOrderViewController: UITableViewDelegate, UITableViewDataS ...@@ -151,7 +151,8 @@ extension MyAllServiceOrderViewController: UITableViewDelegate, UITableViewDataS
appointmentdetails.incrementId = selectedService.incrementId appointmentdetails.incrementId = selectedService.incrementId
appointmentdetails.orderId = selectedService.orderId appointmentdetails.orderId = selectedService.orderId
self.navigationController?.pushViewController(appointmentdetails, animated: true) self.navigationController?.pushViewController(appointmentdetails, animated: true)
} else if selectedService.serviceType == .FAQ { } else if selectedService.typeId == "faq" {
// } else if selectedService.serviceType == .FAQ {
if selectedService.status == .PROCESSING { if selectedService.status == .PROCESSING {
let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self) let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self)
...@@ -170,8 +171,8 @@ extension MyAllServiceOrderViewController: UITableViewDelegate, UITableViewDataS ...@@ -170,8 +171,8 @@ extension MyAllServiceOrderViewController: UITableViewDelegate, UITableViewDataS
enquiryDetailsViewController.customerName = service.services[indexPath.row].customerName enquiryDetailsViewController.customerName = service.services[indexPath.row].customerName
self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true) self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true)
} }
} else if selectedService.typeId == "form" {
} else if selectedService.serviceType == .FORM{ // } else if selectedService.serviceType == .FORM{
if selectedService.status == .COMPLETE { if selectedService.status == .COMPLETE {
let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self) let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self)
......
...@@ -101,14 +101,15 @@ extension MyCompletedOrdersViewController: UITableViewDelegate, UITableViewDataS ...@@ -101,14 +101,15 @@ extension MyCompletedOrdersViewController: UITableViewDelegate, UITableViewDataS
let selectedService = service.services[indexPath.row] let selectedService = service.services[indexPath.row]
if selectedService.typeId == "booking" {
if selectedService.serviceType == .BOOKING { // if selectedService.serviceType == .BOOKING {
let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self) let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self)
appointmentdetails.serviceStatus = .completed appointmentdetails.serviceStatus = .completed
appointmentdetails.incrementId = selectedService.incrementId appointmentdetails.incrementId = selectedService.incrementId
appointmentdetails.orderId = selectedService.orderId appointmentdetails.orderId = selectedService.orderId
self.navigationController?.pushViewController(appointmentdetails, animated: true) self.navigationController?.pushViewController(appointmentdetails, animated: true)
} else if selectedService.serviceType == .FAQ { } else if selectedService.typeId == "faq" {
// } else if selectedService.serviceType == .FAQ {
if selectedService.status == .PROCESSING { if selectedService.status == .PROCESSING {
let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self) let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self)
...@@ -126,7 +127,8 @@ extension MyCompletedOrdersViewController: UITableViewDelegate, UITableViewDataS ...@@ -126,7 +127,8 @@ extension MyCompletedOrdersViewController: UITableViewDelegate, UITableViewDataS
self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true) self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true)
} }
} else if selectedService.serviceType == .FORM{ } else if selectedService.typeId == "forms" {
// } else if selectedService.serviceType == .FORM{
let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self) let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self)
appointmentdetails.incrementId = selectedService.incrementId appointmentdetails.incrementId = selectedService.incrementId
......
...@@ -102,7 +102,8 @@ extension MyOngoingServiceOrderViewController: UITableViewDelegate, UITableViewD ...@@ -102,7 +102,8 @@ extension MyOngoingServiceOrderViewController: UITableViewDelegate, UITableViewD
let selectedService = service.services[indexPath.row] let selectedService = service.services[indexPath.row]
if selectedService.serviceType == .BOOKING { if selectedService.typeId == "booking" {
// if selectedService.serviceType == .BOOKING {
if selectedService.status == .SERVICE_ONGOING { if selectedService.status == .SERVICE_ONGOING {
let videoCallVC = Utils.viewController(storyboardName: "Appointment", ofType: VideoCallingViewController.self) let videoCallVC = Utils.viewController(storyboardName: "Appointment", ofType: VideoCallingViewController.self)
...@@ -115,7 +116,8 @@ extension MyOngoingServiceOrderViewController: UITableViewDelegate, UITableViewD ...@@ -115,7 +116,8 @@ extension MyOngoingServiceOrderViewController: UITableViewDelegate, UITableViewD
// appointmentdetails.incrementId = selectedService.incrementId // appointmentdetails.incrementId = selectedService.incrementId
// appointmentdetails.orderId = selectedService.orderId // appointmentdetails.orderId = selectedService.orderId
// self.navigationController?.pushViewController(appointmentdetails, animated: true) // self.navigationController?.pushViewController(appointmentdetails, animated: true)
} else if selectedService.serviceType == .FAQ { } else if selectedService.typeId == "faq" {
// } else if selectedService.serviceType == .FAQ {
if selectedService.status == .PROCESSING { if selectedService.status == .PROCESSING {
let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self) let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self)
...@@ -131,7 +133,8 @@ extension MyOngoingServiceOrderViewController: UITableViewDelegate, UITableViewD ...@@ -131,7 +133,8 @@ extension MyOngoingServiceOrderViewController: UITableViewDelegate, UITableViewD
self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true) self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true)
} }
} else if selectedService.serviceType == .FORM{ } else if selectedService.typeId == "forms" {
// } else if selectedService.serviceType == .FORM{
if let form = Form.VC(with: selectedService.incrementId!, orderId: selectedService.orderId!, categoryType: selectedService.categoryType){ if let form = Form.VC(with: selectedService.incrementId!, orderId: selectedService.orderId!, categoryType: selectedService.categoryType){
self.navigationController?.pushViewController(form, animated: true) self.navigationController?.pushViewController(form, animated: true)
......
...@@ -102,13 +102,15 @@ extension MyUploadResultViewController: UITableViewDelegate, UITableViewDataSour ...@@ -102,13 +102,15 @@ extension MyUploadResultViewController: UITableViewDelegate, UITableViewDataSour
let selectedService = service.services[indexPath.row] let selectedService = service.services[indexPath.row]
if selectedService.serviceType == .BOOKING { if selectedService.typeId == "booking" {
// if selectedService.serviceType == .BOOKING {
let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self) let appointmentdetails = Utils.viewController(storyboardName: "Appointment", ofType: ServiceDetailViewController.self)
appointmentdetails.serviceStatus = .tbc appointmentdetails.serviceStatus = .tbc
appointmentdetails.incrementId = selectedService.incrementId appointmentdetails.incrementId = selectedService.incrementId
appointmentdetails.orderId = selectedService.orderId appointmentdetails.orderId = selectedService.orderId
self.navigationController?.pushViewController(appointmentdetails, animated: true) self.navigationController?.pushViewController(appointmentdetails, animated: true)
} else if selectedService.serviceType == .FAQ { } else if selectedService.typeId == "faq" {
// } else if selectedService.serviceType == .FAQ {
if selectedService.status == .PROCESSING { if selectedService.status == .PROCESSING {
let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self) let chatViewController = Utils.viewController(storyboardName: "Home", ofType: OnlineEnquiryViewController.self)
...@@ -124,7 +126,8 @@ extension MyUploadResultViewController: UITableViewDelegate, UITableViewDataSour ...@@ -124,7 +126,8 @@ extension MyUploadResultViewController: UITableViewDelegate, UITableViewDataSour
self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true) self.navigationController?.pushViewController(enquiryDetailsViewController, animated: true)
} }
} else if selectedService.serviceType == .FORM{ } else if selectedService.typeId == "forms" {
// } else if selectedService.serviceType == .FORM{
if let form = Form.VC(with: selectedService.incrementId!, orderId: selectedService.orderId!, categoryType: selectedService.categoryType) { if let form = Form.VC(with: selectedService.incrementId!, orderId: selectedService.orderId!, categoryType: selectedService.categoryType) {
self.navigationController?.pushViewController(form, animated: true) self.navigationController?.pushViewController(form, animated: true)
......
...@@ -23,6 +23,9 @@ class EditResult { ...@@ -23,6 +23,9 @@ class EditResult {
func updateResult(for orderId: String, success: @escaping () -> Void, failure: @escaping (_ errorMesage: String) -> Void) { func updateResult(for orderId: String, success: @escaping () -> Void, failure: @escaping (_ errorMesage: String) -> Void) {
print(self.images.count)
print(self.audios.count)
self.uploadAudios(index: 0) { self.uploadAudios(index: 0) {
self.uploadImages(index: 0) { self.uploadImages(index: 0) {
...@@ -30,6 +33,13 @@ class EditResult { ...@@ -30,6 +33,13 @@ class EditResult {
self.uploadedProducts = self.uploadedProducts + "," + product.entityId! self.uploadedProducts = self.uploadedProducts + "," + product.entityId!
} }
if self.uploadedImages.count > 0 {
self.uploadedImages.removeFirst()
}
if self.uploadedAudios.count > 0 {
self.uploadedAudios.removeFirst()
}
let parameters: [String: Any] = ["storeId": UserDefaults.standard.value(forKey: "storeId") as! String, let parameters: [String: Any] = ["storeId": UserDefaults.standard.value(forKey: "storeId") as! String,
"orderId": orderId, "orderId": orderId,
"reply_text": self.message, "reply_text": self.message,
...@@ -38,7 +48,6 @@ class EditResult { ...@@ -38,7 +48,6 @@ class EditResult {
"products": self.uploadedProducts "products": self.uploadedProducts
] ]
SVProgressHUD.show() SVProgressHUD.show()
let headers = [ let headers = [
...@@ -184,7 +193,6 @@ class EditResult { ...@@ -184,7 +193,6 @@ class EditResult {
} }
} }
} }
} }
} }
......
...@@ -54,67 +54,70 @@ class Product { ...@@ -54,67 +54,70 @@ class Product {
var qty: Int = 0 var qty: Int = 0
var serviceType = ServiceType.UNKNOWN var serviceType = ServiceType.UNKNOWN
var categoryType = CategoryType.Unknown var categoryType = CategoryType.Unknown
var typeId: String?
func initWithJSON(json: Any) { func initWithJSON(json: Any) {
if let response = json as? [String: Any] { if let response = json as? [String: Any] {
self.productId = response["productId"] as? String self.productId = response["productId"] as? String
self.name = response["name"] as? String self.name = response["name"] as? String
self.qty = response["qty"] as! Int self.qty = response["qty"] as! Int
self.typeId = response["typeId"] as? String
if let categoryType_ = response["category_type"] as? String { // if let categoryType_ = response["category_type"] as? String {
self.categoryType = CategoryType(rawValue: categoryType_)! // self.categoryType = CategoryType(rawValue: categoryType_)!
//
switch self.categoryType { // switch self.categoryType {
case .OnlineFAQ: // case .OnlineFAQ:
self.serviceType = .FAQ // self.serviceType = .FAQ
//
case .FortuneOfTheYear: // case .FortuneOfTheYear:
fallthrough // fallthrough
case .VideoFortuneTelling: // case .VideoFortuneTelling:
fallthrough // fallthrough
case .OnlineFaceReading: // case .OnlineFaceReading:
self.serviceType = .BOOKING // self.serviceType = .BOOKING
//
//
case .IndividualNamingServiceNamed: // case .IndividualNamingServiceNamed:
fallthrough // fallthrough
case .IndividualNamingServiceReNamedChangeName: // case .IndividualNamingServiceReNamedChangeName:
fallthrough // fallthrough
case .CompanyNamingServiceNamed: // case .CompanyNamingServiceNamed:
fallthrough // fallthrough
case .CompanyNamingServiceReNamedChangeName: // case .CompanyNamingServiceReNamedChangeName:
fallthrough // fallthrough
case .FloorPlanFengShuiGeomancy: // case .FloorPlanFengShuiGeomancy:
fallthrough // fallthrough
case .FloorPlanFengShuiCorporateFengShui: // case .FloorPlanFengShuiCorporateFengShui:
fallthrough // fallthrough
case .OnsiteServiceGeomancy: // case .OnsiteServiceGeomancy:
fallthrough // fallthrough
case .OnsiteServiceCorporateFengShui: // case .OnsiteServiceCorporateFengShui:
fallthrough // fallthrough
case .Groundbreaking: // case .Groundbreaking:
fallthrough // fallthrough
case .Registration: // case .Registration:
fallthrough // fallthrough
case .MovingHouse: // case .MovingHouse:
fallthrough // fallthrough
case .MovingCompany: // case .MovingCompany:
fallthrough // fallthrough
case .StartOpeningBusiness: // case .StartOpeningBusiness:
fallthrough // fallthrough
case .Marriage: // case .Marriage:
fallthrough // fallthrough
case .GODSetting: // case .GODSetting:
fallthrough // fallthrough
case .BedSetting: // case .BedSetting:
self.serviceType = .FORM // self.serviceType = .FORM
//
case .MoreServices: // case .MoreServices:
self.serviceType = .MORE // self.serviceType = .MORE
case .Unknown: // case .Unknown:
self.serviceType = .UNKNOWN // self.serviceType = .UNKNOWN
} // }
} // }
} }
} }
......
...@@ -40,6 +40,8 @@ class Service { ...@@ -40,6 +40,8 @@ class Service {
var serviceType = ServiceType.UNKNOWN var serviceType = ServiceType.UNKNOWN
var categoryType = CategoryType.Unknown var categoryType = CategoryType.Unknown
var typeId: String?
var currentPage = 1 var currentPage = 1
var maxPageNo = 0 var maxPageNo = 0
var isBooking = false var isBooking = false
...@@ -48,8 +50,6 @@ class Service { ...@@ -48,8 +50,6 @@ class Service {
func initWithJSON(json: [String: Any]) { func initWithJSON(json: [String: Any]) {
print(json)
if let status = json["status"] as? String { if let status = json["status"] as? String {
self.status = MyServiceStatus(rawValue: status)! self.status = MyServiceStatus(rawValue: status)!
} }
...@@ -62,60 +62,61 @@ class Service { ...@@ -62,60 +62,61 @@ class Service {
self.productName = productInfo["name"] as? String self.productName = productInfo["name"] as? String
self.productId = productInfo["productId"] as? String self.productId = productInfo["productId"] as? String
self.customerId = productInfo["customer_id"] as? String self.customerId = productInfo["customer_id"] as? String
self.typeId = productInfo["typeId"] as? String
if let categoryType_ = productInfo["category_type"] as? String { // if let categoryType_ = productInfo["category_type"] as? String {
self.categoryType = CategoryType(rawValue: categoryType_)! // self.categoryType = CategoryType(rawValue: categoryType_)!
//
switch self.categoryType { // switch self.categoryType {
case .OnlineFAQ: // case .OnlineFAQ:
self.serviceType = .FAQ // self.serviceType = .FAQ
//
case .FortuneOfTheYear: // case .FortuneOfTheYear:
fallthrough // fallthrough
case .VideoFortuneTelling: // case .VideoFortuneTelling:
fallthrough // fallthrough
case .OnlineFaceReading: // case .OnlineFaceReading:
self.serviceType = .BOOKING // self.serviceType = .BOOKING
//
case .IndividualNamingServiceNamed: // case .IndividualNamingServiceNamed:
fallthrough // fallthrough
case .IndividualNamingServiceReNamedChangeName: // case .IndividualNamingServiceReNamedChangeName:
fallthrough // fallthrough
case .CompanyNamingServiceNamed: // case .CompanyNamingServiceNamed:
fallthrough // fallthrough
case .CompanyNamingServiceReNamedChangeName: // case .CompanyNamingServiceReNamedChangeName:
fallthrough // fallthrough
case .FloorPlanFengShuiGeomancy: // case .FloorPlanFengShuiGeomancy:
fallthrough // fallthrough
case .FloorPlanFengShuiCorporateFengShui: // case .FloorPlanFengShuiCorporateFengShui:
fallthrough // fallthrough
case .OnsiteServiceGeomancy: // case .OnsiteServiceGeomancy:
fallthrough // fallthrough
case .OnsiteServiceCorporateFengShui: // case .OnsiteServiceCorporateFengShui:
fallthrough // fallthrough
case .Groundbreaking: // case .Groundbreaking:
fallthrough // fallthrough
case .Registration: // case .Registration:
fallthrough // fallthrough
case .MovingHouse: // case .MovingHouse:
fallthrough // fallthrough
case .MovingCompany: // case .MovingCompany:
fallthrough // fallthrough
case .StartOpeningBusiness: // case .StartOpeningBusiness:
fallthrough // fallthrough
case .Marriage: // case .Marriage:
fallthrough // fallthrough
case .GODSetting: // case .GODSetting:
fallthrough // fallthrough
case .BedSetting: // case .BedSetting:
self.serviceType = .FORM // self.serviceType = .FORM
//
case .MoreServices: // case .MoreServices:
self.serviceType = .MORE // self.serviceType = .MORE
case .Unknown: // case .Unknown:
self.serviceType = .UNKNOWN // self.serviceType = .UNKNOWN
} // }
} // }
} }
} }
......
...@@ -16,6 +16,7 @@ class Audio { ...@@ -16,6 +16,7 @@ class Audio {
var audioPlayer: AVPlayer? var audioPlayer: AVPlayer?
var audioPlayerForLocalFile: AVAudioPlayer? var audioPlayerForLocalFile: AVAudioPlayer?
var currentRecordingPath: String? var currentRecordingPath: String?
var timer: Timer?
static let shared = Audio() static let shared = Audio()
var Timestamp: String { var Timestamp: String {
...@@ -64,7 +65,6 @@ class Audio { ...@@ -64,7 +65,6 @@ class Audio {
// class func playAudio(audioPath: String, success:() -> Void, failure: (_ message: String) -> Void) { // class func playAudio(audioPath: String, success:() -> Void, failure: (_ message: String) -> Void) {
if audioPath.first == "/" { // local file path if audioPath.first == "/" { // local file path
let audioURL = URL(fileURLWithPath: audioPath) let audioURL = URL(fileURLWithPath: audioPath)
do { do {
...@@ -74,6 +74,21 @@ class Audio { ...@@ -74,6 +74,21 @@ class Audio {
try Audio.shared.audioPlayerForLocalFile = AVAudioPlayer(contentsOf: audioURL) try Audio.shared.audioPlayerForLocalFile = AVAudioPlayer(contentsOf: audioURL)
Audio.shared.audioPlayerForLocalFile!.prepareToPlay() Audio.shared.audioPlayerForLocalFile!.prepareToPlay()
Audio.shared.audioPlayerForLocalFile!.play() Audio.shared.audioPlayerForLocalFile!.play()
Audio.shared.timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { (timer) in
let currentTime = Float(Audio.shared.audioPlayerForLocalFile!.currentTime)
let duration = Float(Audio.shared.audioPlayerForLocalFile!.duration)
progress(Float(currentTime), Float(duration.isNaN == true ? 0.0 : duration))
if Audio.shared.audioPlayerForLocalFile?.isPlaying == true {
progress(Float(currentTime), Float(duration.isNaN == true ? 0.0 : duration))
} else {
progress(1000.0, 1000.0)
Audio.shared.timer?.invalidate()
}
}
success() success()
} catch { } catch {
failure(error.localizedDescription) failure(error.localizedDescription)
...@@ -112,6 +127,7 @@ class Audio { ...@@ -112,6 +127,7 @@ class Audio {
if Audio.shared.audioPlayer != nil { if Audio.shared.audioPlayer != nil {
Audio.shared.audioPlayer!.pause() Audio.shared.audioPlayer!.pause()
Audio.shared.audioPlayerForLocalFile?.pause() Audio.shared.audioPlayerForLocalFile?.pause()
Audio.shared.timer?.invalidate()
} }
} }
......
...@@ -1626,7 +1626,7 @@ ...@@ -1626,7 +1626,7 @@
<constraint firstAttribute="height" constant="45" id="XbZ-vL-zoL"/> <constraint firstAttribute="height" constant="45" id="XbZ-vL-zoL"/>
<constraint firstAttribute="width" constant="45" id="Z29-nc-MV1"/> <constraint firstAttribute="width" constant="45" id="Z29-nc-MV1"/>
</constraints> </constraints>
<state key="normal" image="play"/> <state key="normal" backgroundImage="play"/>
<connections> <connections>
<action selector="play" destination="vtw-sw-ByE" eventType="touchUpInside" id="1bv-0J-FCh"/> <action selector="play" destination="vtw-sw-ByE" eventType="touchUpInside" id="1bv-0J-FCh"/>
</connections> </connections>
...@@ -1683,7 +1683,7 @@ ...@@ -1683,7 +1683,7 @@
<constraint firstAttribute="width" constant="45" id="79P-yY-OHu"/> <constraint firstAttribute="width" constant="45" id="79P-yY-OHu"/>
<constraint firstAttribute="height" constant="45" id="kNY-xT-qzo"/> <constraint firstAttribute="height" constant="45" id="kNY-xT-qzo"/>
</constraints> </constraints>
<state key="normal" image="play"/> <state key="normal" backgroundImage="play"/>
<connections> <connections>
<action selector="play" destination="LQQ-dP-WjW" eventType="touchUpInside" id="REZ-mg-ckA"/> <action selector="play" destination="LQQ-dP-WjW" eventType="touchUpInside" id="REZ-mg-ckA"/>
</connections> </connections>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment