修改了礼物面板送礼物按钮的效果

This commit is contained in:
fengshuo
2022-03-23 19:27:30 +08:00
parent 1f3ba5bac3
commit 926e1aa66b
4 changed files with 23 additions and 20 deletions

View File

@@ -23,24 +23,14 @@
@end
@implementation XPGiftPresenter
///
- (void)attatchView:(id)view {
self.view = view;
}
- (id)getView {
return self.view;
}
///
- (void)getUserWallInfo {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[Api getUserWalletInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
[Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data];
[[self getView] getUserWalletInfo:model];
} uid:uid ticket:ticket];
}] uid:uid ticket:ticket];
}
@@ -113,17 +103,15 @@
if (roomUid.length <=0) {
roomUid = @"";
}
[Api requestSendGift:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200 && data.data) {
[Api requestSendGift:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
GiftReceiveInfoModel *receive = [GiftReceiveInfoModel modelWithJSON:data.data];
receive.sourceType = giftSource;
receive.roomSendGiftType = roomSendType;
NSArray * array = [targetUids componentsSeparatedByString:@","];
[self.getView sendGiftSuccess:receive originDic:data.data uidCount:array.count];
} else {
[self.getView sendGiftFailWithCode:code msg:msg];
}
} targetUids:targetUids giftNum:giftNum sendType:giftSendTypeStr giftId:giftId giftSource:giftSourceStr giftType:giftTypeStr roomUid:roomUid msg:msg uid:uid];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] sendGiftFailWithCode:code msg:msg];
}] targetUids:targetUids giftNum:giftNum sendType:giftSendTypeStr giftId:giftId giftSource:giftSourceStr giftType:giftTypeStr roomUid:roomUid msg:msg uid:uid];
}
@end

View File

@@ -30,6 +30,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong) WalletInfoModel *walletInfoModel;
///是否展示首充
@property (nonatomic,assign) BOOL isShowFirstRecharge;
///是否可用
@property (nonatomic,assign) BOOL sendButtonIsEnable;
@end
NS_ASSUME_NONNULL_END

View File

@@ -267,6 +267,13 @@
return NO;
}
#pragma mark - Getters And Setters
- (void)setSendButtonIsEnable:(BOOL)sendButtonIsEnable {
_sendButtonIsEnable = sendButtonIsEnable;
[UIView animateWithDuration:0.3 animations:^{
self.sendGiftButton.enabled = self.sendButtonIsEnable;
}];
}
- (void)setIsShowFirstRecharge:(BOOL)isShowFirstRecharge {
self.firstRechargeButton.hidden = !isShowFirstRecharge;
}
@@ -374,9 +381,12 @@
if (!_sendGiftButton) {
_sendGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_sendGiftButton setTitle:@"赠送" forState:UIControlStateNormal];
[_sendGiftButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
[_sendGiftButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
[_sendGiftButton setTitle:@"赠送中..." forState:UIControlStateDisabled];
[_sendGiftButton setTitleColor:[ThemeColor disableButtonTextColor] forState:UIControlStateDisabled];
[_sendGiftButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
_sendGiftButton.titleLabel.font = [UIFont systemFontOfSize:13];
[_sendGiftButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor disableButtonColor], [ThemeColor disableButtonColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateDisabled];
_sendGiftButton.titleLabel.font = [UIFont systemFontOfSize:12];
_sendGiftButton.layer.masksToBounds = YES;
_sendGiftButton.layer.cornerRadius = 15;
[_sendGiftButton addTarget:self action:@selector(sendButtonAction:) forControlEvents:UIControlEventTouchUpInside];

View File

@@ -296,6 +296,7 @@
if (roomSendType == -1) {
return;
}
self.giftBarView.sendButtonIsEnable = NO;
///
[self.giftPresenter sendGift:uidString giftNum:giftNumber sendType:sendType giftId:giftId giftSource:sourceType giftType:giftInfo.giftType roomSendType:roomSendType roomUid:self.roomUid msg:@""];
} else {
@@ -371,6 +372,7 @@
}
- (void)sendGiftSuccess:(GiftReceiveInfoModel *)receiveInfo originDic:(NSDictionary *)originDic uidCount:(NSInteger)uidCount{
self.giftBarView.sendButtonIsEnable = YES;
if (receiveInfo.sourceType == GiftSourceType_Pack) {
///
[self.giftInfoView updatePackSource:receiveInfo numberUser:uidCount];
@@ -382,6 +384,7 @@
///
- (void)sendGiftFailWithCode:(NSInteger)code msg:(NSString *)msg {
self.giftBarView.sendButtonIsEnable = YES;
if (code == 31005) {//
[self showNotSufficientFundsWithToast:msg];
} else if (code == 8535) {//