|
@@ -9,6 +9,7 @@
|
|
|
import UIKit
|
|
|
import FWPopupView
|
|
|
import RxSwift
|
|
|
+import SwiftyMediator
|
|
|
|
|
|
enum ShareCommunityViewType {
|
|
|
case postDetail
|
|
@@ -27,7 +28,7 @@ class ShareCommunityView: FWPopupView {
|
|
|
private var sharedTitle : String?
|
|
|
private var sharedDetailTitle : String?
|
|
|
private var h5Str : String?
|
|
|
- private var thumbnailImg : String?
|
|
|
+ private var thumbnailImg : UIImage?
|
|
|
private var shareCommunityViewType : ShareCommunityViewType?
|
|
|
|
|
|
override init(frame: CGRect) {
|
|
@@ -38,7 +39,7 @@ class ShareCommunityView: FWPopupView {
|
|
|
var completion : Completion?
|
|
|
typealias SaveCompletion = (() -> Void)
|
|
|
var saveCompletion : SaveCompletion?
|
|
|
- init(title:String,detailTitle:String,h5Str:String,thumbnailImg:String,sharedTitle:String,sharedDetailTitle:String,shareCommunityViewType:ShareCommunityViewType) {
|
|
|
+ init(title:String,detailTitle:String,h5Str:String,thumbnailImg:UIImage?,sharedTitle:String,sharedDetailTitle:String,shareCommunityViewType:ShareCommunityViewType) {
|
|
|
self.init()
|
|
|
self.title = title
|
|
|
self.detailTitle = detailTitle
|
|
@@ -156,12 +157,12 @@ class ShareCommunityView: FWPopupView {
|
|
|
|
|
|
|
|
|
/// 初始化
|
|
|
- class func shareCommunityView(title:String,detailTitle:String,h5Str:String,thumbnailImg:String,sharedTitle:String,sharedDetailTitle:String,shareCommunityViewType:ShareCommunityViewType,completion: @escaping Completion) -> ShareCommunityView {
|
|
|
+ class func shareCommunityView(title:String,detailTitle:String,h5Str:String,thumbnailImg:UIImage?,sharedTitle:String,sharedDetailTitle:String,shareCommunityViewType:ShareCommunityViewType,completion: @escaping Completion) -> ShareCommunityView {
|
|
|
let view = ShareCommunityView(
|
|
|
title:title,
|
|
|
detailTitle: detailTitle,
|
|
|
h5Str: h5Str,
|
|
|
- thumbnailImg: thumbnailImg,
|
|
|
+ thumbnailImg : thumbnailImg,
|
|
|
sharedTitle: sharedTitle,
|
|
|
sharedDetailTitle:sharedDetailTitle,
|
|
|
shareCommunityViewType:shareCommunityViewType)
|
|
@@ -178,6 +179,23 @@ class ShareCommunityView: FWPopupView {
|
|
|
view.show()
|
|
|
return view
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /// 邀请好友
|
|
|
+ class func inviteGoodFriends() {
|
|
|
+ let shareCommunityView = ShareCommunityView.shareCommunityView(
|
|
|
+ title: kCommunityPushingNewActivitiesTitle,
|
|
|
+ detailTitle: kCommunityPushingNewActivitiesDetailTitle,
|
|
|
+ h5Str: kH5InviteUrl + "\(UserModel.shared().getModel()?.inviteCode ?? "")",
|
|
|
+ thumbnailImg: UIImage.imageUrl(UserModel.shared().getModel()?.avatarurl),
|
|
|
+ sharedTitle: kCommunityPushingNewActivitiesTitleShare,
|
|
|
+ sharedDetailTitle: kCommunityPushingNewActivitiesDetailTitleShare,
|
|
|
+ shareCommunityViewType: ShareCommunityViewType.activity,
|
|
|
+ completion: {})
|
|
|
+ shareCommunityView.saveCompletion = {
|
|
|
+ Mediator.push(ShareRouterModuleType.pushShareActivity)
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -200,23 +218,23 @@ extension ShareCommunityView: UICollectionViewDelegateFlowLayout,UICollectionVie
|
|
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
|
|
switch indexPath.row {
|
|
|
case 0:
|
|
|
- UMManager.shared.shareWebPage(to: UMSocialPlatformType.wechatSession, viewController: findViewController(), title: sharedTitle ?? "", descr: sharedDetailTitle ?? "", thumbImage: UIImage.imageUrl(thumbnailImg) as Any, webpageUrl: h5Str ?? "", completion: {
|
|
|
+ UMManager.shared.shareWebPage(to: UMSocialPlatformType.wechatSession, viewController: findViewController(), title: sharedTitle ?? "", descr: sharedDetailTitle ?? "", thumbImage: thumbnailImg as Any, webpageUrl: h5Str ?? "", completion: {
|
|
|
self.completion!()
|
|
|
})
|
|
|
break
|
|
|
case 1:
|
|
|
- UMManager.shared.shareWebPage(to: UMSocialPlatformType.wechatTimeLine, viewController: findViewController(), title: sharedTitle ?? "", descr: sharedDetailTitle ?? "", thumbImage: UIImage.imageUrl(thumbnailImg) as Any, webpageUrl: h5Str ?? "",completion: {
|
|
|
+ UMManager.shared.shareWebPage(to: UMSocialPlatformType.wechatTimeLine, viewController: findViewController(), title: sharedTitle ?? "", descr: sharedDetailTitle ?? "", thumbImage: thumbnailImg as Any, webpageUrl: h5Str ?? "",completion: {
|
|
|
self.completion!()
|
|
|
})
|
|
|
|
|
|
break
|
|
|
case 2:
|
|
|
- UMManager.shared.shareWebPage(to: UMSocialPlatformType.sina, viewController: findViewController(), title: sharedTitle ?? "", descr: sharedDetailTitle ?? "", thumbImage: UIImage.imageUrl(thumbnailImg) as Any, webpageUrl: h5Str ?? "",completion: {
|
|
|
+ UMManager.shared.shareWebPage(to: UMSocialPlatformType.sina, viewController: findViewController(), title: sharedTitle ?? "", descr: sharedDetailTitle ?? "", thumbImage: thumbnailImg as Any, webpageUrl: h5Str ?? "",completion: {
|
|
|
self.completion!()
|
|
|
})
|
|
|
break
|
|
|
case 3:
|
|
|
- commonCopy(string: thumbnailImg ?? "")
|
|
|
+ commonCopy(string: h5Str ?? "")
|
|
|
break
|
|
|
case 4:
|
|
|
switch shareCommunityViewType {
|
|
@@ -226,6 +244,9 @@ extension ShareCommunityView: UICollectionViewDelegateFlowLayout,UICollectionVie
|
|
|
}
|
|
|
break
|
|
|
case .activity?:
|
|
|
+ if let saveCompletion = self.saveCompletion {
|
|
|
+ saveCompletion()
|
|
|
+ }
|
|
|
break
|
|
|
default:
|
|
|
break
|