removed commented code.
This commit is contained in:
parent
90e6dfd084
commit
1109931d8e
@ -71,160 +71,4 @@ public class PagePlayAudioBehavior: PageCustomActionHandlerBehavior {
|
||||
public func onPageHidden(_ delegateObject: MVMCoreUIDelegateObject?) {
|
||||
// TODO: Stop player
|
||||
}
|
||||
|
||||
|
||||
// func saveVoicemailToDocumentDirectory(voicemail:String) -> URL {
|
||||
// let voicemailUrl = URL(string: "fileNotFound")!
|
||||
// ///Setting Voicemail Path
|
||||
//
|
||||
// let cacheDirectory = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first as NSString?
|
||||
//
|
||||
// if let cachePath = cacheDirectory?.appendingPathComponent("fdv.voicemails"), !FileManager.default.fileExists(atPath: cachePath) {
|
||||
// do{
|
||||
// try FileManager.default.createDirectory(atPath: cachePath, withIntermediateDirectories: false, attributes: nil)
|
||||
// } catch let error as NSError {
|
||||
// MVMCoreLoggingHandler.logDebugMessage(withDelegate: error.debugDescription)
|
||||
// }
|
||||
// }
|
||||
// let fileName = cacheDirectory?.appendingPathComponent("fdv.voicemails").appending("/VM_1.wmv")
|
||||
//#warning("Pending task to check if we can protect the voicemail data")
|
||||
//
|
||||
// let voicemailData = Data(base64Encoded: voicemail)
|
||||
// do{
|
||||
// if let _fileName = fileName, let fileUrl = URL(string: _fileName) {
|
||||
// try voicemailData?.write(to: fileUrl, options: .completeFileProtection)
|
||||
// return fileUrl
|
||||
// }
|
||||
// } catch let error as NSError {
|
||||
// MVMCoreLoggingHandler.logDebugMessage(withDelegate: error.debugDescription)
|
||||
// }
|
||||
// return voicemailUrl
|
||||
// }
|
||||
|
||||
|
||||
// NSDictionary *completeProtection = [NSDictionary dictionaryWithObject:NSFileProtectionComplete forKey:NSFileProtectionKey];
|
||||
// [[NSFileManager defaultManager] setAttributes:completeProtection ofItemAtPath:appFile error:nil];
|
||||
// return ([data writeToFile:appFile atomically:YES]);
|
||||
|
||||
|
||||
// func downloadVoicemail(url: URL?) {
|
||||
//
|
||||
// let downloadTask = URLSession.shared.downloadTask(with: url!) { url, response, error in
|
||||
// guard error == nil, let fileURL = url else { return }
|
||||
// do {
|
||||
// let documentsURL = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
|
||||
// let savedURL = documentsURL.appendingPathComponent(fileURL.lastPathComponent)
|
||||
// try FileManager.default.moveItem(at: fileURL, to: savedURL)
|
||||
//
|
||||
// } catch let error as NSError {
|
||||
// MVMCoreLoggingHandler.logDebugMessage(withDelegate: error.debugDescription)
|
||||
// }
|
||||
// }
|
||||
// downloadTask.resume()
|
||||
// }
|
||||
|
||||
/*
|
||||
// https://oneconfluence.verizon.com/pages/viewpage.action?spaceKey=EIM&title=FDV+API
|
||||
|
||||
/// The directory to store all downloaded voicemails.
|
||||
func voicemailDirectory() -> URL? {
|
||||
|
||||
guard let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { return nil }
|
||||
return documentsURL.appendingPathComponent("fios_vm")
|
||||
}
|
||||
|
||||
func voicemailListQuery(accountId: String, sourceIP: String, mdn: String, mailBoxNo: String, timeZone: String) {
|
||||
|
||||
let url = URL(string: "")!
|
||||
var request = URLRequest(url: url)
|
||||
request.httpMethod = "POST"
|
||||
|
||||
let task = URLSession.shared.dataTask(with: request) { data, response, error in
|
||||
// do something with the result
|
||||
// print(data)
|
||||
// if let data = data {
|
||||
// TODO: Receive List of MDNs
|
||||
// if let data = data, let dataString = String(data: data, encoding: .utf8) {
|
||||
// print("Response data string:\n \(dataString)")
|
||||
// }
|
||||
// print(String(data: data, encoding: .utf8))
|
||||
// } else {
|
||||
// print("no data")
|
||||
// }
|
||||
}
|
||||
|
||||
task.resume()
|
||||
|
||||
}
|
||||
|
||||
func fetchVoicemail(accountId: String, sourceIP: String, mdn: String, mailBoxNo: String) {
|
||||
|
||||
// guard let messageID = messageID else { return }
|
||||
|
||||
let url = URL(string: "")!
|
||||
var request = URLRequest(url: url)
|
||||
request.httpMethod = "POST"
|
||||
|
||||
let task = URLSession.shared.dataTask(with: request) { data, response, error in
|
||||
// do something with the result
|
||||
// print(data)
|
||||
// if let data = data {
|
||||
//body/VoiceMailMessages/Stream/TN/VMID/Audio/bin
|
||||
// TODO: Receive List of MDNs
|
||||
// if let data = data, let dataString = String(data: data, encoding: .utf8) {
|
||||
// print("Response data string:\n \(dataString)")
|
||||
// }
|
||||
// print(String(data: data, encoding: .utf8))
|
||||
// } else {
|
||||
// print("no data")
|
||||
// }
|
||||
}
|
||||
|
||||
task.resume()
|
||||
|
||||
// TODO: Fetch Audio file.
|
||||
}
|
||||
|
||||
func downloadVoicemail(url: URL?) {
|
||||
|
||||
let downloadTask = URLSession.shared.downloadTask(with: url!) { [weak self] url, response, error in
|
||||
guard error == nil,
|
||||
let fileURL = url
|
||||
else { return }
|
||||
|
||||
do {
|
||||
// "data/user/0/com.verizon.myfios/files/VM_INBOX-8711.wav"
|
||||
let documentsURL = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
|
||||
let savedURL = documentsURL.appendingPathComponent(fileURL.lastPathComponent)
|
||||
try FileManager.default.moveItem(at: fileURL, to: savedURL)
|
||||
self?.audioFilePath = savedURL
|
||||
} catch let error as NSError {
|
||||
MVMCoreLoggingHandler.logDebugMessage(withDelegate: error.debugDescription)
|
||||
}
|
||||
}
|
||||
downloadTask.resume()
|
||||
}
|
||||
|
||||
func fetchAudioFilePath() {
|
||||
|
||||
guard let messageID = messageID, // "INBOX-8711"
|
||||
let cleanMDN = cleanMDN, // "4124712342"
|
||||
let destinationURL = voicemailDirectory()
|
||||
else { return }
|
||||
|
||||
let uri = "com.verizon.fios.voice2/downloadvm?VM_DOWNLOAD_URI_DATA_MESSAGE_ID=\(messageID)&VM_DOWNLOAD_URI_DATA_TN=\(cleanMDN)"
|
||||
let url = URL(string: uri)
|
||||
|
||||
|
||||
// TODO: First check to see if the file is stored on disk, if not, then downloaded.
|
||||
createDirectoryIfNeeded(url: destinationURL)
|
||||
|
||||
if FileManager.default.fileExists(atPath: destinationURL.path) {
|
||||
audioFilePath = destinationURL
|
||||
|
||||
} else {
|
||||
downloadVoicemail(url: url)
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user