|
@@ -192,15 +192,14 @@ extension NCActivity: UITableViewDataSource {
|
|
|
DispatchQueue.global().async {
|
|
|
|
|
|
let encodedString = activity.icon.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
|
|
|
- if let data = try? Data(contentsOf: URL(string: encodedString!)!) {
|
|
|
-
|
|
|
- DispatchQueue.main.async {
|
|
|
+ OCNetworking.sharedManager()?.downloadContents(ofUrl: encodedString, completion: { (data, message, errorCode) in
|
|
|
+ if errorCode == 0 {
|
|
|
do {
|
|
|
- try data.write(to: fileNameLocalPath.url, options: .atomic)
|
|
|
+ try data!.write(to: fileNameLocalPath.url, options: .atomic)
|
|
|
} catch { return }
|
|
|
- cell.icon.image = UIImage(data: data)
|
|
|
+ cell.icon.image = UIImage(data: data!)
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -220,14 +219,14 @@ extension NCActivity: UITableViewDataSource {
|
|
|
DispatchQueue.global().async {
|
|
|
let url = self.appDelegate.activeUrl + k_avatar + activity.user + "/128"
|
|
|
let encodedString = url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
|
|
|
- if let data = try? Data(contentsOf: URL(string: encodedString!)!) {
|
|
|
- DispatchQueue.main.async {
|
|
|
+ OCNetworking.sharedManager()?.downloadContents(ofUrl: encodedString, completion: { (data, message, errorCode) in
|
|
|
+ if errorCode == 0 {
|
|
|
do {
|
|
|
- try data.write(to: fileNameLocalPath.url, options: .atomic)
|
|
|
+ try data!.write(to: fileNameLocalPath.url, options: .atomic)
|
|
|
} catch { return }
|
|
|
- cell.avatar.image = UIImage(data: data)
|
|
|
+ cell.avatar.image = UIImage(data: data!)
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|