|
@@ -222,31 +222,70 @@ func kExecuteOnMainThread(_ block: @escaping () -> Void) {
|
|
|
}
|
|
|
|
|
|
let appid = "6740220736"
|
|
|
-let kAppName:String = "Picguru" //Picguru Chibii Chibi Ghiblii AI Image Picguru
|
|
|
+let kAppName:String = "Chibii" //Picguru Chibii Chibi Ghiblii AI Image Picguru
|
|
|
let kUploadImageMaxBit10Size:Int = 10 * 1024 * 1024 //10M
|
|
|
let kUploadImageMaxBit5Size:Int = 5 * 1024 * 1024 //5M
|
|
|
|
|
|
func kShareImage(target: UIViewController,image:UIImage) {
|
|
|
- let httpAppStoreLink = "https://apps.apple.com/app/id\(appid)"
|
|
|
+
|
|
|
let text = "Turn yourself into a Ghibli style with AI magic! 🎨✨ This app creates stunning anime, cyberpunk & more—just upload a photo. Try it now!"
|
|
|
kShareContent(target: target, image: image, text: text)
|
|
|
+
|
|
|
+// shareApplication(target: target)
|
|
|
}
|
|
|
|
|
|
+//func kShareContent(target: UIViewController,image:UIImage?,text:String?) {
|
|
|
+//
|
|
|
+// let url = URL(string: "https://apps.apple.com/app/id\(appid)")
|
|
|
+//
|
|
|
+// let provider = CustomActivityItemProvider(image: image, text: text, url: url)
|
|
|
+// let vc = UIActivityViewController(activityItems: [provider], applicationActivities: nil)
|
|
|
+// vc.completionWithItemsHandler = { activity, _, _, _ in
|
|
|
+// switch activity {
|
|
|
+// case .copyToPasteboard:
|
|
|
+// UIPasteboard.general.string = text
|
|
|
+// default:
|
|
|
+// dePrint("")
|
|
|
+// }
|
|
|
+//// if let type = activity, type == .copyToPasteboard {
|
|
|
+//// UIPasteboard.general.string = text
|
|
|
+//// }else
|
|
|
+// }
|
|
|
+//
|
|
|
+// if UIDevice.current.userInterfaceIdiom == .pad {
|
|
|
+// vc.modalPresentationStyle = .popover
|
|
|
+// vc.popoverPresentationController?.sourceView = target.view
|
|
|
+// vc.popoverPresentationController?.sourceRect = target.view.bounds
|
|
|
+// }
|
|
|
+//
|
|
|
+// target.present(vc, animated: true)
|
|
|
+//}
|
|
|
+
|
|
|
func kShareContent(target: UIViewController,image:UIImage?,text:String?) {
|
|
|
+//
|
|
|
+// let url = URL(string: "https://apps.apple.com/app/id\(appid)")
|
|
|
+// ShareHelper.share(
|
|
|
+// image: image,
|
|
|
+// text: text,
|
|
|
+// url: url,
|
|
|
+// from: target,
|
|
|
+// sourceView: target.view // 可以是按钮或其他UIView
|
|
|
+// )
|
|
|
+// return
|
|
|
+ let urlString = "https://apps.apple.com/app/id\(appid)"
|
|
|
var activityItems:[Any] = []
|
|
|
-
|
|
|
|
|
|
if let image = image {
|
|
|
activityItems.append(image)
|
|
|
}
|
|
|
|
|
|
if let text = text {
|
|
|
- activityItems.append(text)
|
|
|
+ activityItems.append(text+"\nApp:"+urlString)
|
|
|
}
|
|
|
|
|
|
- if let url = URL(string: "https://apps.apple.com/app/id\(appid)") {
|
|
|
- activityItems.append(url)
|
|
|
- }
|
|
|
+// if let url = URL(string: "https://apps.apple.com/app/id\(appid)") {
|
|
|
+// activityItems.append(url)
|
|
|
+// }
|
|
|
|
|
|
if activityItems.isEmpty {
|
|
|
return
|
|
@@ -254,8 +293,11 @@ func kShareContent(target: UIViewController,image:UIImage?,text:String?) {
|
|
|
|
|
|
let vc = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
|
|
|
vc.completionWithItemsHandler = { activity, _, _, _ in
|
|
|
- if let type = activity, type == .copyToPasteboard {
|
|
|
+ switch activity {
|
|
|
+ case .copyToPasteboard:
|
|
|
UIPasteboard.general.string = text
|
|
|
+ default:
|
|
|
+ dePrint("")
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -269,6 +311,25 @@ func kShareContent(target: UIViewController,image:UIImage?,text:String?) {
|
|
|
}
|
|
|
|
|
|
|
|
|
+//func shareApplication(target: UIViewController) {
|
|
|
+// let text = "I'm using Sweeter to decorate my phone, there are not only themes, wallpapers, widgets, but also dynamic island and super useful tools, come and try with me!"
|
|
|
+// let httpAppStoreLink = "https://apps.apple.com/app/id\(appid)"
|
|
|
+// let url = URL(string: httpAppStoreLink)!
|
|
|
+// let image = UIImage(named: "App-Icon")!.compressImageSize(to: CGSize(width: 100, height: 100))
|
|
|
+// let vc = UIActivityViewController(activityItems: [image, text, url], applicationActivities: nil)
|
|
|
+// vc.completionWithItemsHandler = { activity, value, _, error in
|
|
|
+// if let type = activity, type == .copyToPasteboard {
|
|
|
+// UIPasteboard.general.string = httpAppStoreLink
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if UIDevice.current.userInterfaceIdiom == .pad {
|
|
|
+// vc.modalPresentationStyle = .popover
|
|
|
+// vc.popoverPresentationController?.sourceView = target.view
|
|
|
+// vc.popoverPresentationController?.sourceRect = target.view.bounds
|
|
|
+// }
|
|
|
+// target.present(vc, animated: true)
|
|
|
+//}
|
|
|
+
|
|
|
//// todo.kailen-logo
|
|
|
//func shareApp(parent: UIViewController) {
|
|
|
// let httpAppStoreLink = "https://apps.apple.com/app/id\(appid)"
|