更新事件创建功能,新增金钱加载接口,优化事件时长选择器,调整UI组件约束,修复部分UI问题,更新本地化字符串。增加删除事件功能的提示确认。版本号更新至20.20.62。
This commit is contained in:
@@ -78,6 +78,10 @@ void qg_VAP_Logger_handler(VAPLogLevel level, const char* file, int line, const
|
||||
});
|
||||
}];
|
||||
|
||||
if (@available(iOS 15, *)) {
|
||||
[[UITableView appearance] setSectionHeaderTopPadding:0];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, assign) NSTimeInterval eventStartTime;// 事件开始时间戳
|
||||
@property (nonatomic, assign) NSTimeInterval createTime; // 创建时间戳
|
||||
|
||||
@property (nonatomic, copy) NSString *gender;
|
||||
@property (nonatomic, assign) NSInteger gender;
|
||||
@property (nonatomic, copy) NSString *nick;
|
||||
|
||||
@end
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#import "EventItemModel.h"
|
||||
#import "EventRoomModel.h"
|
||||
#import "EventConfigModel.h"
|
||||
#import "WalletInfoModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -61,9 +62,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
uploadToHome:(BOOL)uploadToHome
|
||||
startTime:(NSString *)startTime
|
||||
duration:(NSInteger)duration
|
||||
content:(NSString *)content
|
||||
content:(NSString *)content
|
||||
gold:(NSInteger)gold
|
||||
roomUid:(NSInteger)roomUid
|
||||
notifyFans:(BOOL)notifyFans;
|
||||
|
||||
- (void)loadMoney:(void(^)(WalletInfoModel *walletModel))success failure:(void(^)(NSError *error))failure;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -168,6 +168,8 @@
|
||||
startTime:(NSString *)startTime
|
||||
duration:(NSInteger)duration
|
||||
content:(NSString *)content
|
||||
gold:(NSInteger)gold
|
||||
roomUid:(NSInteger)roomUid
|
||||
notifyFans:(BOOL)notifyFans {
|
||||
|
||||
[Api usereventPublish:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@@ -186,9 +188,29 @@
|
||||
eventTopic:title
|
||||
noticeFans:@(notifyFans)
|
||||
payBanner:@(uploadToHome)
|
||||
payGoldNum:@(1000) // TODO: load gold from config
|
||||
roomUid:[AccountInfoStorage instance].getUid
|
||||
payGoldNum:@(gold)
|
||||
roomUid:@(roomUid).stringValue
|
||||
uid:[AccountInfoStorage instance].getUid];
|
||||
}
|
||||
|
||||
- (void)loadMoney:(void(^)(WalletInfoModel *))success
|
||||
failure:(void(^)(NSError *error))failure {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
@kWeakify(self);
|
||||
[Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
if (data.code == 200) {
|
||||
WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data];
|
||||
if (success) {
|
||||
success(model);
|
||||
}
|
||||
} else {
|
||||
if (failure) {
|
||||
failure([NSError errorWithDomain:data.message code:data.code userInfo:nil]);
|
||||
}
|
||||
}
|
||||
}] uid:uid ticket:ticket];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -24,6 +24,7 @@
|
||||
@property (nonatomic, strong) UIImageView *ringImageView;
|
||||
|
||||
@property (nonatomic, strong) UIButton *statusButton;
|
||||
@property (nonatomic, strong) UIButton *deleteButton;
|
||||
|
||||
@property (nonatomic, assign) EventCellActions action;
|
||||
|
||||
@@ -53,6 +54,7 @@
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
self.separatorInset = UIEdgeInsetsZero;
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
self.contentView.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
[self.contentView addSubview:self.bgImageView];
|
||||
@@ -63,7 +65,7 @@
|
||||
}];
|
||||
|
||||
UIView *mask_1 = [self blackMask];
|
||||
[self.contentView addSubview:mask_1];
|
||||
[self.bgImageView addSubview:mask_1];
|
||||
[mask_1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.bgImageView);
|
||||
}];
|
||||
@@ -83,7 +85,7 @@
|
||||
[self.contentView addSubview:self.sexImageView];
|
||||
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.nameLabel);
|
||||
make.leading.mas_equalTo(2);
|
||||
make.leading.mas_equalTo(self.nameLabel.mas_trailing).offset(2);
|
||||
make.size.mas_equalTo(CGSizeMake(14, 14));
|
||||
}];
|
||||
|
||||
@@ -96,11 +98,11 @@
|
||||
[self.contentView addSubview:self.eventDescLabel];
|
||||
[self.eventDescLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.mas_equalTo(self.bgImageView).inset(12);
|
||||
make.centerY.mas_equalTo(self.bgImageView);
|
||||
make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(12);
|
||||
}];
|
||||
|
||||
UIView *mask_2 = [self blackMask];
|
||||
[self.contentView addSubview:mask_2];
|
||||
[self.bgImageView addSubview:mask_2];
|
||||
[mask_2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.leading.trailing.mas_equalTo(self.bgImageView);
|
||||
make.height.mas_equalTo(32);
|
||||
@@ -137,7 +139,15 @@
|
||||
make.centerY.mas_equalTo(self.avatarImageView);
|
||||
make.trailing.mas_equalTo(self.bgImageView).offset(-13);
|
||||
make.height.mas_equalTo(26);
|
||||
make.width.mas_greaterThanOrEqualTo(26);
|
||||
make.width.mas_greaterThanOrEqualTo(40);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.deleteButton];
|
||||
[self.deleteButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.avatarImageView);
|
||||
make.trailing.mas_equalTo(self.bgImageView).offset(-13);
|
||||
make.height.mas_equalTo(26);
|
||||
make.width.mas_equalTo(38);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
@@ -151,15 +161,28 @@
|
||||
self.idLabel.text = [NSString stringWithFormat:@"ID:%@", @(model.roomErbanNo)];
|
||||
self.eventDescLabel.text = model.eventTopic;
|
||||
self.subLabel.text = @(model.subNum).stringValue;
|
||||
self.sexImageView.image = model.gender == 1 ? kImage(@"common_male") : kImage(@"common_female");
|
||||
|
||||
[self updateTimeLabel];
|
||||
|
||||
[self updateStatusButton];
|
||||
}
|
||||
|
||||
- (void)updateTimeLabel {
|
||||
BOOL needUpdateStatus = YES;
|
||||
if (model.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
||||
switch (model.eventStatus) {
|
||||
if (self.model.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
||||
switch (self.model.eventStatus) {
|
||||
case 0:
|
||||
needUpdateStatus = NO;
|
||||
self.timeLabel.text = YMLocalizedString(@"20.20.59_text_30");
|
||||
break;
|
||||
case 2:
|
||||
needUpdateStatus = NO;
|
||||
self.timeLabel.text = YMLocalizedString(@"20.20.59_text_31");
|
||||
break;
|
||||
case 4:
|
||||
needUpdateStatus = NO;
|
||||
[self statusButtonUpdateToDelete];
|
||||
self.timeLabel.text = YMLocalizedString(@"20.20.59_text_25");
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -167,44 +190,68 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (model.liveStatus) {
|
||||
case 1:
|
||||
{
|
||||
if (needUpdateStatus) {
|
||||
if (model.subStatus) {
|
||||
[self statusButtonUpdateToUnSub];
|
||||
} else {
|
||||
[self statusButtonUpdateToSub];
|
||||
}
|
||||
}
|
||||
|
||||
self.timeLabel.text = [NSString stringWithFormat:@"%@:%@",
|
||||
YMLocalizedString(@"20.20.59_text_15"),
|
||||
model.eventStartTimeStr];
|
||||
if (needUpdateStatus) {
|
||||
switch (self.model.liveStatus) {
|
||||
case 1:
|
||||
self.timeLabel.text = [NSString stringWithFormat:@"%@:%@",
|
||||
YMLocalizedString(@"20.20.59_text_15"),
|
||||
self.model.eventStartTimeStr];
|
||||
break;
|
||||
case 2:
|
||||
self.timeLabel.text = YMLocalizedString(@"20.20.59_text_24");
|
||||
break;
|
||||
case 3:
|
||||
self.timeLabel.text = YMLocalizedString(@"20.20.59_text_25");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (needUpdateStatus) {
|
||||
[self statusButtonUpdateToPatricipate];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.timeLabel.text = YMLocalizedString(@"20.20.59_text_24");
|
||||
break;
|
||||
case 3:
|
||||
if (needUpdateStatus) {
|
||||
if (model.subStatus) {
|
||||
- (void)updateStatusButton {
|
||||
BOOL needUpdateStatus = YES;
|
||||
if (self.model.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
||||
switch (self.model.eventStatus) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 4:
|
||||
needUpdateStatus = NO;
|
||||
self.statusButton.hidden = YES;
|
||||
self.deleteButton.hidden = NO;
|
||||
// [self statusButtonUpdateToDelete];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (needUpdateStatus) {
|
||||
self.statusButton.hidden = NO;
|
||||
self.deleteButton.hidden = YES;
|
||||
switch (self.model.liveStatus) {
|
||||
case 1:
|
||||
if (self.model.subStatus) {
|
||||
[self statusButtonUpdateToUnSub];
|
||||
} else {
|
||||
[self statusButtonUpdateToSub];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
[self statusButtonUpdateToPatricipate];
|
||||
break;
|
||||
case 3:
|
||||
if (self.model.subStatus) {
|
||||
[self statusButtonUpdateToUnSub];
|
||||
} else {
|
||||
[self statusButtonUpdateToSub];
|
||||
}
|
||||
break;
|
||||
|
||||
self.timeLabel.text = YMLocalizedString(@"20.20.59_text_25");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,6 +307,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didTapDeleteButton {
|
||||
if (self.statusButtonDidTap) {
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc]init];
|
||||
config.actionStyle = TTAlertActionBothStyle;
|
||||
config.title = YMLocalizedString(@"20.20.59_text_28.1");
|
||||
config.message = YMLocalizedString(@"20.20.59_text_28.2");
|
||||
|
||||
TTAlertButtonConfig *buttonConfig = config.confirmButtonConfig;
|
||||
buttonConfig.title = YMLocalizedString(@"XPMineCollectRoomListViewController7");
|
||||
config.confirmButtonConfig = buttonConfig;
|
||||
|
||||
|
||||
@kWeakify(self);
|
||||
[TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{
|
||||
@kStrongify(self);
|
||||
self.statusButtonDidTap(self.model, EventCellAction_delete);
|
||||
} cancelHandler:^{ }];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (NetImageView *)bgImageView {
|
||||
if (!_bgImageView) {
|
||||
@@ -276,10 +345,10 @@
|
||||
NetImageConfig *config = [[NetImageConfig alloc] init];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
[_avatarImageView setCornerRadius:35/2
|
||||
corners:kCALayerMaxXMaxYCorner | kCALayerMaxXMinYCorner | kCALayerMinXMaxYCorner | kCALayerMinXMinYCorner
|
||||
borderWidth:1
|
||||
borderColor:UIColorFromRGB(0xfffff)];
|
||||
[_avatarImageView setCornerRadius:12
|
||||
corners:kCALayerMaxXMaxYCorner | kCALayerMaxXMinYCorner | kCALayerMinXMaxYCorner | kCALayerMinXMinYCorner
|
||||
borderWidth:1
|
||||
borderColor:[UIColor whiteColor]];
|
||||
}
|
||||
return _avatarImageView;
|
||||
}
|
||||
@@ -354,7 +423,7 @@
|
||||
- (UIView *)blackMask {
|
||||
UIView *v = [[UIView alloc] init];
|
||||
v.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
|
||||
[v setCornerRadius:8];
|
||||
// [v setCornerRadius:8];
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -368,10 +437,21 @@
|
||||
[_statusButton setBackgroundColor:[UIColor whiteColor]];
|
||||
[_statusButton.titleLabel setFont:kFontMedium(13)];
|
||||
[_statusButton setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal];
|
||||
|
||||
// 将边距设置移到resetStatusButtonInsets方法中,初始化时不设置
|
||||
// contentEdgeInsets、imageEdgeInsets和titleEdgeInsets会在对应的状态更新方法中设置
|
||||
}
|
||||
return _statusButton;
|
||||
}
|
||||
|
||||
- (UIButton *)deleteButton {
|
||||
if (!_deleteButton) {
|
||||
_deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_deleteButton addTarget:self
|
||||
action:@selector(didTapDeleteButton)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
[_deleteButton setCornerRadius:13];
|
||||
[_deleteButton setBackgroundColor:UIColorFromRGB(0xffe5e5)];
|
||||
[_deleteButton setImage:kImage(@"event_delete") forState:UIControlStateNormal];
|
||||
}
|
||||
return _deleteButton;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -7,21 +7,14 @@
|
||||
|
||||
#import "EventCenterOfficialCell.h"
|
||||
#import "HomeBannerInfoModel.h"
|
||||
#import <SVGA.h>
|
||||
|
||||
@interface EventCenterOfficialCell()
|
||||
|
||||
@property (nonatomic, strong) NetImageView *coverImageView;
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
//@property (nonatomic, strong) UIStackView *countdownView;
|
||||
//@property (nonatomic, strong) UILabel *countdownPrefixLabel; // Countdown: 前缀标签
|
||||
//@property (nonatomic, strong) UILabel *daysNumberLabel; // 天数数字标签
|
||||
//@property (nonatomic, strong) UILabel *hourNumberLabel; // 天数数字标签
|
||||
//@property (nonatomic, strong) UILabel *minuteNumberLabel; // 天数数字标签
|
||||
//@property (nonatomic, strong) UILabel *secondNumberLabel; // 天数数字标签
|
||||
//@property (nonatomic, strong) UILabel *daysSuffixLabel; // days 后缀标签
|
||||
//@property (nonatomic, strong) UILabel *colonSuffixLabel_1; // ":" 标签
|
||||
//@property (nonatomic, strong) UILabel *colonSuffixLabel_2; // ":" 后缀标签
|
||||
//@property (nonatomic, strong) NSTimer *countdownTimer; // 倒计时定时器
|
||||
@property(nonatomic, strong) SVGAImageView *svgaImageView;
|
||||
@property(nonatomic, strong) HomeBannerFillVoInfoModel *cellFillVoMode;
|
||||
|
||||
@end
|
||||
|
||||
@@ -34,8 +27,8 @@
|
||||
self.contentView.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
[self.contentView addSubview:self.coverImageView];
|
||||
[self.contentView addSubview:self.svgaImageView];
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
// [self.contentView addSubview:self.countdownView];
|
||||
|
||||
[self.coverImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.contentView).offset(6);
|
||||
@@ -43,17 +36,16 @@
|
||||
make.height.mas_equalTo(80);
|
||||
}];
|
||||
|
||||
[self.svgaImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.coverImageView);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.coverImageView.mas_bottom).offset(4);
|
||||
make.leading.trailing.mas_equalTo(self.contentView).inset(15);
|
||||
make.height.mas_equalTo(26);
|
||||
}];
|
||||
|
||||
// [self.countdownView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(0);
|
||||
// make.leading.trailing.mas_equalTo(self.contentView).inset(15);
|
||||
// make.height.mas_equalTo(26);
|
||||
// }];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -62,6 +54,70 @@
|
||||
_cellModel = cellModel;
|
||||
self.coverImageView.imageUrl = cellModel.bannerPic;
|
||||
self.titleLabel.text = cellModel.bannerName;
|
||||
|
||||
if (cellModel.skipType == HomeBannerInfoSkipType_Web_CP ||
|
||||
cellModel.skipType == HomeBannerInfoSkipType_Web_Custom ||
|
||||
cellModel.skipType == HomeBannerInfoSkipType_Web_WeekStar) {
|
||||
self.coverImageView.hidden = YES;
|
||||
self.svgaImageView.hidden = NO;
|
||||
self.cellFillVoMode = cellModel.fillVo;
|
||||
SVGAParser *p = [[SVGAParser alloc] init];
|
||||
@kWeakify(self);
|
||||
[p parseWithURL:[NSURL URLWithString:cellModel.bannerPic] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
|
||||
@kStrongify(self);
|
||||
if (videoItem) {
|
||||
[self playSVGAWith:videoItem];
|
||||
} else {
|
||||
self.svgaImageView.hidden = YES;
|
||||
self.coverImageView.hidden = NO;
|
||||
self.coverImageView.imageUrl = cellModel.bannerPic;
|
||||
}
|
||||
} failureBlock:^(NSError * _Nullable error) {
|
||||
@kStrongify(self);
|
||||
self.svgaImageView.hidden = YES;
|
||||
self.coverImageView.hidden = NO;
|
||||
self.coverImageView.imageUrl = cellModel.bannerPic;
|
||||
}];
|
||||
} else {
|
||||
self.svgaImageView.hidden = YES;
|
||||
self.coverImageView.hidden = NO;
|
||||
self.coverImageView.imageUrl = cellModel.bannerPic;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)playSVGAWith:(SVGAVideoEntity *)videoItem {
|
||||
self.svgaImageView.videoItem = videoItem;
|
||||
if (self.cellFillVoMode) {
|
||||
[self updateSvgaImage:self.cellFillVoMode.avatar key:@"avatar"];
|
||||
[self updateSvgaImage:self.cellFillVoMode.picUrl key:@"gift"];
|
||||
[self updateSvgaImage:self.cellFillVoMode.avatar key:@"avatar_1"];
|
||||
[self updateSvgaImage:self.cellFillVoMode.loverAvatar key:@"avatar_2"];
|
||||
|
||||
[self updateSvgaText:[NSString stringWithFormat:@"ID: %@", self.cellFillVoMode.erbanNo] key:@"id"];
|
||||
[self updateSvgaText:self.cellFillVoMode.giftName key:@"name"];
|
||||
[self updateSvgaText:[NSString stringWithFormat:@"ID: %@", self.cellFillVoMode.erbanNo] key:@"id_1"];
|
||||
[self updateSvgaText:[NSString stringWithFormat:@"ID: %@", self.cellFillVoMode.loverErbanNo] key:@"id_2"];
|
||||
}
|
||||
|
||||
[self.svgaImageView startAnimation];
|
||||
}
|
||||
|
||||
- (void)updateSvgaImage:(NSString *)imagePath key:(NSString *)key {
|
||||
if (self.svgaImageView && ![NSString isEmpty:imagePath] && ![NSString isEmpty:key]) {
|
||||
[self.svgaImageView setImageWithURL:[NSURL URLWithString:imagePath] forKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateSvgaText:(NSString *)content key:(NSString *)key {
|
||||
if (self.svgaImageView && ![NSString isEmpty:content] && ![NSString isEmpty:key]) {
|
||||
NSAttributedString *string = [[NSAttributedString alloc] initWithString:content
|
||||
attributes:@{
|
||||
NSFontAttributeName: kFontMedium(16),
|
||||
NSForegroundColorAttributeName: UIColorFromRGB(0xF9F8CF)
|
||||
}];
|
||||
[self.svgaImageView setAttributedText:string
|
||||
forKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
@@ -82,154 +138,18 @@
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
//- (UIStackView *)countdownView {
|
||||
// if (!_countdownView) {
|
||||
// _countdownView = [[UIStackView alloc] initWithArrangedSubviews:@[
|
||||
// self.countdownPrefixLabel,
|
||||
// self.daysNumberLabel,
|
||||
// self.daysSuffixLabel,
|
||||
// self.hourNumberLabel,
|
||||
// self.colonSuffixLabel_1,
|
||||
// self.minuteNumberLabel,
|
||||
// self.colonSuffixLabel_2,
|
||||
// self.secondNumberLabel,
|
||||
// [UIView new]
|
||||
// ]];
|
||||
// _countdownView.spacing = 6;
|
||||
// _countdownView.backgroundColor = [UIColor clearColor];
|
||||
//
|
||||
// [self.daysNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.width.greaterThanOrEqualTo(@30);
|
||||
// }];
|
||||
// [self.hourNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.width.greaterThanOrEqualTo(@30);
|
||||
// }];
|
||||
// [self.minuteNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.width.greaterThanOrEqualTo(@30);
|
||||
// }];
|
||||
// [self.secondNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.width.greaterThanOrEqualTo(@30);
|
||||
// }];
|
||||
// }
|
||||
// return _countdownView;
|
||||
//}
|
||||
//
|
||||
//- (UILabel *)countdownPrefixLabel {
|
||||
// if (!_countdownPrefixLabel) {
|
||||
// _countdownPrefixLabel = [UILabel labelInitWithText:@"Countdown: " font:kFontSemibold(16) textColor:UIColorFromRGB(0xff9900)];
|
||||
// }
|
||||
// return _countdownPrefixLabel;
|
||||
//}
|
||||
//
|
||||
//- (UILabel *)daysNumberLabel {
|
||||
// if (!_daysNumberLabel) {
|
||||
// _daysNumberLabel = [UILabel labelInitWithText:@"00" font:kFontSemibold(16) textColor:UIColorFromRGB(0xff9900)];
|
||||
// _daysNumberLabel.backgroundColor = [[UIColor orangeColor] colorWithAlphaComponent:0.15];
|
||||
// _daysNumberLabel.layer.cornerRadius = 6;
|
||||
// _daysNumberLabel.layer.masksToBounds = YES;
|
||||
// _daysNumberLabel.textAlignment = NSTextAlignmentCenter;
|
||||
// }
|
||||
// return _daysNumberLabel;
|
||||
//}
|
||||
//
|
||||
//- (UILabel *)hourNumberLabel {
|
||||
// if (!_hourNumberLabel) {
|
||||
// _hourNumberLabel = [UILabel labelInitWithText:@"00" font:kFontSemibold(16) textColor:UIColorFromRGB(0xff9900)];
|
||||
// _hourNumberLabel.backgroundColor = [[UIColor orangeColor] colorWithAlphaComponent:0.15];
|
||||
// _hourNumberLabel.layer.cornerRadius = 6;
|
||||
// _hourNumberLabel.layer.masksToBounds = YES;
|
||||
// _hourNumberLabel.textAlignment = NSTextAlignmentCenter;
|
||||
// }
|
||||
// return _hourNumberLabel;
|
||||
//}
|
||||
//
|
||||
//- (UILabel *)minuteNumberLabel {
|
||||
// if (!_minuteNumberLabel) {
|
||||
// _minuteNumberLabel = [UILabel labelInitWithText:@"00" font:kFontSemibold(16) textColor:UIColorFromRGB(0xff9900)];
|
||||
// _minuteNumberLabel.backgroundColor = [[UIColor orangeColor] colorWithAlphaComponent:0.15];
|
||||
// _minuteNumberLabel.layer.cornerRadius = 6;
|
||||
// _minuteNumberLabel.layer.masksToBounds = YES;
|
||||
// _minuteNumberLabel.textAlignment = NSTextAlignmentCenter;
|
||||
// }
|
||||
// return _minuteNumberLabel;
|
||||
//}
|
||||
//
|
||||
//- (UILabel *)secondNumberLabel {
|
||||
// if (!_secondNumberLabel) {
|
||||
// _secondNumberLabel = [UILabel labelInitWithText:@"00" font:kFontSemibold(16) textColor:UIColorFromRGB(0xff9900)];
|
||||
// _secondNumberLabel.backgroundColor = [[UIColor orangeColor] colorWithAlphaComponent:0.15];
|
||||
// _secondNumberLabel.layer.cornerRadius = 6;
|
||||
// _secondNumberLabel.layer.masksToBounds = YES;
|
||||
// _secondNumberLabel.textAlignment = NSTextAlignmentCenter;
|
||||
// }
|
||||
// return _secondNumberLabel;
|
||||
//}
|
||||
//
|
||||
//- (UILabel *)daysSuffixLabel {
|
||||
// if (!_daysSuffixLabel) {
|
||||
// _daysSuffixLabel = [UILabel labelInitWithText:@"days" font:kFontSemibold(16) textColor:UIColorFromRGB(0xff9900)];
|
||||
// }
|
||||
// return _daysSuffixLabel;
|
||||
//}
|
||||
//
|
||||
//- (UILabel *)colonSuffixLabel_1 {
|
||||
// if (!_colonSuffixLabel_1) {
|
||||
// _colonSuffixLabel_1 = [UILabel labelInitWithText:@":" font:kFontSemibold(16) textColor:UIColorFromRGB(0xff9900)];
|
||||
// }
|
||||
// return _colonSuffixLabel_1;
|
||||
//}
|
||||
//
|
||||
//- (UILabel *)colonSuffixLabel_2 {
|
||||
// if (!_colonSuffixLabel_2) {
|
||||
// _colonSuffixLabel_2 = [UILabel labelInitWithText:@":" font:kFontSemibold(16) textColor:UIColorFromRGB(0xff9900)];
|
||||
// }
|
||||
// return _colonSuffixLabel_2;
|
||||
//}
|
||||
|
||||
//- (void)updateCountdownWithDays:(NSInteger)days {
|
||||
// // 更新天数标签
|
||||
// self.daysNumberLabel.text = [NSString stringWithFormat:@"%02ld", (long)days];
|
||||
//
|
||||
// // 如果有定时器,先停止
|
||||
// [self stopCountdownTimer];
|
||||
//
|
||||
// // 如果天数大于0,启动定时器进行倒计时
|
||||
// if (days > 0) {
|
||||
// [self startCountdownTimerWithDays:days];
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//- (void)startCountdownTimerWithDays:(NSInteger)days {
|
||||
// // 创建一个每天触发一次的定时器
|
||||
// // 注意:实际应用中,可能需要更精确的倒计时逻辑,这里仅作示例
|
||||
// self.countdownTimer = [NSTimer scheduledTimerWithTimeInterval:86400 target:self selector:@selector(updateDaysCount) userInfo:nil repeats:YES];
|
||||
//}
|
||||
//
|
||||
//- (void)updateDaysCount {
|
||||
// // 获取当前显示的天数
|
||||
// NSInteger currentDays = [self.daysNumberLabel.text integerValue];
|
||||
//
|
||||
// // 如果天数大于0,减少一天
|
||||
// if (currentDays > 0) {
|
||||
// currentDays--;
|
||||
// self.daysNumberLabel.text = [NSString stringWithFormat:@"%02ld", (long)currentDays];
|
||||
// }
|
||||
//
|
||||
// // 如果天数为0,停止定时器
|
||||
// if (currentDays == 0) {
|
||||
// [self stopCountdownTimer];
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//- (void)stopCountdownTimer {
|
||||
// if (self.countdownTimer && [self.countdownTimer isValid]) {
|
||||
// [self.countdownTimer invalidate];
|
||||
// self.countdownTimer = nil;
|
||||
// }
|
||||
//}
|
||||
- (SVGAImageView *)svgaImageView {
|
||||
if (!_svgaImageView) {
|
||||
_svgaImageView = [[SVGAImageView alloc] init];
|
||||
_svgaImageView.loops = -1;
|
||||
_svgaImageView.autoPlay = YES;
|
||||
_svgaImageView.clearsAfterStop = NO;
|
||||
[_svgaImageView setCornerRadius:12];
|
||||
}
|
||||
return _svgaImageView;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
// 确保在Cell被释放时停止定时器
|
||||
// [self stopCountdownTimer];
|
||||
|
||||
}
|
||||
@end
|
||||
|
@@ -7,11 +7,15 @@ typedef NS_ENUM(NSInteger, CreateEventPickerType) {
|
||||
|
||||
@interface CreateEventPickerContainerView : UIView <UIGestureRecognizerDelegate, UIPickerViewDataSource, UIPickerViewDelegate>
|
||||
@property (nonatomic, assign) CreateEventPickerType pickerType;
|
||||
@property (nonatomic, copy) void (^onConfirmDate)(NSDate *date, NSString *resultString);
|
||||
@property (nonatomic, copy) void (^onConfirmDate)(NSDate *date,
|
||||
NSString *resultString,
|
||||
NSInteger dutationMinutes);
|
||||
|
||||
- (void)showInView:(UIView *)parentView
|
||||
initialDate:(NSDate *)date
|
||||
config:(EventConfigModel *)config
|
||||
pickerType:(CreateEventPickerType)type
|
||||
onConfirm:(void (^)(NSDate *date, NSString *resultString))onConfirm;
|
||||
onConfirm:(void (^)(NSDate *date,
|
||||
NSString *resultString,
|
||||
NSInteger dutationMinutes))onConfirm;
|
||||
@end
|
||||
|
@@ -73,6 +73,7 @@
|
||||
[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(_pickerBg).offset(8);
|
||||
make.centerX.equalTo(_pickerBg);
|
||||
make.height.mas_equalTo(26);
|
||||
}];
|
||||
|
||||
[_okButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -82,7 +83,7 @@
|
||||
|
||||
[self.pickerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(_titleLabel.mas_bottom).offset(8);
|
||||
make.left.right.bottom.equalTo(_pickerBg);
|
||||
make.left.right.equalTo(_pickerBg);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -100,33 +101,59 @@
|
||||
NSInteger minutes = [minutesString integerValue];
|
||||
|
||||
NSMutableDictionary *result = [NSMutableDictionary dictionary];
|
||||
result[@"minutes"] = minutesString;
|
||||
|
||||
if (minutes < 60) {
|
||||
// 小于60分钟,直接显示分钟
|
||||
result[@"title"] = [NSString stringWithFormat:@"%@分钟", minutesString];
|
||||
result[@"minutes"] = minutesString;
|
||||
result[@"title"] = [NSString stringWithFormat:@"%@%@", minutesString, YMLocalizedString(@"XPFreeGiftsObtainView4")];
|
||||
} else if (minutes < 1440) {
|
||||
// 大于等于60分钟且小于24小时(1440分钟)
|
||||
double hours = minutes / 60.0;
|
||||
if (fmod(hours, 1) == 0) {
|
||||
// 如果能整除,不显示小数点
|
||||
result[@"title"] = [NSString stringWithFormat:@"%ld小时", (long)hours];
|
||||
NSInteger hours = minutes / 60;
|
||||
NSInteger remainingMinutes = minutes % 60;
|
||||
|
||||
if (remainingMinutes == 0) {
|
||||
// 没有剩余分钟
|
||||
result[@"title"] = [NSString stringWithFormat:@"%ld%@", (long)hours, YMLocalizedString(@"XPFreeGiftsObtainView5")];
|
||||
} else {
|
||||
// 如果不能整除,保留一位小数
|
||||
result[@"title"] = [NSString stringWithFormat:@"%.1f小时", hours];
|
||||
// 有剩余分钟
|
||||
result[@"title"] = [NSString stringWithFormat:@"%ld%@ %ld%@", (long)hours, YMLocalizedString(@"XPFreeGiftsObtainView5"), (long)remainingMinutes, YMLocalizedString(@"XPFreeGiftsObtainView4")];
|
||||
}
|
||||
result[@"minutes"] = minutesString;
|
||||
} else {
|
||||
// 大于等于24小时
|
||||
double days = minutes / 1440.0;
|
||||
if (fmod(days, 1) == 0) {
|
||||
// 如果能整除,不显示小数点
|
||||
result[@"title"] = [NSString stringWithFormat:@"%ld天", (long)days];
|
||||
NSInteger days = minutes / 1440;
|
||||
NSInteger remainingMinutes = minutes % 1440;
|
||||
NSInteger hours = remainingMinutes / 60;
|
||||
NSInteger mins = remainingMinutes % 60;
|
||||
|
||||
if (hours == 0 && mins == 0) {
|
||||
// 无小时和分钟
|
||||
result[@"title"] = [NSString stringWithFormat:@"%ld%@",
|
||||
(long)days,
|
||||
YMLocalizedString(@"App_Commont_Day")];
|
||||
} else if (mins == 0) {
|
||||
// 有小时无分钟
|
||||
result[@"title"] = [NSString stringWithFormat:@"%ld%@ %ld%@",
|
||||
(long)days,
|
||||
YMLocalizedString(@"App_Commont_Day"),
|
||||
(long)hours,
|
||||
YMLocalizedString(@"XPFreeGiftsObtainView5")];
|
||||
} else if (hours == 0) {
|
||||
// 无小时有分钟
|
||||
result[@"title"] = [NSString stringWithFormat:@"%ld%@ %ld%@",
|
||||
(long)days,
|
||||
YMLocalizedString(@"App_Commont_Day"),
|
||||
(long)mins,
|
||||
YMLocalizedString(@"XPFreeGiftsObtainView4")];
|
||||
} else {
|
||||
// 如果不能整除,保留一位小数
|
||||
result[@"title"] = [NSString stringWithFormat:@"%.1f天", days];
|
||||
// 有小时和分钟
|
||||
result[@"title"] = [NSString stringWithFormat:@"%ld%@ %ld%@ %ld%@",
|
||||
(long)days,
|
||||
YMLocalizedString(@"App_Commont_Day"),
|
||||
(long)hours,
|
||||
YMLocalizedString(@"XPFreeGiftsObtainView5"),
|
||||
(long)mins,
|
||||
YMLocalizedString(@"XPFreeGiftsObtainView4")];
|
||||
}
|
||||
result[@"minutes"] = minutesString;
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -187,16 +214,18 @@
|
||||
initialDate:(NSDate *)date
|
||||
config:(EventConfigModel *)config
|
||||
pickerType:(CreateEventPickerType)type
|
||||
onConfirm:(void (^)(NSDate *date, NSString *resultString))onConfirm{
|
||||
onConfirm:(void (^)(NSDate *date,
|
||||
NSString *resultString,
|
||||
NSInteger dutationMinutes))onConfirm{
|
||||
self.pickerType = type;
|
||||
self.configModel = config;
|
||||
self.onConfirmDate = onConfirm;
|
||||
if (type == CreateEventPickerTypeStartTime) {
|
||||
[self buildStartTimeSourceWithInitialDate:date];
|
||||
_titleLabel.text = @"Start Time";
|
||||
_titleLabel.text = YMLocalizedString(@"20.20.59_text_15");
|
||||
} else if (type == CreateEventPickerTypeDuration) {
|
||||
[self buildDurationDataSource];
|
||||
_titleLabel.text = @"Duration";
|
||||
_titleLabel.text = YMLocalizedString(@"20.20.59_text_16");
|
||||
}
|
||||
self.frame = parentView.bounds;
|
||||
[parentView addSubview:self];
|
||||
@@ -298,7 +327,7 @@
|
||||
}
|
||||
|
||||
label.text = content;
|
||||
label.font = isSelectedRow ? kFontMedium(15) : kFontRegular(12);
|
||||
label.font = isSelectedRow ? kFontMedium(15) : kFontRegular(15);
|
||||
label.textColor = isSelectedRow ? UIColorFromRGB(0x313131) : UIColorFromRGB(0x7b7b7d);
|
||||
|
||||
return label;
|
||||
@@ -308,72 +337,11 @@
|
||||
return 30; // 设置行高
|
||||
}
|
||||
|
||||
//- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component {
|
||||
// NSInteger selectedRow = [pickerView selectedRowInComponent:component];
|
||||
// BOOL isSelectedRow = selectedRow == row;
|
||||
// NSString *content = @"";
|
||||
// switch (self.pickerType) {
|
||||
// case CreateEventPickerTypeStartTime: {
|
||||
// if (component == 0) content = self.monthArray[row];
|
||||
// if (component == 1) content = self.dayArray[row];
|
||||
// if (component == 2) content = self.hourArray[row];
|
||||
// }
|
||||
// break;
|
||||
// case CreateEventPickerTypeDuration:
|
||||
// content = self.durationsOptions[row][@"title"];
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// return [[NSAttributedString alloc] initWithString:content attributes:@{
|
||||
// NSFontAttributeName: isSelectedRow ? kFontMedium(12) : kFontRegular(12),
|
||||
// NSForegroundColorAttributeName: isSelectedRow ? UIColorFromRGB(0x313131) : UIColorFromRGB(0x7b7b7d)
|
||||
// }];
|
||||
//}
|
||||
|
||||
//- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
|
||||
// __block UILabel *label = (UILabel *)view;
|
||||
//// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
// if (!label) {
|
||||
// label = [[UILabel alloc] init];
|
||||
// label.textAlignment = NSTextAlignmentCenter;
|
||||
// }
|
||||
//
|
||||
// NSString *content = @"";
|
||||
// switch (self.pickerType) {
|
||||
// case CreateEventPickerTypeStartTime: {
|
||||
// if (component == 0) content = self.monthArray[row];
|
||||
// if (component == 1) content = self.dayArray[row];
|
||||
// if (component == 2) content = self.hourArray[row];
|
||||
// }
|
||||
// break;
|
||||
// case CreateEventPickerTypeDuration:
|
||||
// content = self.durationsOptions[row][@"title"];
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// label.text = content;
|
||||
//
|
||||
// // 设置选中和未选中状态的样式
|
||||
// NSInteger selectedRow = [pickerView selectedRowInComponent:component];
|
||||
// if (row == selectedRow) {
|
||||
// label.textColor = UIColorFromRGB(0x313131);
|
||||
// label.font = kFontMedium(15);
|
||||
// } else {
|
||||
// label.textColor = UIColorFromRGB(0x7b7b7d);
|
||||
// label.font = kFontRegular(14);
|
||||
// }
|
||||
//// });
|
||||
// return label;
|
||||
//}
|
||||
|
||||
#pragma mark - Actions
|
||||
- (void)okTapped {
|
||||
if (self.onConfirmDate) {
|
||||
NSString *resultString = @"";
|
||||
NSInteger durationMinutes = 0;
|
||||
switch (self.pickerType) {
|
||||
case CreateEventPickerTypeStartTime: {
|
||||
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
||||
@@ -384,12 +352,13 @@
|
||||
case CreateEventPickerTypeDuration: {
|
||||
NSInteger selectedRow = [self.pickerView selectedRowInComponent:0];
|
||||
resultString = self.durationsOptions[selectedRow][@"title"];
|
||||
durationMinutes = [self.durationsOptions[selectedRow][@"minutes"] integerValue];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
self.onConfirmDate(self.selectedDate, resultString);
|
||||
self.onConfirmDate(self.selectedDate, resultString, durationMinutes);
|
||||
}
|
||||
[self dismiss];
|
||||
}
|
||||
|
@@ -123,6 +123,7 @@
|
||||
tableView.separatorInset = UIEdgeInsetsZero;
|
||||
tableView.backgroundColor = [UIColor whiteColor];
|
||||
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
[CreateEventSelectRoomCell registerTo:tableView];
|
||||
[EventCenterEmptyCell registerTo:tableView withCustomID:@""];
|
||||
[self.view addSubview:tableView];
|
||||
@@ -180,7 +181,7 @@
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
switch (indexPath.section) {
|
||||
case 0: {
|
||||
return self.model.selfRoom == nil ? [EventCenterEmptyCell cellHeight] : [CreateEventSelectRoomCell cellHeight]-10;
|
||||
return self.model.selfRoom == nil ? [EventCenterEmptyCell cellHeight] : [CreateEventSelectRoomCell cellHeight];
|
||||
}
|
||||
break;
|
||||
case 1: {
|
||||
|
@@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CreateEventViewControllerV2 : MvpViewController
|
||||
|
||||
@property (nonatomic, copy) void(^createSuccess)();
|
||||
@property (nonatomic, copy) void(^createSuccess)(void);
|
||||
|
||||
@property (nonatomic, strong) UIScrollView *scrollView;
|
||||
@property (nonatomic, strong) UIView *contentView;
|
||||
@@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, strong) UILabel *durationPlaceholderLabel;
|
||||
@property (nonatomic, strong) UIImageView *durationArrowImageView;
|
||||
|
||||
@property (nonatomic, assign) NSInteger selectedDurationInMinutes; // 新增:存储选择的时长(分钟)
|
||||
|
||||
@property (nonatomic, strong) UIView *durationPickerContainerView; // 新增:时长选择器容器视图
|
||||
@property (nonatomic, strong) UIPickerView *durationPicker; // 新增:时长选择器 (UIPickerView)
|
||||
@property (nonatomic, strong) UIToolbar *durationPickerToolbar; // 新增:时长选择器工具栏
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#import "CreateEventPickerContainerView.h"
|
||||
#import "CreateEventSelectRoomViewController.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "XPIAPRechargeViewController.h"
|
||||
|
||||
#define MAX_EVENT_TITLE_LENGTH 20
|
||||
#define MAX_EVENT_CONTENT_LENGTH 100
|
||||
@@ -23,28 +24,21 @@
|
||||
|
||||
@property (nonatomic, strong) EventConfigModel *configModel;
|
||||
@property (nonatomic, strong) EventRoomModel *selectRoomModel;
|
||||
@property (nonatomic, strong) WalletInfoModel *walletInfoModel;
|
||||
|
||||
@property (nonatomic, strong) UIImage *selectedImage;
|
||||
//@property (nonatomic, strong) UIView *durationPickerContainerView;
|
||||
@property (nonatomic, strong) CreateEventPickerContainerView *durationPickerView;
|
||||
//@property (nonatomic, strong) CreateEventPickerContainerView *durationPickerView;
|
||||
@property (nonatomic, strong) UILabel *durationPickerTitleLabel;
|
||||
@property (nonatomic, strong) UIButton *durationPickerOkButton;
|
||||
@property (nonatomic, assign) NSInteger selectedHour;
|
||||
@property (nonatomic, assign) NSInteger selectedMin;
|
||||
@property (nonatomic, assign) NSInteger durationMinutes;
|
||||
|
||||
|
||||
// 添加私有方法声明
|
||||
- (UIButton *)createUploadBannerButtonWithTitle:(NSString *)title imageName:(NSString *)imageName selectedImageName:(NSString *)selectedImageName tag:(NSInteger)tag;
|
||||
- (void)setupDatePicker; // 新增:设置日期选择器
|
||||
|
||||
- (void)hideDatePicker; // 新增:隐藏日期选择器
|
||||
- (void)datePickerDoneTapped; // 新增:日期选择器确定按钮点击事件
|
||||
- (void)datePickerCancelTapped; // 新增:日期选择器取消按钮点击事件
|
||||
|
||||
// 新增:时长选择器相关方法声明
|
||||
- (void)setupDurationPicker;
|
||||
- (void)showDurationPicker;
|
||||
- (void)hideDurationPicker;
|
||||
- (void)durationPickerOkTapped;
|
||||
@end
|
||||
|
||||
@implementation CreateEventViewControllerV2
|
||||
@@ -60,15 +54,12 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
self.title = @"Create Event";
|
||||
self.title = YMLocalizedString(@"20.20.59_text_8");
|
||||
|
||||
[self setupUI];
|
||||
[self updateEventTitleCharCount];
|
||||
[self updateEventContentCharCount];
|
||||
|
||||
self.selectedDurationInMinutes = 120; // Default to 2 hours
|
||||
[self updateDurationLabel];
|
||||
|
||||
// 键盘通知
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
|
||||
@@ -128,7 +119,8 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
// Create Event Button (fixed at bottom)
|
||||
self.createEventButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[self.createEventButton setTitle:YMLocalizedString(@"20.20.59_text_8") forState:UIControlStateNormal];
|
||||
[self.createEventButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; // Adjust color as needed
|
||||
[self.createEventButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[self.createEventButton.titleLabel setFont:kFontSemibold(16)];
|
||||
[self.createEventButton addGradientBackgroundWithColors:@[
|
||||
UIColorFromRGB(0xe29030),
|
||||
UIColorFromRGB(0xfcc074),
|
||||
@@ -187,7 +179,7 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
}
|
||||
|
||||
- (void)createEventSuccess {
|
||||
[XNDJTDDLoadingTool hideHUD];
|
||||
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"20.20.59_text_34")];
|
||||
[self.navigationController popViewControllerAnimated:NO];
|
||||
}
|
||||
|
||||
@@ -204,6 +196,7 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
[b setTitle:title forState:UIControlStateNormal];
|
||||
[b setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal];
|
||||
[b.titleLabel setFont:kFontMedium(14)];
|
||||
[b setTitleEdgeInsets:UIEdgeInsetsMake(0, 8, 0, 0)];
|
||||
b.tag = tag;
|
||||
return b;
|
||||
}
|
||||
@@ -221,9 +214,20 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
textField.placeholder = placeholder;
|
||||
textField.font = kFontRegular(14);
|
||||
textField.textColor = UIColorFromRGB(0x313131);
|
||||
textField.borderStyle = UITextBorderStyleRoundedRect;
|
||||
textField.layer.cornerRadius = 8;
|
||||
textField.borderStyle = UITextBorderStyleNone;
|
||||
[textField setCornerRadius:8];
|
||||
textField.backgroundColor = UIColorFromRGB(0xf2f3f7);
|
||||
|
||||
// 设置左侧内间距为16
|
||||
UIView *leftPaddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 16, textField.frame.size.height)];
|
||||
textField.leftView = leftPaddingView;
|
||||
textField.leftViewMode = UITextFieldViewModeAlways;
|
||||
|
||||
// 设置右侧内间距为16
|
||||
UIView *rightPaddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 16, textField.frame.size.height)];
|
||||
textField.rightView = rightPaddingView;
|
||||
textField.rightViewMode = UITextFieldViewModeAlways;
|
||||
|
||||
return textField;
|
||||
}
|
||||
|
||||
@@ -331,7 +335,9 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
initialDate:[NSDate date]
|
||||
config:self.configModel
|
||||
pickerType:CreateEventPickerTypeStartTime
|
||||
onConfirm:^(NSDate *date, NSString *resultString) {
|
||||
onConfirm:^(NSDate *date,
|
||||
NSString *resultString,
|
||||
NSInteger dutationMinutes) {
|
||||
weakSelf.startTimePlaceholderLabel.text = resultString;
|
||||
[weakSelf checkCreateEventButtonState];
|
||||
}];
|
||||
@@ -344,52 +350,49 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
initialDate:[NSDate date]
|
||||
config:self.configModel
|
||||
pickerType:CreateEventPickerTypeDuration
|
||||
onConfirm:^(NSDate *date, NSString *resultString) {
|
||||
onConfirm:^(NSDate *date,
|
||||
NSString *resultString,
|
||||
NSInteger dutationMinutes) {
|
||||
weakSelf.durationPlaceholderLabel.text = resultString;
|
||||
weakSelf.durationMinutes = dutationMinutes;
|
||||
[weakSelf checkCreateEventButtonState];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)createEventButtonTapped {
|
||||
NSLog(@"Create Event Tapped");
|
||||
// Gather all data and proceed with event creation logic
|
||||
NSString *title = self.eventTitleTextField.text;
|
||||
UIImage *bannerImage = self.eventBannerImageView.image;
|
||||
BOOL uploadToHomepage = self.uploadBannerYesButton.selected;
|
||||
NSString *selectedRoom = self.selectRoomPlaceholderLabel.text; // This is a placeholder, get actual ID
|
||||
NSString *startTime = self.startTimePlaceholderLabel.text; // This is a placeholder, get actual NSDate
|
||||
NSString *duration = self.durationPlaceholderLabel.text; // This is a placeholder, get actual duration value
|
||||
NSString *content = self.eventContentTextView.text;
|
||||
BOOL notifyFans = self.notifyFansSwitch.isOn;
|
||||
|
||||
// Basic Validation (can be expanded)
|
||||
if (title.length == 0) {
|
||||
NSLog(@"Event title is missing");
|
||||
return;
|
||||
if (uploadToHomepage) {
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc]init];
|
||||
config.title = YMLocalizedString(@"XPAnchorAudienceUpMicView2");
|
||||
config.message = [NSString stringWithFormat:YMLocalizedString(@"20.20.59_text_33"),
|
||||
@(self.configModel.goldNum)];
|
||||
config.actionStyle = TTAlertActionBothStyle;
|
||||
@kWeakify(self);
|
||||
[TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{
|
||||
@kStrongify(self);
|
||||
@kWeakify(self);
|
||||
[self uploadCover:bannerImage
|
||||
finish:^(NSString *path) {
|
||||
@kStrongify(self);
|
||||
[self.presenter createEventWithTitle:title
|
||||
image:path
|
||||
uploadToHome:uploadToHomepage
|
||||
startTime:startTime
|
||||
duration:self.durationMinutes
|
||||
content:content
|
||||
gold:uploadToHomepage ? self.configModel.goldNum : 0
|
||||
roomUid:self.selectRoomModel.roomUid
|
||||
notifyFans:notifyFans];
|
||||
}];
|
||||
} cancelHandler:^{ }];
|
||||
}
|
||||
if (!bannerImage) {
|
||||
NSLog(@"Event banner is missing");
|
||||
// return; // Allow creating event without banner for now, or enforce
|
||||
}
|
||||
// ... more validations
|
||||
|
||||
NSLog(@"Title: %@, Upload: %d, Room: %@, Start: %@, Duration: %@, Content: %@, Notify: %d",
|
||||
title, uploadToHomepage, selectedRoom, startTime, duration, content, notifyFans);
|
||||
// TODO: 1. 补充 loading; 2. duration 使用 config 内容;3. start time 使用 picker 内容
|
||||
|
||||
@kWeakify(self);
|
||||
[self uploadCover:bannerImage
|
||||
finish:^(NSString *path) {
|
||||
@kStrongify(self);
|
||||
[self.presenter createEventWithTitle:title
|
||||
image:path
|
||||
uploadToHome:uploadToHomepage
|
||||
startTime:startTime
|
||||
duration:30
|
||||
content:content
|
||||
notifyFans:notifyFans];
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
- (void)uploadCover:(UIImage *)cover finish:(void(^)(NSString *path))finish {
|
||||
@@ -449,23 +452,56 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
}
|
||||
|
||||
- (void)uploadBannerButtonTapped:(UIButton *)sender {
|
||||
// TODO: 补充钱包判断
|
||||
if (sender == self.uploadBannerYesButton) {
|
||||
if (!self.uploadBannerYesButton.selected) { // 避免重复设置
|
||||
if (!self.uploadBannerYesButton.selected) {
|
||||
self.uploadBannerYesButton.selected = YES;
|
||||
self.uploadBannerNoButton.selected = NO;
|
||||
// 可在此处处理横幅上传状态的逻辑,例如: self.shouldUploadBanner = YES;
|
||||
// if (!self.walletInfoModel) {
|
||||
// [XNDJTDDLoadingTool showLoading];
|
||||
// @kWeakify(self);
|
||||
// [self.presenter loadMoney:^(WalletInfoModel * walletModel) {
|
||||
// @kStrongify(self);
|
||||
// self.walletInfoModel = walletModel;
|
||||
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
// [XNDJTDDLoadingTool hideHUD];
|
||||
// [self checkWalletToUploadBanner];
|
||||
// });
|
||||
// } failure:^(NSError * _Nonnull error) {
|
||||
// [XNDJTDDLoadingTool showErrorWithMessage:error.domain];
|
||||
// }];
|
||||
// } else {
|
||||
// [self checkWalletToUploadBanner];
|
||||
// }
|
||||
}
|
||||
} else if (sender == self.uploadBannerNoButton) {
|
||||
if (!self.uploadBannerNoButton.selected) { // 避免重复设置
|
||||
self.uploadBannerYesButton.selected = NO;
|
||||
self.uploadBannerNoButton.selected = YES;
|
||||
// 可在此处处理横幅上传状态的逻辑,例如: self.shouldUploadBanner = NO;
|
||||
}
|
||||
}
|
||||
[self checkCreateEventButtonState];
|
||||
}
|
||||
|
||||
|
||||
- (void)checkWalletToUploadBanner {
|
||||
if (self.walletInfoModel.diamonds.integerValue >= self.configModel.goldNum) {
|
||||
self.uploadBannerYesButton.selected = YES;
|
||||
self.uploadBannerNoButton.selected = NO;
|
||||
} else {
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc]init];
|
||||
config.title = YMLocalizedString(@"UserDetail_CP_Toast_0");
|
||||
config.message = YMLocalizedString(@"XPNobleCenterViewController3");
|
||||
config.actionStyle = TTAlertActionBothStyle;
|
||||
@kWeakify(self);
|
||||
[TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{
|
||||
@kStrongify(self);
|
||||
XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init];
|
||||
webVC.type = @"4";
|
||||
[self.navigationController pushViewController:webVC animated:YES];
|
||||
} cancelHandler:^{ }];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UIImagePickerControllerDelegate (Legacy)
|
||||
|
||||
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<UIImagePickerControllerInfoKey,id> *)info {
|
||||
@@ -497,97 +533,6 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
[self checkCreateEventButtonState];
|
||||
}
|
||||
|
||||
#pragma mark - Date Picker Methods
|
||||
|
||||
- (void)setupDatePicker {
|
||||
// Container View
|
||||
self.datePickerContainerView = [[UIView alloc] init];
|
||||
self.datePickerContainerView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; // Semi-transparent background
|
||||
[self.view addSubview:self.datePickerContainerView];
|
||||
self.datePickerContainerView.hidden = YES; // Initially hidden
|
||||
|
||||
[self.datePickerContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.view);
|
||||
}];
|
||||
|
||||
// Picker Toolbar
|
||||
self.pickerToolbar = [[UIToolbar alloc] init];
|
||||
self.pickerToolbar.barStyle = UIBarStyleDefault;
|
||||
[self.pickerToolbar sizeToFit];
|
||||
|
||||
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(datePickerCancelTapped)];
|
||||
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(datePickerDoneTapped)];
|
||||
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
|
||||
[self.pickerToolbar setItems:@[cancelButton, flexibleSpace, doneButton]];
|
||||
[self.datePickerContainerView addSubview:self.pickerToolbar];
|
||||
|
||||
// Date Picker
|
||||
self.datePicker = [[UIDatePicker alloc] init];
|
||||
self.datePicker.datePickerMode = UIDatePickerModeDateAndTime;
|
||||
if (@available(iOS 13.4, *)) {
|
||||
self.datePicker.preferredDatePickerStyle = UIDatePickerStyleWheels;
|
||||
}
|
||||
self.datePicker.backgroundColor = [UIColor whiteColor];
|
||||
[self.datePickerContainerView addSubview:self.datePicker];
|
||||
|
||||
self.pickerToolbar.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
self.datePicker.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
|
||||
// Constraints for Toolbar and DatePicker
|
||||
[self.pickerToolbar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.equalTo(self.datePickerContainerView);
|
||||
make.bottom.equalTo(self.datePicker.mas_top);
|
||||
make.height.mas_equalTo(44);
|
||||
}];
|
||||
|
||||
[self.datePicker mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.bottom.equalTo(self.datePickerContainerView);
|
||||
make.height.mas_equalTo(216);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)hideDatePicker {
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.datePickerContainerView.alpha = 0;
|
||||
} completion:^(BOOL finished) {
|
||||
self.datePickerContainerView.hidden = YES;
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)datePickerDoneTapped {
|
||||
self.selectedStartTime = self.datePicker.date;
|
||||
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
||||
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; // Customize format as needed
|
||||
NSString *formattedDate = [dateFormatter stringFromDate:self.selectedStartTime];
|
||||
|
||||
self.startTimePlaceholderLabel.text = formattedDate;
|
||||
|
||||
[self hideDatePicker];
|
||||
}
|
||||
|
||||
- (void)datePickerCancelTapped {
|
||||
[self hideDatePicker];
|
||||
}
|
||||
|
||||
- (void)updateDurationLabel {
|
||||
NSInteger hours = self.selectedDurationInMinutes / 60;
|
||||
NSInteger minutes = self.selectedDurationInMinutes % 60;
|
||||
NSString *durationString;
|
||||
if (hours > 0 && minutes > 0) {
|
||||
durationString = [NSString stringWithFormat:@"%ldh %ldm", (long)hours, (long)minutes];
|
||||
} else if (hours > 0) {
|
||||
durationString = [NSString stringWithFormat:@"%ldh", (long)hours];
|
||||
} else if (minutes > 0) {
|
||||
durationString = [NSString stringWithFormat:@"%ldm", (long)minutes];
|
||||
} else {
|
||||
durationString = @"Select"; // Or some default placeholder
|
||||
}
|
||||
UILabel *label = (UILabel *)[self.durationView viewWithTag:100];
|
||||
if (label) {
|
||||
label.text = durationString;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Event Title Section
|
||||
- (void)setupEventTitleSection {
|
||||
self.eventTitleLabel = [self createLabelWithText:YMLocalizedString(@"20.20.59_text_9")];
|
||||
@@ -673,12 +618,13 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
make.top.equalTo(self.uploadBannerLabel.mas_bottom).offset(kVerticalPadding);
|
||||
make.leading.equalTo(self.contentView).offset(kHorizontalPadding);
|
||||
make.height.mas_equalTo(20);
|
||||
make.width.mas_greaterThanOrEqualTo(60);
|
||||
}];
|
||||
[self.uploadBannerNoButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.uploadBannerLabel.mas_bottom).offset(kVerticalPadding);
|
||||
make.leading.equalTo(self.uploadBannerYesButton.mas_trailing).offset(70);
|
||||
make.trailing.lessThanOrEqualTo(self.contentView).offset(-16);
|
||||
make.height.height.equalTo(self.uploadBannerYesButton);
|
||||
make.height.equalTo(self.uploadBannerYesButton);
|
||||
make.width.mas_greaterThanOrEqualTo(60);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -739,6 +685,7 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
- (void)setupEventContentSection {
|
||||
self.eventContentLabel = [self createLabelWithText:YMLocalizedString(@"20.20.59_text_17")];
|
||||
[self.contentView addSubview:self.eventContentLabel];
|
||||
|
||||
self.eventContentTextView = [[UITextView alloc] init];
|
||||
self.eventContentTextView.backgroundColor = UIColorFromRGB(0xf2f3f7);
|
||||
self.eventContentTextView.font = kFontRegular(14);
|
||||
@@ -746,8 +693,10 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
self.eventContentTextView.layer.cornerRadius = 8;
|
||||
self.eventContentTextView.delegate = self;
|
||||
[self.contentView addSubview:self.eventContentTextView];
|
||||
|
||||
self.eventContentCharCountLabel = [self createCharCountLabel];
|
||||
[self.contentView addSubview:self.eventContentCharCountLabel];
|
||||
|
||||
[self.eventContentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.durationView.mas_bottom).offset(kSectionSpacing);
|
||||
make.leading.equalTo(self.contentView).offset(kHorizontalPadding);
|
||||
@@ -768,6 +717,9 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
self.notifyFansLabel = [self createLabelWithText:YMLocalizedString(@"20.20.59_text_18")];
|
||||
[self.contentView addSubview:self.notifyFansLabel];
|
||||
self.notifyFansSwitch = [[UISwitch alloc] init];
|
||||
self.notifyFansSwitch.tintColor = UIColorRGBAlpha(0xFFE3AF, 0.4);
|
||||
self.notifyFansSwitch.onTintColor = UIColorFromRGB(0xff8c03);
|
||||
self.notifyFansSwitch.transform = CGAffineTransformMakeScale(0.8, 0.8);
|
||||
[self.contentView addSubview:self.notifyFansSwitch];
|
||||
[self.notifyFansLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.eventContentTextView.mas_bottom).offset(kSectionSpacing);
|
||||
@@ -806,57 +758,6 @@ static const CGFloat kSectionSpacing = 20.0;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Duration Picker Methods
|
||||
|
||||
- (void)setupDurationPicker {
|
||||
if (!self.durationPickerView) {
|
||||
self.durationPickerView = [[CreateEventPickerContainerView alloc] init];
|
||||
}
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[self.durationPickerView showInView:self.view
|
||||
initialDate:[NSDate date]
|
||||
config:self.configModel
|
||||
pickerType:CreateEventPickerTypeDuration
|
||||
onConfirm:^(NSDate *date, NSString *resultString) {
|
||||
weakSelf.durationPlaceholderLabel.text = resultString;
|
||||
[weakSelf checkCreateEventButtonState];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)showDurationPicker {
|
||||
[self setupDurationPicker];
|
||||
[self.view bringSubviewToFront:self.durationPickerView];
|
||||
self.durationPickerView.hidden = NO;
|
||||
self.durationPickerView.alpha = 0;
|
||||
[UIView animateWithDuration:0.25 animations:^{
|
||||
self.durationPickerView.alpha = 1;
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)hideDurationPicker {
|
||||
[UIView animateWithDuration:0.25 animations:^{
|
||||
self.durationPickerView.alpha = 0;
|
||||
} completion:^(BOOL finished) {
|
||||
self.durationPickerView.hidden = YES;
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)durationPickerOkTapped {
|
||||
[self hideDurationPicker];
|
||||
// 更新 label
|
||||
NSString *hourStr = [NSString stringWithFormat:@"%ldHours", (long)self.selectedHour];
|
||||
NSString *minStr = [NSString stringWithFormat:@"%ldMins", (long)self.selectedMin];
|
||||
if (self.selectedHour == 0 && self.selectedMin == 0) {
|
||||
self.durationPlaceholderLabel.text = YMLocalizedString(@"XPAnchorPKTableViewCell2");
|
||||
} else if (self.selectedMin == 0) {
|
||||
self.durationPlaceholderLabel.text = hourStr;
|
||||
} else if (self.selectedHour == 0) {
|
||||
self.durationPlaceholderLabel.text = minStr;
|
||||
} else {
|
||||
self.durationPlaceholderLabel.text = [NSString stringWithFormat:@"%@ & %@", hourStr, minStr];
|
||||
}
|
||||
[self checkCreateEventButtonState];
|
||||
}
|
||||
|
||||
#pragma mark - TZImagePickerControllerDelegate
|
||||
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos {
|
||||
|
@@ -24,7 +24,7 @@ static NSString *kSquareEmptyID = @"square empty";
|
||||
static NSString *kMyEmptyID = @"my empty";
|
||||
|
||||
static UIEdgeInsets kEventTableViewContentInset(void) {
|
||||
return UIEdgeInsetsMake(-10, 0, 100 + kSafeAreaBottomHeight, 0);
|
||||
return UIEdgeInsetsMake(0, 0, 100 + kSafeAreaBottomHeight, 0);
|
||||
}
|
||||
static UIEdgeInsets kOfficialTableViewContentInset(void) {
|
||||
return UIEdgeInsetsMake(0, 0, 100 + kSafeAreaBottomHeight, 0);
|
||||
@@ -619,6 +619,12 @@ static UIEdgeInsets kOfficialTableViewContentInset(void) {
|
||||
}
|
||||
|
||||
- (void)eventSubActionSuccess:(BOOL)isSub eventId:(NSInteger)eventId {
|
||||
if (isSub) {
|
||||
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"20.20.59_text_35")];
|
||||
} else {
|
||||
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"20.20.59_text_36")];
|
||||
}
|
||||
|
||||
switch (self.currentIndex) {
|
||||
case 1:
|
||||
for (EventItemModel *m in self.eventSquareDatasource) {
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#import "EventCenterEmptyCell.h"
|
||||
#import "EventCenterEventCell.h"
|
||||
#import "XPWebViewController.h"
|
||||
#import "XPRoomViewController.h"
|
||||
|
||||
@interface MyEventsViewController () <UITableViewDataSource, UITableViewDelegate, CreateEventPresenterProcotol>
|
||||
|
||||
@@ -38,6 +39,27 @@
|
||||
[self.myEventTableView.mj_header beginRefreshing];
|
||||
}
|
||||
|
||||
- (void)handleCellStatusButtonDidTap:(EventItemModel *)model action:(EventCellActions)action {
|
||||
switch (action) {
|
||||
case EventCellAction_participate:
|
||||
[XPRoomViewController openRoom:@(model.roomUid).stringValue
|
||||
viewController:self];
|
||||
break;
|
||||
case EventCellAction_sub:
|
||||
[self.presenter subEvent:model.subStatus ? NO : YES
|
||||
eventId:model.id];
|
||||
break;
|
||||
case EventCellAction_unsub:
|
||||
[self.presenter subEvent:model.subStatus ? NO : YES
|
||||
eventId:model.id];
|
||||
break;
|
||||
case EventCellAction_delete:
|
||||
[self.presenter deleteEvent:model.id];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.datasource.count == 0 ? 1 : self.datasource.count;
|
||||
@@ -54,6 +76,11 @@
|
||||
EventCenterEventCell *cell = [EventCenterEventCell cellFor:tableView atIndexPath:indexPath];
|
||||
EventItemModel *model = [self.datasource xpSafeObjectAtIndex:indexPath.row];
|
||||
[cell updateCell:model];
|
||||
@kWeakify(self);
|
||||
[cell setStatusButtonDidTap:^(EventItemModel * _Nonnull model, EventCellActions action) {
|
||||
@kStrongify(self);
|
||||
[self handleCellStatusButtonDidTap:model action:action];
|
||||
}];
|
||||
return cell;
|
||||
}
|
||||
|
||||
@@ -101,6 +128,38 @@
|
||||
|
||||
}
|
||||
|
||||
- (void)eventSubActionSuccess:(BOOL)isSub eventId:(NSInteger)eventId {
|
||||
if (isSub) {
|
||||
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"20.20.59_text_35")];
|
||||
} else {
|
||||
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"20.20.59_text_36")];
|
||||
}
|
||||
|
||||
for (EventItemModel *m in self.datasource) {
|
||||
if (m.id == eventId) {
|
||||
m.subStatus = isSub;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[self.myEventTableView reloadData];
|
||||
}
|
||||
|
||||
|
||||
- (void)deleteEventSuccess:(NSInteger)eventId {
|
||||
for (EventItemModel *m in self.datasource) {
|
||||
if (m.id == eventId) {
|
||||
[self.datasource removeObject:m];
|
||||
break;
|
||||
}
|
||||
}
|
||||
[self.myEventTableView reloadData];
|
||||
}
|
||||
|
||||
- (void)deleteEventFailure:(NSString *)msg {
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (UITableView *)myEventTableView {
|
||||
if (!_myEventTableView) {
|
||||
|
@@ -155,6 +155,7 @@
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(117);
|
||||
make.trailing.mas_equalTo(-80);
|
||||
make.centerY.mas_equalTo(self.goButton);
|
||||
make.height.mas_equalTo(70);
|
||||
}];
|
||||
}
|
||||
|
@@ -83,14 +83,12 @@
|
||||
[self.presenter getUserInfo];
|
||||
if ([XPRoomFaceTool shareFaceTool].faceDirectory) {
|
||||
[self.presenter getRoomNormalFace];
|
||||
// [self.presenter getRoomNobelFace];
|
||||
} else {
|
||||
[self showLoading];
|
||||
[[XPRoomFaceTool shareFaceTool] downFaceDataCompletion:^(NSString * _Nonnull path) {
|
||||
[self hideHUD];
|
||||
if (path.length > 0) {
|
||||
[self.presenter getRoomNormalFace];
|
||||
// [self.presenter getRoomNobelFace];
|
||||
} else {
|
||||
[self showErrorToast:YMLocalizedString(@"XPRoomFaceViewController0")];
|
||||
}
|
||||
@@ -152,7 +150,7 @@
|
||||
|
||||
|
||||
[self.titleCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(36);
|
||||
make.height.mas_equalTo(44);
|
||||
}];
|
||||
|
||||
[self.pageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
|
@@ -4169,28 +4169,40 @@ ineHeadView12" = "الحمل";
|
||||
"20.20.56_text_19" = "مرفوض";
|
||||
"20.20.56_text_20" = "والآخر يرفض دعوتك لتغيير العلاقات.";
|
||||
|
||||
"20.20.59_text_1" = "老年人活動中心";
|
||||
"20.20.59_text_2" = "Offical";
|
||||
"20.20.59_text_3" = "Event Square";
|
||||
"20.20.59_text_4" = "My Events";
|
||||
"20.20.59_text_5" = " Sub";
|
||||
"20.20.59_text_6" = " Unsub";
|
||||
"20.20.59_text_7" = " Participate";
|
||||
"20.20.59_text_8" = "Create Event";
|
||||
"20.20.59_text_9" = "Event Title";
|
||||
"20.20.59_text_10" = "Event Banner";
|
||||
"20.20.59_text_11" = "Upload Banner to Homepage(Costs %@)";
|
||||
"20.20.59_text_12" = "YES";
|
||||
"20.20.59_text_13" = "NO";
|
||||
"20.20.59_text_14" = "Select Room";
|
||||
"20.20.59_text_15" = "Start Time";
|
||||
"20.20.59_text_16" = "Duration";
|
||||
"20.20.59_text_17" = "Event Content";
|
||||
"20.20.59_text_18" = "Notify My Fans";
|
||||
"20.20.59_text_19" = "No rooms available~";
|
||||
"20.20.59_text_22" = "My Sub";
|
||||
"20.20.59_text_23" = "Only the data of the last 30 days is displayed";
|
||||
"20.20.59_text_24" = "Event starting";
|
||||
"20.20.59_text_25" = "Event ended";
|
||||
"20.20.59_text_26" = "Your Event is about to start! Your fans and subscribers have been notified!";
|
||||
"20.20.59_text_27" = "The Event you followed is about to start—click to join now!!!";
|
||||
"20.20.59_text_1" = "مركز الفعاليات";
|
||||
"20.20.59_text_2" = "رسمي";
|
||||
"20.20.59_text_3" = "ساحة الفعاليات";
|
||||
"20.20.59_text_4" = "فعاليتي";
|
||||
"20.20.59_text_5" = " فرعي";
|
||||
"20.20.59_text_6" = " إلغاء الاشتراك";
|
||||
"20.20.59_text_7" = " شارك";
|
||||
"20.20.59_text_8" = "إنشاء الحدث";
|
||||
"20.20.59_text_9" = "عنوان الحدث";
|
||||
"20.20.59_text_10" = "بنر الفعالية";
|
||||
"20.20.59_text_11" = "رفع بنر إلى الصفحة الرئيسية(%@التكاليف )";
|
||||
"20.20.59_text_12" = "نعم";
|
||||
"20.20.59_text_13" = "لا ";
|
||||
"20.20.59_text_14" = "اختر الغرفة";
|
||||
"20.20.59_text_15" = "وقت البدء";
|
||||
"20.20.59_text_16" = "المدة";
|
||||
"20.20.59_text_17" = "محتوى الحدث";
|
||||
"20.20.59_text_18" = "إعلام المعجبين";
|
||||
"20.20.59_text_19" = "لا توجد غرف متاحة";
|
||||
"20.20.59_text_20" = "غرفتي";
|
||||
"20.20.59_text_21" = "الغرف التي أديرها";
|
||||
"20.20.59_text_22" = "اشتراكاتي";
|
||||
"20.20.59_text_23" = "يتم عرض بيانات آخر 30 يومًا فقط";
|
||||
"20.20.59_text_24" = "بدء الحدث";
|
||||
"20.20.59_text_25" = "انتهاء الحدث";
|
||||
"20.20.59_text_26" = "حدثك على وشك البدء! تم إعلام معجبيك ومشتركيك";
|
||||
"20.20.59_text_27" = "الحدث الذي تابعته على وشك البدء-انقر للانضمام الآن";
|
||||
"20.20.59_text_28.1" = "هل أنت متأكد من رغبتك في حذف الحدث الخاص بك؟";
|
||||
"20.20.59_text_28.2" = "بمجرد الحذف، لا يمكن بدء الحدث\nيرجى المتابعة بحذر\nستتم إزالة الحدث من المربع\nلن يتم استرداد الكونزات التي تم إنفاقها على اللافتة\n";
|
||||
"20.20.59_text_29" = "تم إلغاء هذا الحدث";
|
||||
"20.20.59_text_30" = "قيد المراجعة";
|
||||
"20.20.59_text_31" = "فشل المراجعة";
|
||||
"20.20.59_text_32" = "انضم الآن >>>>";
|
||||
"20.20.59_text_33" = "سيكلف تحميل البانر إلى الصفحة الرئيسية عملات: %@\nبعد النقر على \"تأكيد\"، سيتم خصم العملات مباشرةً.";
|
||||
"20.20.59_text_34" = "تم التقديم بنجاح";
|
||||
"20.20.59_text_35" = "تم الاشتراك بنجاح";
|
||||
"20.20.59_text_36" = "تم الإلغاء بنجاح";
|
||||
|
@@ -3954,8 +3954,8 @@
|
||||
"20.20.56_text_19" = "Rejected";
|
||||
"20.20.56_text_20" = "The other rejects your invitation to change relationships.";
|
||||
|
||||
"20.20.59_text_1" = "老年人活動中心";
|
||||
"20.20.59_text_2" = "Offical";
|
||||
"20.20.59_text_1" = "Event Center";
|
||||
"20.20.59_text_2" = "Official";
|
||||
"20.20.59_text_3" = "Event Square";
|
||||
"20.20.59_text_4" = "My Events";
|
||||
"20.20.59_text_5" = " Sub";
|
||||
@@ -3973,9 +3973,21 @@
|
||||
"20.20.59_text_17" = "Event Content";
|
||||
"20.20.59_text_18" = "Notify My Fans";
|
||||
"20.20.59_text_19" = "No rooms available~";
|
||||
"20.20.59_text_20" = "My Rooms";
|
||||
"20.20.59_text_21" = "Admin Rooms";
|
||||
"20.20.59_text_22" = "My Sub";
|
||||
"20.20.59_text_23" = "Only the data of the last 30 days is displayed";
|
||||
"20.20.59_text_23" = "Only the data of the last 30 days is displayed ";
|
||||
"20.20.59_text_24" = "Event starting";
|
||||
"20.20.59_text_25" = "Event ended";
|
||||
"20.20.59_text_26" = "Your Event is about to start! Your fans and subscribers have been notified!";
|
||||
"20.20.59_text_27" = "The Event you followed is about to start—click to join now!!!";
|
||||
"20.20.59_text_28.1" = "Are you sure you want to delete your Event?";
|
||||
"20.20.59_text_28.2" = "Once deleted, the Event cannot be started!\nPlease proceed with caution!!!\nThe Event will be removed from the square.\nCoins spent on the banner will not be refunded!\n";
|
||||
"20.20.59_text_29" = "This Event has been canceled";
|
||||
"20.20.59_text_30" = "Under Review";
|
||||
"20.20.59_text_31" = "Review Failed";
|
||||
"20.20.59_text_32" = "Join Now >>>";
|
||||
"20.20.59_text_33" = "Uploading the banner to the homepage will cost coins: %@\nAfter clicking confirm, the coins will be deducted directly.";
|
||||
"20.20.59_text_34" = "Submission Successful";
|
||||
"20.20.59_text_35" = "Sub successful";
|
||||
"20.20.59_text_36" = "Cancel successful";
|
||||
|
@@ -3747,28 +3747,40 @@
|
||||
"20.20.56_text_19" = "Reddedildi";
|
||||
"20.20.56_text_20" = "Diğeri sizin ilişkileri değiştirme davetinizi reddeder.";
|
||||
|
||||
"20.20.59_text_1" = "老年人活動中心";
|
||||
"20.20.59_text_2" = "Offical";
|
||||
"20.20.59_text_3" = "Event Square";
|
||||
"20.20.59_text_4" = "My Events";
|
||||
"20.20.59_text_5" = " Sub";
|
||||
"20.20.59_text_1" = "Etkinlik Merkezi";
|
||||
"20.20.59_text_2" = "Resmi";
|
||||
"20.20.59_text_3" = "Etkinlik Meydanı";
|
||||
"20.20.59_text_4" = "Etkinliğim";
|
||||
"20.20.59_text_5" = " Alt";
|
||||
"20.20.59_text_6" = " Unsub";
|
||||
"20.20.59_text_7" = " Participate";
|
||||
"20.20.59_text_8" = "Create Event";
|
||||
"20.20.59_text_9" = "Event Title";
|
||||
"20.20.59_text_10" = "Event Banner";
|
||||
"20.20.59_text_11" = "Upload Banner to Homepage(Costs %@)";
|
||||
"20.20.59_text_12" = "YES";
|
||||
"20.20.59_text_13" = "NO";
|
||||
"20.20.59_text_14" = "Select Room";
|
||||
"20.20.59_text_15" = "Start Time";
|
||||
"20.20.59_text_16" = "Duration";
|
||||
"20.20.59_text_17" = "Event Content";
|
||||
"20.20.59_text_18" = "Notify My Fans";
|
||||
"20.20.59_text_19" = "No rooms available~";
|
||||
"20.20.59_text_22" = "My Sub";
|
||||
"20.20.59_text_23" = "Only the data of the last 30 days is displayed";
|
||||
"20.20.59_text_24" = "Event starting";
|
||||
"20.20.59_text_25" = "Event ended";
|
||||
"20.20.59_text_26" = "Your Event is about to start! Your fans and subscribers have been notified!";
|
||||
"20.20.59_text_27" = "The Event you followed is about to start—click to join now!!!";
|
||||
"20.20.59_text_7" = " Katılmak";
|
||||
"20.20.59_text_8" = "Etkinlik Oluştur";
|
||||
"20.20.59_text_9" = "Etkinlik Başlığı";
|
||||
"20.20.59_text_10" = "Etkinlik Afişi";
|
||||
"20.20.59_text_11" = "Ana Sayfaya Banner Yükleyin(Maliyet %@)";
|
||||
"20.20.59_text_12" = "Evet";
|
||||
"20.20.59_text_13" = "Hayır";
|
||||
"20.20.59_text_14" = "Oda Seçiniz";
|
||||
"20.20.59_text_15" = "Başlangıç Zamanı";
|
||||
"20.20.59_text_16" = "Süre";
|
||||
"20.20.59_text_17" = "Etkinlik İçeriği";
|
||||
"20.20.59_text_18" = "Hayranlarıma Bildir";
|
||||
"20.20.59_text_19" = "Müsait oda yok~";
|
||||
"20.20.59_text_20" = "Benim Odalarım";
|
||||
"20.20.59_text_21" = "Yönetici Odaları";
|
||||
"20.20.59_text_22" = "Aboneliklerim";
|
||||
"20.20.59_text_23" = "Sadece son 30 günün verileri görüntüleniyor";
|
||||
"20.20.59_text_24" = "Etkinlik başlangıcı";
|
||||
"20.20.59_text_25" = "Etkinlik sona erdi";
|
||||
"20.20.59_text_26" = "Etkinliğiniz başlamak üzere! Hayranlarınız ve aboneleriniz bilgilendirildi!";
|
||||
"20.20.59_text_27" = "Takip ettiğiniz Etkinlik başlamak üzere-şimdi katılmak için tıklayın!!!";
|
||||
"20.20.59_text_28.1" = "Etkinliğinizi silmek istediğinizden emin misiniz?";
|
||||
"20.20.59_text_28.2" = "Silindikten sonra Etkinlik başlatılamaz!\nLütfen dikkatli olun!!!\nEtkinlik meydandan kaldırılacaktır.\nAfiş için harcanan paralar iade edilmeyecektir!\n";
|
||||
"20.20.59_text_29" = "Bu Etkinlik İptal Edildi";
|
||||
"20.20.59_text_30" = "İnceleme Altında";
|
||||
"20.20.59_text_31" = "İnceleme Başarısız";
|
||||
"20.20.59_text_32" = "Şimdi Katılın >>>";
|
||||
"20.20.59_text_33" = "Ana sayfaya banner yüklemenin maliyeti şu kadardır: %@\nOnay'a tıkladıktan sonra, coin'ler doğrudan düşülecektir.";
|
||||
"20.20.59_text_34" = "Gönderim Başarılı";
|
||||
"20.20.59_text_35" = "Alt başarılı";
|
||||
"20.20.59_text_36" = "İptal başarılı";
|
||||
|
@@ -3619,30 +3619,40 @@
|
||||
"20.20.56_text_19" = "已拒絕";
|
||||
"20.20.56_text_20" = "拒绝改变关系的邀请。";
|
||||
|
||||
"20.20.59_text_1" = "老年人活動中心";
|
||||
"20.20.59_text_2" = "Offical";
|
||||
"20.20.59_text_3" = "Event Square";
|
||||
"20.20.59_text_4" = "My Event";
|
||||
"20.20.59_text_5" = " Sub";
|
||||
"20.20.59_text_6" = " Unsub";
|
||||
"20.20.59_text_7" = " Participate";
|
||||
"20.20.59_text_8" = "Create Event";
|
||||
"20.20.59_text_9" = "Event Title";
|
||||
"20.20.59_text_10" = "Event Banner";
|
||||
"20.20.59_text_11" = "Upload Banner to Homepage(Costs %@)";
|
||||
"20.20.59_text_12" = "YES";
|
||||
"20.20.59_text_13" = "NO";
|
||||
"20.20.59_text_14" = "Select Room";
|
||||
"20.20.59_text_15" = "Start Time";
|
||||
"20.20.59_text_16" = "Duration";
|
||||
"20.20.59_text_17" = "Event Content";
|
||||
"20.20.59_text_18" = "Notify My Fans";
|
||||
"20.20.59_text_19" = "No rooms available~";
|
||||
"20.20.59_text_20" = "My Rooms";
|
||||
"20.20.59_text_21" = "Admin Rooms";
|
||||
"20.20.59_text_22" = "My Sub";
|
||||
"20.20.59_text_23" = "Only the data of the last 30 days is displayed";
|
||||
"20.20.59_text_24" = "Event starting";
|
||||
"20.20.59_text_25" = "Event ended";
|
||||
"20.20.59_text_26" = "Your Event is about to start! Your fans and subscribers have been notified!";
|
||||
"20.20.59_text_27" = "The Event you followed is about to start—click to join now!!!";
|
||||
"20.20.59_text_1" = "活動中心";
|
||||
"20.20.59_text_2" = "官方活動";
|
||||
"20.20.59_text_3" = "活動廣場";
|
||||
"20.20.59_text_4" = "我的活動";
|
||||
"20.20.59_text_5" = " 加入";
|
||||
"20.20.59_text_6" = " 取消訂閱";
|
||||
"20.20.59_text_7" = " 參與活動";
|
||||
"20.20.59_text_8" = "建立活動";
|
||||
"20.20.59_text_9" = "活動標題";
|
||||
"20.20.59_text_10" = "活動橫幅";
|
||||
"20.20.59_text_11" = "上傳橫幅至首頁(成本 %@)";
|
||||
"20.20.59_text_12" = "有";
|
||||
"20.20.59_text_13" = "無";
|
||||
"20.20.59_text_14" = "選擇房間";
|
||||
"20.20.59_text_15" = "開始時間";
|
||||
"20.20.59_text_16" = "持續時間";
|
||||
"20.20.59_text_17" = "活動內容";
|
||||
"20.20.59_text_18" = "通知我的粉絲";
|
||||
"20.20.59_text_19" = "沒有可用的房間~";
|
||||
"20.20.59_text_20" = "我的房間";
|
||||
"20.20.59_text_21" = "管理房間";
|
||||
"20.20.59_text_22" = "我的訂閱";
|
||||
"20.20.59_text_23" = "僅顯示最近30天的數據";
|
||||
"20.20.59_text_24" = "活動開始";
|
||||
"20.20.59_text_25" = "活動結束";
|
||||
"20.20.59_text_26" = "您的活動即將開始!您的粉絲和訂閱者已收到通知!";
|
||||
"20.20.59_text_27" = "您關注的活動即將開始,請點擊立即加入!";
|
||||
"20.20.59_text_28.1" = "您確定要刪除您的活動嗎?";
|
||||
"20.20.59_text_28.2" = "一旦刪除,事件將無法啟動!\n請謹慎處理!!\n活動將會從廣場中移除。\n花在橫幅上的金幣將不會退還!\n";
|
||||
"20.20.59_text_29" = "此活動已取消";
|
||||
"20.20.59_text_30" = "審核中";
|
||||
"20.20.59_text_31" = "審核失敗";
|
||||
"20.20.59_text_32" = "立即加入 >>>";
|
||||
"20.20.59_text_33" = "將橫幅上傳到主頁將花費金幣:%@\n點選確認後,會直接扣除金幣。";
|
||||
"20.20.59_text_34" = "提交成功";
|
||||
"20.20.59_text_35" = "訂閱成功";
|
||||
"20.20.59_text_36" = "取消成功";
|
||||
|
Reference in New Issue
Block a user