修改了礼物面板送礼物按钮的效果
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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];
|
||||
|
@@ -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) {//贵族等级未达到礼物等级
|
||||
|
Reference in New Issue
Block a user