|
@@ -65,8 +65,6 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
|
|
|
|
|
|
@property (nonatomic, strong) KSMediaManager *mediaManager;
|
|
|
|
|
|
-@property (strong, nonatomic) MBProgressHUD *HUD;
|
|
|
-
|
|
|
@property (nonatomic, assign) CHOOSETYPE fileChooseType;
|
|
|
|
|
|
@property (nonatomic, strong) NSString *bucketName;
|
|
@@ -652,9 +650,9 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
|
|
|
else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"joinLiveRoom"]) { // 进入直播间
|
|
|
NSDictionary *valueDic = [parm ks_dictionaryValueForKey:@"content"];
|
|
|
NSString *roomId = [valueDic ks_stringValueForKey:@"roomId"];
|
|
|
- [LOADING_MANAGER showHUD];
|
|
|
+ [LOADING_MANAGER showCustomLoading:@"加载中..."];
|
|
|
[KSEnterLiveroomManager joinLiveWithRoomId:roomId inController:(CustomNavViewController *)self.navigationController callback:^{
|
|
|
- [LOADING_MANAGER removeHUD];
|
|
|
+ [LOADING_MANAGER removeCustomLoading];
|
|
|
}];
|
|
|
}
|
|
|
else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"setEventTracking"]) {
|
|
@@ -1597,28 +1595,6 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
|
|
|
|
|
|
#pragma mark -- 上传图片
|
|
|
|
|
|
-- (void)hudTipWillShow:(BOOL)willShow{
|
|
|
- if (willShow) {
|
|
|
- [self resignFirstResponder];
|
|
|
- UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
|
|
|
- if (!_HUD) {
|
|
|
- _HUD = [MBProgressHUD showHUDAddedTo:keyWindow animated:YES];
|
|
|
- _HUD.mode = MBProgressHUDModeDeterminateHorizontalBar;
|
|
|
- _HUD.label.attributedText = [self getAttrStringWithText:@"正在上传视频文件..."];
|
|
|
- _HUD.contentColor = [UIColor whiteColor];
|
|
|
- _HUD.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
|
|
|
- _HUD.bezelView.backgroundColor = HexRGBAlpha(0x000000, 0.8);
|
|
|
- _HUD.removeFromSuperViewOnHide = YES;
|
|
|
-
|
|
|
- }else{
|
|
|
- _HUD.progress = 0;
|
|
|
- [keyWindow addSubview:_HUD];
|
|
|
- [_HUD showAnimated:YES];
|
|
|
- }
|
|
|
- }else{
|
|
|
- [_HUD hideAnimated:YES];
|
|
|
- }
|
|
|
-}
|
|
|
- (NSMutableAttributedString *)getAttrStringWithText:(NSString *)text {
|
|
|
if (![NSString isEmptyString:text]) {
|
|
|
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
|
@@ -1631,7 +1607,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
|
|
|
}
|
|
|
}
|
|
|
- (void)uploadImageArray:(NSMutableArray *)imageArray bucket:(NSString *)bucket {
|
|
|
- [LOADING_MANAGER showHUD];
|
|
|
+ [LOADING_MANAGER showCustomLoading:@"上传中..."];
|
|
|
NSMutableArray *imageDataArray = [NSMutableArray array];
|
|
|
for (UIImage *image in imageArray) {
|
|
|
NSData *imgData = [UIImage turnsImaegDataByImage:image];
|
|
@@ -1639,7 +1615,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
|
|
|
}
|
|
|
[UPLOAD_MANAGER configWithfilePath:@"/user/"];
|
|
|
[UPLOAD_MANAGER mutilUploadImage:imageDataArray fileName:@"complainImg" successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
|
|
|
- [LOADING_MANAGER removeHUD];
|
|
|
+ [LOADING_MANAGER removeCustomLoading];
|
|
|
NSMutableArray *urlArray = [NSMutableArray array];
|
|
|
for (NSString *url in fileUrlArray) {
|
|
|
[urlArray addObject:url];
|
|
@@ -1651,7 +1627,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
|
|
|
self.chooseFileParm = nil;
|
|
|
}
|
|
|
} faliure:^(NSError * _Nullable error, NSString * _Nullable descMessaeg) {
|
|
|
- [LOADING_MANAGER removeHUD];
|
|
|
+ [LOADING_MANAGER removeCustomLoading];
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:descMessaeg];
|
|
|
[self fileChooseErrorCallback];
|
|
|
}];
|
|
@@ -1684,23 +1660,22 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
|
|
|
|
|
|
- (void)submitUrlWith:(NSString *)imgUrl videoUrl:(NSString *)videoUrl {
|
|
|
// 上传视频
|
|
|
- [self hudTipWillShow:YES];
|
|
|
NSURL *uploadFileUrl = [NSURL fileURLWithPath:videoUrl];
|
|
|
NSData *fileData = [NSData dataWithContentsOfURL:uploadFileUrl];
|
|
|
NSString *suffix = [NSString stringWithFormat:@".%@",[uploadFileUrl pathExtension]];
|
|
|
[UPLOAD_MANAGER videoUpload:fileData fileName:@"video" fileSuffix:suffix progress:^(int64_t bytesWritten, int64_t totalBytes) {
|
|
|
+ // 显示进度
|
|
|
+ int progress = (int)(bytesWritten / totalBytes * 100);
|
|
|
+ __block NSString *tipsMessage = [NSString stringWithFormat:@"上传中 %d%%",progress];
|
|
|
dispatch_main_async_safe(^{
|
|
|
- // 显示进度
|
|
|
- if (self.HUD) {
|
|
|
- self.HUD.progress = bytesWritten / totalBytes;// progress是回调进度
|
|
|
- }
|
|
|
+ [LOADING_MANAGER.loadingView setDisplayText:tipsMessage];
|
|
|
});
|
|
|
} successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
|
|
|
- [self hudTipWillShow:NO];
|
|
|
+ [LOADING_MANAGER removeCustomLoading];
|
|
|
NSString *fileUrl = [fileUrlArray lastObject];
|
|
|
[self videoUploadCallback:fileUrl firstFrameImg:imgUrl];
|
|
|
} faliure:^(NSError * _Nullable error, NSString * _Nullable descMessaeg) {
|
|
|
- [self hudTipWillShow:NO];
|
|
|
+ [LOADING_MANAGER removeCustomLoading];
|
|
|
if (![NSString isEmptyString:descMessaeg]) {
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:descMessaeg];
|
|
|
}
|
|
@@ -1925,7 +1900,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
|
|
|
|
|
|
- (void)uploadFile:(NSString *)fileName fileUrl:(NSString *)fileUrl {
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
- [LOADING_MANAGER showHUD];
|
|
|
+ [LOADING_MANAGER showCustomLoading:@"上传中..."];
|
|
|
NSString *suffix = [NSString stringWithFormat:@".%@",[[fileName componentsSeparatedByString:@"."] lastObject]];
|
|
|
NSData *fileData = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:fileUrl]];
|
|
|
[UPLOAD_MANAGER configWithfilePath:@"/user/"];
|
|
@@ -1936,7 +1911,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
|
|
|
[LOADING_MANAGER.loadingView setDisplayText:tipsMessage];
|
|
|
});
|
|
|
} successCallback:^(NSMutableArray * _Nonnull fileUrlArray) {
|
|
|
- [LOADING_MANAGER removeHUD];
|
|
|
+ [LOADING_MANAGER removeCustomLoading];
|
|
|
NSString *fileUrl = [fileUrlArray lastObject];
|
|
|
if (self.chooseFileParm) { // 回调
|
|
|
[self.chooseFileParm setValue:fileUrl forKey:@"fileUrl"];
|
|
@@ -1944,7 +1919,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
|
|
|
self.chooseFileParm = nil;
|
|
|
}
|
|
|
} faliure:^(NSError * _Nullable error, NSString * _Nullable descMessaeg) {
|
|
|
- [LOADING_MANAGER removeHUD];
|
|
|
+ [LOADING_MANAGER removeCustomLoading];
|
|
|
[LOADING_MANAGER MBShowAUTOHidingInWindow:descMessaeg];
|
|
|
[self fileChooseErrorCallback];
|
|
|
}];
|
|
@@ -2064,6 +2039,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
|
|
|
- (void)removeCustomLoadingView {
|
|
|
[self.customLoading stopLoading];
|
|
|
}
|
|
|
+
|
|
|
/*
|
|
|
#pragma mark - Navigation
|
|
|
|