temp save

This commit is contained in:
eggmanQQQ
2024-11-07 16:16:09 +08:00
parent 694d56b604
commit efefa94d3c
29 changed files with 665 additions and 193 deletions

View File

@@ -15,6 +15,47 @@ NS_ASSUME_NONNULL_BEGIN
bottomLeftCorner:(CGFloat)bottemLeft
bottomRightCorner:(CGFloat)bottemRight
size:(CGSize)size;
///**
// * 设置视图的圆角半径,边框宽度和颜色
// *
// * @param radius 圆角半径
// * @param corners 圆角位置 (可以组合使用 UIRectCornerTopLeft、UIRectCornerTopRight、UIRectCornerBottomLeft、UIRectCornerBottomRight)
// * @param borderWidth 边框宽度
// * @param borderColor 边框颜色
// */
//- (void)setCornerRadius:(CGFloat)radius
// corners:(UIRectCorner)corners
// borderWidth:(CGFloat)borderWidth
// borderColor:(UIColor *)borderColor;
/**
* 直接设置视图的圆角半径,应用到所有角
*
* @param radius 圆角半径
*/
- (void)setCornerRadius:(CGFloat)radius;
/**
* 直接设置视图的圆角半径和指定角
*
* @param radius 圆角半径
* @param corners 指定需要圆角的位置 (UIRectCornerTopLeft, UIRectCornerTopRight, etc.)
*/
- (void)setCornerRadius:(CGFloat)radius corners:(UIRectCorner)corners;
/**
* 设置视图的指定圆角、圆角半径、边框宽度和边框颜色
*
* @param radius 圆角半径
* @param corners 需要圆角的角位置 (可以组合,例如 `kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner`)
* @param borderWidth 边框宽度
* @param borderColor 边框颜色
*/
- (void)setCornerRadius:(CGFloat)radius
corners:(CACornerMask)corners
borderWidth:(CGFloat)borderWidth
borderColor:(UIColor *)borderColor;
@end
NS_ASSUME_NONNULL_END

View File

@@ -40,4 +40,66 @@
self.layer.mask = maskLayer;
}
//- (void)setCornerRadius:(CGFloat)radius
// corners:(UIRectCorner)corners
// borderWidth:(CGFloat)borderWidth
// borderColor:(UIColor *)borderColor {
//
// // UIBezierPath
// UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bounds
// byRoundingCorners:corners
// cornerRadii:CGSizeMake(radius, radius)];
//
// // CAShapeLayer path
// CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
// maskLayer.path = path.CGPath;
// self.layer.mask = maskLayer;
//
// //
// if (borderWidth > 0 && borderColor) {
// CAShapeLayer *borderLayer = [[CAShapeLayer alloc] init];
// borderLayer.path = path.CGPath;
// borderLayer.lineWidth = borderWidth;
// borderLayer.strokeColor = borderColor.CGColor;
// borderLayer.fillColor = UIColor.clearColor.CGColor;
// borderLayer.frame = self.bounds;
// [self.layer addSublayer:borderLayer];
// }
//}
- (void)setCornerRadius:(CGFloat)radius {
self.layer.cornerRadius = radius;
self.layer.masksToBounds = YES; //
}
- (void)setCornerRadius:(CGFloat)radius corners:(UIRectCorner)corners {
if (corners == UIRectCornerAllCorners) {
[self setCornerRadius:radius];
} else {
// 使 `CAShapeLayer` `UIBezierPath`使
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bounds
byRoundingCorners:corners
cornerRadii:CGSizeMake(radius, radius)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.path = path.CGPath;
self.layer.mask = maskLayer;
}
}
- (void)setCornerRadius:(CGFloat)radius
corners:(CACornerMask)corners
borderWidth:(CGFloat)borderWidth
borderColor:(UIColor *)borderColor {
//
self.layer.cornerRadius = radius;
self.layer.maskedCorners = corners;
self.layer.masksToBounds = YES; //
//
self.layer.borderWidth = borderWidth;
self.layer.borderColor = borderColor.CGColor;
}
@end

View File

@@ -140,7 +140,7 @@
NSString *encodingUrl = [resourcePath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
@kWeakify(self);
[self.vapParser parseWithURL:encodingUrl completionBlock:^(NSString * _Nullable videoUrl) {
[self.vapParser parseWithURL:[encodingUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]] completionBlock:^(NSString * _Nullable videoUrl) {
@kStrongify(self);
if (videoUrl.length) {
[self.vapView setMute:YES];

View File

@@ -36,7 +36,7 @@
- (void)setEmptyImageStr:(NSString *)emptyImageStr {
@kWeakify(self);
[self.parser parseWithURL:[NSURL URLWithString:emptyImageStr] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
[self.parser parseWithURL:[NSURL URLWithString:[emptyImageStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@kStrongify(self);
self.imageView.loops = INT_MAX;
self.imageView.clearsAfterStop = NO;

View File

@@ -87,7 +87,7 @@
- (void)setVipInfo:(NobleInfo *)vipInfo {
@kWeakify(self);
[self.parser parseWithURL:[NSURL URLWithString:vipInfo.vipLogo] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
[self.parser parseWithURL:[NSURL URLWithString:[vipInfo.vipLogo stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@kStrongify(self);
self.svgDisplayView.loops = INT_MAX;
self.svgDisplayView.clearsAfterStop = NO;

View File

@@ -184,7 +184,7 @@
- (void)setLevelUpInfo:(NobleLevelUpModel *)levelUpInfo {
self.subTitleLabel.text = [NSString stringWithFormat:YMLocalizedString(@"XPNobleUpgradeLevelView4"), levelUpInfo.vipName];
@kWeakify(self);
[self.parser parseWithURL:[NSURL URLWithString:levelUpInfo.vipLogo] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
[self.parser parseWithURL:[NSURL URLWithString:[levelUpInfo.vipLogo stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@kStrongify(self);
self.svgDisplayView.loops = INT_MAX;
self.svgDisplayView.clearsAfterStop = NO;

View File

@@ -394,7 +394,7 @@
NSString *encodingUrl = [_svgaPath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
@kWeakify(self);
[self.vapParser parseWithURL:encodingUrl completionBlock:^(NSString * _Nullable videoUrl) {
[self.vapParser parseWithURL:[encodingUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]] completionBlock:^(NSString * _Nullable videoUrl) {
@kStrongify(self);
if (videoUrl.length) {
[self.vapView setMute:YES];

View File

@@ -17,11 +17,15 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)deleteRoomBackground:(HttpRequestHelperCompletion)completion
roomUid:(NSString *)roomUid
backgroundItemId:(NSString *)id;
id:(NSString *)bid;
+ (void)listOfRoomBackground:(HttpRequestHelperCompletion)completion
roomUid:(NSString *)roomUid;
+ (void)uploadCustomBackground:(HttpRequestHelperCompletion)completion
roomUid:(NSString *)roomUid
url:(NSString *)url;
+ (void)selectedRoomBackground:(HttpRequestHelperCompletion)completion
roomUid:(NSString *)roomUid
id:(NSString *)bid;

View File

@@ -19,10 +19,10 @@
+ (void)deleteRoomBackground:(HttpRequestHelperCompletion)completion
roomUid:(NSString *)roomUid
backgroundItemId:(NSString *)id {
id:(NSString *)bid {
[self makeRequest:@"room/background/del"
method:HttpRequestHelperMethodPOST
completion:completion, __FUNCTION__, roomUid, id, nil];
completion:completion, __FUNCTION__, roomUid, bid, nil];
}
+ (void)listOfRoomBackground:(HttpRequestHelperCompletion)completion
@@ -32,6 +32,14 @@
completion:completion, __FUNCTION__, roomUid, nil];
}
+ (void)uploadCustomBackground:(HttpRequestHelperCompletion)completion
roomUid:(NSString *)roomUid
url:(NSString *)url {
[self makeRequest:@"room/background/custom"
method:HttpRequestHelperMethodPOST
completion:completion, __FUNCTION__, roomUid, url, nil];
}
+ (void)selectedRoomBackground:(HttpRequestHelperCompletion)completion
roomUid:(NSString *)roomUid
id:(NSString *)bid {

View File

@@ -29,12 +29,16 @@ typedef enum : NSUInteger {
@property (nonatomic, assign) NSInteger goldPrice;
@property (nonatomic, assign) NSInteger id;
@property (nonatomic, assign) BOOL isCur;
@property (nonatomic, assign) NSInteger remainHour;
@property (nonatomic, copy) NSString *remainHour;
@property (nonatomic, copy) NSString *url;
/// 0=免费1=付费2=自定义
@property (nonatomic, assign) RoomBGType type;
@property (nonatomic, assign) RoomBGStatus status; // -1=过期0=审核中1=通过2=不过审
- (NSString *)remainDays;
- (NSString *)pricePerDays;
- (BOOL)isAlreadyPay;
@end
@interface CustomRoomBGModel : PIBaseModel

View File

@@ -9,6 +9,33 @@
@implementation CustomRoomBGItemModel
- (NSString *)remainDays {
if ([NSString isEmpty:self.remainHour]) {
return @"";
} else {
NSInteger hour = self.remainHour.integerValue;
if (hour<24) {
return [NSString stringWithFormat:@"<1%@", YMLocalizedString(@"1.0.18_8")];
} else {
return [NSString stringWithFormat:@"%@%@", @(hour/24), YMLocalizedString(@"1.0.18_8")];
}
}
}
- (NSString *)pricePerDays {
return [NSString stringWithFormat:@"%@/%@%@",
@(self.goldPrice),
@(self.buyHour/24),
YMLocalizedString(@"1.0.18_8")];
}
- (BOOL)isAlreadyPay {
if (self.status == RoomBGStatus_Pass) {
return ![NSString isEmpty:self.remainHour];
}
return NO;
}
@end
@implementation CustomRoomBGModel

View File

@@ -2531,6 +2531,7 @@ HWDMP4PlayDelegate>
/// vap
- (void)playLuckyGiftEffectWithVapUrl:(NSString *)vapUrl {
NSString *encodingUrl = [vapUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
encodingUrl = [encodingUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *fileName = [[encodingUrl componentsSeparatedByString:@"/"] lastObject];
NSString *fullPath = [self.GiftDynamicEffectListPath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){

View File

@@ -74,7 +74,7 @@
if ([roomInfo.backPic containsString:@".svga"]) { //SVGA
@weakify(self);
[self.parserManager loadSvgaWithURL:[NSURL URLWithString:roomInfo.backPic] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
[self.parserManager loadSvgaWithURL:[NSURL URLWithString:[roomInfo.backPic stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@strongify(self);
if (videoItem != nil) {
self.svgDisplayView.hidden = NO;

View File

@@ -21,6 +21,9 @@ NS_ASSUME_NONNULL_BEGIN
model:(CustomRoomBGItemModel *)model
atIndexPath:(NSIndexPath *)indexPath;
- (void)playSVGA;
- (void)pauseSVGA;
@end
NS_ASSUME_NONNULL_END

View File

@@ -6,12 +6,15 @@
//
#import "CustomRoomBGCell.h"
#import "SVGA.h"
#import "CustomRoomBGItemModel.h"
@interface CustomRoomBGCell ()
@property (nonatomic, strong) NetImageView *bgImageView;
@property (nonatomic, strong) UIView *selectedStateView;
@property (nonatomic, strong) UILabel *freeDefaultTagLabel;
@property (nonatomic, strong) UILabel *remainingDaysLabel;
@property (nonatomic, strong) UILabel *typeLabel;
@property (nonatomic, strong) UIButton *previewButton;
@@ -20,9 +23,12 @@
@property (nonatomic, strong) UIImageView *bgTypeImageView;
@property (nonatomic, strong) UIButton *playButton;
@property (nonatomic, strong) UIButton *trashButton;
@property (nonatomic, strong) UIImageView *goldIcon;
@property (nonatomic, strong) CustomRoomBGItemModel *cellModel;
@property (nonatomic, strong) NSIndexPath *cellIndexPath;
@property (nonatomic, strong) SVGAImageView *svgaImageView;
@property (nonatomic, strong) SVGAParser *parser;
//@property (nonatomic, strong) SVGAVideoEntity *svgaEntity;
@end
@implementation CustomRoomBGCell
@@ -45,6 +51,7 @@
NSString *cellID = [NSString stringWithFormat:@"%@%@", NSStringFromClass([self class]), @(model.type)];
CustomRoomBGCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellID
forIndexPath:indexPath];
cell.cellIndexPath = indexPath;
cell.cellModel = model;
return cell;
}
@@ -56,6 +63,90 @@
return self;
}
- (void)prepareForReuse {
[super prepareForReuse];
[self pauseSVGA];
}
- (void)playSVGA {
self.bgImageView.hidden = YES;
self.svgaImageView.hidden = YES;
if ([self.cellModel.url.lowercaseString hasSuffix:@"svga"]) {
self.svgaImageView.hidden = NO;
if (self.svgaImageView.videoItem) {
[self.svgaImageView startAnimation];
} else {
NSLog(@"%@", self.cellModel.url);
@kWeakify(self);
[self.parser parseWithURL:[NSURL URLWithString:[self.cellModel.url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]]
completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@kStrongify(self);
self.svgaImageView.videoItem = videoItem;
[self.svgaImageView startAnimation];
} failureBlock:^(NSError * _Nullable error) {
NSLog(@"%@", error);
}];
}
} else {
self.bgImageView.hidden = NO;
self.bgImageView.imageUrl = self.cellModel.url;
}
}
- (void)pauseSVGA {
if ([self.cellModel.url.lowercaseString hasSuffix:@"svga"]) {
[self.svgaImageView stopAnimation]; //
self.svgaImageView.videoItem = nil; //
}
}
- (void)displayFreeDefaultTag:(BOOL)needDisplay {
self.freeDefaultTagLabel.hidden = !needDisplay;
}
- (void)displayPayRemainTag:(BOOL)needDisplay {
self.remainingDaysLabel.hidden = !needDisplay;
}
- (void)displayGIFTag:(BOOL)needDisplay {
self.bgTypeImageView.hidden = !needDisplay;
self.playButton.hidden = !needDisplay;
}
- (void)updateActionButtonToRenew {
[self.actionButton setTitle:YMLocalizedString(@"1.0.18_10") forState:UIControlStateNormal];
self.actionButton.backgroundColor = [UIColor colorWithWhite:1 alpha:0.2];
[self.actionButton setCornerRadius:10
corners:(kCALayerMinXMinYCorner |
kCALayerMaxXMinYCorner |
kCALayerMinXMaxYCorner |
kCALayerMaxXMaxYCorner)
borderWidth:1
borderColor:[UIColor whiteColor]];
}
- (void)updateActionButtonToBuy {
[self.actionButton setTitle:YMLocalizedString(@"1.0.18_9") forState:UIControlStateNormal];
//
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = @[(__bridge id)UIColorFromRGB(0xE29030).CGColor,
(__bridge id)UIColorFromRGB(0xFCC074).CGColor];
gradientLayer.startPoint = CGPointMake(0.0, 0.0); //
gradientLayer.endPoint = CGPointMake(0.0, 1.0); //
gradientLayer.frame = CGRectMake(0, 0, 72, 22); //
//
[self.actionButton.layer insertSublayer:gradientLayer atIndex:0];
[self.actionButton setCornerRadius:10
corners:(kCALayerMinXMinYCorner |
kCALayerMaxXMinYCorner |
kCALayerMinXMaxYCorner |
kCALayerMaxXMaxYCorner)
borderWidth:0
borderColor:[UIColor clearColor]];
self.actionButton.userInteractionEnabled = NO;
}
- (void)setIsSelectedCell:(BOOL)isSelectedCell {
_isSelectedCell = isSelectedCell;
self.selectedStateView.hidden = !isSelectedCell;
@@ -63,17 +154,41 @@
- (void)setCellModel:(CustomRoomBGItemModel *)cellModel {
_cellModel = cellModel;
self.bgImageView.imageUrl = cellModel.url;
self.isSelectedCell = cellModel.isCur;
switch (cellModel.type) {
case 0:
case RoomBGType_Free:
[self layoutFreeUI];
[self displayFreeDefaultTag:self.cellIndexPath.row == 0];
[self displayGIFTag:[cellModel.url hasSuffix:@"svga"]];
break;
case 1:
case RoomBGType_Pay:
[self layoutPayUI];
[self setupBottomArea];
self.pricePerDayLabel.text = [cellModel pricePerDays];
[self displayGIFTag:[cellModel.url hasSuffix:@"svga"]];
[self displayPayRemainTag:cellModel.status == RoomBGStatus_Expired || cellModel.status == RoomBGStatus_Pass];
[self updateActionButtonToBuy];
switch (cellModel.status) {
case RoomBGStatus_Expired:
self.remainingDaysLabel.text = YMLocalizedString(@"1.0.18_7");
[self updateActionButtonToRenew];
break;
case RoomBGStatus_Reviewing:
self.remainingDaysLabel.text = @"";
break;
case RoomBGStatus_Pass:
self.remainingDaysLabel.text = [cellModel remainDays];
self.remainingDaysLabel.hidden = [NSString isEmpty:[cellModel remainDays]];
break;
case RoomBGStatus_Rejected:
self.remainingDaysLabel.text = @"";
break;
default:
break;
}
break;
case 2:
case RoomBGType_Custom:
[self layoutCustomUI];
[self setupBottomArea];
break;
@@ -83,14 +198,18 @@
}
- (void)layoutFreeUI {
[self.contentView addSubview:self.remainingDaysLabel];
[self.remainingDaysLabel mas_makeConstraints:^(MASConstraintMaker *make) {
[self.contentView addSubview:self.freeDefaultTagLabel];
[self.freeDefaultTagLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.leading.mas_equalTo(6);
make.height.mas_equalTo(20);
make.width.mas_greaterThanOrEqualTo(50);
make.width.mas_greaterThanOrEqualTo(52);
}];
self.remainingDaysLabel.text = YMLocalizedString(@"1.0.18_17");
[self.contentView addSubview:self.bgTypeImageView];
[self.bgTypeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.top.mas_equalTo(self.contentView).inset(6);
make.size.mas_equalTo(CGSizeMake(27, 19));
}];
}
- (void)layoutPayUI {
@@ -133,6 +252,14 @@
- (void)setupUI {
[self.contentView addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.contentView).offset(6);
make.top.leading.trailing.mas_equalTo(self.contentView);
make.height.mas_equalTo(kGetScaleWidth(180));
}];
[self.contentView addSubview:self.svgaImageView];
[self.svgaImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.contentView).offset(6);
make.top.leading.trailing.mas_equalTo(self.contentView);
make.height.mas_equalTo(kGetScaleWidth(180));
}];
@@ -153,9 +280,8 @@
make.height.mas_equalTo(22);
}];
UIImageView *gold = [self goldIcon];
[stack addArrangedSubview:gold];
[gold mas_makeConstraints:^(MASConstraintMaker *make) {
[stack addArrangedSubview:self.goldIcon];
[self.goldIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(22, 22));
}];
@@ -199,6 +325,15 @@
return _bgImageView;
}
- (SVGAImageView *)svgaImageView {
if (!_svgaImageView) {
_svgaImageView = [[SVGAImageView alloc] init];
_svgaImageView.contentMode = UIViewContentModeScaleAspectFit;
_svgaImageView.loops = 0;
}
return _svgaImageView;
}
- (UIView *)selectedStateView {
if (!_selectedStateView) {
_selectedStateView = [[UIView alloc] init];
@@ -214,18 +349,20 @@
- (UILabel *)remainingDaysLabel {
if (!_remainingDaysLabel) {
_remainingDaysLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.18_7") font:kFontRegular(12) textColor:[UIColor whiteColor]];
_remainingDaysLabel = [UILabel labelInitWithText:@"" font:kFontRegular(12) textColor:[UIColor whiteColor]];
_remainingDaysLabel.backgroundColor = UIColorFromRGB(0x696969);
_remainingDaysLabel.textAlignment = NSTextAlignmentCenter;
_remainingDaysLabel.layer.cornerRadius = 10;
_remainingDaysLabel.layer.masksToBounds = YES;
[_remainingDaysLabel setCornerRadius:10];
}
return _remainingDaysLabel;
}
- (UIImageView *)goldIcon {
UIImageView *gold = [[UIImageView alloc] initWithImage:kImage(@"moli_money_icon")];
return gold;
if (!_goldIcon) {
_goldIcon = [[UIImageView alloc] initWithImage:kImage(@"moli_money_icon")];
}
return _goldIcon;
}
- (UILabel *)pricePerDayLabel {
@@ -242,7 +379,7 @@
_actionButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_actionButton setTitle:YMLocalizedString(@"1.0.18_9")
forState:UIControlStateNormal];
_actionButton.layer.cornerRadius = 11;
_actionButton.layer.cornerRadius = 10;
_actionButton.layer.masksToBounds = YES;
[_actionButton addTarget:self
action:@selector(didTapActionButton)
@@ -280,4 +417,21 @@
return _trashButton;
}
- (UILabel *)freeDefaultTagLabel {
if (!_freeDefaultTagLabel) {
_freeDefaultTagLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.18_17") font:kFontRegular(12) textColor:[UIColor whiteColor]];
_freeDefaultTagLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
_freeDefaultTagLabel.textAlignment = NSTextAlignmentCenter;
[_freeDefaultTagLabel setCornerRadius:10];
}
return _freeDefaultTagLabel;
}
- (SVGAParser *)parser {
if (!_parser) {
_parser = [[SVGAParser alloc] init];
}
return _parser;
}
@end

View File

@@ -11,7 +11,7 @@
#import "CustomRoomBGPresenter.h"
#import "XPRoomSettingPresenter.h"
@interface CustomRoomBGContentViewController () <UICollectionViewDelegateFlowLayout, UICollectionViewDataSource>
@interface CustomRoomBGContentViewController () <UICollectionViewDelegateFlowLayout, UICollectionViewDataSource, UIImagePickerControllerDelegate, UINavigationControllerDelegate>
@property (nonatomic, strong) UIView *bottomAreaBackGround;
@property (nonatomic, strong) UIView *emptyStateView;
@@ -30,6 +30,8 @@
@property (nonatomic, strong) UILabel *previewTipsContentLabel;
@property (nonatomic, strong) UIButton *previewActionButton;
@property (nonatomic, strong) UIButton *cancelPreviewButton;
@property (nonatomic, strong) UIButton *createCustomButton;
@property (nonatomic, strong) UIButton *helpButton;
@property (nonatomic, strong) NSMutableArray *payBackgrounds;
@property (nonatomic, strong) NSMutableArray *freeBackgrounds;
@@ -40,9 +42,15 @@
@property (nonatomic, strong) CustomRoomBGItemModel *currentSelectedModel;
@property (nonatomic, strong) UIView *previewArea;
@property (nonatomic, strong) UIButton *dismissPreviewButton;
@property (nonatomic, strong) UIImageView *previewGold;
@property (nonatomic, strong) UILabel *previewPricePerDay;
@property (nonatomic, strong) UIImage *customSelectedImage;
@property (nonatomic, assign) NSInteger customBGUsageHours;
@property (nonatomic, assign) NSInteger customBGUsageGolds;
@end
@implementation CustomRoomBGContentViewController
@@ -57,21 +65,25 @@
self.currentSelectedTabIndex = 0;
self.currentSelectedItemIndex = 0;
self.payBackgrounds = @[].mutableCopy;
self.freeBackgrounds = @[].mutableCopy;
self.customBackgrounds = @[].mutableCopy;
[self setupUI];
[self setupData];
}
- (void)setupData {
self.payBackgrounds = @[].mutableCopy;
self.freeBackgrounds = @[].mutableCopy;
self.customBackgrounds = @[].mutableCopy;
__block CustomRoomBGItemModel *currentModel = nil;
@kWeakify(self);
[self.presenter loadListOfRoomBG:self.roomUID
complete:^(CustomRoomBGModel *roomBGModel) {
@kStrongify(self);
self.customBGUsageHours = roomBGModel.customHour;
self.customBGUsageGolds = roomBGModel.customGoldPrice;
for (CustomRoomBGItemModel *model in roomBGModel.itemList) {
if (model.isCur) {
currentModel = model;
@@ -133,7 +145,7 @@
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.bottomAreaBackGround).offset(50);
make.leading.trailing.mas_equalTo(self.view);
make.height.mas_equalTo(kGetScaleWidth(180 + 32 + 22));
make.height.mas_equalTo(kGetScaleWidth(180 + 32 + 32));
}];
}
@@ -185,19 +197,17 @@
make.width.mas_greaterThanOrEqualTo(20);
}];
UIButton *helpButton = [self helpButton];
[self.view addSubview:helpButton];
[helpButton mas_makeConstraints:^(MASConstraintMaker *make) {
[self.view addSubview:self.helpButton];
[self.helpButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.freeButton);
make.trailing.mas_equalTo(self.view).offset(-15);
make.size.mas_equalTo(CGSizeMake(22, 22));
}];
UIButton *createButton = [self createCustomButton];
[self.view addSubview:createButton];
[createButton mas_makeConstraints:^(MASConstraintMaker *make) {
[self.view addSubview:self.createCustomButton];
[self.createCustomButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.freeButton);
make.trailing.mas_equalTo(helpButton.mas_leading).offset(-5);
make.trailing.mas_equalTo(self.helpButton.mas_leading).offset(-5);
make.size.mas_equalTo(CGSizeMake(82, 22));
}];
}
@@ -209,6 +219,9 @@
self.currentSelectedItemIndex = 0;
[self.collectionView reloadData];
self.helpButton.hidden = YES;
self.createCustomButton.hidden = YES;
switch (tag) {
case 100:
self.emptyStateView.hidden = YES;
@@ -217,6 +230,8 @@
self.emptyStateView.hidden = self.payBackgrounds.count != 0;
break;
case 102:
self.helpButton.hidden = NO;
self.createCustomButton.hidden = NO;
self.emptyStateView.hidden = self.customBackgrounds.count != 0;
break;
default:
@@ -230,6 +245,11 @@
[self.view addSubview:view];
self.previewArea = view;
[view addSubview:self.dismissPreviewButton];
[self.dismissPreviewButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(view);
}];
[view addSubview:self.previewBottomBackground];
[self.previewBottomBackground addSubview:self.previewTipsContentLabel];
@@ -285,29 +305,30 @@
self.previewBackSvgaView.hidden = !isSvga;
switch (model.type) {
case 0:
[self.previewPricePerDay removeFromSuperview];
[self.previewGold removeFromSuperview];
case RoomBGType_Free:
// [self.previewPricePerDay removeFromSuperview];
// [self.previewGold removeFromSuperview];
// [self.previewActionButton setTitle:YMLocalizedString(@"1.0.18_15") forState:UIControlStateNormal];
break;
case RoomBGType_Pay:
self.previewPricePerDay.text = [model pricePerDays];
self.previewTipsContentLabel.text = YMLocalizedString(@"1.0.18_13");
[self.previewActionButton setTitle:YMLocalizedString(@"1.0.18_16") forState:UIControlStateNormal];
break;
case RoomBGType_Custom:
self.previewPricePerDay.text = [model pricePerDays];
self.previewTipsContentLabel.text = YMLocalizedString(@"1.0.18_12");
[self.previewActionButton setTitle:YMLocalizedString(@"1.0.18_15") forState:UIControlStateNormal];
break;
case 1:
[self.previewActionButton setTitle:YMLocalizedString(@"1.0.18_16") forState:UIControlStateNormal];
break;
case 2:
[self.previewActionButton setTitle:YMLocalizedString(@"1.0.18_16") forState:UIControlStateNormal];
break;
default:
break;
}
if (model.type == 0) {
}
if (isSvga) {
SVGAParser *_parser = [SVGAParser new];
@kWeakify(self);
[_parser parseWithURL:[NSURL URLWithString:model.url] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
[_parser parseWithURL:[NSURL URLWithString:[model.url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]]
completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@kStrongify(self);
self.previewBackSvgaView.loops = 0;
self.previewBackSvgaView.videoItem = videoItem;
@@ -315,12 +336,16 @@
} failureBlock:^(NSError * _Nullable error) {
NSLog(@"%@", error);
}];
} else {
self.previewBackImageView.imageUrl = model.url;
}
}
- (void)updatePreviewWith:(UIImage *)image {
self.previewBackImageView.image = image;
[self.previewActionButton setTitle:YMLocalizedString(@"1.0.18_16") forState:UIControlStateNormal];
}
#pragma mark -
- (void)didTapEmptySpace {
[self dismissViewControllerAnimated:YES completion:nil];
@@ -337,9 +362,22 @@
}
- (void)didTapCreate {
if (self.currentSelectedModel.type == 0) {
}
@kWeakify(self);
[YYUtility checkAssetsLibrayAvailable:^{
@kStrongify(self);
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.modalPresentationCapturesStatusBarAppearance = YES;
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.allowsEditing = NO;
[self presentViewController:imagePicker animated:YES completion:NULL];
} denied:^{
@kStrongify(self);
[self showNotPhoto:YMLocalizedString(@"SessionViewController21") content:YMLocalizedString(@"XPMineUserInfoAlbumViewController8")];
} restriction:^{
@kStrongify(self);
[self showNotPhoto:YMLocalizedString(@"SessionViewController21") content:YMLocalizedString(@"XPMineUserInfoAlbumViewController10")];
}];
}
- (void)didTapHelp {
@@ -361,14 +399,18 @@
[self.previewArea removeFromSuperview];
}
- (void)updateRoomBG {
if (!self.currentSelectedModel) {
[self uploadBG];
return;
}
switch (self.currentSelectedModel.type) {
case 0:
[self applyBG];
break;
case 1:
if (self.currentSelectedModel.status == 1) {
if (self.currentSelectedModel.status == 1 && [self.currentSelectedModel isAlreadyPay]) {
[self applyBG];
} else {
[self buyBG];
@@ -395,7 +437,14 @@
}
- (void)uploadBG {
@kWeakify(self);
[self.presenter uploadRoomBG:self.roomUID photo:self.customSelectedImage complete:^{
@kStrongify(self);
// TODO: custom tab
[self setupData];
} failure:^{
[self hideHUD];
}];
}
- (void)applyBG {
@@ -409,6 +458,40 @@
failure:^{}];
}
#pragma mark - UIImagePickerControllerDelegate
- (void)showNotPhoto:(NSString *)title content:(NSString *)content{
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.title = title;
config.message = content;
[TTPopup alertWithConfig:config confirmHandler:^{
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
} cancelHandler:^{
}];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
@kWeakify(self);
[picker dismissViewControllerAnimated:YES completion:^{
@kStrongify(self);
UIImage *selectedPhoto = [info objectForKey:UIImagePickerControllerOriginalImage];
if (selectedPhoto) {
self.customSelectedImage = selectedPhoto;
[self displayPreviewArea];
[self updatePreviewWith:selectedPhoto];
}
}];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[picker dismissViewControllerAnimated:YES completion:^{
}];
}
#pragma mark -
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
switch (self.currentSelectedTabIndex) {
@@ -479,17 +562,35 @@
[collectionView reloadData];
return;
}
// TODO: buy preview
if (model.status == RoomBGStatus_Pass) {
[self applyBG];
if ([model isAlreadyPay]) {
[self applyBG];
} else {
self.currentSelectedItemIndex = indexPath.row;
[self displayPreviewArea];
[self updatePreviewArea:model];
// [collectionView reloadData];
}
} else {
self.currentSelectedItemIndex = indexPath.row;
[self displayPreviewArea];
[self updatePreviewArea:model];
[collectionView reloadData];
// [collectionView reloadData];
}
}
}
- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
CustomRoomBGCell *bgCell = (CustomRoomBGCell *)cell;
[bgCell playSVGA];
}
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
CustomRoomBGCell *bgCell = (CustomRoomBGCell *)cell;
[bgCell pauseSVGA];
}
#pragma mark -
- (UIButton *)dismissButton {
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
@@ -542,38 +643,48 @@ forControlEvents:UIControlEventTouchUpInside];
}
- (UIButton *)createCustomButton {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, 0, 82, 22);
[button setTitle:YMLocalizedString(@"1.0.18_4") forState:UIControlStateNormal];
[button.titleLabel setFont:kFontRegular(12)];
button.layer.cornerRadius = 11; //
button.clipsToBounds = YES; // 使
if (!_createCustomButton) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.hidden = YES;
button.frame = CGRectMake(0, 0, 82, 22);
[button setTitle:YMLocalizedString(@"1.0.18_4") forState:UIControlStateNormal];
[button.titleLabel setFont:kFontRegular(12)];
button.layer.cornerRadius = 11; //
button.clipsToBounds = YES; // 使
//
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = @[(__bridge id)UIColorFromRGB(0xE29030).CGColor,
(__bridge id)UIColorFromRGB(0xFCC074).CGColor];
gradientLayer.startPoint = CGPointMake(0.0, 0.0); //
gradientLayer.endPoint = CGPointMake(0.0, 1.0); //
gradientLayer.frame = button.bounds; //
//
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = @[(__bridge id)UIColorFromRGB(0xE29030).CGColor,
(__bridge id)UIColorFromRGB(0xFCC074).CGColor];
gradientLayer.startPoint = CGPointMake(0.0, 0.0); //
gradientLayer.endPoint = CGPointMake(0.0, 1.0); //
gradientLayer.frame = button.bounds; //
//
[button.layer insertSublayer:gradientLayer atIndex:0];
//
[button.layer insertSublayer:gradientLayer atIndex:0];
[button addTarget:self
action:@selector(didTapCreate)
forControlEvents:UIControlEventTouchUpInside];
[button addTarget:self
action:@selector(didTapCreate)
forControlEvents:UIControlEventTouchUpInside];
return button;
_createCustomButton = button;
}
return _createCustomButton;
}
- (UIButton *)helpButton {
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
[b setImage:kImage(@"custom_bg_help") forState:UIControlStateNormal];
[b addTarget:self
action:@selector(didTapHelp)
forControlEvents:UIControlEventTouchUpInside];
return b;
if (!_helpButton) {
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
b.hidden = YES;
[b setImage:kImage(@"custom_bg_help") forState:UIControlStateNormal];
[b addTarget:self
action:@selector(didTapHelp)
forControlEvents:UIControlEventTouchUpInside];
_helpButton = b;
}
return _helpButton;
}
- (UIView *)emptyStateView {
@@ -604,7 +715,7 @@ forControlEvents:UIControlEventTouchUpInside];
- (UICollectionView *)collectionView {
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(kGetScaleWidth(135), kGetScaleWidth(180 + 32 + 22));
layout.itemSize = CGSizeMake(kGetScaleWidth(135), kGetScaleWidth(180 + 32 + 32));
layout.minimumLineSpacing = 10;
layout.minimumInteritemSpacing = 10;
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
@@ -613,6 +724,7 @@ forControlEvents:UIControlEventTouchUpInside];
_collectionView.backgroundColor = [UIColor clearColor];
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.clipsToBounds = NO;
_collectionView.showsHorizontalScrollIndicator = NO;
[CustomRoomBGCell registerTo:_collectionView];
}
@@ -662,7 +774,7 @@ forControlEvents:UIControlEventTouchUpInside];
_previewBackImageView = [[NetImageView alloc] init];
_previewBackImageView.layer.cornerRadius = 14;
_previewBackImageView.layer.masksToBounds = YES;
// _previewBackImageView.imageUrl = @"https://wx1.moyu.im/mw600/008ElFOcly1hv5oqfnpxtj30z07czx1k.jpg";
_previewBackImageView.contentMode = UIViewContentModeScaleAspectFill;
}
return _previewBackImageView;
}
@@ -746,6 +858,17 @@ forControlEvents:UIControlEventTouchUpInside];
return b;
}
- (UIButton *)dismissPreviewButton {
if (!_dismissPreviewButton) {
_dismissPreviewButton = [UIButton buttonWithType:UIButtonTypeCustom];
_dismissPreviewButton.backgroundColor = [UIColor clearColor];
[_dismissPreviewButton addTarget:self
action:@selector(didTapCancelPreview)
forControlEvents:UIControlEventTouchUpInside];
}
return _dismissPreviewButton;
}
#pragma mark -
- (NSString *)titleForTag:(NSInteger)tag {

View File

@@ -27,6 +27,11 @@ NS_ASSUME_NONNULL_BEGIN
complete:(void(^)(void))complete
failure:(void(^)(void))failure;
- (void)uploadRoomBG:(NSString *)roomUID
photo:(UIImage *)photo
complete:(void(^)(void))complete
failure:(void(^)(void))failure;
- (void)loadListOfRoomBG:(NSString *)roomUID
complete:(void(^)(CustomRoomBGModel *model))complete
failure:(void(^)(void))failure;

View File

@@ -7,6 +7,7 @@
#import "CustomRoomBGPresenter.h"
#import "UploadFile.h"
#import "Api+CustomBackground.h"
@implementation CustomRoomBGPresenter
@@ -52,7 +53,7 @@
showLoading:YES
errorToast:YES]
roomUid:roomUID
backgroundItemId:itemID];
id:itemID];
}
- (void)useRoomBG:(NSString *)roomUID
@@ -75,12 +76,44 @@
id:itemID];
}
- (void)uploadRoomBG:(NSString *)roomUID
photo:(UIImage *)photo
complete:(void(^)(void))complete
failure:(void(^)(void))failure {
NSData *data = UIImageJPEGRepresentation(photo, 0.7);
NSString *format = [UIImage getImageTypeWithImageData:data];
NSString *name = [NSString stringWithFormat:@"image/%@.%@",[NSString createUUID],format];
[[UploadFile share]QCloudUploadImage:data named:name success:^(NSString * _Nonnull key, NSDictionary * _Nonnull resp) {
if ([NSString isEmpty:key]) {
if (failure) {
failure();
}
} else {
[Api uploadCustomBackground:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
if (complete) {
complete();
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
if (failure) {
failure();
}
}] roomUid:roomUID url:key];
}
} failure:^(NSNumber * _Nonnull resCode, NSString * _Nonnull message) {
if (failure) {
failure();
}
}];
}
- (void)loadListOfRoomBG:(NSString *)roomUID
complete:(void(^)(CustomRoomBGModel *model))complete
failure:(void(^)(void))failure {
[Api listOfRoomBackground:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
if (complete) {
CustomRoomBGModel *model = [CustomRoomBGModel modelWithJSON:data.data];
NSArray *sortItems = [model.itemList sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"id" ascending:YES]]];
model.itemList = sortItems.copy;
complete(model);
}
}

View File

@@ -82,7 +82,7 @@
make.top.mas_equalTo(self.svgDisplayView.mas_bottom).mas_offset(7);
}];
NSString * anatomiser1Name = [NSString stringWithFormat:@"%@/anchorPK_vs.svga", API_Image_URL];
NSString * anatomiser1Name = [[NSString stringWithFormat:@"%@/anchorPK_vs.svga", API_Image_URL] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
[self.parser parseWithURL:[NSURL URLWithString:anatomiser1Name] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
self.svgDisplayView.loops = INT_MAX;
self.svgDisplayView.clearsAfterStop = NO;

View File

@@ -42,7 +42,7 @@
return;
}
@kWeakify(self);
[self.parser parseWithURL:[NSURL URLWithString:url] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
[self.parser parseWithURL:[NSURL URLWithString:[url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@kStrongify(self);
self.svgDisplayView.loops = 1;
self.svgDisplayView.clearsAfterStop = YES;

View File

@@ -285,6 +285,7 @@
}];
}
NSString *encodingUrl = [animtionName stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
encodingUrl = [encodingUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSString *fileName = [[encodingUrl componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) xpSafeObjectAtIndex:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];

View File

@@ -547,7 +547,7 @@
if (resourcePath.length > 0) {
NSString *encodingUrl = [resourcePath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
@kWeakify(self);
[self.vapParser parseWithURL:encodingUrl completionBlock:^(NSString * _Nullable videoUrl) {
[self.vapParser parseWithURL:[encodingUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]] completionBlock:^(NSString * _Nullable videoUrl) {
@kStrongify(self);
if (videoUrl.length) {
[self.vapView setMute:YES];

View File

@@ -55,7 +55,7 @@
}
+ (void)clientConfig:(HttpRequestHelperCompletion)completion {
[HttpRequestHelper request:@"client/config" method:HttpRequestHelperMethodGET params:@{} completion:completion];
[HttpRequestHelper request:@"client/config" method:HttpRequestHelperMethodGET params:@{@"timeoutInterval":@(2)} completion:completion];
}

View File

@@ -253,7 +253,7 @@
@kWeakify(self);
if (isSvga == YES) {
SVGAParser *parser = [SVGAParser new];
[parser parseWithURL:[NSURL URLWithString:model.resourceContent] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
[parser parseWithURL:[NSURL URLWithString:[model.resourceContent stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
model.videoItem = videoItem;
CGFloat height = kGetScaleWidth(60);

View File

@@ -57,28 +57,31 @@
if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == 0) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
failure(-1, YMLocalizedString(@"HttpRequestHelper0"));
});
return;
}
[self configHeaders];
AFHTTPSessionManager *manager = [HttpRequestHelper requestManager];
NSString *key = @"timeoutInterval";
if ([params.allKeys containsObject:key]) {
NSInteger timeout = [[params objectForKey:key] integerValue];
NSMutableDictionary *filteredDictionary = [params mutableCopy];
[filteredDictionary removeObjectForKey:key];
params = filteredDictionary.copy;
if (timeout > 0) {
manager.requestSerializer.timeoutInterval = timeout;
}
}
params = [MSParamsDecode msDecodeParams:[params mutableCopy] ];
params = [self configBaseParmars:params];
#ifdef DEBUG
NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params);
#endif
#ifdef DEBUG
NSString *url = [self getHostUrl];
NSString *urlPath = [NSString stringWithFormat:@"%@/%@", url ,method];
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[BSNetListenModel addHttpReq:urlPath header:manager.requestSerializer.HTTPRequestHeaders param:[params copy] time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]];
});
#else
#endif
[manager GET:method parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
@@ -86,11 +89,6 @@
#ifdef DEBUG
NSLog(@"\n%@", [baseModel toJSONString]);
NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response;
NSDictionary *allHeaders = response.allHeaderFields;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[BSNetListenModel addHttpRsp:urlPath header:allHeaders result:baseModel.data isSuccess:YES time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]];
});
#else
#endif
@@ -108,7 +106,6 @@
if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == 0) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
failure(-1, YMLocalizedString(@"HttpRequestHelper0"));
});
return;
}
@@ -122,12 +119,6 @@
#ifdef DEBUG
NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params);
NSString *url = [self getHostUrl];
NSString *urlPath = [NSString stringWithFormat:@"%@/%@", url ,method];
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[BSNetListenModel addHttpReq:urlPath header:manager.requestSerializer.HTTPRequestHeaders param:[params copy] time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]];
});
#else
#endif
@@ -135,11 +126,6 @@
BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject];
#ifdef DEBUG
NSLog(@"\n%@", [baseModel toJSONString]);
NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response;
NSDictionary *allHeaders = response.allHeaderFields;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[BSNetListenModel addHttpRsp:urlPath header:allHeaders result:baseModel.data isSuccess:YES time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]];
});
#else
#endif
@@ -168,11 +154,6 @@
AFHTTPSessionManager *manager = [HttpRequestHelper requestManager];
#ifdef DEBUG
NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params);
NSString *url = [self getHostUrl];
NSString *urlPath = [NSString stringWithFormat:@"%@/%@", url ,method];
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[BSNetListenModel addHttpReq:urlPath header:manager.requestSerializer.HTTPRequestHeaders param:[params copy] time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]];
});
#else
#endif
@@ -181,11 +162,6 @@
#ifdef DEBUG
NSLog(@"\n%@", [baseModel toJSONString]);
NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response;
NSDictionary *allHeaders = response.allHeaderFields;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[BSNetListenModel addHttpRsp:urlPath header:allHeaders result:baseModel.data isSuccess:YES time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]];
});
#else
#endif
success(baseModel);

View File

@@ -3965,21 +3965,31 @@ ineHeadView12" = "الحمل";
"UserCard_1.0.17_0" = "%@فشل الإعداد، هذا المستخدم هو في اي بي";
"UserCard_1.0.17_1" = "فشل المتابعة، تم تعيين المستخدم على عدم إمكانية متابعته";
"1.0.18_0" = "房间背景";
"1.0.18_1" = "免费";
"1.0.18_2" = "给点";
"1.0.18_3" = "给多点你就是王";
"1.0.18_4" = "Create new";
"1.0.18_5" = "You can customize up to 6 backgrounds.";
"1.0.18_6" = "You can only upload up to 6 images at a time as a custom background. Once the background is created, it cannot be canceled. We will review the uploaded background within 24 hours. If the background is rejected, you will receive a refund of coins.";
"1.0.18_7" = "Expired";
"1.0.18_8" = "Days";
"1.0.18_9" = "Buy";
"1.0.18_10" = "Renew";
"1.0.18_11" = "Purchases Tips";
"1.0.18_12" = "Are you sure you want to use this image as your background?";
"1.0.18_13" = "Are you sure you want to buy?";
"1.0.18_0" = "الخلفية";
"1.0.18_1" = "مجانية";
"1.0.18_2" = "الدفع";
"1.0.18_3" = "مخصصة";
"1.0.18_4" = "إنشاء جديد";
"1.0.18_5" = "يمكنك تخصيص ما يصل إلى 6 خلفيات";
"1.0.18_6" = "لا يمكنك تحميل أكثر من 6 صور في المرة الواحدة كخلفية مخصصة.
بمجرد إنشاء الخلفية، لا يمكن إلغاؤها.
سوف نراجع الخلفية التي تم تحميلها خلال 24 ساعة.
إذا تم رفض الخلفية، فسوف تتلقى استردادًا للعملات.";
"1.0.18_7" = "انتهاء الصلاحية";
"1.0.18_8" = "أيام";
"1.0.18_9" = "شراء";
"1.0.18_10" = "تجديد";
"1.0.18_11" = "تلميح شراء";
"1.0.18_12" = "هل أنت متأكد أنك تريد استخدام هذه الصورة كخلفية؟";
"1.0.18_13" = "هل أنت متأكد أنك تريد الشراء؟";
"1.0.18_14" = "1000/15Days";
"1.0.18_15" = "Submit";
"1.0.18_16" = "Confirm";
"1.0.18_17" = "Original";
"1.0.18_15" = "تقديم";
"1.0.18_16" = "تأكيد";
"1.0.18_17" = "أصلية";
"1.0.18_18" = "قيد المراجعة";
"1.0.18_19" = "مرفوض";
"11.0.18_20" = "تلميح";
"1.0.18_21" = "سوف نقوم بمراجعة خلفية الغرفة التي أرسلتها في أقرب وقت ممكن. بمجرد اكتمال المراجعة، سنخطرك بالنتيجة من خلال رسالة النظام.";
"1.0.18_22" = "تهانينا! تمت مراجعة خلفيتك. يمكنك الآن تخصيص غرفتك على الفور بالخلفية الجديدة.";
"1.0.18_23" = "عذرًا، لم تتم مراجعة خلفيتك. يرجى تحميل خلفية جديدة مرة أخرى.";
"1.0.18_24" = "شراء الخلفية";

View File

@@ -3761,10 +3761,10 @@
"UserCard_1.0.17_0" = "Setting failed, this user is VIP%@";
"UserCard_1.0.17_1" = "Follow failed, the user has been set to be unfollowable.";
"1.0.18_0" = "房间背景";
"1.0.18_1" = "免费";
"1.0.18_2" = "给点";
"1.0.18_3" = "给多点你就是王";
"1.0.18_0" = "Background";
"1.0.18_1" = "Free";
"1.0.18_2" = "Pay";
"1.0.18_3" = "Custom";
"1.0.18_4" = "Create new";
"1.0.18_5" = "You can customize up to 6 backgrounds.";
"1.0.18_6" = "You can only upload up to 6 images at a time as a custom background. Once the background is created, it cannot be canceled. We will review the uploaded background within 24 hours. If the background is rejected, you will receive a refund of coins.";
@@ -3779,3 +3779,10 @@
"1.0.18_15" = "Submit";
"1.0.18_16" = "Confirm";
"1.0.18_17" = "Original";
"1.0.18_18" = "In review";
"1.0.18_19" = "Rejected";
"1.0.18_20" = "Tips";
"1.0.18_21" = "We will review your submitted room background as soon as possible. Once the review is completed, we will notify you of the result through a system message.";
"1.0.18_22" = "Congratulations! Your background has been reviewed. Now you can immediately personalize your room with the new background.";
"1.0.18_23" = "Sorry, your background has not been reviewed. Please upload a new background again.";
"1.0.18_24" = "Buy background";

