forked from mirrors/linphone-iphone
Refactor file path extraction for getNewFilePath
This commit is contained in:
parent
8fb0b8a5df
commit
f51e92adee
1 changed files with 17 additions and 8 deletions
|
|
@ -432,7 +432,9 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
} else {
|
||||
if content.type != "video" {
|
||||
let path = URL(string: self.getNewFilePath(name: content.name ?? ""))
|
||||
let filePathSep = content.filePath!.components(separatedBy: "/Library/Images/")
|
||||
let path = URL(string: self.getNewFilePath(name: filePathSep[1]))
|
||||
|
||||
var typeTmp: AttachmentType = .other
|
||||
|
||||
switch content.type {
|
||||
|
|
@ -467,7 +469,8 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
} else if content.type == "video" {
|
||||
let path = URL(string: self.getNewFilePath(name: content.name ?? ""))
|
||||
let filePathSep = content.filePath!.components(separatedBy: "/Library/Images/")
|
||||
let path = URL(string: self.getNewFilePath(name: filePathSep[1]))
|
||||
let pathThumbnail = URL(string: self.generateThumbnail(name: content.name ?? ""))
|
||||
|
||||
if path != nil && pathThumbnail != nil {
|
||||
|
|
@ -666,7 +669,8 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
} else {
|
||||
if content.type != "video" {
|
||||
let path = URL(string: self.getNewFilePath(name: content.name ?? ""))
|
||||
let filePathSep = content.filePath!.components(separatedBy: "/Library/Images/")
|
||||
let path = URL(string: self.getNewFilePath(name: filePathSep[1]))
|
||||
var typeTmp: AttachmentType = .other
|
||||
|
||||
switch content.type {
|
||||
|
|
@ -701,7 +705,8 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
} else if content.type == "video" {
|
||||
let path = URL(string: self.getNewFilePath(name: content.name ?? ""))
|
||||
let filePathSep = content.filePath!.components(separatedBy: "/Library/Images/")
|
||||
let path = URL(string: self.getNewFilePath(name: filePathSep[1]))
|
||||
let pathThumbnail = URL(string: self.generateThumbnail(name: content.name ?? ""))
|
||||
|
||||
if path != nil && pathThumbnail != nil {
|
||||
|
|
@ -898,7 +903,8 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
} else if content.name != nil && !content.name!.isEmpty {
|
||||
if content.type != "video" {
|
||||
let path = URL(string: self.getNewFilePath(name: content.name ?? ""))
|
||||
let filePathSep = content.filePath!.components(separatedBy: "/Library/Images/")
|
||||
let path = URL(string: self.getNewFilePath(name: filePathSep[1]))
|
||||
var typeTmp: AttachmentType = .other
|
||||
|
||||
switch content.type {
|
||||
|
|
@ -933,7 +939,8 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
} else if content.type == "video" {
|
||||
let path = URL(string: self.getNewFilePath(name: content.name ?? ""))
|
||||
let filePathSep = content.filePath!.components(separatedBy: "/Library/Images/")
|
||||
let path = URL(string: self.getNewFilePath(name: filePathSep[1]))
|
||||
|
||||
let pathThumbnail = URL(string: self.generateThumbnail(name: content.name ?? ""))
|
||||
if path != nil && pathThumbnail != nil {
|
||||
|
|
@ -1208,7 +1215,8 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
} else {
|
||||
if content.type != "video" {
|
||||
let path = URL(string: self.getNewFilePath(name: content.name ?? ""))
|
||||
let filePathSep = content.filePath!.components(separatedBy: "/Library/Images/")
|
||||
let path = URL(string: self.getNewFilePath(name: filePathSep[1]))
|
||||
var typeTmp: AttachmentType = .other
|
||||
|
||||
switch content.type {
|
||||
|
|
@ -1243,7 +1251,8 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
} else if content.type == "video" {
|
||||
let path = URL(string: self.getNewFilePath(name: content.name ?? ""))
|
||||
let filePathSep = content.filePath!.components(separatedBy: "/Library/Images/")
|
||||
let path = URL(string: self.getNewFilePath(name: filePathSep[1]))
|
||||
let pathThumbnail = URL(string: self.generateThumbnail(name: content.name ?? ""))
|
||||
|
||||
if path != nil && pathThumbnail != nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue