|
@@ -5,249 +5,249 @@
|
|
|
// Created by 100Years on 2025/6/11.
|
|
|
//
|
|
|
|
|
|
-import Alamofire
|
|
|
+//import Alamofire
|
|
|
|
|
|
|
|
|
|
|
|
-let actionInfoDictVideo:[String:Any] = [
|
|
|
- "actionType":"image_animation",
|
|
|
- "comments": "Success",
|
|
|
- "costTime":11,
|
|
|
- "createdTimestamp":1744972580,
|
|
|
- "id":32743,
|
|
|
- "percent":1,
|
|
|
- "request":"{\\\"imageUrl\\\": \\\"https://be-aigc.oss-cn-shanghai.aliyuncs.com/1981095e-b810-4eef-923b-5540350ae2d7.jpeg\\\", \\\"countryCode\\\": \\\"CN\\\", \\\"ip\\\": \\\"120.229.53.7\\\"}",
|
|
|
- "response": "{\\\"resultUrl\\\": \\\"https://be-aigc.s3-accelerate.amazonaws.com/4e0da626-1de7-4c2e-9be2-3e6d0742a28e.mp4\\\"}",
|
|
|
- "status":"success"
|
|
|
-]
|
|
|
-
|
|
|
-
|
|
|
-class TSAIListPhotoGeneratorBaseVM {
|
|
|
-
|
|
|
- var uploadRequest:Request?
|
|
|
- var creatRequest:Request?
|
|
|
- var queryRequest:Request?
|
|
|
- var stopNetwork = false
|
|
|
-
|
|
|
- @Published var stateDatauPblished:(TSProgressState,TSActionInfoModel?) = (TSProgressState.none,nil)
|
|
|
-
|
|
|
- var imageUrl:String?
|
|
|
- var imageUrls:[String]?
|
|
|
- var generatorModel:TSAIListPhotoGeneratorModel
|
|
|
- init(generatorModel:TSAIListPhotoGeneratorModel) {
|
|
|
- self.generatorModel = generatorModel
|
|
|
- }
|
|
|
-
|
|
|
- func uploadAndCreatImage() {
|
|
|
- //上传多个图片
|
|
|
- if let _ = generatorModel.upLoadImages {
|
|
|
- uploadImagesAndCreat()
|
|
|
- return
|
|
|
- }
|
|
|
- //上传单个图片
|
|
|
- if let imageUrl = imageUrl,imageUrl.contains("http") {
|
|
|
- creatImage()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- stopNetwork = false
|
|
|
- stateDatauPblished = (.start,nil)
|
|
|
-
|
|
|
- stateDatauPblished = (.progressString(uploadingPhoto(progress: 0.0)),nil)
|
|
|
- uploadRequest = TSNetworkShared.uploadImage(upLoadImage: generatorModel.upLoadImage, maxKb: generatorModel.generatorStyle.imageMaxKb) { [weak self] progress in
|
|
|
- guard let self = self else { return }
|
|
|
-
|
|
|
- stateDatauPblished = (.progressString(uploadingPhoto(progress: progress)),nil)
|
|
|
-
|
|
|
- } completion: { [weak self] data, error in
|
|
|
- guard let self = self else { return }
|
|
|
- if let error = error {
|
|
|
- imageUrl = nil
|
|
|
- self.stateDatauPblished = (TSProgressState.getFailed(error.tsDesc,error.tsCode),nil)
|
|
|
- }else{
|
|
|
- if let string = data as? String {
|
|
|
- imageUrl = string
|
|
|
- creatImage()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private func uploadImagesAndCreat() {
|
|
|
-
|
|
|
- if let imageUrls = imageUrls{
|
|
|
- creatImage()
|
|
|
- return
|
|
|
- }
|
|
|
- guard let upLoadImages = generatorModel.upLoadImages else { return }
|
|
|
- var uploadImageUrls:[String] = []
|
|
|
- let progressRatio:Float = 1.0/Float(upLoadImages.count)//进度分割比例
|
|
|
- var totalProgress:Float = 0.0//总进度
|
|
|
- stopNetwork = false
|
|
|
- stateDatauPblished = (.start,nil)
|
|
|
- stateDatauPblished = (.progressString(uploadingPhoto(progress: 0.0)),nil)
|
|
|
-
|
|
|
- let group = DispatchGroup()
|
|
|
- for image in upLoadImages {
|
|
|
- group.enter()
|
|
|
- uploadRequest = TSNetworkShared.uploadImage(upLoadImage: image, maxKb: generatorModel.generatorStyle.imageMaxKb) { [weak self] progress in
|
|
|
- guard let self = self else { return }
|
|
|
- totalProgress+=progress*progressRatio
|
|
|
- stateDatauPblished = (.progressString(uploadingPhoto(progress: totalProgress)),nil)
|
|
|
- } completion: { [weak self] data, error in
|
|
|
- guard let self = self else { return }
|
|
|
- if let error = error {
|
|
|
- self.imageUrls = nil
|
|
|
- self.stateDatauPblished = (TSProgressState.getFailed(error.tsDesc,error.tsCode),nil)
|
|
|
- }else{
|
|
|
- if let string = data as? String {
|
|
|
- uploadImageUrls.append(string)
|
|
|
- }
|
|
|
- }
|
|
|
- group.leave()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- group.notify(queue: .main) {
|
|
|
- if uploadImageUrls.count == upLoadImages.count {
|
|
|
- self.imageUrls = uploadImageUrls
|
|
|
- self.imageUrl = ""
|
|
|
- self.creatImage()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- func creatImage() {
|
|
|
- guard let imageUrl = imageUrl else { return }
|
|
|
- stopNetwork = false
|
|
|
- stateDatauPblished = (.start,nil)
|
|
|
- stateDatauPblished = (.progressString(generating(progress: 0.0)),nil)
|
|
|
-
|
|
|
- var urlType:TSNeURLType = .imageRewrite
|
|
|
- var postDict:[String:Any] = [
|
|
|
- "device":getUserInfoJsonString(),
|
|
|
- "imageUrl":imageUrl,
|
|
|
- "model": generatorModel.generatorStyle.aiModel
|
|
|
- ]
|
|
|
- switch generatorModel.generatorStyle {
|
|
|
- case .enhance:
|
|
|
- urlType = .imageRewrite
|
|
|
- postDict["prompt"] = "把图片变清晰"
|
|
|
- case .colorize:
|
|
|
- urlType = .imageRewrite
|
|
|
- postDict["prompt"] = "Add suitable colors to photos"
|
|
|
- case .descratch:
|
|
|
- urlType = .imageRewrite
|
|
|
- postDict["prompt"] = "Remove the photo's scratches and dirt"
|
|
|
- case .enlighten:
|
|
|
- urlType = .imageRewrite
|
|
|
- postDict["prompt"] = "Adjust the light and darkness of the photo to make the overall look coordinated"
|
|
|
-
|
|
|
- case .recreate:
|
|
|
- urlType = .imageRewrite
|
|
|
- postDict["prompt"] = "Recreate damaged portraits and added suitable color for photo"
|
|
|
- }
|
|
|
-
|
|
|
- creatRequest = TSNetworkShared.post(urlType: urlType,parameters: postDict) { [weak self] data,error in
|
|
|
- guard let self = self else { return }
|
|
|
-
|
|
|
- if let dataDict = kNetWorkCodeSuccess(data: data),
|
|
|
- let actionId = dataDict["actionId"] as? Int{
|
|
|
- if stopNetwork == false {
|
|
|
- self.getActionInfo(action_id:actionId)
|
|
|
- }
|
|
|
- }else{
|
|
|
- if let error = error {
|
|
|
- self.stateDatauPblished = (TSProgressState.getFailed(error.tsDesc,error.tsCode),nil)
|
|
|
- }else{
|
|
|
- self.stateDatauPblished = (.generalNormalFailed,nil)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- func getActionInfo(action_id:Int){
|
|
|
- queryRequest = TSNetworkShared.get(urlType: .actionInfo,parameters: ["action_id":action_id]) { [weak self] data,error in
|
|
|
- guard let self = self else { return }
|
|
|
- if let result = kNetWorkResultSuccess(data: data) {
|
|
|
- if let genmojiModel = TSActionInfoModel(JSON: result) {
|
|
|
- switch genmojiModel.actionStatus {
|
|
|
- case .success:
|
|
|
- if let _ = URL(string:genmojiModel.response.resultUrl) {
|
|
|
-// if generatorModel.generatorStyle == .photoLive {
|
|
|
-// downloadVideo(urlString: genmojiModel.response.resultUrl) { url in
|
|
|
-// if let url = url {
|
|
|
-//
|
|
|
-// genmojiModel.videoPath = url.path.documentLastURLString
|
|
|
-// if let videoImage = kGetVideoThumbnail(from: url) {
|
|
|
-// let imageSavePath = url.deletingPathExtension().path + ".jpeg"
|
|
|
-// videoImage.saveToFile(at:URL(fileURLWithPath:imageSavePath))
|
|
|
-// genmojiModel.videoThumbnailPath = imageSavePath.documentLastURLString
|
|
|
-// }
|
|
|
+//let actionInfoDictVideo:[String:Any] = [
|
|
|
+// "actionType":"image_animation",
|
|
|
+// "comments": "Success",
|
|
|
+// "costTime":11,
|
|
|
+// "createdTimestamp":1744972580,
|
|
|
+// "id":32743,
|
|
|
+// "percent":1,
|
|
|
+// "request":"{\\\"imageUrl\\\": \\\"https://be-aigc.oss-cn-shanghai.aliyuncs.com/1981095e-b810-4eef-923b-5540350ae2d7.jpeg\\\", \\\"countryCode\\\": \\\"CN\\\", \\\"ip\\\": \\\"120.229.53.7\\\"}",
|
|
|
+// "response": "{\\\"resultUrl\\\": \\\"https://be-aigc.s3-accelerate.amazonaws.com/4e0da626-1de7-4c2e-9be2-3e6d0742a28e.mp4\\\"}",
|
|
|
+// "status":"success"
|
|
|
+//]
|
|
|
+//
|
|
|
//
|
|
|
-// self.stateDatauPblished = (.success(nil),genmojiModel)
|
|
|
-// }else{
|
|
|
-// self.stateDatauPblished = (.generalNormalFailed,nil)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }else {
|
|
|
-
|
|
|
- let group = DispatchGroup()
|
|
|
+//class TSAIListPhotoGeneratorBaseVM {
|
|
|
+//
|
|
|
+// var uploadRequest:Request?
|
|
|
+// var creatRequest:Request?
|
|
|
+// var queryRequest:Request?
|
|
|
+// var stopNetwork = false
|
|
|
+//
|
|
|
+// @Published var stateDatauPblished:(TSProgressState,TSActionInfoModel?) = (TSProgressState.none,nil)
|
|
|
+//
|
|
|
+// var imageUrl:String?
|
|
|
+// var imageUrls:[String]?
|
|
|
+// var generatorModel:TSAIListPhotoGeneratorModel
|
|
|
+// init(generatorModel:TSAIListPhotoGeneratorModel) {
|
|
|
+// self.generatorModel = generatorModel
|
|
|
+// }
|
|
|
+//
|
|
|
+// func uploadAndCreatImage() {
|
|
|
+// //上传多个图片
|
|
|
+// if let _ = generatorModel.upLoadImages {
|
|
|
+// uploadImagesAndCreat()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// //上传单个图片
|
|
|
+// if let imageUrl = imageUrl,imageUrl.contains("http") {
|
|
|
+// creatImage()
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// stopNetwork = false
|
|
|
+// stateDatauPblished = (.start,nil)
|
|
|
+//
|
|
|
+// stateDatauPblished = (.progressString(uploadingPhoto(progress: 0.0)),nil)
|
|
|
+// uploadRequest = TSNetworkShared.uploadImage(upLoadImage: generatorModel.upLoadImage, maxKb: generatorModel.generatorStyle.imageMaxKb) { [weak self] progress in
|
|
|
+// guard let self = self else { return }
|
|
|
+//
|
|
|
+// stateDatauPblished = (.progressString(uploadingPhoto(progress: progress)),nil)
|
|
|
+//
|
|
|
+// } completion: { [weak self] data, error in
|
|
|
+// guard let self = self else { return }
|
|
|
+// if let error = error {
|
|
|
+// imageUrl = nil
|
|
|
+// self.stateDatauPblished = (TSProgressState.getFailed(error.tsDesc,error.tsCode),nil)
|
|
|
+// }else{
|
|
|
+// if let string = data as? String {
|
|
|
+// imageUrl = string
|
|
|
+// creatImage()
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// private func uploadImagesAndCreat() {
|
|
|
+//
|
|
|
+// if let imageUrls = imageUrls{
|
|
|
+// creatImage()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// guard let upLoadImages = generatorModel.upLoadImages else { return }
|
|
|
+// var uploadImageUrls:[String] = []
|
|
|
+// let progressRatio:Float = 1.0/Float(upLoadImages.count)//进度分割比例
|
|
|
+// var totalProgress:Float = 0.0//总进度
|
|
|
+// stopNetwork = false
|
|
|
+// stateDatauPblished = (.start,nil)
|
|
|
+// stateDatauPblished = (.progressString(uploadingPhoto(progress: 0.0)),nil)
|
|
|
+//
|
|
|
+// let group = DispatchGroup()
|
|
|
+// for image in upLoadImages {
|
|
|
+// group.enter()
|
|
|
+// uploadRequest = TSNetworkShared.uploadImage(upLoadImage: image, maxKb: generatorModel.generatorStyle.imageMaxKb) { [weak self] progress in
|
|
|
+// guard let self = self else { return }
|
|
|
+// totalProgress+=progress*progressRatio
|
|
|
+// stateDatauPblished = (.progressString(uploadingPhoto(progress: totalProgress)),nil)
|
|
|
+// } completion: { [weak self] data, error in
|
|
|
+// guard let self = self else { return }
|
|
|
+// if let error = error {
|
|
|
+// self.imageUrls = nil
|
|
|
+// self.stateDatauPblished = (TSProgressState.getFailed(error.tsDesc,error.tsCode),nil)
|
|
|
+// }else{
|
|
|
+// if let string = data as? String {
|
|
|
+// uploadImageUrls.append(string)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// group.leave()
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// group.notify(queue: .main) {
|
|
|
+// if uploadImageUrls.count == upLoadImages.count {
|
|
|
+// self.imageUrls = uploadImageUrls
|
|
|
+// self.imageUrl = ""
|
|
|
+// self.creatImage()
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// func creatImage() {
|
|
|
+// guard let imageUrl = imageUrl else { return }
|
|
|
+// stopNetwork = false
|
|
|
+// stateDatauPblished = (.start,nil)
|
|
|
+// stateDatauPblished = (.progressString(generating(progress: 0.0)),nil)
|
|
|
+//
|
|
|
+// var urlType:TSNeURLType = .imageRewrite
|
|
|
+// var postDict:[String:Any] = [
|
|
|
+// "device":getUserInfoJsonString(),
|
|
|
+// "imageUrl":imageUrl,
|
|
|
+// "model": generatorModel.generatorStyle.aiModel
|
|
|
+// ]
|
|
|
+// switch generatorModel.generatorStyle {
|
|
|
+// case .enhance:
|
|
|
+// urlType = .imageRewrite
|
|
|
+// postDict["prompt"] = "把图片变清晰"
|
|
|
+// case .colorize:
|
|
|
+// urlType = .imageRewrite
|
|
|
+// postDict["prompt"] = "Add suitable colors to photos"
|
|
|
+// case .descratch:
|
|
|
+// urlType = .imageRewrite
|
|
|
+// postDict["prompt"] = "Remove the photo's scratches and dirt"
|
|
|
+// case .enlighten:
|
|
|
+// urlType = .imageRewrite
|
|
|
+// postDict["prompt"] = "Adjust the light and darkness of the photo to make the overall look coordinated"
|
|
|
+//
|
|
|
+// case .recreate:
|
|
|
+// urlType = .imageRewrite
|
|
|
+// postDict["prompt"] = "Recreate damaged portraits and added suitable color for photo"
|
|
|
+// }
|
|
|
+//
|
|
|
+// creatRequest = TSNetworkShared.post(urlType: urlType,parameters: postDict) { [weak self] data,error in
|
|
|
+// guard let self = self else { return }
|
|
|
+//
|
|
|
+// if let dataDict = kNetWorkCodeSuccess(data: data),
|
|
|
+// let actionId = dataDict["actionId"] as? Int{
|
|
|
+// if stopNetwork == false {
|
|
|
+// self.getActionInfo(action_id:actionId)
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// if let error = error {
|
|
|
+// self.stateDatauPblished = (TSProgressState.getFailed(error.tsDesc,error.tsCode),nil)
|
|
|
+// }else{
|
|
|
+// self.stateDatauPblished = (.generalNormalFailed,nil)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// func getActionInfo(action_id:Int){
|
|
|
+// queryRequest = TSNetworkShared.get(urlType: .actionInfo,parameters: ["action_id":action_id]) { [weak self] data,error in
|
|
|
+// guard let self = self else { return }
|
|
|
+// if let result = kNetWorkResultSuccess(data: data) {
|
|
|
+// if let genmojiModel = TSActionInfoModel(JSON: result) {
|
|
|
+// switch genmojiModel.actionStatus {
|
|
|
+// case .success:
|
|
|
+// if let _ = URL(string:genmojiModel.response.resultUrl) {
|
|
|
+//// if generatorModel.generatorStyle == .photoLive {
|
|
|
+//// downloadVideo(urlString: genmojiModel.response.resultUrl) { url in
|
|
|
+//// if let url = url {
|
|
|
+////
|
|
|
+//// genmojiModel.videoPath = url.path.documentLastURLString
|
|
|
+//// if let videoImage = kGetVideoThumbnail(from: url) {
|
|
|
+//// let imageSavePath = url.deletingPathExtension().path + ".jpeg"
|
|
|
+//// videoImage.saveToFile(at:URL(fileURLWithPath:imageSavePath))
|
|
|
+//// genmojiModel.videoThumbnailPath = imageSavePath.documentLastURLString
|
|
|
+//// }
|
|
|
+////
|
|
|
+//// self.stateDatauPblished = (.success(nil),genmojiModel)
|
|
|
+//// }else{
|
|
|
+//// self.stateDatauPblished = (.generalNormalFailed,nil)
|
|
|
+//// }
|
|
|
+//// }
|
|
|
+//// }else {
|
|
|
+//
|
|
|
+// let group = DispatchGroup()
|
|
|
+//// group.enter()
|
|
|
+//// downloadImage(urlString: genmojiModel.request.imageUrl) {
|
|
|
+//// group.leave()
|
|
|
+//// }
|
|
|
+//
|
|
|
+// TSImageStoreTool.storeImage(image: generatorModel.upLoadImage, urlString: genmojiModel.request.imageUrl)
|
|
|
+//
|
|
|
// group.enter()
|
|
|
-// downloadImage(urlString: genmojiModel.request.imageUrl) {
|
|
|
+// downloadImage(urlString: genmojiModel.response.resultUrl) {
|
|
|
// group.leave()
|
|
|
// }
|
|
|
-
|
|
|
- TSImageStoreTool.storeImage(image: generatorModel.upLoadImage, urlString: genmojiModel.request.imageUrl)
|
|
|
-
|
|
|
- group.enter()
|
|
|
- downloadImage(urlString: genmojiModel.response.resultUrl) {
|
|
|
- group.leave()
|
|
|
- }
|
|
|
-
|
|
|
- group.notify(queue: .main) {
|
|
|
- self.stateDatauPblished = (.success(nil),genmojiModel)
|
|
|
- }
|
|
|
-
|
|
|
+//
|
|
|
+// group.notify(queue: .main) {
|
|
|
+// self.stateDatauPblished = (.success(nil),genmojiModel)
|
|
|
// }
|
|
|
- }else{
|
|
|
- self.stateDatauPblished = (.success(nil),genmojiModel)
|
|
|
- }
|
|
|
-
|
|
|
- case .failed:
|
|
|
- self.stateDatauPblished = (TSProgressState.getFailed(genmojiModel.response.codeErrorMsg,genmojiModel.response.code),nil)
|
|
|
- default:
|
|
|
- stateDatauPblished = (.progressString(generating(progress: genmojiModel.percent)),nil)
|
|
|
- if stopNetwork == false {
|
|
|
- kDelayOnMainThread(1.0) {
|
|
|
- self.getActionInfo(action_id: action_id)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- if let error = error {
|
|
|
- self.stateDatauPblished = (TSProgressState.getFailed(error.tsDesc,error.tsCode),nil)
|
|
|
- }else{
|
|
|
- self.stateDatauPblished = (.generalNormalFailed,nil)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- func downloadImage(urlString:String,completion:@escaping ()->Void){
|
|
|
- TSImageStoreTool.downloadImageWithProgress(urlString: urlString) { [weak self] progress in
|
|
|
- guard let self = self else { return }
|
|
|
-
|
|
|
- let progressInt = Int(progress*10.0)
|
|
|
- let progressString = generatingText + " \(90 + progressInt)%"
|
|
|
- stateDatauPblished = (.progressString(progressString),nil)
|
|
|
- dePrint("生成后图片下载进度: \(progress)")
|
|
|
- } completion: { image in
|
|
|
- completion()
|
|
|
- }
|
|
|
- }
|
|
|
+//
|
|
|
+//// }
|
|
|
+// }else{
|
|
|
+// self.stateDatauPblished = (.success(nil),genmojiModel)
|
|
|
+// }
|
|
|
+//
|
|
|
+// case .failed:
|
|
|
+// self.stateDatauPblished = (TSProgressState.getFailed(genmojiModel.response.codeErrorMsg,genmojiModel.response.code),nil)
|
|
|
+// default:
|
|
|
+// stateDatauPblished = (.progressString(generating(progress: genmojiModel.percent)),nil)
|
|
|
+// if stopNetwork == false {
|
|
|
+// kDelayOnMainThread(1.0) {
|
|
|
+// self.getActionInfo(action_id: action_id)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// if let error = error {
|
|
|
+// self.stateDatauPblished = (TSProgressState.getFailed(error.tsDesc,error.tsCode),nil)
|
|
|
+// }else{
|
|
|
+// self.stateDatauPblished = (.generalNormalFailed,nil)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// func downloadImage(urlString:String,completion:@escaping ()->Void){
|
|
|
+// TSImageStoreTool.downloadImageWithProgress(urlString: urlString) { [weak self] progress in
|
|
|
+// guard let self = self else { return }
|
|
|
+//
|
|
|
+// let progressInt = Int(progress*10.0)
|
|
|
+// let progressString = generatingText + " \(90 + progressInt)%"
|
|
|
+// stateDatauPblished = (.progressString(progressString),nil)
|
|
|
+// dePrint("生成后图片下载进度: \(progress)")
|
|
|
+// } completion: { image in
|
|
|
+// completion()
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
// func downloadVideo(urlString:String,completion:@escaping (URL?)->Void){
|
|
|
// TSDownloadManager.getDownLoadVideo(urlString: urlString) { progress in
|
|
@@ -259,36 +259,36 @@ class TSAIListPhotoGeneratorBaseVM {
|
|
|
// completion(url)
|
|
|
// }
|
|
|
// }
|
|
|
-
|
|
|
- func cancelAllRequest(){
|
|
|
- creatRequest?.cancel()
|
|
|
- queryRequest?.cancel()
|
|
|
- stopNetwork = true
|
|
|
- }
|
|
|
-
|
|
|
- func uploadingPhoto(progress:Float) -> String {
|
|
|
- //Uploading Photo 0%-100%
|
|
|
- var progressInt = Int(progress*100)
|
|
|
- if progressInt > 99 {
|
|
|
- progressInt = 99
|
|
|
- }
|
|
|
- return "Uploading Photo".localized + " \(progressInt)%"
|
|
|
- }
|
|
|
-
|
|
|
- func generating(progress:Float) -> String {
|
|
|
- let progress = progress*(0.9) // 预留 10% 进度给图片下载
|
|
|
- //Processing 0%-100%
|
|
|
- var progressInt = Int(progress*100)
|
|
|
-
|
|
|
- if progressInt > 99 {
|
|
|
- progressInt = 99
|
|
|
- }
|
|
|
-
|
|
|
- return generatingText + " \(progressInt)%"
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- var generatingText:String{
|
|
|
- return "Processing".localized
|
|
|
- }
|
|
|
-}
|
|
|
+//
|
|
|
+// func cancelAllRequest(){
|
|
|
+// creatRequest?.cancel()
|
|
|
+// queryRequest?.cancel()
|
|
|
+// stopNetwork = true
|
|
|
+// }
|
|
|
+//
|
|
|
+// func uploadingPhoto(progress:Float) -> String {
|
|
|
+// //Uploading Photo 0%-100%
|
|
|
+// var progressInt = Int(progress*100)
|
|
|
+// if progressInt > 99 {
|
|
|
+// progressInt = 99
|
|
|
+// }
|
|
|
+// return "Uploading Photo".localized + " \(progressInt)%"
|
|
|
+// }
|
|
|
+//
|
|
|
+// func generating(progress:Float) -> String {
|
|
|
+// let progress = progress*(0.9) // 预留 10% 进度给图片下载
|
|
|
+// //Processing 0%-100%
|
|
|
+// var progressInt = Int(progress*100)
|
|
|
+//
|
|
|
+// if progressInt > 99 {
|
|
|
+// progressInt = 99
|
|
|
+// }
|
|
|
+//
|
|
|
+// return generatingText + " \(progressInt)%"
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// var generatingText:String{
|
|
|
+// return "Processing".localized
|
|
|
+// }
|
|
|
+//}
|