View File

@@ -3547,21 +3547,28 @@
"MSRoomGameQuit tGameView3"="Eşleşme başarısız oldu, tekrar eşleşmek ister misiniz?";
"MSRoomGameVC1"="Cüzdan";
"1.0.18_0" = "房间背景";
"1.0.18_1" = "免费";
"1.0.18_2" = "给点";
"1.0.18_3" = "给多点你就是王";
"1.0.18_4" = "Create new";
"1.0.18_5" = "You can customize up to 6 backgrounds.";
"1.0.18_6" = "You can only upload up to 6 images at a time as a custom background. Once the background is created, it cannot be canceled. We will review the uploaded background within 24 hours. If the background is rejected, you will receive a refund of coins.";
"1.0.18_7" = "Expired";
"1.0.18_8" = "Days";
"1.0.18_9" = "Buy";
"1.0.18_10" = "Renew";
"1.0.18_11" = "Purchases Tips";
"1.0.18_12" = "Are you sure you want to use this image as your background?";
"1.0.18_13" = "Are you sure you want to buy?";
"1.0.18_0" = "Arka Plan";
"1.0.18_1" = "Ücretsiz";
"1.0.18_2" = "Öde";
"1.0.18_3" = "Özel";
"1.0.18_4" = "Yeni oluştur";
"1.0.18_5" = "En fazla 6 arka planı özelleştirebilirsiniz.";
"1.0.18_6" = "Özel arka plan olarak aynı anda en fazla 6 resim yükleyebilirsiniz. Arka plan oluşturulduktan sonra iptal edilemez. Yüklenen arka planı 24 saat içinde inceleyeceğiz. Arka plan reddedilirse, jeton iadesi alacaksınız.";
"1.0.18_7" = "Süresi doldu";
"1.0.18_8" = "Günler";
"1.0.18_9" = "Satın Al";
"1.0.18_10" = "Yenile";
"1.0.18_11" = "Satın Alma İpucu";
"1.0.18_12" = "Bu resmi arka planınız olarak kullanmak istediğinizden emin misiniz?";
"1.0.18_13" = "Satın almak istediğinizden emin misiniz?";
"1.0.18_14" = "1000/15Days";
"1.0.18_15" = "Submit";
"1.0.18_16" = "Confirm";
"1.0.18_17" = "Original";
"1.0.18_15" = "Gönder";
"1.0.18_16" = "Onayla";
"1.0.18_17" = "Orijinal";
"1.0.18_18" = "İncelemede";
"1.0.18_19" = "Reddedildi";
"1.0.18_20" = "İpuçları";
"1.0.18_21" = "Gönderdiğiniz oda arka planını en kısa sürede inceleyeceğiz. İnceleme tamamlandıktan sonra, sonucu bir sistem mesajıyla size bildireceğiz.";
"1.0.18_22" = "Tebrikler! Arka planınız incelendi. Artık odanızı yeni arka planla hemen kişiselleştirebilirsiniz.";
"1.0.18_23" = "Üzgünüz, arka planınız incelenmedi. Lütfen tekrar yeni bir arka plan yükleyin.";
"1.0.18_24" = "Arkaplan satın al";

View File

@@ -3417,23 +3417,29 @@
"UserCard_1.0.17_0" = "設定失敗用户為尊貴的VIP%@";
"UserCard_1.0.17_1" = "關注失敗,該用戶已被設定為不可關注。";
"1.0.18_0" = "房间背景";
"1.0.18_0" = "背景";
"1.0.18_1" = "免费";
"1.0.18_2" = "给点";
"1.0.18_3" = "给多点你就是王";
"1.0.18_4" = "Create new";
"1.0.18_5" = "You can customize up to 6 backgrounds.";
"1.0.18_6" = "You can only upload up to 6 images at a time as a custom background. Once the background is created, it cannot be canceled. We will review the uploaded background within 24 hours. If the background is rejected, you will receive a refund of coins.";
"1.0.18_7" = "Expired";
"1.0.18_8" = "Days";
"1.0.18_9" = "Buy";
"1.0.18_10" = "Renew";
"1.0.18_11" = "Purchases Tips";
"1.0.18_12" = "Are you sure you want to use this image as your background?";
"1.0.18_2" = "支付";
"1.0.18_3" = "自定義";
"1.0.18_4" = "創造新的";
"1.0.18_5" = "您最多可以自定義 6 個背景。";
"1.0.18_6" = "您一次最多只能上传 6 张图片作为自定义背景。 背景一旦创建,就无法取消。 我们将在 24 小时内审核上传的背景。 如果背景被拒绝,您将收到金币退款。";
"1.0.18_7" = "過期";
"1.0.18_8" = "";
"1.0.18_9" = "";
"1.0.18_10" = "更新";
"1.0.18_11" = "購買提示";
"1.0.18_12" = "您確定要使用此圖像作為背景嗎?";
"1.0.18_14" = "天";
"1.0.18_13" = "您確定要購買嗎?";
"1.0.18_14" = "1000/15Days";
"1.0.18_13" = "Are you sure you want to buy?";
"1.0.18_14" = "1000/15Days";
"1.0.18_15" = "Submit";
"1.0.18_16" = "Confirm";
"1.0.18_17" = "Original";
"1.0.18_15" = "提交";
"1.0.18_16" = "確認";
"1.0.18_17" = "通用";
"1.0.18_18" = "審核中";
"1.0.18_19" = "拒絕";
"1.0.18_20" = "提示";
"1.0.18_21" = "我們將盡快審查您提交的房間背景。審核完成後,我們將透過系統訊息通知您結果。";
"1.0.18_22" = "恭喜!您的背景已被審查。現在您可以立即使用新背景來個性化您的房間。";
"1.0.18_23" = "抱歉,您的背景尚未經過審核。請重新上傳新背景。";
"1.0.18_24" = "购买背景";