Commit 2e534f08 by pierce

fixed bugs

parent b427d222
......@@ -30,6 +30,7 @@ Pod::Spec.new do |s|
'FUSCommonBundle' => ['FUSCommon/Assets/*.xcassets',
'FUSCommon/Assets/*.plist',
'FUSCommon/Assets/LOTResource/**/*.{json,mp3,png}',
'FUSCommon/Assets/Sounds/*.mp3',
'FUSCommon/Assets/Anims/**/*.png',
'FUSCommon/Classes/**/*.xib',
'FUSCommon/FUSRouter/Routers/**/*.xib']
......
......@@ -79,6 +79,11 @@
[largeLotAnimView playWithCompletion:^(BOOL animationFinished) {
[weakSelf removeFromSuperview];
}];
BOOL soundSwitch = [FUSSoundAndVibrateHelper systemSoundOpen];
if (soundSwitch && FUSConfig.sharedInstanced.liveConfigs.isAnchor == NO) {
[FUSSoundAndVibrateHelper playSoundEffect:@"check_in_success" bundle:[FUSCommonBundle bundle] ofType:@"mp3"];
}
}
@end
......@@ -31,4 +31,9 @@
*/
@property (nonatomic, strong) NSString *videoDuration;
/**
缩略图
*/
@property (nonatomic, strong) UIImage *thumbnail;
@end
......@@ -883,7 +883,6 @@
BEDEDC4C2C66076900B4B0B0 /* FUSDailyCheckInCardView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BEDEDC342C66075400B4B0B0 /* FUSDailyCheckInCardView.xib */; };
BEDEDC4D2C66076900B4B0B0 /* FUSDailyCheckInView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BEDEDC372C66075400B4B0B0 /* FUSDailyCheckInView.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 */; };
BEF0A6152CF5C4E200C0578D /* FUSSocialBindSettingViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = BEF0A6122CF5C4E200C0578D /* FUSSocialBindSettingViewController.h */; };
/* End PBXBuildFile section */
......@@ -1771,7 +1770,6 @@
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>"; };
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>"; };
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>"; };
......@@ -2397,7 +2395,6 @@
BED65D1B2C62203800668116 /* common */,
BED65C6A2C60B86E00668116 /* zone_bottom_view_mask_img.png */,
BE4096C02C7C380A00CE2FE8 /* Info.plist */,
BEDEDC4F2C660F8300B4B0B0 /* check_in_success.mp3 */,
BED65D032C621A4F00668116 /* startPageVideo.mp4 */,
BED65C2B2C60B85A00668116 /* FUSUserCenterAssets.xcassets */,
);
......@@ -4092,7 +4089,6 @@
BE3625872C6B32130004606D /* 1_zone_details_animation_6@3x.png in Resources */,
BE3625C72C6B32130004606D /* news_feed_like_anim_1@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 */,
BE3625F52C6B32130004606D /* zone_video_call_btn_anim_18@2x.png in Resources */,
BED65C602C60B85B00668116 /* zone_voice_sign_play_btn_icon_anim_2@2x.png in Resources */,
......
......@@ -439,6 +439,8 @@
if ([FUSImagePickerManager sharedManager].phAssetType == PHAssetMediaTypeVideo) {
[_confirmBtn setTitle:[NSString stringWithFormat:@"%@(%ld)", self.confirmBtnTitle, [[[FUSImagePickerManager sharedManager]selectedPhotos]count]] forState:UIControlStateNormal];
[_confirmBtn sizeToFit];
_confirmBtn.width = _confirmBtn.width + 50;
_confirmBtn.frame = CGRectMake(0, 0, _confirmBtn.width, _confirmBtn.frame.size.height + 4);
} else {
[_confirmBtn setTitle:[NSString stringWithFormat:@"%@(%ld)",self.confirmBtnTitle,[[[FUSImagePickerManager sharedManager]selectedPhotos]count]] forState:UIControlStateNormal];
}
......@@ -448,11 +450,15 @@
if ([FUSImagePickerManager sharedManager].phAssetType == PHAssetMediaTypeVideo) {
[_confirmBtn setTitle:[NSString stringWithFormat:@"%@", self.confirmBtnTitle] forState:UIControlStateNormal];
[_confirmBtn sizeToFit];
_confirmBtn.width = _confirmBtn.width + 50;
_confirmBtn.frame = CGRectMake(0, 0, _confirmBtn.width, _confirmBtn.frame.size.height + 4);
} else {
[_confirmBtn setTitle:[NSString stringWithFormat:@"%@",self.confirmBtnTitle] forState:UIControlStateNormal];
}
}
}
#pragma mark - Method
......@@ -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 respondsToSelector:@selector(fus_imagePicker:didFinishSelectWithImageVideoArray:)]) {
......@@ -631,7 +637,7 @@
FUSLogInfo(@"超过最大图片个数");
NSString *content = [NSString fus_localString:@"张图片"];
NSInteger count = 0;
NSInteger count = [FUSImagePickerManager sharedManager].limit;
if ([FUSImagePickerManager sharedManager].assetType == FUSAssetTypeVideo) {
count = [[FUSImagePickerManager sharedManager]limit];
content = [NSString fus_localString:@"个视频"];
......@@ -1218,6 +1224,7 @@
__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) {
if (result) {
model.thumbnail = result;
[weakCell fus_setupImage:result];
}
}];
......
......@@ -10,7 +10,9 @@
#import "FUSTextField.h"
#import "FUSCustomCollectionViewLayout.h"
#import "FUSPublishPhotoCollectionViewCell.h"
#import "TZImagePickerController.h"
//#import "TZImagePickerController.h"
#import "FUSImagePickerManager.h"
#import "FUSImagePickerViewController.h"
#import "FUSMomentCreateModel.h"
#import "FUSEditPickerView.h"
#import "FUSNewsFeedPriceModel.h"
......@@ -39,7 +41,7 @@ FUSImagePickerViewControllerDelegate>
@property (nonatomic, strong) UIView *headerView;
@property (nonatomic, weak) TZImagePickerController *imagePickerVc;
@property (nonatomic, strong) FUSImagePickerViewController *imagePickerVc;
@property (nonatomic, strong) UICollectionView *collectionView;
......@@ -486,11 +488,8 @@ FUSImagePickerViewControllerDelegate>
}];
return;;
}
_imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 columnNumber:3 delegate:nil];
_imagePickerVc.showSelectBtn = NO;
_imagePickerVc.modalPresentationStyle = UIModalPresentationCustom;
FUSAssetType assetType = FUSAssetTypePhoto;
NSInteger leftCount = 6;
if (_publishType == FUSPublishNewsPhoto) {
if (self.images.count > 6) {
......@@ -500,114 +499,26 @@ FUSImagePickerViewControllerDelegate>
}else{
leftCount = 6 - (self.images.count - 1);
}
_imagePickerVc.allowPickingVideo = NO;
}else if (_publishType == FUSPublishNewsVideo){
if (self.images.count > 1) {
leftCount = 0;
}else {
leftCount = 1;
}
_imagePickerVc.allowPickingVideo = YES;
_imagePickerVc.allowPickingImage = NO;
_imagePickerVc.allowPickingGif = NO;
// [self fus_showVideoPicker];
// return;
assetType = FUSAssetTypeVideo;
}
_imagePickerVc.maxImagesCount = leftCount; //剩余可选图片
_imagePickerVc.sortAscendingByModificationDate = NO;
_imagePickerVc.autoSelectCurrentWhenDone = NO;
// _imagePickerVc.modalPresentationStyle = UIModalPresentationPageSheet;
__weak typeof(self) weakSelf = self;
[self.imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
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;
}];
[FUSImagePickerManager sharedManager].confirmBtnTitle = [NSString fus_localString:@"确定"];
self.imagePickerVc = [[FUSImagePickerViewController alloc] initWithMaxImagesCount:leftCount columnNumber:4 isPushToPhoto:NO type:assetType];
[self.imagePickerVc setDidFinishPickingVideoHandle:^(UIImage *coverImage, PHAsset *asset) {
WGUploadFileModel *fileM = [WGUploadFileModel new];
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.imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen;
self.imagePickerVc.imagePickerDelegate = self;
self.imagePickerVc.showRecordBtn = NO;
self.imagePickerVc.videoTimeLimit = 10 * 60;
[self presentViewController:self.imagePickerVc animated:YES completion:nil];
//v5.9不要半屏
// [self presentPanModal:self.imagePickerVc completion:nil];
}
- (void)fus_showVideoPicker{
......@@ -975,84 +886,141 @@ FUSImagePickerViewControllerDelegate>
}
#pragma mark - FUSImagePickerViewControllerDelegate
/**
选取视频回调
@param videos 视频数组,储存视频 URL
*/
- (void)fus_imagePicker:(FUSImagePickerViewController *)imagePicker didFinishSelectWithVideoArray:(NSArray<NSURL *> *)videos{
- (void)fus_imagePicker:(FUSPublicImagePickerViewController *)imagePicker didFinishSelectWithArray:(NSArray<UIImage *> *)photos {
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;
}
/**
选取了图片,数组内容为 PHAsset
*/
- (void)fus_imagePicker:(FUSImagePickerViewController *)imagePicker didFinishSelectWithAssetArray:(NSArray<PHAsset *> *)photos{
- (void)fus_imagePicker:(FUSPublicImagePickerViewController *)imagePicker didFinishSelectWithImageVideoArray:(NSArray<FUSAssetModel *> *)imageVideos {
FUSAssetModel *assetModel = imageVideos.firstObject;
if (assetModel == nil) {
return;
}
__weak typeof(self) weakSelf = self;
FUSImagePickerManager *manager = [FUSImagePickerManager sharedManager];
// for (PHAsset *asset in photos) {
// WGUploadFileModel *fileM = [WGUploadFileModel new];
// fileM.fileData = UIImageJPEGRepresentation(coverImage,0.8f);
// fileM.key = fileM.uuid;
// fileM.image = coverImage;
// fileM.asset = asset;
//
// 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;
//
// manager.videoTimeLimit = 15.0 * 60.0;
// [FUSImagePickerManager sharedManager].assetType = FUSAssetTypePhotoVideoOnlyOne;
// NSData *data = [FUSVideoProfileHelper fus_dealVideoWithAssetDuration:urlAsset.duration avURLAsset:urlAsset];
// fileM.videoData = data;
// int videoDuration = (int)ceil(CMTimeGetSeconds(urlAsset.duration)*1000);
// fileM.videoDuration = videoDuration;
// fileM.videoLocalUrl = urlAsset.URL;
// 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.itemR.enabled = YES;
// }else{
// weakSelf.itemR.enabled = NO;
// }
//
// [weakSelf.collectionView reloadData];
// }];
// };
[self fus_getThumbnailWithModel:assetModel completed:^(FUSAssetModel *resultModel) {
WGUploadFileModel *fileM = [WGUploadFileModel new];
fileM.fileData = UIImageJPEGRepresentation(resultModel.thumbnail,0.8f);
fileM.key = fileM.uuid;
fileM.image = resultModel.thumbnail;
fileM.asset = resultModel.asset;
fileM.key = assetModel.asset.localIdentifier;
FUSImagePickerManager *manager = [FUSImagePickerManager sharedManager];
PHVideoRequestOptions *videoOptions = [[PHVideoRequestOptions alloc] init];
videoOptions.version = PHVideoRequestOptionsVersionOriginal;
videoOptions.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
videoOptions.networkAccessAllowed = YES;
[manager requestAVAssetForVideo:assetModel.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];
});
});
}];
[imagePicker dismissViewControllerAnimated:YES completion:nil];
weakSelf.imagePickerVc = nil;
}];
}
#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;
- (void)fus_imagePickerDidCancle:(FUSPublicImagePickerViewController *)imagePicker{
[imagePicker dismissViewControllerAnimated:YES completion:^{
}];
}
- (void)fus_getThumbnailWithModel:(FUSAssetModel *)assetModel completed:(void(^)(FUSAssetModel *resultModel))completed {
if (completed == nil) { return; }
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{
if (!_images) {
......
......@@ -11,7 +11,8 @@
#import <JavaScriptCore/JavaScriptCore.h>
#import "CustomIOSAlertView.h"
#import "WGInputAlertView.h"
#import "TZImagePickerController.h"
//#import "TZImagePickerController.h"
#import "FUSImagePickerViewController.h"
#import "FUSMainSearchViewController.h"
#import "ResultViewController.h"
......@@ -35,7 +36,8 @@ WGEditorToolBarDelegate,
WGFontStyleBarDelegate,
CustomIOSAlertViewDelegate,
UIScrollViewDelegate,
WKScriptMessageHandler
WKScriptMessageHandler,
FUSImagePickerViewControllerDelegate
>
{
dispatch_queue_t queue;
......@@ -45,7 +47,7 @@ WKScriptMessageHandler
@property (nonatomic,strong) CustomIOSAlertView *alertView;
@property (nonatomic,strong) WGInputAlertView *inputAlertView;
@property (nonatomic,strong) WGFontStyleBar *fontBar;
@property (nonatomic,strong) TZImagePickerController *imagePickerVc;
@property (nonatomic,strong) FUSImagePickerViewController *imagePickerVc;
@property (nonatomic,strong) NSMutableArray <WGUploadFileModel*>*uploadArr;
@property (nonatomic,assign) CGFloat lastPostion;
......@@ -83,7 +85,7 @@ WKScriptMessageHandler
[super viewDidLoad];
self.view.backgroundColor = UIColor.fus_appBGColor;
// self.view.backgroundColor = [UIColor redColor];
// self.view.backgroundColor = [UIColor redColor];
//防止导航出现色差
self.navigationController.navigationBar.translucent = NO;
self.tabBarController.tabBar.backgroundColor = WG_BLACK;
......@@ -155,7 +157,7 @@ WKScriptMessageHandler
//添加WebView加载HTML
[self.view addSubview:self.webView];
[self.webView allowDisplayingKeyboardWithoutUserAction];
// [self clearWebCache];
// [self clearWebCache];
if (self.webHTML == nil) {
self.webHTML = [NSString stringWithFormat:@"%@?lang=%@", FUSCommonWebURLs.fus_newsfeedInput,FUSLocalizationHelper.fus_currentLanguage.languageID];
}
......@@ -174,7 +176,7 @@ WKScriptMessageHandler
- (void)getTitle{
if ([self isUploadResult]) {
// [SVProgressHUD showErrorWithStatus:@"图片未上传成功"];
// [SVProgressHUD showErrorWithStatus:@"图片未上传成功"];
return;
}
......@@ -188,7 +190,7 @@ WKScriptMessageHandler
}
- (void)getText{
if ([self isUploadResult]) {
// [SVProgressHUD showErrorWithStatus:@"图片未上传成功"];
// [SVProgressHUD showErrorWithStatus:@"图片未上传成功"];
return;
}
[self.webView contentTextHandleCallback:^(id _Nullable obj, NSError * _Nullable error) {
......@@ -252,13 +254,13 @@ WKScriptMessageHandler
[self.webView getLastContentHtmlTextHandleCallback:^(id _Nullable HTMLContent, NSError * _Nullable error) {
NSMutableString *mutStr = [NSMutableString stringWithString:HTMLContent];
// [FUSAlertView showAlertWithTitle:nil message:HTMLContent cancelButtonTitle:@"确认" otherButtonTitles:nil clickBlock:^(NSInteger buttonIndex) {
//
// }];
//
// [self.view endEditing:YES];
//
// return;
// [FUSAlertView showAlertWithTitle:nil message:HTMLContent cancelButtonTitle:@"确认" otherButtonTitles:nil clickBlock:^(NSInteger buttonIndex) {
//
// }];
//
// [self.view endEditing:YES];
//
// return;
[self.webView getImagesAndAtSomeOneIDListHandleCallback:^(id _Nullable obj, NSError * _Nullable error) {
NSArray *images = obj[@"img"];
......@@ -345,7 +347,7 @@ WKScriptMessageHandler
[_addressBgView addSubview:_addressBtn];
_addressBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
[_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];
......@@ -379,7 +381,7 @@ WKScriptMessageHandler
- (void)fus_switchSynAddress:(UISwitch *)sender{
if (sender.isOn) {
[self getAddress];
}else{
......@@ -410,21 +412,21 @@ WKScriptMessageHandler
return _fontBar;
}
- (TZImagePickerController *)imagePickerVc{
if (_imagePickerVc == nil) {
// _imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:6 delegate:nil];
// _imagePickerVc.showSelectBtn = NO;
// _imagePickerVc.sortAscendingByModificationDate = NO;
// _imagePickerVc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
}
return _imagePickerVc;
}
//- (FUSImagePickerViewController *)imagePickerVc{
// if (_imagePickerVc == nil) {
//// _imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:6 delegate:nil];
//// _imagePickerVc.showSelectBtn = NO;
//// _imagePickerVc.sortAscendingByModificationDate = NO;
//// _imagePickerVc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
// }
// return _imagePickerVc;
//}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
_hiddenKeyBoard = YES;
[self.webView hiddenKeyboard];
// FUSLogDebug(@"");
// FUSLogDebug(@"");
}
- (NSMutableArray<WGUploadFileModel *> *)uploadArr{
......@@ -448,13 +450,13 @@ WKScriptMessageHandler
__weak typeof(self) weakSelf = self;
[webView getCaretYPositionPositionHandleCallback:^(id _Nullable obj, NSError * _Nullable error) {
CGFloat currentPos = [obj floatValue];
CGFloat currentPos = [obj floatValue];
if (weakSelf.lastPostion != currentPos) {
weakSelf.lastPostion = currentPos;
if (currentPos > weakSelf.webView.height - 65) {
// FUSLogDebug(@"===aaaa %f",(currentPos - (weakSelf.webView.height - 65)));
// [weakSelf.webView autoScrollTop:currentPos - (weakSelf.webView.height - 65)];
// FUSLogDebug(@"===aaaa %f",(currentPos - (weakSelf.webView.height - 65)));
// [weakSelf.webView autoScrollTop:currentPos - (weakSelf.webView.height - 65)];
}
}
......@@ -473,93 +475,93 @@ WKScriptMessageHandler
/// 检测内容是否可以发布
- (void)fus_checkInputContent{
[self.webView titleTextHandleCallback:^(NSString *_Nullable title, NSError * _Nullable error) {
NSString *titleStr = [title stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
if (titleStr.length < 5) {
self.rightBtn.enabled = NO;
[self.webView titleTextHandleCallback:^(NSString *_Nullable title, NSError * _Nullable error) {
NSString *titleStr = [title stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
if (titleStr.length < 5) {
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;
}
[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;
}
self.rightBtn.enabled = YES;
FUSLogDebug(@"");
}];
self.rightBtn.enabled = YES;
FUSLogDebug(@"");
}];
}];
}
/// 检测内容是否可以发布
- (void)fus_checkPopViewContoller{
__weak typeof(self) weakSelf = self;
[self.webView titleTextHandleCallback:^(NSString *_Nullable title, NSError * _Nullable error) {
if (![NSString isNull:title]) {
[self.webView titleTextHandleCallback:^(NSString *_Nullable title, NSError * _Nullable error) {
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) {
if (buttonIndex == 1) {
[weakSelf.navigationController popViewControllerAnimated:YES];
[self.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) {
if (buttonIndex == 1) {
[self.navigationController popViewControllerAnimated:YES];
}
}];
return;
}
FUSLogDebug(@"");
}];
FUSLogDebug(@"");
}];
}];
}
///MARK:图片操作
- (BOOL)handleWithString:(NSString *)urlString{
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];
NSLog(@"截取后:%@",dictString);
......@@ -590,7 +592,7 @@ WKScriptMessageHandler
//重传
__weak typeof(self) weakSelf = self;
[[WGUploadFileTool alloc] upLoadFileModel:fileM Callback:^(NSString * _Nonnull key, float percent, id _Nullable obj, NSError * _Nullable error) {
WGUploadFileModel *fileM = [weakSelf fileModelWithKey:key];
if (percent < 1) {
//正在上传
......@@ -641,7 +643,7 @@ WKScriptMessageHandler
if (self.keboardHeight == 0) {
return;
}
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;
......@@ -650,9 +652,9 @@ WKScriptMessageHandler
if (isEditorTitle){
self.addressBgView.top = self.view.height - self.addressBgView.height - self.keboardHeight;
self.webView.height = height;
// [FUSDialogView fus_showDialog:@"点击了标题"];
// [FUSDialogView fus_showDialog:@"点击了标题"];
}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;
if(self.webView.height != height2){
self.webView.height = height2;
......@@ -667,7 +669,7 @@ WKScriptMessageHandler
[self.fontBar updateFontBarWithButtonName:className];
if ([[className componentsSeparatedByString:@","] containsObject:@"unorderedList"]) {
// [self.webView placeHolderWithHidden:YES];
// [self.webView placeHolderWithHidden:YES];
}
}
}
......@@ -708,8 +710,8 @@ WKScriptMessageHandler
[self showPhotoPicker];
});
}];
}else{
dispatch_async(dispatch_get_main_queue(), ^{
[self.webView contentBecomeFirstResponder];
......@@ -735,7 +737,7 @@ WKScriptMessageHandler
});
}];
}
}
break;
......@@ -793,7 +795,7 @@ WKScriptMessageHandler
- (void)atSomeOneAction{
__weak typeof(self) weakSelf = self;
_hiddenKeyBoard = YES;
// [self.webView undo];
// [self.webView undo];
FUSMainSearchViewController *searchVC = [[FUSMainSearchViewController alloc] init];
searchVC.fromType = FUSSearchFromAtSomeOne;
searchVC.modalPresentationStyle = UIModalPresentationCustom;
......@@ -804,7 +806,7 @@ WKScriptMessageHandler
}];
[weakSelf.atSomeOneArr addObject:model];
};
searchVC.dismissCompletion = ^{
[weakSelf.webView contentBecomeFirstResponder];
};
......@@ -834,17 +836,17 @@ WKScriptMessageHandler
*/
- (UIImage *)addImage:(UIImage *)useImage addMsakImage:(UIImage *)maskImage
{
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)];
//四个参数为水印图片的位置
// 145 × 29
// if (@available(iOS 11.0, *)) {
[maskImage drawInRect:CGRectMake(useImage.size.width - 115 - 24, 20, 115, 20)];
// } else {
// [maskImage drawInRect:CGRectMake(useImage.size.width - 115, useImage.size.height - 23, 115, 23)];
// }
// 145 × 29
// if (@available(iOS 11.0, *)) {
[maskImage drawInRect:CGRectMake(useImage.size.width - 115 - 24, 20, 115, 20)];
// } else {
// [maskImage drawInRect:CGRectMake(useImage.size.width - 115, useImage.size.height - 23, 115, 23)];
// }
UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resultingImage;
......@@ -910,13 +912,13 @@ WKScriptMessageHandler
}else{
[self.webView indent];
}
}
}
break;
case 11:{
}
break;
default:
......@@ -958,10 +960,6 @@ WKScriptMessageHandler
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) {
NSArray *images = obj[@"img"];
......@@ -970,96 +968,19 @@ WKScriptMessageHandler
[FUSDialogView fus_showDialog:[NSString fus_localString:@"已达到最大可选数量"]];
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 setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
NSMutableArray *selectArr = [NSMutableArray array];
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.imagePickerVc = [[FUSImagePickerViewController alloc] initWithMaxImagesCount:6 - images.count columnNumber:4 isPushToPhoto:NO type:FUSAssetTypePhoto];
self.imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen;
self.imagePickerVc.imagePickerDelegate = self;
self.imagePickerVc.showRecordBtn = NO;
[self presentViewController:self.imagePickerVc animated:YES completion:nil];
}];
}
- (BOOL)createDirectoryAtPath:(NSString *)path error:(NSError *__autoreleasing *)error {
NSFileManager *manager = [NSFileManager defaultManager];
/* createDirectoryAtPath:withIntermediateDirectories:attributes:error:
......@@ -1067,7 +988,7 @@ WKScriptMessageHandler
* 参数2:是否创建媒介的布尔值,一般为YES
* 参数3: 属性,没有就置为nil
* 参数4: 错误信息
*/
*/
BOOL isSuccess = [manager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:error];
return isSuccess;
}
......@@ -1127,7 +1048,7 @@ WKScriptMessageHandler
if (selectionStr.length > 0) {
[self.webView getSelectionHandleCallback:^(id _Nullable obj, NSError * _Nullable error) {
if (error == nil) {
NSString *tagStr = obj;
if ([tagStr isEqualToString:@"A"]) {
......@@ -1192,11 +1113,11 @@ WKScriptMessageHandler
{
if (buttonIndex == 1) {
if (_inputAlertView.topTextField.text.length <= 0) {
// [SVProgressHUD showErrorWithStatus:@"文本内容不能为空"];
// [SVProgressHUD showErrorWithStatus:@"文本内容不能为空"];
return;
}
if (_inputAlertView.midTextField.text.length <= 0) {
// [SVProgressHUD showErrorWithStatus:@"链接地址不能为空"];
// [SVProgressHUD showErrorWithStatus:@"链接地址不能为空"];
return;
}
......@@ -1229,7 +1150,7 @@ WKScriptMessageHandler
[_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]];
}
@try {
// [self.toolBar removeObserver:self forKeyPath:@"transform"];
// [self.toolBar removeObserver:self forKeyPath:@"transform"];
} @catch (NSException *exception){
NSLog(@"Exception: %@", exception);
} @finally {
......@@ -1238,7 +1159,7 @@ WKScriptMessageHandler
}
- (FUSPublicIMEmojiView *)chatIMEmojiView {
if (!_chatIMEmojiView) {
_chatIMEmojiView = [FUSRouter.chatRouter createImEmojiViewWithFrame:CGRectMake(0, 0,UIView.fus_screenW , FUSPublicIMEmojiView.fus_emojiInputViewHeight - FUSChatPublicDefine.fus_bottomViewHeight)];
_chatIMEmojiView.delegate = self;
......@@ -1264,13 +1185,13 @@ WKScriptMessageHandler
CGFloat toolBarHeight = self.toolBar.frame.size.height;
_hiddenKeyBoard = NO;
if (frame.origin.y == WG_SCREEN_HEIGHT) {
// [UIView animateWithDuration:duration animations:^{
// self.toolBar.y = self.view.height - frame.size.height - toolBarHeight;
// self.toolBar.keyBoardSelected = NO;
// [self.webView setHeight:WG_SCREEN_HEIGHT - toolBarHeight - self.addressBgView.height - WG_SafeAreaTopHeight];
// self.addressBgView.top = self.view.height - self.addressBgView.height - toolBarHeight;
//
// }];
// [UIView animateWithDuration:duration animations:^{
// self.toolBar.y = self.view.height - frame.size.height - toolBarHeight;
// self.toolBar.keyBoardSelected = NO;
// [self.webView setHeight:WG_SCREEN_HEIGHT - toolBarHeight - self.addressBgView.height - WG_SafeAreaTopHeight];
// self.addressBgView.top = self.view.height - self.addressBgView.height - toolBarHeight;
//
// }];
}else{
[UIView animateWithDuration:duration animations:^{
self.toolBar.y = self.view.height - frame.size.height - toolBarHeight;
......@@ -1284,15 +1205,15 @@ WKScriptMessageHandler
- (void)keyBoardWillHideChangeFrame:(NSNotification*)notification{
// if (!_hiddenKeyBoard) {
// return;
// }
// if (!_hiddenKeyBoard) {
// return;
// }
self.keboardHeight = 0;
CGFloat duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
CGFloat toolBarHeight = self.toolBar.frame.size.height;
[UIView animateWithDuration:duration animations:^{
if (@available(iOS 11.0, *)) {
self.toolBar.y = self.view.height - toolBarHeight - UIView.fus_SafeBottom;
......@@ -1325,22 +1246,22 @@ WKScriptMessageHandler
NSSet *websiteDataTypes
= [NSSet setWithArray:@[
WKWebsiteDataTypeDiskCache,
WKWebsiteDataTypeOfflineWebApplicationCache,
WKWebsiteDataTypeMemoryCache,
// 打开 local Storage 缓存
// WKWebsiteDataTypeLocalStorage,
WKWebsiteDataTypeCookies,
WKWebsiteDataTypeSessionStorage,
WKWebsiteDataTypeIndexedDBDatabases,
WKWebsiteDataTypeWebSQLDatabases
]];
WKWebsiteDataTypeDiskCache,
WKWebsiteDataTypeOfflineWebApplicationCache,
WKWebsiteDataTypeMemoryCache,
// 打开 local Storage 缓存
// WKWebsiteDataTypeLocalStorage,
WKWebsiteDataTypeCookies,
WKWebsiteDataTypeSessionStorage,
WKWebsiteDataTypeIndexedDBDatabases,
WKWebsiteDataTypeWebSQLDatabases
]];
NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
......@@ -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
......@@ -251,6 +251,8 @@
self.imagePickerVc.imagePickerDelegate = self;
self.imagePickerVc.showRecordBtn = NO;
[[UIViewController fus_topViewController] presentViewController:self.imagePickerVc animated:YES completion:nil];
// _imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:nil];
// _imagePickerVc.showSelectBtn = NO;
......@@ -304,8 +306,8 @@
// weakSelf.superview.hidden = NO;
// [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 {
......
......@@ -325,13 +325,13 @@
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) {
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];
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];
......
......@@ -193,7 +193,7 @@
// BOOL soundSwitch = [FUSSoundAndVibrateHelper systemSoundOpen];
// 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:
FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb
FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd
FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a
FUSCommon: e454e7b391ab8f8954d471eb13c11e238bfea615
FUSCommon: e33dade81aa6ab79fe5240e9e66128cb7fc7b6a8
FUSFoundation: 866b0d08a170e406461ef7cf3990887e45898b61
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
GoogleAppMeasurement: 6b6a08fd9c71f4dbc89e0e812acca81d797aa342
......
......@@ -33,6 +33,7 @@
"FUSCommon/Assets/*.xcassets",
"FUSCommon/Assets/*.plist",
"FUSCommon/Assets/LOTResource/**/*.{json,mp3,png}",
"FUSCommon/Assets/Sounds/*.mp3",
"FUSCommon/Assets/Anims/**/*.png",
"FUSCommon/Classes/**/*.xib",
"FUSCommon/FUSRouter/Routers/**/*.xib"
......
......@@ -374,7 +374,7 @@ SPEC CHECKSUMS:
FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb
FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd
FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a
FUSCommon: e454e7b391ab8f8954d471eb13c11e238bfea615
FUSCommon: e33dade81aa6ab79fe5240e9e66128cb7fc7b6a8
FUSFoundation: 866b0d08a170e406461ef7cf3990887e45898b61
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
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