Commit 2e534f08 by pierce

fixed bugs

parent b427d222
...@@ -30,6 +30,7 @@ Pod::Spec.new do |s| ...@@ -30,6 +30,7 @@ Pod::Spec.new do |s|
'FUSCommonBundle' => ['FUSCommon/Assets/*.xcassets', 'FUSCommonBundle' => ['FUSCommon/Assets/*.xcassets',
'FUSCommon/Assets/*.plist', 'FUSCommon/Assets/*.plist',
'FUSCommon/Assets/LOTResource/**/*.{json,mp3,png}', 'FUSCommon/Assets/LOTResource/**/*.{json,mp3,png}',
'FUSCommon/Assets/Sounds/*.mp3',
'FUSCommon/Assets/Anims/**/*.png', 'FUSCommon/Assets/Anims/**/*.png',
'FUSCommon/Classes/**/*.xib', 'FUSCommon/Classes/**/*.xib',
'FUSCommon/FUSRouter/Routers/**/*.xib'] 'FUSCommon/FUSRouter/Routers/**/*.xib']
......
...@@ -79,6 +79,11 @@ ...@@ -79,6 +79,11 @@
[largeLotAnimView playWithCompletion:^(BOOL animationFinished) { [largeLotAnimView playWithCompletion:^(BOOL animationFinished) {
[weakSelf removeFromSuperview]; [weakSelf removeFromSuperview];
}]; }];
BOOL soundSwitch = [FUSSoundAndVibrateHelper systemSoundOpen];
if (soundSwitch && FUSConfig.sharedInstanced.liveConfigs.isAnchor == NO) {
[FUSSoundAndVibrateHelper playSoundEffect:@"check_in_success" bundle:[FUSCommonBundle bundle] ofType:@"mp3"];
}
} }
@end @end
...@@ -31,4 +31,9 @@ ...@@ -31,4 +31,9 @@
*/ */
@property (nonatomic, strong) NSString *videoDuration; @property (nonatomic, strong) NSString *videoDuration;
/**
缩略图
*/
@property (nonatomic, strong) UIImage *thumbnail;
@end @end
...@@ -883,7 +883,6 @@ ...@@ -883,7 +883,6 @@
BEDEDC4C2C66076900B4B0B0 /* FUSDailyCheckInCardView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BEDEDC342C66075400B4B0B0 /* FUSDailyCheckInCardView.xib */; }; BEDEDC4C2C66076900B4B0B0 /* FUSDailyCheckInCardView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BEDEDC342C66075400B4B0B0 /* FUSDailyCheckInCardView.xib */; };
BEDEDC4D2C66076900B4B0B0 /* FUSDailyCheckInView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BEDEDC372C66075400B4B0B0 /* FUSDailyCheckInView.xib */; }; BEDEDC4D2C66076900B4B0B0 /* FUSDailyCheckInView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BEDEDC372C66075400B4B0B0 /* FUSDailyCheckInView.xib */; };
BEDEDC4E2C66076900B4B0B0 /* FUSSingleDailyCheckInView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BEDEDC3A2C66075400B4B0B0 /* FUSSingleDailyCheckInView.xib */; }; BEDEDC4E2C66076900B4B0B0 /* FUSSingleDailyCheckInView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BEDEDC3A2C66075400B4B0B0 /* FUSSingleDailyCheckInView.xib */; };
BEDEDC502C660F8300B4B0B0 /* check_in_success.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = BEDEDC4F2C660F8300B4B0B0 /* check_in_success.mp3 */; };
BEF0A6142CF5C4E200C0578D /* FUSSocialBindSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BEF0A6132CF5C4E200C0578D /* FUSSocialBindSettingViewController.m */; }; BEF0A6142CF5C4E200C0578D /* FUSSocialBindSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BEF0A6132CF5C4E200C0578D /* FUSSocialBindSettingViewController.m */; };
BEF0A6152CF5C4E200C0578D /* FUSSocialBindSettingViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = BEF0A6122CF5C4E200C0578D /* FUSSocialBindSettingViewController.h */; }; BEF0A6152CF5C4E200C0578D /* FUSSocialBindSettingViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = BEF0A6122CF5C4E200C0578D /* FUSSocialBindSettingViewController.h */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -1771,7 +1770,6 @@ ...@@ -1771,7 +1770,6 @@
BEDEDC382C66075400B4B0B0 /* FUSSingleDailyCheckInView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSSingleDailyCheckInView.h; sourceTree = "<group>"; }; BEDEDC382C66075400B4B0B0 /* FUSSingleDailyCheckInView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSSingleDailyCheckInView.h; sourceTree = "<group>"; };
BEDEDC392C66075400B4B0B0 /* FUSSingleDailyCheckInView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSSingleDailyCheckInView.m; sourceTree = "<group>"; }; BEDEDC392C66075400B4B0B0 /* FUSSingleDailyCheckInView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSSingleDailyCheckInView.m; sourceTree = "<group>"; };
BEDEDC3A2C66075400B4B0B0 /* FUSSingleDailyCheckInView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FUSSingleDailyCheckInView.xib; sourceTree = "<group>"; }; BEDEDC3A2C66075400B4B0B0 /* FUSSingleDailyCheckInView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FUSSingleDailyCheckInView.xib; sourceTree = "<group>"; };
BEDEDC4F2C660F8300B4B0B0 /* check_in_success.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = check_in_success.mp3; sourceTree = "<group>"; };
BEF0A6122CF5C4E200C0578D /* FUSSocialBindSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSSocialBindSettingViewController.h; sourceTree = "<group>"; }; BEF0A6122CF5C4E200C0578D /* FUSSocialBindSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSSocialBindSettingViewController.h; sourceTree = "<group>"; };
BEF0A6132CF5C4E200C0578D /* FUSSocialBindSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSSocialBindSettingViewController.m; sourceTree = "<group>"; }; BEF0A6132CF5C4E200C0578D /* FUSSocialBindSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSSocialBindSettingViewController.m; sourceTree = "<group>"; };
C73EF9B6903BB9ABD9479E07 /* Pods-FUSUserCenterModule.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FUSUserCenterModule.release.xcconfig"; path = "Target Support Files/Pods-FUSUserCenterModule/Pods-FUSUserCenterModule.release.xcconfig"; sourceTree = "<group>"; }; C73EF9B6903BB9ABD9479E07 /* Pods-FUSUserCenterModule.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FUSUserCenterModule.release.xcconfig"; path = "Target Support Files/Pods-FUSUserCenterModule/Pods-FUSUserCenterModule.release.xcconfig"; sourceTree = "<group>"; };
...@@ -2397,7 +2395,6 @@ ...@@ -2397,7 +2395,6 @@
BED65D1B2C62203800668116 /* common */, BED65D1B2C62203800668116 /* common */,
BED65C6A2C60B86E00668116 /* zone_bottom_view_mask_img.png */, BED65C6A2C60B86E00668116 /* zone_bottom_view_mask_img.png */,
BE4096C02C7C380A00CE2FE8 /* Info.plist */, BE4096C02C7C380A00CE2FE8 /* Info.plist */,
BEDEDC4F2C660F8300B4B0B0 /* check_in_success.mp3 */,
BED65D032C621A4F00668116 /* startPageVideo.mp4 */, BED65D032C621A4F00668116 /* startPageVideo.mp4 */,
BED65C2B2C60B85A00668116 /* FUSUserCenterAssets.xcassets */, BED65C2B2C60B85A00668116 /* FUSUserCenterAssets.xcassets */,
); );
...@@ -4092,7 +4089,6 @@ ...@@ -4092,7 +4089,6 @@
BE3625872C6B32130004606D /* 1_zone_details_animation_6@3x.png in Resources */, BE3625872C6B32130004606D /* 1_zone_details_animation_6@3x.png in Resources */,
BE3625C72C6B32130004606D /* news_feed_like_anim_1@2x.png in Resources */, BE3625C72C6B32130004606D /* news_feed_like_anim_1@2x.png in Resources */,
BE3625A92C6B32130004606D /* CheckInSuccessAnimation_24@2x.png in Resources */, BE3625A92C6B32130004606D /* CheckInSuccessAnimation_24@2x.png in Resources */,
BEDEDC502C660F8300B4B0B0 /* check_in_success.mp3 in Resources */,
BE3625D82C6B32130004606D /* zone_audio_call_btn_anim_8@2x.png in Resources */, BE3625D82C6B32130004606D /* zone_audio_call_btn_anim_8@2x.png in Resources */,
BE3625F52C6B32130004606D /* zone_video_call_btn_anim_18@2x.png in Resources */, BE3625F52C6B32130004606D /* zone_video_call_btn_anim_18@2x.png in Resources */,
BED65C602C60B85B00668116 /* zone_voice_sign_play_btn_icon_anim_2@2x.png in Resources */, BED65C602C60B85B00668116 /* zone_voice_sign_play_btn_icon_anim_2@2x.png in Resources */,
......
...@@ -439,6 +439,8 @@ ...@@ -439,6 +439,8 @@
if ([FUSImagePickerManager sharedManager].phAssetType == PHAssetMediaTypeVideo) { if ([FUSImagePickerManager sharedManager].phAssetType == PHAssetMediaTypeVideo) {
[_confirmBtn setTitle:[NSString stringWithFormat:@"%@(%ld)", self.confirmBtnTitle, [[[FUSImagePickerManager sharedManager]selectedPhotos]count]] forState:UIControlStateNormal]; [_confirmBtn setTitle:[NSString stringWithFormat:@"%@(%ld)", self.confirmBtnTitle, [[[FUSImagePickerManager sharedManager]selectedPhotos]count]] forState:UIControlStateNormal];
[_confirmBtn sizeToFit]; [_confirmBtn sizeToFit];
_confirmBtn.width = _confirmBtn.width + 50;
_confirmBtn.frame = CGRectMake(0, 0, _confirmBtn.width, _confirmBtn.frame.size.height + 4);
} else { } else {
[_confirmBtn setTitle:[NSString stringWithFormat:@"%@(%ld)",self.confirmBtnTitle,[[[FUSImagePickerManager sharedManager]selectedPhotos]count]] forState:UIControlStateNormal]; [_confirmBtn setTitle:[NSString stringWithFormat:@"%@(%ld)",self.confirmBtnTitle,[[[FUSImagePickerManager sharedManager]selectedPhotos]count]] forState:UIControlStateNormal];
} }
...@@ -448,11 +450,15 @@ ...@@ -448,11 +450,15 @@
if ([FUSImagePickerManager sharedManager].phAssetType == PHAssetMediaTypeVideo) { if ([FUSImagePickerManager sharedManager].phAssetType == PHAssetMediaTypeVideo) {
[_confirmBtn setTitle:[NSString stringWithFormat:@"%@", self.confirmBtnTitle] forState:UIControlStateNormal]; [_confirmBtn setTitle:[NSString stringWithFormat:@"%@", self.confirmBtnTitle] forState:UIControlStateNormal];
[_confirmBtn sizeToFit]; [_confirmBtn sizeToFit];
_confirmBtn.width = _confirmBtn.width + 50;
_confirmBtn.frame = CGRectMake(0, 0, _confirmBtn.width, _confirmBtn.frame.size.height + 4);
} else { } else {
[_confirmBtn setTitle:[NSString stringWithFormat:@"%@",self.confirmBtnTitle] forState:UIControlStateNormal]; [_confirmBtn setTitle:[NSString stringWithFormat:@"%@",self.confirmBtnTitle] forState:UIControlStateNormal];
} }
} }
} }
#pragma mark - Method #pragma mark - Method
...@@ -584,7 +590,7 @@ ...@@ -584,7 +590,7 @@
} }
// 图片 和 视频 // 图片 和 视频
if (([FUSImagePickerManager sharedManager].assetType == FUSAssetTypePhotoVideo || [FUSImagePickerManager sharedManager].assetType == FUSAssetTypePhotoVideoOnlyOne)&& if (([FUSImagePickerManager sharedManager].assetType == FUSAssetTypePhotoVideo || [FUSImagePickerManager sharedManager].assetType == FUSAssetTypePhotoVideoOnlyOne || [FUSImagePickerManager sharedManager].assetType == FUSAssetTypeVideo)&&
imagePickerVC.imagePickerDelegate && imagePickerVC.imagePickerDelegate &&
[imagePickerVC.imagePickerDelegate respondsToSelector:@selector(fus_imagePicker:didFinishSelectWithImageVideoArray:)]) { [imagePickerVC.imagePickerDelegate respondsToSelector:@selector(fus_imagePicker:didFinishSelectWithImageVideoArray:)]) {
...@@ -631,7 +637,7 @@ ...@@ -631,7 +637,7 @@
FUSLogInfo(@"超过最大图片个数"); FUSLogInfo(@"超过最大图片个数");
NSString *content = [NSString fus_localString:@"张图片"]; NSString *content = [NSString fus_localString:@"张图片"];
NSInteger count = 0; NSInteger count = [FUSImagePickerManager sharedManager].limit;
if ([FUSImagePickerManager sharedManager].assetType == FUSAssetTypeVideo) { if ([FUSImagePickerManager sharedManager].assetType == FUSAssetTypeVideo) {
count = [[FUSImagePickerManager sharedManager]limit]; count = [[FUSImagePickerManager sharedManager]limit];
content = [NSString fus_localString:@"个视频"]; content = [NSString fus_localString:@"个视频"];
...@@ -1218,6 +1224,7 @@ ...@@ -1218,6 +1224,7 @@
__weak typeof(cell) weakCell = cell; __weak typeof(cell) weakCell = cell;
cell.requestId = [[FUSImagePickerManager sharedManager] requestImageForAsset:asset targetSize:size contentMode:PHImageContentModeAspectFill options:options loadingView:self.view loadiCloudHandler:nil resultHandler:^(UIImage * _Nullable result) { cell.requestId = [[FUSImagePickerManager sharedManager] requestImageForAsset:asset targetSize:size contentMode:PHImageContentModeAspectFill options:options loadingView:self.view loadiCloudHandler:nil resultHandler:^(UIImage * _Nullable result) {
if (result) { if (result) {
model.thumbnail = result;
[weakCell fus_setupImage:result]; [weakCell fus_setupImage:result];
} }
}]; }];
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
#import "FUSTextField.h" #import "FUSTextField.h"
#import "FUSCustomCollectionViewLayout.h" #import "FUSCustomCollectionViewLayout.h"
#import "FUSPublishPhotoCollectionViewCell.h" #import "FUSPublishPhotoCollectionViewCell.h"
#import "TZImagePickerController.h" //#import "TZImagePickerController.h"
#import "FUSImagePickerManager.h"
#import "FUSImagePickerViewController.h"
#import "FUSMomentCreateModel.h" #import "FUSMomentCreateModel.h"
#import "FUSEditPickerView.h" #import "FUSEditPickerView.h"
#import "FUSNewsFeedPriceModel.h" #import "FUSNewsFeedPriceModel.h"
...@@ -39,7 +41,7 @@ FUSImagePickerViewControllerDelegate> ...@@ -39,7 +41,7 @@ FUSImagePickerViewControllerDelegate>
@property (nonatomic, strong) UIView *headerView; @property (nonatomic, strong) UIView *headerView;
@property (nonatomic, weak) TZImagePickerController *imagePickerVc; @property (nonatomic, strong) FUSImagePickerViewController *imagePickerVc;
@property (nonatomic, strong) UICollectionView *collectionView; @property (nonatomic, strong) UICollectionView *collectionView;
...@@ -486,11 +488,8 @@ FUSImagePickerViewControllerDelegate> ...@@ -486,11 +488,8 @@ FUSImagePickerViewControllerDelegate>
}]; }];
return;; return;;
} }
_imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 columnNumber:3 delegate:nil];
_imagePickerVc.showSelectBtn = NO;
_imagePickerVc.modalPresentationStyle = UIModalPresentationCustom;
FUSAssetType assetType = FUSAssetTypePhoto;
NSInteger leftCount = 6; NSInteger leftCount = 6;
if (_publishType == FUSPublishNewsPhoto) { if (_publishType == FUSPublishNewsPhoto) {
if (self.images.count > 6) { if (self.images.count > 6) {
...@@ -500,114 +499,26 @@ FUSImagePickerViewControllerDelegate> ...@@ -500,114 +499,26 @@ FUSImagePickerViewControllerDelegate>
}else{ }else{
leftCount = 6 - (self.images.count - 1); leftCount = 6 - (self.images.count - 1);
} }
_imagePickerVc.allowPickingVideo = NO;
}else if (_publishType == FUSPublishNewsVideo){ }else if (_publishType == FUSPublishNewsVideo){
if (self.images.count > 1) { if (self.images.count > 1) {
leftCount = 0; leftCount = 0;
}else { }else {
leftCount = 1; leftCount = 1;
} }
_imagePickerVc.allowPickingVideo = YES; assetType = FUSAssetTypeVideo;
_imagePickerVc.allowPickingImage = NO;
_imagePickerVc.allowPickingGif = NO;
// [self fus_showVideoPicker];
// return;
} }
_imagePickerVc.maxImagesCount = leftCount; //剩余可选图片
_imagePickerVc.sortAscendingByModificationDate = NO;
_imagePickerVc.autoSelectCurrentWhenDone = NO;
// _imagePickerVc.modalPresentationStyle = UIModalPresentationPageSheet;
__weak typeof(self) weakSelf = self; [FUSImagePickerManager sharedManager].confirmBtnTitle = [NSString fus_localString:@"确定"];
[self.imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { self.imagePickerVc = [[FUSImagePickerViewController alloc] initWithMaxImagesCount:leftCount columnNumber:4 isPushToPhoto:NO type:assetType];
for (int i = 0; i < photos.count; i++) {
UIImage *selImg = photos[i];
WGUploadFileModel *fileM = [WGUploadFileModel new];
fileM.fileData = UIImageJPEGRepresentation(selImg,0.8f);
fileM.key = fileM.uuid;
PHAsset *asset = assets[i];
fileM.asset = asset;
fileM.image = selImg;
fileM.key = asset.localIdentifier;
[weakSelf.images insertObject:fileM atIndex:weakSelf.images.count -1];
}
if (weakSelf.images.count > 1) {
weakSelf.postBtn.enabled = YES;
}else{
weakSelf.postBtn.enabled = NO;
}
[weakSelf.collectionView reloadData];
weakSelf.imagePickerVc = nil;
}];
self.imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen;
[self.imagePickerVc setDidFinishPickingVideoHandle:^(UIImage *coverImage, PHAsset *asset) { self.imagePickerVc.imagePickerDelegate = self;
self.imagePickerVc.showRecordBtn = NO;
WGUploadFileModel *fileM = [WGUploadFileModel new]; self.imagePickerVc.videoTimeLimit = 10 * 60;
fileM.fileData = UIImageJPEGRepresentation(coverImage,0.8f);
fileM.key = fileM.uuid;
fileM.image = coverImage;
fileM.asset = asset;
fileM.key = asset.localIdentifier;
FUSImagePickerManager *manager = [FUSImagePickerManager sharedManager];
PHVideoRequestOptions *videoOptions = [[PHVideoRequestOptions alloc] init];
videoOptions.version = PHVideoRequestOptionsVersionOriginal;
videoOptions.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
videoOptions.networkAccessAllowed = YES;
[manager requestAVAssetForVideo:asset options:videoOptions loadingView:weakSelf.view loadiCloudHandler:^(BOOL isStart) {
} resultHandler:^(AVAsset * _Nullable asset) {
AVURLAsset *urlAsset = (AVURLAsset *)asset;
weakSelf.loadingView = [[FUSFuSiLoadingView alloc] initWithFrame:weakSelf.view.bounds];
weakSelf.loadingView.state = FUSLoadingStateLoading;
weakSelf.loadingView.titleLabel.hidden = YES;
[weakSelf.view addSubview:weakSelf.loadingView];
manager.videoTimeLimit = 15.0 * 60.0;
[FUSImagePickerManager sharedManager].assetType = FUSAssetTypePhotoVideoOnlyOne;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData *data = [FUSVideoProfileHelper fus_dealVideoWithAssetDuration:urlAsset.duration avURLAsset:urlAsset];
dispatch_async(dispatch_get_main_queue(), ^{
fileM.videoData = data;
int videoDuration = (int)ceil(CMTimeGetSeconds(urlAsset.duration)*1000);
fileM.videoDuration = videoDuration;
fileM.videoLocalUrl = urlAsset.URL;
weakSelf.loadingView.hidden = YES;
if (!data) {
return;
}
if ([[urlAsset.URL.absoluteString pathExtension] isEqualToString:@"mp4"] || [[urlAsset.URL.absoluteString pathExtension] isEqualToString:@"MP4"]) { // 原来是mp4的不用转
fileM.videoType = [urlAsset.URL.absoluteString pathExtension];
}else{
fileM.videoType = @"mp4"; //自己转化的格式后缀为 mp4
}
[weakSelf.images insertObject:fileM atIndex:0];
if (weakSelf.images.count > 1) {
weakSelf.postBtn.enabled = YES;
}else{
weakSelf.postBtn.enabled = NO;
}
[weakSelf.collectionView reloadData];
});
});
}];
weakSelf.imagePickerVc = nil;
}];
[self presentViewController:self.imagePickerVc animated:YES completion:nil]; [self presentViewController:self.imagePickerVc animated:YES completion:nil];
//v5.9不要半屏
// [self presentPanModal:self.imagePickerVc completion:nil];
} }
- (void)fus_showVideoPicker{ - (void)fus_showVideoPicker{
...@@ -975,84 +886,141 @@ FUSImagePickerViewControllerDelegate> ...@@ -975,84 +886,141 @@ FUSImagePickerViewControllerDelegate>
} }
#pragma mark - FUSImagePickerViewControllerDelegate #pragma mark - FUSImagePickerViewControllerDelegate
/**
选取视频回调 - (void)fus_imagePicker:(FUSPublicImagePickerViewController *)imagePicker didFinishSelectWithArray:(NSArray<UIImage *> *)photos {
@param videos 视频数组,储存视频 URL
*/
- (void)fus_imagePicker:(FUSImagePickerViewController *)imagePicker didFinishSelectWithVideoArray:(NSArray<NSURL *> *)videos{
FUSLogDebug(@"");
} for (int i = 0; i < photos.count; i++) {
UIImage *selImg = photos[i];
WGUploadFileModel *fileM = [WGUploadFileModel new];
fileM.fileData = UIImageJPEGRepresentation(selImg,0.8f);
fileM.key = fileM.uuid;
fileM.image = selImg;
[self.images insertObject:fileM atIndex:self.images.count -1];
}
if (self.images.count > 1) {
self.postBtn.enabled = YES;
}else{
self.postBtn.enabled = NO;
}
[self.collectionView reloadData];
[imagePicker dismissViewControllerAnimated:YES completion:nil];
self.imagePickerVc = nil;
}
/** - (void)fus_imagePicker:(FUSPublicImagePickerViewController *)imagePicker didFinishSelectWithImageVideoArray:(NSArray<FUSAssetModel *> *)imageVideos {
选取了图片,数组内容为 PHAsset
*/ FUSAssetModel *assetModel = imageVideos.firstObject;
- (void)fus_imagePicker:(FUSImagePickerViewController *)imagePicker didFinishSelectWithAssetArray:(NSArray<PHAsset *> *)photos{ if (assetModel == nil) {
return;
}
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
FUSImagePickerManager *manager = [FUSImagePickerManager sharedManager]; [self fus_getThumbnailWithModel:assetModel completed:^(FUSAssetModel *resultModel) {
// for (PHAsset *asset in photos) {
// WGUploadFileModel *fileM = [WGUploadFileModel new]; WGUploadFileModel *fileM = [WGUploadFileModel new];
// fileM.fileData = UIImageJPEGRepresentation(coverImage,0.8f); fileM.fileData = UIImageJPEGRepresentation(resultModel.thumbnail,0.8f);
// fileM.key = fileM.uuid; fileM.key = fileM.uuid;
// fileM.image = coverImage; fileM.image = resultModel.thumbnail;
// fileM.asset = asset; fileM.asset = resultModel.asset;
// fileM.key = assetModel.asset.localIdentifier;
// FUSImagePickerManager *manager = [FUSImagePickerManager sharedManager]; FUSImagePickerManager *manager = [FUSImagePickerManager sharedManager];
// PHVideoRequestOptions *videoOptions = [[PHVideoRequestOptions alloc] init]; PHVideoRequestOptions *videoOptions = [[PHVideoRequestOptions alloc] init];
// videoOptions.version = PHVideoRequestOptionsVersionOriginal; videoOptions.version = PHVideoRequestOptionsVersionOriginal;
// videoOptions.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic; videoOptions.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
// videoOptions.networkAccessAllowed = YES; videoOptions.networkAccessAllowed = YES;
// [manager requestAVAssetForVideo:asset options:videoOptions loadingView:weakSelf.view loadiCloudHandler:^(BOOL isStart) { [manager requestAVAssetForVideo:assetModel.asset options:videoOptions loadingView:weakSelf.view loadiCloudHandler:^(BOOL isStart) {
//
// } resultHandler:^(AVAsset * _Nullable asset) { } resultHandler:^(AVAsset * _Nullable asset) {
// AVURLAsset *urlAsset = (AVURLAsset *)asset; AVURLAsset *urlAsset = (AVURLAsset *)asset;
//
// manager.videoTimeLimit = 15.0 * 60.0; weakSelf.loadingView = [[FUSFuSiLoadingView alloc] initWithFrame:weakSelf.view.bounds];
// [FUSImagePickerManager sharedManager].assetType = FUSAssetTypePhotoVideoOnlyOne; weakSelf.loadingView.state = FUSLoadingStateLoading;
// NSData *data = [FUSVideoProfileHelper fus_dealVideoWithAssetDuration:urlAsset.duration avURLAsset:urlAsset]; weakSelf.loadingView.titleLabel.hidden = YES;
// fileM.videoData = data; [weakSelf.view addSubview:weakSelf.loadingView];
// int videoDuration = (int)ceil(CMTimeGetSeconds(urlAsset.duration)*1000);
// fileM.videoDuration = videoDuration; manager.videoTimeLimit = 15.0 * 60.0;
// fileM.videoLocalUrl = urlAsset.URL; [FUSImagePickerManager sharedManager].assetType = FUSAssetTypePhotoVideoOnlyOne;
// if (!data) {
// return; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// } NSData *data = [FUSVideoProfileHelper fus_dealVideoWithAssetDuration:urlAsset.duration avURLAsset:urlAsset];
// dispatch_async(dispatch_get_main_queue(), ^{
// // if ([[urlAsset.URL.absoluteString pathExtension] isEqualToString:@"mp4"] || [[urlAsset.URL.absoluteString pathExtension] isEqualToString:@"MP4"]) { // 原来是mp4的不用转 fileM.videoData = data;
// fileM.videoType = [urlAsset.URL.absoluteString pathExtension]; int videoDuration = (int)ceil(CMTimeGetSeconds(urlAsset.duration)*1000);
// // }else{ fileM.videoDuration = videoDuration;
// // fileM.videoType = @"mp4"; //自己转化的格式后缀为 mp4 fileM.videoLocalUrl = urlAsset.URL;
// // } weakSelf.loadingView.hidden = YES;
// if (!data) {
// [weakSelf.images insertObject:fileM atIndex:0]; return;
// }
// if (weakSelf.images.count > 1) {
// weakSelf.itemR.enabled = YES; if ([[urlAsset.URL.absoluteString pathExtension] isEqualToString:@"mp4"] || [[urlAsset.URL.absoluteString pathExtension] isEqualToString:@"MP4"]) { // 原来是mp4的不用转
// }else{ fileM.videoType = [urlAsset.URL.absoluteString pathExtension];
// weakSelf.itemR.enabled = NO; }else{
// } fileM.videoType = @"mp4"; //自己转化的格式后缀为 mp4
// }
// [weakSelf.collectionView reloadData];
// }]; [weakSelf.images insertObject:fileM atIndex:0];
// };
if (weakSelf.images.count > 1) {
weakSelf.postBtn.enabled = YES;
}else{
weakSelf.postBtn.enabled = NO;
}
[weakSelf.collectionView reloadData];
});
});
}];
[imagePicker dismissViewControllerAnimated:YES completion:nil];
weakSelf.imagePickerVc = nil;
}];
} }
#pragma mark - getter - (void)fus_imagePickerDidCancle:(FUSPublicImagePickerViewController *)imagePicker{
- (TZImagePickerController *)imagePickerVc{ [imagePicker dismissViewControllerAnimated:YES completion:^{
if (_imagePickerVc == nil) { }];
// _imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:nil]; }
// _imagePickerVc.showSelectBtn = NO;
// _imagePickerVc.maxImagesCount = 6; - (void)fus_getThumbnailWithModel:(FUSAssetModel *)assetModel completed:(void(^)(FUSAssetModel *resultModel))completed {
// _imagePickerVc.sortAscendingByModificationDate = NO;
// _imagePickerVc.autoSelectCurrentWhenDone = NO; if (completed == nil) { return; }
// _imagePickerVc.modalPresentationStyle = UIModalPresentationPageSheet;
if (assetModel.thumbnail) {
completed(assetModel);
} else {
PHImageRequestOptions *options = [[PHImageRequestOptions alloc]init];
options.resizeMode = PHImageRequestOptionsResizeModeExact;
options.synchronous = NO;
[[FUSImagePickerManager sharedManager] requestImageForAsset:assetModel.asset targetSize:CGSizeMake(100, 100) contentMode:PHImageContentModeAspectFill options:options loadingView:self.view loadiCloudHandler:nil resultHandler:^(UIImage * _Nullable result) {
if (result) {
assetModel.thumbnail = result;
completed(assetModel);
}
}];
} }
return _imagePickerVc;
} }
#pragma mark - getter
//- (TZImagePickerController *)imagePickerVc{
// if (_imagePickerVc == nil) {
//// _imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:nil];
//// _imagePickerVc.showSelectBtn = NO;
//// _imagePickerVc.maxImagesCount = 6;
//// _imagePickerVc.sortAscendingByModificationDate = NO;
//// _imagePickerVc.autoSelectCurrentWhenDone = NO;
//// _imagePickerVc.modalPresentationStyle = UIModalPresentationPageSheet;
// }
// return _imagePickerVc;
//}
- (NSMutableArray<WGUploadFileModel *> *)images{ - (NSMutableArray<WGUploadFileModel *> *)images{
if (!_images) { if (!_images) {
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
#import <JavaScriptCore/JavaScriptCore.h> #import <JavaScriptCore/JavaScriptCore.h>
#import "CustomIOSAlertView.h" #import "CustomIOSAlertView.h"
#import "WGInputAlertView.h" #import "WGInputAlertView.h"
#import "TZImagePickerController.h" //#import "TZImagePickerController.h"
#import "FUSImagePickerViewController.h"
#import "FUSMainSearchViewController.h" #import "FUSMainSearchViewController.h"
#import "ResultViewController.h" #import "ResultViewController.h"
...@@ -35,7 +36,8 @@ WGEditorToolBarDelegate, ...@@ -35,7 +36,8 @@ WGEditorToolBarDelegate,
WGFontStyleBarDelegate, WGFontStyleBarDelegate,
CustomIOSAlertViewDelegate, CustomIOSAlertViewDelegate,
UIScrollViewDelegate, UIScrollViewDelegate,
WKScriptMessageHandler WKScriptMessageHandler,
FUSImagePickerViewControllerDelegate
> >
{ {
dispatch_queue_t queue; dispatch_queue_t queue;
...@@ -45,7 +47,7 @@ WKScriptMessageHandler ...@@ -45,7 +47,7 @@ WKScriptMessageHandler
@property (nonatomic,strong) CustomIOSAlertView *alertView; @property (nonatomic,strong) CustomIOSAlertView *alertView;
@property (nonatomic,strong) WGInputAlertView *inputAlertView; @property (nonatomic,strong) WGInputAlertView *inputAlertView;
@property (nonatomic,strong) WGFontStyleBar *fontBar; @property (nonatomic,strong) WGFontStyleBar *fontBar;
@property (nonatomic,strong) TZImagePickerController *imagePickerVc; @property (nonatomic,strong) FUSImagePickerViewController *imagePickerVc;
@property (nonatomic,strong) NSMutableArray <WGUploadFileModel*>*uploadArr; @property (nonatomic,strong) NSMutableArray <WGUploadFileModel*>*uploadArr;
@property (nonatomic,assign) CGFloat lastPostion; @property (nonatomic,assign) CGFloat lastPostion;
...@@ -83,7 +85,7 @@ WKScriptMessageHandler ...@@ -83,7 +85,7 @@ WKScriptMessageHandler
[super viewDidLoad]; [super viewDidLoad];
self.view.backgroundColor = UIColor.fus_appBGColor; self.view.backgroundColor = UIColor.fus_appBGColor;
// self.view.backgroundColor = [UIColor redColor]; // self.view.backgroundColor = [UIColor redColor];
//防止导航出现色差 //防止导航出现色差
self.navigationController.navigationBar.translucent = NO; self.navigationController.navigationBar.translucent = NO;
self.tabBarController.tabBar.backgroundColor = WG_BLACK; self.tabBarController.tabBar.backgroundColor = WG_BLACK;
...@@ -155,7 +157,7 @@ WKScriptMessageHandler ...@@ -155,7 +157,7 @@ WKScriptMessageHandler
//添加WebView加载HTML //添加WebView加载HTML
[self.view addSubview:self.webView]; [self.view addSubview:self.webView];
[self.webView allowDisplayingKeyboardWithoutUserAction]; [self.webView allowDisplayingKeyboardWithoutUserAction];
// [self clearWebCache]; // [self clearWebCache];
if (self.webHTML == nil) { if (self.webHTML == nil) {
self.webHTML = [NSString stringWithFormat:@"%@?lang=%@", FUSCommonWebURLs.fus_newsfeedInput,FUSLocalizationHelper.fus_currentLanguage.languageID]; self.webHTML = [NSString stringWithFormat:@"%@?lang=%@", FUSCommonWebURLs.fus_newsfeedInput,FUSLocalizationHelper.fus_currentLanguage.languageID];
} }
...@@ -174,7 +176,7 @@ WKScriptMessageHandler ...@@ -174,7 +176,7 @@ WKScriptMessageHandler
- (void)getTitle{ - (void)getTitle{
if ([self isUploadResult]) { if ([self isUploadResult]) {
// [SVProgressHUD showErrorWithStatus:@"图片未上传成功"]; // [SVProgressHUD showErrorWithStatus:@"图片未上传成功"];
return; return;
} }
...@@ -188,7 +190,7 @@ WKScriptMessageHandler ...@@ -188,7 +190,7 @@ WKScriptMessageHandler
} }
- (void)getText{ - (void)getText{
if ([self isUploadResult]) { if ([self isUploadResult]) {
// [SVProgressHUD showErrorWithStatus:@"图片未上传成功"]; // [SVProgressHUD showErrorWithStatus:@"图片未上传成功"];
return; return;
} }
[self.webView contentTextHandleCallback:^(id _Nullable obj, NSError * _Nullable error) { [self.webView contentTextHandleCallback:^(id _Nullable obj, NSError * _Nullable error) {
...@@ -252,13 +254,13 @@ WKScriptMessageHandler ...@@ -252,13 +254,13 @@ WKScriptMessageHandler
[self.webView getLastContentHtmlTextHandleCallback:^(id _Nullable HTMLContent, NSError * _Nullable error) { [self.webView getLastContentHtmlTextHandleCallback:^(id _Nullable HTMLContent, NSError * _Nullable error) {
NSMutableString *mutStr = [NSMutableString stringWithString:HTMLContent]; NSMutableString *mutStr = [NSMutableString stringWithString:HTMLContent];
// [FUSAlertView showAlertWithTitle:nil message:HTMLContent cancelButtonTitle:@"确认" otherButtonTitles:nil clickBlock:^(NSInteger buttonIndex) { // [FUSAlertView showAlertWithTitle:nil message:HTMLContent cancelButtonTitle:@"确认" otherButtonTitles:nil clickBlock:^(NSInteger buttonIndex) {
// //
// }]; // }];
// //
// [self.view endEditing:YES]; // [self.view endEditing:YES];
// //
// return; // return;
[self.webView getImagesAndAtSomeOneIDListHandleCallback:^(id _Nullable obj, NSError * _Nullable error) { [self.webView getImagesAndAtSomeOneIDListHandleCallback:^(id _Nullable obj, NSError * _Nullable error) {
NSArray *images = obj[@"img"]; NSArray *images = obj[@"img"];
...@@ -345,7 +347,7 @@ WKScriptMessageHandler ...@@ -345,7 +347,7 @@ WKScriptMessageHandler
[_addressBgView addSubview:_addressBtn]; [_addressBgView addSubview:_addressBtn];
_addressBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; _addressBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
[_addressBtn addTarget:self action:@selector(getAddress) forControlEvents:UIControlEventTouchUpInside]; [_addressBtn addTarget:self action:@selector(getAddress) forControlEvents:UIControlEventTouchUpInside];
// self.addressBgView.top = self.view.height - self.addressBgView.height - self.keboardHeight - self.toolBar.height; // self.addressBgView.top = self.view.height - self.addressBgView.height - self.keboardHeight - self.toolBar.height;
[self.view addSubview:_addressBgView]; [self.view addSubview:_addressBgView];
...@@ -379,7 +381,7 @@ WKScriptMessageHandler ...@@ -379,7 +381,7 @@ WKScriptMessageHandler
- (void)fus_switchSynAddress:(UISwitch *)sender{ - (void)fus_switchSynAddress:(UISwitch *)sender{
if (sender.isOn) { if (sender.isOn) {
[self getAddress]; [self getAddress];
}else{ }else{
...@@ -410,21 +412,21 @@ WKScriptMessageHandler ...@@ -410,21 +412,21 @@ WKScriptMessageHandler
return _fontBar; return _fontBar;
} }
- (TZImagePickerController *)imagePickerVc{ //- (FUSImagePickerViewController *)imagePickerVc{
if (_imagePickerVc == nil) { // if (_imagePickerVc == nil) {
// _imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:6 delegate:nil]; //// _imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:6 delegate:nil];
// _imagePickerVc.showSelectBtn = NO; //// _imagePickerVc.showSelectBtn = NO;
// _imagePickerVc.sortAscendingByModificationDate = NO; //// _imagePickerVc.sortAscendingByModificationDate = NO;
// _imagePickerVc.modalPresentationStyle = UIModalPresentationOverCurrentContext; //// _imagePickerVc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
} // }
return _imagePickerVc; // return _imagePickerVc;
} //}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{ - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
_hiddenKeyBoard = YES; _hiddenKeyBoard = YES;
[self.webView hiddenKeyboard]; [self.webView hiddenKeyboard];
// FUSLogDebug(@""); // FUSLogDebug(@"");
} }
- (NSMutableArray<WGUploadFileModel *> *)uploadArr{ - (NSMutableArray<WGUploadFileModel *> *)uploadArr{
...@@ -448,13 +450,13 @@ WKScriptMessageHandler ...@@ -448,13 +450,13 @@ WKScriptMessageHandler
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
[webView getCaretYPositionPositionHandleCallback:^(id _Nullable obj, NSError * _Nullable error) { [webView getCaretYPositionPositionHandleCallback:^(id _Nullable obj, NSError * _Nullable error) {
CGFloat currentPos = [obj floatValue]; CGFloat currentPos = [obj floatValue];
if (weakSelf.lastPostion != currentPos) { if (weakSelf.lastPostion != currentPos) {
weakSelf.lastPostion = currentPos; weakSelf.lastPostion = currentPos;
if (currentPos > weakSelf.webView.height - 65) { if (currentPos > weakSelf.webView.height - 65) {
// FUSLogDebug(@"===aaaa %f",(currentPos - (weakSelf.webView.height - 65))); // FUSLogDebug(@"===aaaa %f",(currentPos - (weakSelf.webView.height - 65)));
// [weakSelf.webView autoScrollTop:currentPos - (weakSelf.webView.height - 65)]; // [weakSelf.webView autoScrollTop:currentPos - (weakSelf.webView.height - 65)];
} }
} }
...@@ -473,93 +475,93 @@ WKScriptMessageHandler ...@@ -473,93 +475,93 @@ WKScriptMessageHandler
/// 检测内容是否可以发布 /// 检测内容是否可以发布
- (void)fus_checkInputContent{ - (void)fus_checkInputContent{
[self.webView titleTextHandleCallback:^(NSString *_Nullable title, NSError * _Nullable error) { [self.webView titleTextHandleCallback:^(NSString *_Nullable title, NSError * _Nullable error) {
NSString *titleStr = [title stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; NSString *titleStr = [title stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
if (titleStr.length < 5) { if (titleStr.length < 5) {
self.rightBtn.enabled = NO; self.rightBtn.enabled = NO;
return;
}
[self.webView contentTextHandleCallback:^(id _Nullable content, NSError * _Nullable error) {
NSString *contentStr = [content stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
if ([NSString isNull:contentStr]) {
[self.webView getImagesAndAtSomeOneIDListHandleCallback:^(NSDictionary *objs, NSError * _Nullable error) {
NSArray *images = objs[@"img"];
NSArray *uids = objs[@"uid"];
if (images.count > 0 || uids.count > 0) {
self.rightBtn.enabled = YES;
}else{
self.rightBtn.enabled = NO;
}
}];
return; return;
} }
self.rightBtn.enabled = YES;
[self.webView contentTextHandleCallback:^(id _Nullable content, NSError * _Nullable error) { FUSLogDebug(@"");
NSString *contentStr = [content stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
if ([NSString isNull:contentStr]) {
[self.webView getImagesAndAtSomeOneIDListHandleCallback:^(NSDictionary *objs, NSError * _Nullable error) {
NSArray *images = objs[@"img"];
NSArray *uids = objs[@"uid"];
if (images.count > 0 || uids.count > 0) {
self.rightBtn.enabled = YES;
}else{
self.rightBtn.enabled = NO;
}
}];
return;
}
self.rightBtn.enabled = YES;
FUSLogDebug(@"");
}];
}]; }];
}];
} }
/// 检测内容是否可以发布 /// 检测内容是否可以发布
- (void)fus_checkPopViewContoller{ - (void)fus_checkPopViewContoller{
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
[self.webView titleTextHandleCallback:^(NSString *_Nullable title, NSError * _Nullable error) { [self.webView titleTextHandleCallback:^(NSString *_Nullable title, NSError * _Nullable error) {
if (![NSString isNull:title]) { if (![NSString isNull:title]) {
[FUSAlertView showAlertWithTitle:[NSString fus_localString:@"确认取消发布动态吗?"] message:nil cancelButtonTitle:[NSString fus_localString:@"取消"] otherButtonTitles:@[[NSString fus_localString:@"确定"]] clickBlock:^(NSInteger buttonIndex) {
if (buttonIndex == 1) {
[weakSelf.navigationController popViewControllerAnimated:YES];
}
}];
return;
}
[weakSelf.webView contentTextHandleCallback:^(NSString *content, NSError * _Nullable error) {
if ([NSString isNull:content]) {
[weakSelf.webView getImagesAndAtSomeOneIDListHandleCallback:^(NSDictionary *objs, NSError * _Nullable error) {
NSArray *images = objs[@"img"];
NSArray *uids = objs[@"uid"];
if (images.count > 0 || uids.count > 0) {
[FUSAlertView showAlertWithTitle:[NSString fus_localString:@"确认取消发布动态吗?"] message:nil cancelButtonTitle:[NSString fus_localString:@"取消"] otherButtonTitles:@[[NSString fus_localString:@"确定"]] clickBlock:^(NSInteger buttonIndex) {
if (buttonIndex == 1) {
[self.navigationController popViewControllerAnimated:YES];
}
}];
return;
}else{
[self.navigationController popViewControllerAnimated:YES];
}
}];
return;
}else{
[FUSAlertView showAlertWithTitle:[NSString fus_localString:@"确认取消发布动态吗?"] message:nil cancelButtonTitle:[NSString fus_localString:@"取消"] otherButtonTitles:@[[NSString fus_localString:@"确定"]] clickBlock:^(NSInteger buttonIndex) { [FUSAlertView showAlertWithTitle:[NSString fus_localString:@"确认取消发布动态吗?"] message:nil cancelButtonTitle:[NSString fus_localString:@"取消"] otherButtonTitles:@[[NSString fus_localString:@"确定"]] clickBlock:^(NSInteger buttonIndex) {
if (buttonIndex == 1) { if (buttonIndex == 1) {
[weakSelf.navigationController popViewControllerAnimated:YES]; [self.navigationController popViewControllerAnimated:YES];
} }
}]; }];
return; return;
} }
[weakSelf.webView contentTextHandleCallback:^(NSString *content, NSError * _Nullable error) { FUSLogDebug(@"");
if ([NSString isNull:content]) {
[weakSelf.webView getImagesAndAtSomeOneIDListHandleCallback:^(NSDictionary *objs, NSError * _Nullable error) {
NSArray *images = objs[@"img"];
NSArray *uids = objs[@"uid"];
if (images.count > 0 || uids.count > 0) {
[FUSAlertView showAlertWithTitle:[NSString fus_localString:@"确认取消发布动态吗?"] message:nil cancelButtonTitle:[NSString fus_localString:@"取消"] otherButtonTitles:@[[NSString fus_localString:@"确定"]] clickBlock:^(NSInteger buttonIndex) {
if (buttonIndex == 1) {
[self.navigationController popViewControllerAnimated:YES];
}
}];
return;
}else{
[self.navigationController popViewControllerAnimated:YES];
}
}];
return;
}else{
[FUSAlertView showAlertWithTitle:[NSString fus_localString:@"确认取消发布动态吗?"] message:nil cancelButtonTitle:[NSString fus_localString:@"取消"] otherButtonTitles:@[[NSString fus_localString:@"确定"]] clickBlock:^(NSInteger buttonIndex) {
if (buttonIndex == 1) {
[self.navigationController popViewControllerAnimated:YES];
}
}];
return;
}
FUSLogDebug(@"");
}];
}]; }];
}];
} }
///MARK:图片操作 ///MARK:图片操作
- (BOOL)handleWithString:(NSString *)urlString{ - (BOOL)handleWithString:(NSString *)urlString{
if ([urlString hasPrefix:@"protocol://iOS?code=uploadResult&data="]){ if ([urlString hasPrefix:@"protocol://iOS?code=uploadResult&data="]){
//获取当前 //获取当前
NSRange range = [urlString rangeOfString:@"protocol://iOS?code=uploadResult&data="]; NSRange range = [urlString rangeOfString:@"protocol://iOS?code=uploadResult&data="];
NSString *dictString = [urlString substringFromIndex:range.length]; NSString *dictString = [urlString substringFromIndex:range.length];
NSLog(@"截取后:%@",dictString); NSLog(@"截取后:%@",dictString);
...@@ -590,7 +592,7 @@ WKScriptMessageHandler ...@@ -590,7 +592,7 @@ WKScriptMessageHandler
//重传 //重传
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
[[WGUploadFileTool alloc] upLoadFileModel:fileM Callback:^(NSString * _Nonnull key, float percent, id _Nullable obj, NSError * _Nullable error) { [[WGUploadFileTool alloc] upLoadFileModel:fileM Callback:^(NSString * _Nonnull key, float percent, id _Nullable obj, NSError * _Nullable error) {
WGUploadFileModel *fileM = [weakSelf fileModelWithKey:key]; WGUploadFileModel *fileM = [weakSelf fileModelWithKey:key];
if (percent < 1) { if (percent < 1) {
//正在上传 //正在上传
...@@ -641,7 +643,7 @@ WKScriptMessageHandler ...@@ -641,7 +643,7 @@ WKScriptMessageHandler
if (self.keboardHeight == 0) { if (self.keboardHeight == 0) {
return; return;
} }
CGFloat height = WG_SCREEN_HEIGHT - self.addressBgView.height - WG_SafeAreaTopHeight - self.keboardHeight; CGFloat height = WG_SCREEN_HEIGHT - self.addressBgView.height - WG_SafeAreaTopHeight - self.keboardHeight;
CGFloat height2 = WG_SCREEN_HEIGHT - self.toolBar.height - self.addressBgView.height - WG_SafeAreaTopHeight - self.keboardHeight; CGFloat height2 = WG_SCREEN_HEIGHT - self.toolBar.height - self.addressBgView.height - WG_SafeAreaTopHeight - self.keboardHeight;
...@@ -650,9 +652,9 @@ WKScriptMessageHandler ...@@ -650,9 +652,9 @@ WKScriptMessageHandler
if (isEditorTitle){ if (isEditorTitle){
self.addressBgView.top = self.view.height - self.addressBgView.height - self.keboardHeight; self.addressBgView.top = self.view.height - self.addressBgView.height - self.keboardHeight;
self.webView.height = height; self.webView.height = height;
// [FUSDialogView fus_showDialog:@"点击了标题"]; // [FUSDialogView fus_showDialog:@"点击了标题"];
}else if(self.keboardHeight > 0){ }else if(self.keboardHeight > 0){
// [FUSDialogView fus_showDialog:@"点击了内容内容内容"]; // [FUSDialogView fus_showDialog:@"点击了内容内容内容"];
self.addressBgView.top = self.view.height - self.addressBgView.height - self.keboardHeight - self.toolBar.height; self.addressBgView.top = self.view.height - self.addressBgView.height - self.keboardHeight - self.toolBar.height;
if(self.webView.height != height2){ if(self.webView.height != height2){
self.webView.height = height2; self.webView.height = height2;
...@@ -667,7 +669,7 @@ WKScriptMessageHandler ...@@ -667,7 +669,7 @@ WKScriptMessageHandler
[self.fontBar updateFontBarWithButtonName:className]; [self.fontBar updateFontBarWithButtonName:className];
if ([[className componentsSeparatedByString:@","] containsObject:@"unorderedList"]) { if ([[className componentsSeparatedByString:@","] containsObject:@"unorderedList"]) {
// [self.webView placeHolderWithHidden:YES]; // [self.webView placeHolderWithHidden:YES];
} }
} }
} }
...@@ -708,8 +710,8 @@ WKScriptMessageHandler ...@@ -708,8 +710,8 @@ WKScriptMessageHandler
[self showPhotoPicker]; [self showPhotoPicker];
}); });
}]; }];
}else{ }else{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self.webView contentBecomeFirstResponder]; [self.webView contentBecomeFirstResponder];
...@@ -735,7 +737,7 @@ WKScriptMessageHandler ...@@ -735,7 +737,7 @@ WKScriptMessageHandler
}); });
}]; }];
} }
} }
break; break;
...@@ -793,7 +795,7 @@ WKScriptMessageHandler ...@@ -793,7 +795,7 @@ WKScriptMessageHandler
- (void)atSomeOneAction{ - (void)atSomeOneAction{
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
_hiddenKeyBoard = YES; _hiddenKeyBoard = YES;
// [self.webView undo]; // [self.webView undo];
FUSMainSearchViewController *searchVC = [[FUSMainSearchViewController alloc] init]; FUSMainSearchViewController *searchVC = [[FUSMainSearchViewController alloc] init];
searchVC.fromType = FUSSearchFromAtSomeOne; searchVC.fromType = FUSSearchFromAtSomeOne;
searchVC.modalPresentationStyle = UIModalPresentationCustom; searchVC.modalPresentationStyle = UIModalPresentationCustom;
...@@ -804,7 +806,7 @@ WKScriptMessageHandler ...@@ -804,7 +806,7 @@ WKScriptMessageHandler
}]; }];
[weakSelf.atSomeOneArr addObject:model]; [weakSelf.atSomeOneArr addObject:model];
}; };
searchVC.dismissCompletion = ^{ searchVC.dismissCompletion = ^{
[weakSelf.webView contentBecomeFirstResponder]; [weakSelf.webView contentBecomeFirstResponder];
}; };
...@@ -834,17 +836,17 @@ WKScriptMessageHandler ...@@ -834,17 +836,17 @@ WKScriptMessageHandler
*/ */
- (UIImage *)addImage:(UIImage *)useImage addMsakImage:(UIImage *)maskImage - (UIImage *)addImage:(UIImage *)useImage addMsakImage:(UIImage *)maskImage
{ {
UIGraphicsBeginImageContextWithOptions(useImage.size ,NO, 0.0); // 0.0 for scale means "scale for device's main screen". UIGraphicsBeginImageContextWithOptions(useImage.size ,NO, 0.0); // 0.0 for scale means "scale for device's main screen".
[useImage drawInRect:CGRectMake(0, 0, useImage.size.width, useImage.size.height)]; [useImage drawInRect:CGRectMake(0, 0, useImage.size.width, useImage.size.height)];
//四个参数为水印图片的位置 //四个参数为水印图片的位置
// 145 × 29 // 145 × 29
// if (@available(iOS 11.0, *)) { // if (@available(iOS 11.0, *)) {
[maskImage drawInRect:CGRectMake(useImage.size.width - 115 - 24, 20, 115, 20)]; [maskImage drawInRect:CGRectMake(useImage.size.width - 115 - 24, 20, 115, 20)];
// } else { // } else {
// [maskImage drawInRect:CGRectMake(useImage.size.width - 115, useImage.size.height - 23, 115, 23)]; // [maskImage drawInRect:CGRectMake(useImage.size.width - 115, useImage.size.height - 23, 115, 23)];
// } // }
UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext(); UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext(); UIGraphicsEndImageContext();
return resultingImage; return resultingImage;
...@@ -910,13 +912,13 @@ WKScriptMessageHandler ...@@ -910,13 +912,13 @@ WKScriptMessageHandler
}else{ }else{
[self.webView indent]; [self.webView indent];
} }
} }
} }
break; break;
case 11:{ case 11:{
} }
break; break;
default: default:
...@@ -958,10 +960,6 @@ WKScriptMessageHandler ...@@ -958,10 +960,6 @@ WKScriptMessageHandler
return; return;
} }
__weak typeof(self) weakSelf = self;
__weak dispatch_group_t blockGroup = group;
__weak dispatch_queue_t blockQueue = queue;
[self.webView getImagesAndAtSomeOneIDListHandleCallback:^(id _Nullable obj, NSError * _Nullable error) { [self.webView getImagesAndAtSomeOneIDListHandleCallback:^(id _Nullable obj, NSError * _Nullable error) {
NSArray *images = obj[@"img"]; NSArray *images = obj[@"img"];
...@@ -970,96 +968,19 @@ WKScriptMessageHandler ...@@ -970,96 +968,19 @@ WKScriptMessageHandler
[FUSDialogView fus_showDialog:[NSString fus_localString:@"已达到最大可选数量"]]; [FUSDialogView fus_showDialog:[NSString fus_localString:@"已达到最大可选数量"]];
return; return;
} }
_imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:6 columnNumber:3 delegate:nil];
_imagePickerVc.maxImagesCount = 6 - images.count;
_imagePickerVc.showSelectBtn = YES;
_imagePickerVc.sortAscendingByModificationDate = NO;
_imagePickerVc.allowPickingOriginalPhoto = YES;
self.imagePickerVc.allowPickingVideo = NO; self.imagePickerVc = [[FUSImagePickerViewController alloc] initWithMaxImagesCount:6 - images.count columnNumber:4 isPushToPhoto:NO type:FUSAssetTypePhoto];
[self.imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { self.imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen;
self.imagePickerVc.imagePickerDelegate = self;
NSMutableArray *selectArr = [NSMutableArray array]; self.imagePickerVc.showRecordBtn = NO;
for (int i = 0; i < photos.count; i++) {
UIImage *image = photos[i];
PHAsset *asset = assets[i];
NSString *filename = [asset valueForKey:@"filename"];
NSString *dirPath = [NSHomeDirectory() stringByAppendingPathComponent: [NSString stringWithFormat:tempPath]];
[weakSelf createDirectoryAtPath:dirPath error:nil];
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent: [NSString stringWithFormat:@"%@/%@",tempPath,filename]];
// 把文件移到本地sever所在目录
[UIImagePNGRepresentation(image) writeToFile:path atomically:true];
NSString *localPath = [NSString stringWithFormat:@"http://localhost/%@/%@",tempPath,filename];
FUSLogDebug(@"插入的图片名:%@ , 要插入文件路径: %@ , sever所在目录:%@",filename,dirPath,localPath);
WGUploadFileModel *fileM = [WGUploadFileModel new];
fileM.fileData = UIImageJPEGRepresentation(image,0.8f);
fileM.key = fileM.uuid;
fileM.image = image;
fileM.localUrl = localPath;
[weakSelf.uploadArr addObject:fileM];
[selectArr addObject:fileM];
// [weakSelf.webView insertImageUrl:localPath index:weakSelf.imageIndex alt:];
[weakSelf.webView insertImageBase64:fileM.fileData Url:localPath index:weakSelf.imageIndex alt:@"loading..."];
// [weakSelf.webView insetImage:fileM.fileData key:localPath];
NSString *key = [NSString stringWithFormat:@"%ld",weakSelf.imageIndex];
weakSelf.imageInfo[key] = fileM;
weakSelf.imageIndex += 1;
dispatch_group_enter(blockGroup);
}
dispatch_group_async(blockGroup, blockQueue, ^{
[[WGUploadFileTool alloc] upLoadFileModels:[selectArr copy] Callback:^(NSString * _Nonnull key, float percent, id _Nullable obj, NSError * _Nullable error) {
WGUploadFileModel *fileM = [weakSelf fileModelWithKey:key];
if (percent < 1) {
//正在上传
// [weakSelf.webView insetImageKey:fileM.key progress:percent];
}else{
// [weakSelf.webView setupContentDisable:true];
if (obj) {
// 上传成功
fileM.state = WGUploadFileStateSuccess;
fileM.uploadUrl = [FUSConfig.sharedInstanced.pathConfigs webImagePath:obj];
[weakSelf.imageDict setValue:fileM forKey:fileM.localUrl];
// [weakSelf successWithKey:fileM.key url:testUrl];
}else{
// 上传失败
fileM.state = WGUploadFileStateError;
[weakSelf.webView uploadErrorKey:fileM.key];
weakSelf.autoPublish = NO;
[FUSLoadingView fus_dismissProgressView];
}
}
dispatch_group_leave(blockGroup);
}];
});
dispatch_group_notify(blockGroup, blockQueue, ^{
if (weakSelf.autoPublish) {
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf getHTML]; //发布
});
}
});
weakSelf.imagePickerVc = nil;
}];
[self presentViewController:self.imagePickerVc animated:YES completion:nil]; [self presentViewController:self.imagePickerVc animated:YES completion:nil];
}]; }];
} }
- (BOOL)createDirectoryAtPath:(NSString *)path error:(NSError *__autoreleasing *)error { - (BOOL)createDirectoryAtPath:(NSString *)path error:(NSError *__autoreleasing *)error {
NSFileManager *manager = [NSFileManager defaultManager]; NSFileManager *manager = [NSFileManager defaultManager];
/* createDirectoryAtPath:withIntermediateDirectories:attributes:error: /* createDirectoryAtPath:withIntermediateDirectories:attributes:error:
...@@ -1067,7 +988,7 @@ WKScriptMessageHandler ...@@ -1067,7 +988,7 @@ WKScriptMessageHandler
* 参数2:是否创建媒介的布尔值,一般为YES * 参数2:是否创建媒介的布尔值,一般为YES
* 参数3: 属性,没有就置为nil * 参数3: 属性,没有就置为nil
* 参数4: 错误信息 * 参数4: 错误信息
*/ */
BOOL isSuccess = [manager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:error]; BOOL isSuccess = [manager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:error];
return isSuccess; return isSuccess;
} }
...@@ -1127,7 +1048,7 @@ WKScriptMessageHandler ...@@ -1127,7 +1048,7 @@ WKScriptMessageHandler
if (selectionStr.length > 0) { if (selectionStr.length > 0) {
[self.webView getSelectionHandleCallback:^(id _Nullable obj, NSError * _Nullable error) { [self.webView getSelectionHandleCallback:^(id _Nullable obj, NSError * _Nullable error) {
if (error == nil) { if (error == nil) {
NSString *tagStr = obj; NSString *tagStr = obj;
if ([tagStr isEqualToString:@"A"]) { if ([tagStr isEqualToString:@"A"]) {
...@@ -1192,11 +1113,11 @@ WKScriptMessageHandler ...@@ -1192,11 +1113,11 @@ WKScriptMessageHandler
{ {
if (buttonIndex == 1) { if (buttonIndex == 1) {
if (_inputAlertView.topTextField.text.length <= 0) { if (_inputAlertView.topTextField.text.length <= 0) {
// [SVProgressHUD showErrorWithStatus:@"文本内容不能为空"]; // [SVProgressHUD showErrorWithStatus:@"文本内容不能为空"];
return; return;
} }
if (_inputAlertView.midTextField.text.length <= 0) { if (_inputAlertView.midTextField.text.length <= 0) {
// [SVProgressHUD showErrorWithStatus:@"链接地址不能为空"]; // [SVProgressHUD showErrorWithStatus:@"链接地址不能为空"];
return; return;
} }
...@@ -1229,7 +1150,7 @@ WKScriptMessageHandler ...@@ -1229,7 +1150,7 @@ WKScriptMessageHandler
[_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]];
} }
@try { @try {
// [self.toolBar removeObserver:self forKeyPath:@"transform"]; // [self.toolBar removeObserver:self forKeyPath:@"transform"];
} @catch (NSException *exception){ } @catch (NSException *exception){
NSLog(@"Exception: %@", exception); NSLog(@"Exception: %@", exception);
} @finally { } @finally {
...@@ -1238,7 +1159,7 @@ WKScriptMessageHandler ...@@ -1238,7 +1159,7 @@ WKScriptMessageHandler
} }
- (FUSPublicIMEmojiView *)chatIMEmojiView { - (FUSPublicIMEmojiView *)chatIMEmojiView {
if (!_chatIMEmojiView) { if (!_chatIMEmojiView) {
_chatIMEmojiView = [FUSRouter.chatRouter createImEmojiViewWithFrame:CGRectMake(0, 0,UIView.fus_screenW , FUSPublicIMEmojiView.fus_emojiInputViewHeight - FUSChatPublicDefine.fus_bottomViewHeight)]; _chatIMEmojiView = [FUSRouter.chatRouter createImEmojiViewWithFrame:CGRectMake(0, 0,UIView.fus_screenW , FUSPublicIMEmojiView.fus_emojiInputViewHeight - FUSChatPublicDefine.fus_bottomViewHeight)];
_chatIMEmojiView.delegate = self; _chatIMEmojiView.delegate = self;
...@@ -1264,13 +1185,13 @@ WKScriptMessageHandler ...@@ -1264,13 +1185,13 @@ WKScriptMessageHandler
CGFloat toolBarHeight = self.toolBar.frame.size.height; CGFloat toolBarHeight = self.toolBar.frame.size.height;
_hiddenKeyBoard = NO; _hiddenKeyBoard = NO;
if (frame.origin.y == WG_SCREEN_HEIGHT) { if (frame.origin.y == WG_SCREEN_HEIGHT) {
// [UIView animateWithDuration:duration animations:^{ // [UIView animateWithDuration:duration animations:^{
// self.toolBar.y = self.view.height - frame.size.height - toolBarHeight; // self.toolBar.y = self.view.height - frame.size.height - toolBarHeight;
// self.toolBar.keyBoardSelected = NO; // self.toolBar.keyBoardSelected = NO;
// [self.webView setHeight:WG_SCREEN_HEIGHT - toolBarHeight - self.addressBgView.height - WG_SafeAreaTopHeight]; // [self.webView setHeight:WG_SCREEN_HEIGHT - toolBarHeight - self.addressBgView.height - WG_SafeAreaTopHeight];
// self.addressBgView.top = self.view.height - self.addressBgView.height - toolBarHeight; // self.addressBgView.top = self.view.height - self.addressBgView.height - toolBarHeight;
// //
// }]; // }];
}else{ }else{
[UIView animateWithDuration:duration animations:^{ [UIView animateWithDuration:duration animations:^{
self.toolBar.y = self.view.height - frame.size.height - toolBarHeight; self.toolBar.y = self.view.height - frame.size.height - toolBarHeight;
...@@ -1284,15 +1205,15 @@ WKScriptMessageHandler ...@@ -1284,15 +1205,15 @@ WKScriptMessageHandler
- (void)keyBoardWillHideChangeFrame:(NSNotification*)notification{ - (void)keyBoardWillHideChangeFrame:(NSNotification*)notification{
// if (!_hiddenKeyBoard) { // if (!_hiddenKeyBoard) {
// return; // return;
// } // }
self.keboardHeight = 0; self.keboardHeight = 0;
CGFloat duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; CGFloat duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
CGFloat toolBarHeight = self.toolBar.frame.size.height; CGFloat toolBarHeight = self.toolBar.frame.size.height;
[UIView animateWithDuration:duration animations:^{ [UIView animateWithDuration:duration animations:^{
if (@available(iOS 11.0, *)) { if (@available(iOS 11.0, *)) {
self.toolBar.y = self.view.height - toolBarHeight - UIView.fus_SafeBottom; self.toolBar.y = self.view.height - toolBarHeight - UIView.fus_SafeBottom;
...@@ -1325,22 +1246,22 @@ WKScriptMessageHandler ...@@ -1325,22 +1246,22 @@ WKScriptMessageHandler
NSSet *websiteDataTypes NSSet *websiteDataTypes
= [NSSet setWithArray:@[ = [NSSet setWithArray:@[
WKWebsiteDataTypeDiskCache, WKWebsiteDataTypeDiskCache,
WKWebsiteDataTypeOfflineWebApplicationCache, WKWebsiteDataTypeOfflineWebApplicationCache,
WKWebsiteDataTypeMemoryCache, WKWebsiteDataTypeMemoryCache,
// 打开 local Storage 缓存 // 打开 local Storage 缓存
// WKWebsiteDataTypeLocalStorage, // WKWebsiteDataTypeLocalStorage,
WKWebsiteDataTypeCookies, WKWebsiteDataTypeCookies,
WKWebsiteDataTypeSessionStorage, WKWebsiteDataTypeSessionStorage,
WKWebsiteDataTypeIndexedDBDatabases, WKWebsiteDataTypeIndexedDBDatabases,
WKWebsiteDataTypeWebSQLDatabases WKWebsiteDataTypeWebSQLDatabases
]]; ]];
NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0]; NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
...@@ -1359,5 +1280,95 @@ WKScriptMessageHandler ...@@ -1359,5 +1280,95 @@ WKScriptMessageHandler
} }
} }
#pragma mark - FUSImagePickerViewControllerDelegate
- (void)fus_imagePicker:(FUSPublicImagePickerViewController *)imagePicker didFinishSelectWithArray:(NSArray<UIImage *> *)photos {
__weak typeof(self) weakSelf = self;
__weak dispatch_group_t blockGroup = group;
__weak dispatch_queue_t blockQueue = queue;
NSMutableArray *selectArr = [NSMutableArray array];
for (int i = 0; i < photos.count; i++) {
UIImage *image = photos[i];
NSString *filename = [NSString stringWithFormat:@"dymaicimageName_%lld",(long long)(NSDate.date.timeIntervalSince1970 * 1000)];
NSString *dirPath = [NSHomeDirectory() stringByAppendingPathComponent: [NSString stringWithFormat:tempPath]];
[self createDirectoryAtPath:dirPath error:nil];
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent: [NSString stringWithFormat:@"%@/%@",tempPath,filename]];
// 把文件移到本地sever所在目录
[UIImagePNGRepresentation(image) writeToFile:path atomically:true];
NSString *localPath = [NSString stringWithFormat:@"http://localhost/%@/%@",tempPath,filename];
FUSLogDebug(@"插入的图片名:%@ , 要插入文件路径: %@ , sever所在目录:%@",filename,dirPath,localPath);
WGUploadFileModel *fileM = [WGUploadFileModel new];
fileM.fileData = UIImageJPEGRepresentation(image,0.8f);
fileM.key = fileM.uuid;
fileM.image = image;
fileM.localUrl = localPath;
[self.uploadArr addObject:fileM];
[selectArr addObject:fileM];
// [weakSelf.webView insertImageUrl:localPath index:weakSelf.imageIndex alt:];
[self.webView insertImageBase64:fileM.fileData Url:localPath index:weakSelf.imageIndex alt:@"loading..."];
// [weakSelf.webView insetImage:fileM.fileData key:localPath];
NSString *key = [NSString stringWithFormat:@"%ld",weakSelf.imageIndex];
self.imageInfo[key] = fileM;
self.imageIndex += 1;
dispatch_group_enter(blockGroup);
}
dispatch_group_async(blockGroup, blockQueue, ^{
[[WGUploadFileTool alloc] upLoadFileModels:[selectArr copy] Callback:^(NSString * _Nonnull key, float percent, id _Nullable obj, NSError * _Nullable error) {
WGUploadFileModel *fileM = [weakSelf fileModelWithKey:key];
if (percent < 1) {
//正在上传
// [weakSelf.webView insetImageKey:fileM.key progress:percent];
}else{
// [weakSelf.webView setupContentDisable:true];
if (obj) {
// 上传成功
fileM.state = WGUploadFileStateSuccess;
fileM.uploadUrl = [FUSConfig.sharedInstanced.pathConfigs webImagePath:obj];
[weakSelf.imageDict setValue:fileM forKey:fileM.localUrl];
// [weakSelf successWithKey:fileM.key url:testUrl];
}else{
// 上传失败
fileM.state = WGUploadFileStateError;
[weakSelf.webView uploadErrorKey:fileM.key];
weakSelf.autoPublish = NO;
[FUSLoadingView fus_dismissProgressView];
}
}
dispatch_group_leave(blockGroup);
}];
});
dispatch_group_notify(blockGroup, blockQueue, ^{
if (weakSelf.autoPublish) {
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf getHTML]; //发布
});
}
});
[imagePicker dismissViewControllerAnimated:YES completion:nil];
weakSelf.imagePickerVc = nil;
}
- (void)fus_imagePickerDidCancle:(FUSPublicImagePickerViewController *)imagePicker{
[imagePicker dismissViewControllerAnimated:YES completion:^{
}];
}
@end @end
...@@ -251,6 +251,8 @@ ...@@ -251,6 +251,8 @@
self.imagePickerVc.imagePickerDelegate = self; self.imagePickerVc.imagePickerDelegate = self;
self.imagePickerVc.showRecordBtn = NO; self.imagePickerVc.showRecordBtn = NO;
[[UIViewController fus_topViewController] presentViewController:self.imagePickerVc animated:YES completion:nil];
// _imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:nil]; // _imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:nil];
// _imagePickerVc.showSelectBtn = NO; // _imagePickerVc.showSelectBtn = NO;
...@@ -304,8 +306,8 @@ ...@@ -304,8 +306,8 @@
// weakSelf.superview.hidden = NO; // weakSelf.superview.hidden = NO;
// [weakSelf.inputTextView becomeFirstResponder]; // [weakSelf.inputTextView becomeFirstResponder];
// }]; // }];
//
[[UIViewController fus_topViewController] presentViewController:self.imagePickerVc animated:YES completion:nil]; // [[UIViewController fus_topViewController] presentViewController:self.imagePickerVc animated:YES completion:nil];
} }
- (void)setSendTopicId:(NSString *)topicId commentId:(NSString *__nullable)commentId toReplyId:(NSString *__nullable)toReplyId replyName:(NSString *__nullable)replyName { - (void)setSendTopicId:(NSString *)topicId commentId:(NSString *__nullable)commentId toReplyId:(NSString *__nullable)toReplyId replyName:(NSString *__nullable)replyName {
......
...@@ -325,13 +325,13 @@ ...@@ -325,13 +325,13 @@
self.getAwardDesLabel.text = model.tips; self.getAwardDesLabel.text = model.tips;
[self.getAwardImageView setWebImageWithSubURLString:model.icon placeholder:[FUSUserCenterBunble imageNamed:@"checkIn_placeholder"] completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) { [self.getAwardImageView setWebImageWithSubURLString:model.icon placeholder:[FUSUserCenterBunble imageNamed:@"checkIn_placeholder"] completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
BOOL soundSwitch = [FUSSoundAndVibrateHelper systemSoundOpen]; BOOL soundSwitch = [FUSSoundAndVibrateHelper systemSoundOpen];
if (soundSwitch && FUSConfig.sharedInstanced.liveConfigs.isAnchor == NO) { if (soundSwitch && FUSConfig.sharedInstanced.liveConfigs.isAnchor == NO) {
[FUSSoundAndVibrateHelper playSoundEffect:@"check_in_success" bundle:[FUSUserCenterBunble bundle] ofType:@"mp3"]; [FUSSoundAndVibrateHelper playSoundEffect:@"check_in_success" bundle:[FUSCommonBundle bundle] ofType:@"mp3"];
} }
}); // });
}]; }];
self.getAwardAmountLabel.text = [NSString stringWithFormat:@"+%@",model.award]; self.getAwardAmountLabel.text = [NSString stringWithFormat:@"+%@",model.award];
......
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
// BOOL soundSwitch = [FUSSoundAndVibrateHelper systemSoundOpen]; // BOOL soundSwitch = [FUSSoundAndVibrateHelper systemSoundOpen];
// if (soundSwitch && FUSConfig.sharedInstanced.liveConfigs.isAnchor == NO) { // if (soundSwitch && FUSConfig.sharedInstanced.liveConfigs.isAnchor == NO) {
// //
// [FUSSoundAndVibrateHelper playSoundEffect:@"check_in_success" bundle:[FUSUserCenterBunble bundle] ofType:@"mp3"]; // [FUSSoundAndVibrateHelper playSoundEffect:@"check_in_success" bundle:[FUSCommonBundle bundle] ofType:@"mp3"];
// } // }
// }); // });
// }]; // }];
......
...@@ -374,7 +374,7 @@ SPEC CHECKSUMS: ...@@ -374,7 +374,7 @@ SPEC CHECKSUMS:
FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb
FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd
FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a
FUSCommon: e454e7b391ab8f8954d471eb13c11e238bfea615 FUSCommon: e33dade81aa6ab79fe5240e9e66128cb7fc7b6a8
FUSFoundation: 866b0d08a170e406461ef7cf3990887e45898b61 FUSFoundation: 866b0d08a170e406461ef7cf3990887e45898b61
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4 GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
GoogleAppMeasurement: 6b6a08fd9c71f4dbc89e0e812acca81d797aa342 GoogleAppMeasurement: 6b6a08fd9c71f4dbc89e0e812acca81d797aa342
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
"FUSCommon/Assets/*.xcassets", "FUSCommon/Assets/*.xcassets",
"FUSCommon/Assets/*.plist", "FUSCommon/Assets/*.plist",
"FUSCommon/Assets/LOTResource/**/*.{json,mp3,png}", "FUSCommon/Assets/LOTResource/**/*.{json,mp3,png}",
"FUSCommon/Assets/Sounds/*.mp3",
"FUSCommon/Assets/Anims/**/*.png", "FUSCommon/Assets/Anims/**/*.png",
"FUSCommon/Classes/**/*.xib", "FUSCommon/Classes/**/*.xib",
"FUSCommon/FUSRouter/Routers/**/*.xib" "FUSCommon/FUSRouter/Routers/**/*.xib"
......
...@@ -374,7 +374,7 @@ SPEC CHECKSUMS: ...@@ -374,7 +374,7 @@ SPEC CHECKSUMS:
FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb
FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd
FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a
FUSCommon: e454e7b391ab8f8954d471eb13c11e238bfea615 FUSCommon: e33dade81aa6ab79fe5240e9e66128cb7fc7b6a8
FUSFoundation: 866b0d08a170e406461ef7cf3990887e45898b61 FUSFoundation: 866b0d08a170e406461ef7cf3990887e45898b61
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4 GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
GoogleAppMeasurement: 6b6a08fd9c71f4dbc89e0e812acca81d797aa342 GoogleAppMeasurement: 6b6a08fd9c71f4dbc89e0e812acca81d797aa342
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment