feat: 完成 1.0.16 验收
@@ -520,6 +520,7 @@
|
||||
545888362C1C306B00897585 /* XPRoomPKPaneAvatarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 545888352C1C306B00897585 /* XPRoomPKPaneAvatarView.m */; };
|
||||
5468995D2C8AFE4C0049136A /* GiftComboFlagView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5468995C2C8AFE4C0049136A /* GiftComboFlagView.m */; };
|
||||
547853A12C258F2A00F45E60 /* XPMineUserViewHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 547853A02C258F2A00F45E60 /* XPMineUserViewHeader.m */; };
|
||||
5484E1FD2CA2897B008E8754 /* IAPManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5484E1FC2CA2897B008E8754 /* IAPManager.m */; };
|
||||
548E01C52C3F78360071C83D /* FeedBackViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 548E01C22C3F78360071C83D /* FeedBackViewController.xib */; };
|
||||
548E01C62C3F78360071C83D /* FeedBackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 548E01C42C3F78360071C83D /* FeedBackViewController.m */; };
|
||||
548E01C92C3F78600071C83D /* FeedBackConfigModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 548E01C82C3F78600071C83D /* FeedBackConfigModel.m */; };
|
||||
@@ -2593,6 +2594,8 @@
|
||||
5468995C2C8AFE4C0049136A /* GiftComboFlagView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiftComboFlagView.m; sourceTree = "<group>"; };
|
||||
5478539F2C258F2A00F45E60 /* XPMineUserViewHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineUserViewHeader.h; sourceTree = "<group>"; };
|
||||
547853A02C258F2A00F45E60 /* XPMineUserViewHeader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineUserViewHeader.m; sourceTree = "<group>"; };
|
||||
5484E1FB2CA2897B008E8754 /* IAPManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IAPManager.h; sourceTree = "<group>"; };
|
||||
5484E1FC2CA2897B008E8754 /* IAPManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IAPManager.m; sourceTree = "<group>"; };
|
||||
548E01C22C3F78360071C83D /* FeedBackViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FeedBackViewController.xib; sourceTree = "<group>"; };
|
||||
548E01C32C3F78360071C83D /* FeedBackViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeedBackViewController.h; sourceTree = "<group>"; };
|
||||
548E01C42C3F78360071C83D /* FeedBackViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FeedBackViewController.m; sourceTree = "<group>"; };
|
||||
@@ -10486,6 +10489,8 @@
|
||||
233423D22AAF0F4F00B1253F /* XPIAPRechargeHeadCell.m */,
|
||||
1464C5F729A4D00000AF7C94 /* XPIAPRechargeHeaderView.h */,
|
||||
1464C5F829A4D00000AF7C94 /* XPIAPRechargeHeaderView.m */,
|
||||
5484E1FB2CA2897B008E8754 /* IAPManager.h */,
|
||||
5484E1FC2CA2897B008E8754 /* IAPManager.m */,
|
||||
);
|
||||
path = Recharge;
|
||||
sourceTree = "<group>";
|
||||
@@ -12713,6 +12718,7 @@
|
||||
9B0086C627BA392B0032BD2B /* AnchorStageView.m in Sources */,
|
||||
9BCD02C72796C02800F396AA /* MicroNobleWaveView.m in Sources */,
|
||||
2305F3382AD9194B00AD403C /* PIRoomMessageUnlockPhotoAlbumView.m in Sources */,
|
||||
5484E1FD2CA2897B008E8754 /* IAPManager.m in Sources */,
|
||||
E874B88827215D39003954B9 /* MicroStateModel.m in Sources */,
|
||||
23E9EABB2A84CCBE00B792F2 /* XPMineDataSkillDataCollectionViewCell.m in Sources */,
|
||||
23FE47D52BB3C64600F09D23 /* PINobleCenterTitleCell.m in Sources */,
|
||||
|
21
YuMi/Assets.xcassets/1.0.16/big_gift_button.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "组 7122@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/1.0.16/big_gift_button.imageset/组 7122@3x.png
vendored
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
YuMi/Assets.xcassets/1.0.16/cp_avatar_card_head.imageset/1@3x.png
vendored
Normal file
After Width: | Height: | Size: 82 KiB |
21
YuMi/Assets.xcassets/1.0.16/cp_avatar_card_head.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "1@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@@ -9,7 +9,7 @@
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "切图 12@3x (2).png",
|
||||
"filename" : "monents_info_comment_count@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
|
BIN
YuMi/Assets.xcassets/Monents/monents_info_comment_count.imageset/monents_info_comment_count@3x.png
vendored
Normal file
After Width: | Height: | Size: 610 B |
21
YuMi/Assets.xcassets/Monents/monents_info_comment_count_new.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "切图 12@3x (2).png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -9,7 +9,7 @@
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "切图 45@3x-3.png",
|
||||
"filename" : "monents_info_like_count_normal@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
|
After Width: | Height: | Size: 652 B |
21
YuMi/Assets.xcassets/Monents/monents_info_like_count_normal_new.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "切图 45@3x-3.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -9,7 +9,7 @@
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "切图 12@3x.png",
|
||||
"filename" : "monents_info_like_count_select@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
21
YuMi/Assets.xcassets/Monents/monents_info_like_count_select_new.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "切图 12@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -5,7 +5,6 @@
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "monents_info_like_report@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
|
Before Width: | Height: | Size: 187 B |
21
YuMi/Assets.xcassets/Monents/monents_info_like_report_new.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "切图 12@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/Monents/monents_info_like_report_new.imageset/切图 12@3x.png
vendored
Normal file
After Width: | Height: | Size: 917 B |
@@ -23,7 +23,7 @@ NSString * const URLWithType(URLType type) {
|
||||
@(kCandyTreeRuleURL) : @"modules/rule/newWishingWellRule.html",///糖果树规则 modules/rank/index.html#/wishingWellRule
|
||||
@(kChannelUrl) : @"modules/%@/index.html?channelType=%@&deviceId=%@",
|
||||
@(kLUDOUrl) : @"modules/gameRank/index.html",///LUDO排行榜路径
|
||||
@(kCPRule) : @"molistar/modules/rule/cpRule.html"
|
||||
@(kCPRule) : @"modules/rule/cpRule.html"
|
||||
};
|
||||
NSString * newUrl = [newDic objectForKey:@(type)];
|
||||
if(newUrl != nil){
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#import "XPForgetPwdViewController.h"
|
||||
#import "PISwitchingEnvironmentVC.h"
|
||||
#import "FeedBackViewController.h"
|
||||
#import "IAPManager.h"
|
||||
|
||||
UIKIT_EXTERN NSString * const kYouMiNumberCountKey;
|
||||
NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
|
||||
@@ -120,6 +121,8 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
|
||||
#endif
|
||||
|
||||
[self setupDefaultLoginType];
|
||||
|
||||
[[IAPManager sharedManager] handleLogout];
|
||||
}
|
||||
|
||||
- (void)setupDefaultLoginType {
|
||||
|
@@ -185,7 +185,7 @@
|
||||
/// @param completion 完成
|
||||
/// @param chooseEnv @"true"
|
||||
/// @param chargeRecordId 服务端生成的订单编号
|
||||
/// @param transcationId 内购的唯一标识符
|
||||
/// @param transcationId 内购的唯一标识符 “transcationId” 后端的参数是拼错的!不要调整!
|
||||
/// @param uid 用户uid
|
||||
/// @param ticket ticket
|
||||
+ (void)checkReceipt:(HttpRequestHelperCompletion)completion chooseEnv:(NSString *)chooseEnv chargeRecordId:(NSString *)chargeRecordId transcationId:(NSString *)transcationId uid:(NSString *)uid ticket:(NSString *)ticket {
|
||||
|
@@ -17,7 +17,6 @@
|
||||
///Model
|
||||
#import "RechargeListModel.h"
|
||||
#import "WalletInfoModel.h"
|
||||
|
||||
@implementation XPMineRechargePresenter
|
||||
|
||||
|
||||
@@ -60,7 +59,7 @@
|
||||
[[self getView]showErrorToast:msg];
|
||||
}
|
||||
[[self getView] requestIAPRechargeOrderFailWithCode:code];
|
||||
}errorToast:NO] chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
||||
} errorToast:NO] chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
||||
}
|
||||
|
||||
|
||||
|
@@ -15,23 +15,54 @@
|
||||
|
||||
|
||||
@interface RoundCornerBorderBackground : UIView
|
||||
@property (nonatomic, strong) CAGradientLayer *gradientLayer;
|
||||
|
||||
- (void)setupBGColor;
|
||||
- (void)setupCellBGColor;
|
||||
@end
|
||||
|
||||
@implementation RoundCornerBorderBackground
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
[self setupBGColor];
|
||||
self.layer.borderColor = UIColorFromRGB(0x1A4655).CGColor;
|
||||
self.layer.borderWidth = 1;
|
||||
self.layer.cornerRadius = 8;
|
||||
self.layer.cornerRadius = 10;
|
||||
self.layer.masksToBounds = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
|
||||
// 在 layoutSubviews 中设置渐变图层的 frame
|
||||
self.gradientLayer.frame = self.bounds;
|
||||
}
|
||||
|
||||
- (void)setupBGColor {
|
||||
// UIView *bg = [[UIView alloc] init];
|
||||
self.layer.borderColor = UIColorFromRGB(0x1C4B5D).CGColor;
|
||||
// 创建 CAGradientLayer
|
||||
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
|
||||
|
||||
// 设置渐变颜色数组(从上到下)
|
||||
gradientLayer.colors = @[
|
||||
(id)UIColorFromRGB(0x071A21).CGColor,
|
||||
(id)UIColorFromRGB(0x0B222B).CGColor
|
||||
];
|
||||
|
||||
// 设置渐变的起止位置(0.0 是顶部,1.0 是底部)
|
||||
gradientLayer.startPoint = CGPointMake(0.5, 0.0); // 顶部中央
|
||||
gradientLayer.endPoint = CGPointMake(0.5, 1.0); // 底部中央
|
||||
|
||||
// 将渐变图层添加到 view 的图层中
|
||||
[self.layer insertSublayer:gradientLayer atIndex:0];
|
||||
|
||||
self.gradientLayer = gradientLayer;
|
||||
}
|
||||
|
||||
- (void)setupCellBGColor {
|
||||
self.layer.borderColor = UIColorFromRGB(0x1A4655).CGColor;
|
||||
// 创建 CAGradientLayer
|
||||
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
|
||||
|
||||
@@ -45,11 +76,10 @@
|
||||
gradientLayer.startPoint = CGPointMake(0.5, 0.0); // 顶部中央
|
||||
gradientLayer.endPoint = CGPointMake(0.5, 1.0); // 底部中央
|
||||
|
||||
// 设置渐变图层的大小为视图的大小
|
||||
gradientLayer.frame = self.bounds;
|
||||
|
||||
// 将渐变图层添加到 view 的图层中
|
||||
[self.layer insertSublayer:gradientLayer atIndex:0];
|
||||
|
||||
self.gradientLayer = gradientLayer;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -73,6 +103,7 @@
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
RoundCornerBorderBackground *view = [[RoundCornerBorderBackground alloc] init];
|
||||
[view setupCellBGColor];
|
||||
[self.contentView addSubview:view];
|
||||
[view mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.contentView);
|
||||
@@ -81,27 +112,24 @@
|
||||
[self.contentView addSubview:self.icon];
|
||||
[self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
make.top.mas_equalTo(self.contentView).offset(8);
|
||||
make.top.mas_equalTo(self.contentView);
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(63));
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.nameLabel];
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
make.top.mas_equalTo(self.icon.mas_bottom).offset(2);
|
||||
make.height.mas_equalTo(18);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.countLabel];
|
||||
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(2);
|
||||
make.bottom.mas_equalTo(-2);
|
||||
make.height.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.vapView];
|
||||
[self.vapView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.icon);
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
make.top.mas_equalTo(self.contentView).offset(7);
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(63));
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
@@ -119,6 +147,12 @@
|
||||
self.icon.imageUrl = giftModel.picUrl;
|
||||
self.nameLabel.text = giftModel.giftName;
|
||||
self.countLabel.text = [NSString stringWithFormat:@"x%ld", (long)giftModel.reciveCount];
|
||||
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
make.bottom.mas_equalTo(-24);
|
||||
make.height.mas_equalTo(18);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setUserMedalModel:(UserMedalModel *)userMedalModel {
|
||||
@@ -127,6 +161,12 @@
|
||||
self.vapView.hidden = NO;
|
||||
self.countLabel.hidden = YES;
|
||||
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
make.bottom.mas_equalTo(-8);
|
||||
make.height.mas_equalTo(18);
|
||||
}];
|
||||
|
||||
self.nameLabel.text = userMedalModel.medalName;
|
||||
if (self.videoUrl.length > 0) {
|
||||
[self.vapView playHWDMP4:self.videoUrl repeatCount:-1 delegate:nil];
|
||||
@@ -209,7 +249,7 @@
|
||||
return kGetScaleWidth(116);
|
||||
}
|
||||
NSInteger lines = ceil(medalModel.userMedals.count/4.0);
|
||||
return 42 + lines * (kGetScaleWidth(94) + 16);
|
||||
return 50 + lines * (kGetScaleWidth(94) + 8);
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +259,7 @@
|
||||
return kGetScaleWidth(116);
|
||||
}
|
||||
NSInteger lines = ceil((giftWall.count + luckyGiftWall.count)/4.0);
|
||||
return lines * (kGetScaleWidth(107) + 16);
|
||||
return 58 + lines * (kGetScaleWidth(107) + 7);
|
||||
}
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
@@ -237,37 +277,37 @@
|
||||
RoundCornerBorderBackground *view = [[RoundCornerBorderBackground alloc] init];
|
||||
[self.contentView addSubview:view];
|
||||
[view mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.leading.trailing.mas_equalTo(self.contentView);
|
||||
make.bottom.mas_equalTo(self.contentView);//.offset(-8);
|
||||
make.edges.mas_equalTo(self.contentView);
|
||||
}];
|
||||
[view setupBGColor];
|
||||
|
||||
[self.contentView addSubview:self.medalButton];
|
||||
[self.medalButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(8);
|
||||
make.top.mas_equalTo(self.contentView).offset(8);
|
||||
make.leading.mas_equalTo(8);
|
||||
make.size.mas_equalTo(CGSizeMake(60, 22));
|
||||
make.size.mas_equalTo(CGSizeMake(60, 30));
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.giftButton];
|
||||
[self.giftButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self.medalButton);
|
||||
make.top.mas_equalTo(self.contentView).offset(8);
|
||||
make.leading.mas_equalTo(8 + 60 + 8);
|
||||
make.size.mas_equalTo(CGSizeMake(50, 22));
|
||||
make.size.mas_equalTo(CGSizeMake(50, 30));
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.indicatorImageView];
|
||||
[self.indicatorImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.medalButton);
|
||||
make.top.mas_equalTo(self.medalButton.mas_bottom);
|
||||
make.leading.mas_equalTo(8 + 30 - 11);
|
||||
make.top.mas_equalTo(self.contentView).offset(34);
|
||||
make.size.mas_equalTo(CGSizeMake(21, 6));
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.contentCollectionView];
|
||||
[self.contentCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.indicatorImageView.mas_bottom).offset(8);
|
||||
make.bottom.mas_equalTo(view).offset(-8);
|
||||
make.leading.mas_equalTo(view).offset(8);
|
||||
make.trailing.mas_equalTo(view).offset(-8);
|
||||
make.top.mas_equalTo(self.contentView).offset(50);
|
||||
make.bottom.mas_equalTo(self.contentView).offset(-8);
|
||||
make.leading.mas_equalTo(self.contentView).offset(8);
|
||||
make.trailing.mas_equalTo(self.contentView).offset(-8);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.emptyLabel];
|
||||
@@ -289,8 +329,8 @@
|
||||
self.giftButton.titleLabel.font = self.isMedal ? kFontRegular(14) : kFontSemibold(16);
|
||||
|
||||
[self.indicatorImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.isMedal ? self.medalButton : self.giftButton);
|
||||
make.top.mas_equalTo(self.medalButton.mas_bottom);
|
||||
make.leading.mas_equalTo(self.isMedal ? (8 + 30 - 11) : (8+90-11));
|
||||
make.top.mas_equalTo(self.contentView).offset(34);
|
||||
make.size.mas_equalTo(CGSizeMake(21, 6));
|
||||
}];
|
||||
|
||||
@@ -332,18 +372,20 @@
|
||||
}
|
||||
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
XPMultipleContentCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMultipleContentCollectionCell class]) forIndexPath:indexPath];
|
||||
if (self.isMedal) {
|
||||
XPMultipleContentCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Medal Cell" forIndexPath:indexPath];
|
||||
cell.userMedalModel = [self.medalModel.userMedals xpSafeObjectAtIndex:indexPath.row];
|
||||
return cell;
|
||||
} else {
|
||||
XPMultipleContentCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Gift Cell" forIndexPath:indexPath];
|
||||
cell.giftModel = [self.allGifts xpSafeObjectAtIndex:indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return self.isMedal ? CGSizeMake(kGetScaleWidth(77), kGetScaleWidth(94)) : CGSizeMake(kGetScaleWidth(77), kGetScaleWidth(107));
|
||||
CGFloat width = (KScreenWidth - 14*2 - 16 - 7 * 3)/4.0;
|
||||
return self.isMedal ? CGSizeMake(width, kGetScaleWidth(94)) : CGSizeMake(width, kGetScaleWidth(107));
|
||||
}
|
||||
|
||||
|
||||
@@ -407,7 +449,9 @@
|
||||
_contentCollectionView.backgroundColor = [UIColor clearColor];
|
||||
_contentCollectionView.scrollEnabled = NO;
|
||||
[_contentCollectionView registerClass:[XPMultipleContentCollectionCell class]
|
||||
forCellWithReuseIdentifier:NSStringFromClass([XPMultipleContentCollectionCell class])];
|
||||
forCellWithReuseIdentifier:@"Medal Cell"];
|
||||
[_contentCollectionView registerClass:[XPMultipleContentCollectionCell class]
|
||||
forCellWithReuseIdentifier:@"Gift Cell"];
|
||||
}
|
||||
return _contentCollectionView;
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///标题
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
@property (nonatomic,strong) UILabel *titleLabelLong;
|
||||
///头像
|
||||
@property (nonatomic,strong) NetImageView *avatarImageView;
|
||||
///副标题
|
||||
@@ -78,9 +79,16 @@
|
||||
[self.soundView addSubview:self.soundTimeView];
|
||||
|
||||
[self.stackView addArrangedSubview:self.titleLabel];
|
||||
UIView *emptyVeiw1 = [UIView new];
|
||||
[self.stackView addArrangedSubview:emptyVeiw1];
|
||||
[emptyVeiw1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_greaterThanOrEqualTo(5);
|
||||
}];
|
||||
[self.stackView addArrangedSubview:self.avatarImageView];
|
||||
[self.stackView addArrangedSubview:self.subTitleLabel];
|
||||
|
||||
|
||||
[self.stackView addSubview:self.titleLabelLong];
|
||||
|
||||
UIView *emptyVeiw = [UIView new];
|
||||
[self.stackView addArrangedSubview:emptyVeiw];
|
||||
[emptyVeiw mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -112,6 +120,12 @@
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(kGetScaleWidth(100));
|
||||
make.height.mas_equalTo(kGetScaleWidth(20));
|
||||
}];
|
||||
[self.titleLabelLong mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.centerY.mas_equalTo(self.stackView);
|
||||
make.width.mas_equalTo(kGetScaleWidth(300));
|
||||
make.height.mas_equalTo(kGetScaleWidth(20));
|
||||
}];
|
||||
[self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.trailing.equalTo(self.arrowImageView.mas_leading).mas_offset(-kGetScaleWidth(2));
|
||||
@@ -190,6 +204,8 @@
|
||||
self.switchButton.hidden = YES;
|
||||
self.phototStackView.hidden = YES;
|
||||
self.avatarImageView.hidden = YES;
|
||||
self.titleLabelLong.hidden = YES;
|
||||
self.titleLabel.hidden = NO;
|
||||
|
||||
switch (model.type) {
|
||||
case XPMineUserInfoEditType_Avatar:
|
||||
@@ -247,9 +263,8 @@
|
||||
self.arrowImageView.hidden = YES;
|
||||
self.switchButton.hidden = NO;
|
||||
[self.switchButton setOn:self.isCPAvatarDisplay];
|
||||
[self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(kGetScaleWidth(300));
|
||||
}];
|
||||
self.titleLabelLong.hidden = NO;
|
||||
self.titleLabel.hidden = YES;
|
||||
break;
|
||||
}
|
||||
case XPMineUserInfoEditType_CP_Animation:
|
||||
@@ -257,9 +272,8 @@
|
||||
self.arrowImageView.hidden = YES;
|
||||
self.switchButton.hidden = NO;
|
||||
[self.switchButton setOn:self.isCPAnimationDisplay];
|
||||
[self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(kGetScaleWidth(300));
|
||||
}];
|
||||
self.titleLabelLong.hidden = NO;
|
||||
self.titleLabel.hidden = YES;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -299,6 +313,7 @@
|
||||
_itmeModel = itmeModel;
|
||||
if (_itmeModel) {
|
||||
self.titleLabel.text = _itmeModel.title;
|
||||
self.titleLabelLong.text = _itmeModel.title;
|
||||
self.subTitleLabel.text = _itmeModel.subTitle;
|
||||
self.isCPAvatarDisplay = itmeModel.isCPAvatar;
|
||||
self.isCPAnimationDisplay = itmeModel.isCPAnimation;
|
||||
@@ -327,6 +342,16 @@
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabelLong {
|
||||
if (!_titleLabelLong) {
|
||||
_titleLabelLong = [[UILabel alloc] init];
|
||||
_titleLabelLong.font = kFontMedium(14);
|
||||
_titleLabelLong.textColor = [DJDKMIMOMColor inputTextColor];
|
||||
[_titleLabelLong setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
|
||||
}
|
||||
return _titleLabelLong;
|
||||
}
|
||||
|
||||
- (UILabel *)subTitleLabel {
|
||||
if (!_subTitleLabel) {
|
||||
_subTitleLabel = [[UILabel alloc] init];
|
||||
@@ -481,7 +506,7 @@
|
||||
_switchButton.tintColor = UIColorFromRGB(0xDCDCDC); // 灰色
|
||||
|
||||
[_switchButton addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
|
||||
|
||||
_switchButton.transform = CGAffineTransformMakeScale(0.8, 0.8);
|
||||
}
|
||||
return _switchButton;
|
||||
}
|
||||
|
@@ -56,8 +56,13 @@
|
||||
[self initSubViewConstraints];
|
||||
[self showLoading];
|
||||
[self.presenter requestQueryWithRoomType];
|
||||
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
[self hideHUD];
|
||||
}
|
||||
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
}
|
||||
|
@@ -132,7 +132,7 @@ typedef enum : NSUInteger {
|
||||
}
|
||||
|
||||
- (void)setNum:(NSString *)num {
|
||||
_numLabel.text = num;
|
||||
// _numLabel.text = num;
|
||||
}
|
||||
|
||||
- (void)setHasMore:(BOOL)hasMore {
|
||||
@@ -490,18 +490,18 @@ typedef enum : NSUInteger {
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if(indexPath.section == 0)return;
|
||||
// if(indexPath.section == 0)return;
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
XPMomentsDetailViewController * detailVC = [[XPMomentsDetailViewController alloc] init];
|
||||
MomentsInfoModel * monentsInfo = [self.datasource xpSafeObjectAtIndex:indexPath.row];
|
||||
if(monentsInfo.dynamicId == nil){
|
||||
return;
|
||||
}
|
||||
detailVC.momentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
}
|
||||
// if (self.datasource.count > 0) {
|
||||
// XPMomentsDetailViewController * detailVC = [[XPMomentsDetailViewController alloc] init];
|
||||
// MomentsInfoModel * monentsInfo = [self.datasource xpSafeObjectAtIndex:indexPath.row];
|
||||
// if(monentsInfo.dynamicId == nil){
|
||||
// return;
|
||||
// }
|
||||
// detailVC.momentsInfo = monentsInfo;
|
||||
// detailVC.delegate = self;
|
||||
// [self.navigationController pushViewController:detailVC animated:YES];
|
||||
// }
|
||||
}
|
||||
|
||||
#pragma mark - XPMomentsTableViewCellDelegate
|
||||
@@ -675,6 +675,7 @@ typedef enum : NSUInteger {
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.showsVerticalScrollIndicator = NO;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
|
@@ -205,11 +205,28 @@ UIKIT_EXTERN NSString * kUpdateSoundInfo;
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
||||
if (section == 1) {
|
||||
return @"CP";
|
||||
// 创建 header view
|
||||
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 60)];
|
||||
headerView.backgroundColor = [UIColor clearColor];
|
||||
|
||||
// 创建 label 或者其他子视图
|
||||
UILabel *label = [UILabel labelInitWithText:@"CP" font:kFontMedium(15) textColor:UIColorFromRGB(0x313131)];
|
||||
|
||||
// 添加到 header view
|
||||
[headerView addSubview:label];
|
||||
|
||||
// 设置 Auto Layout 约束,给 label 添加左间距
|
||||
label.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[NSLayoutConstraint activateConstraints:@[
|
||||
[label.leadingAnchor constraintEqualToAnchor:headerView.leadingAnchor constant:16], // 左间距为16
|
||||
[label.centerYAnchor constraintEqualToAnchor:headerView.centerYAnchor], // 垂直居中
|
||||
]];
|
||||
|
||||
return headerView;
|
||||
}
|
||||
return @"";
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
@@ -223,11 +240,11 @@ UIKIT_EXTERN NSString * kUpdateSoundInfo;
|
||||
XPMineUserInfoEditModel *model = [[XPMineUserInfoEditModel alloc] init];
|
||||
if (indexPath.row == 0) {
|
||||
model.isCPAnimation = self.relationUser.showCpAnim;
|
||||
model.title = @"Homepage animation display-CP";
|
||||
model.title = YMLocalizedString(@"UserDetail_Setting_0");
|
||||
model.type = XPMineUserInfoEditType_CP_Animation;
|
||||
} else {
|
||||
model.isCPAvatar = self.relationUser.showCpAvatar;
|
||||
model.title = @"Homepage avatars display-CP";
|
||||
model.title =YMLocalizedString(@"UserDetail_Setting_1");
|
||||
model.type = XPMineUserInfoEditType_CP_Avatar;
|
||||
}
|
||||
cell.itmeModel = model;
|
||||
@@ -254,6 +271,9 @@ UIKIT_EXTERN NSString * kUpdateSoundInfo;
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (indexPath.section == 1) {
|
||||
return;
|
||||
}
|
||||
XPMineUserInfoEditModel * model = [self.datasouce xpSafeObjectAtIndex:indexPath.row];
|
||||
switch (model.type) {
|
||||
case XPMineUserInfoEditType_Nick:
|
||||
|
@@ -85,7 +85,7 @@ HWDMP4PlayDelegate>
|
||||
///禮物牆
|
||||
@property (nonatomic,strong) XPGiftUserDataViewController *giftVC;
|
||||
///编辑资料
|
||||
@property (nonatomic,strong) XPMineUserInfoEditViewController * editVC;
|
||||
@property (nonatomic,strong) XPMineUserInfoEditViewController *editVC;
|
||||
|
||||
@property (nonatomic, strong) XPMomentUserDataViewController *userMomentVC;
|
||||
|
||||
@@ -97,6 +97,8 @@ HWDMP4PlayDelegate>
|
||||
@property (nonatomic, strong) NetImageView *avatarLoader;
|
||||
@property (nonatomic, strong) NetImageView *cpAvatarLoader;
|
||||
|
||||
@property (nonatomic, assign) NSInteger playVapCount;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPMineUserInfoViewController
|
||||
@@ -115,7 +117,7 @@ HWDMP4PlayDelegate>
|
||||
-(void)viewDidAppear:(BOOL)animated{
|
||||
[super viewDidAppear:animated];
|
||||
|
||||
[self initHttpRequest];
|
||||
// [self initHttpRequest];
|
||||
}
|
||||
|
||||
-(void)viewDidDisappear:(BOOL)animated{
|
||||
@@ -136,6 +138,7 @@ HWDMP4PlayDelegate>
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.view.backgroundColor = UIColorFromRGB(0x08151A);
|
||||
self.playVapCount = 0;
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
@@ -347,6 +350,7 @@ HWDMP4PlayDelegate>
|
||||
self.headerHeight = [XPMineUserInfoHeaderView headerHeight:userInfo];
|
||||
|
||||
[self.pagingView reloadData];
|
||||
self.pagingView.hidden = NO;
|
||||
|
||||
//获取用户详细信息 跟随进房目前使用的这个接口
|
||||
[self.presenter getUserDetailInfoWithUid:@(self.uid).stringValue];
|
||||
@@ -386,7 +390,12 @@ HWDMP4PlayDelegate>
|
||||
}
|
||||
|
||||
- (void)playCPAnimation {
|
||||
if (self.userInfo.relationUserVO.showCpAnim && self.userInfo.relationUserVO.cpLevel >= 3) {
|
||||
if (self.userInfo.relationUserVO.showCpAnim &&
|
||||
self.userInfo.relationUserVO.cpLevel >= 3 &&
|
||||
self.playVapCount == 0) {
|
||||
|
||||
self.playVapCount = 1;
|
||||
|
||||
[self.view addSubview:self.vapView];
|
||||
NSString *filePath = [[NSBundle mainBundle] pathForResource:@(self.userInfo.relationUserVO.cpLevel).stringValue ofType:@"mp4"];
|
||||
[self.vapView playHWDMP4:filePath delegate:self];
|
||||
@@ -514,7 +523,7 @@ HWDMP4PlayDelegate>
|
||||
[_chatButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0x04D5C6)] forState:UIControlStateNormal];
|
||||
[_chatButton setImage:kImage(@"user_detail_message") forState:UIControlStateNormal];
|
||||
_chatButton.layer.masksToBounds = YES;
|
||||
_chatButton.layer.cornerRadius = 39/2;
|
||||
_chatButton.layer.cornerRadius = 45/2;
|
||||
[_chatButton addTarget:self action:@selector(chatButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _chatButton;
|
||||
@@ -533,7 +542,7 @@ HWDMP4PlayDelegate>
|
||||
[_attentionButton setImage:kImage(@"user_detail_unfollow") forState:UIControlStateNormal];
|
||||
[_attentionButton setImage:kImage(@"user_detail_followed") forState:UIControlStateSelected];
|
||||
_attentionButton.layer.masksToBounds = YES;
|
||||
_attentionButton.layer.cornerRadius = 39/2;
|
||||
_attentionButton.layer.cornerRadius = 45/2;
|
||||
[_attentionButton addTarget:self action:@selector(attentionButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _attentionButton;
|
||||
@@ -570,6 +579,7 @@ HWDMP4PlayDelegate>
|
||||
- (JXPagerView *)pagingView {
|
||||
if (!_pagingView) {
|
||||
_pagingView = [[JXPagerView alloc] initWithDelegate:self];
|
||||
_pagingView.hidden = YES;
|
||||
_pagingView.backgroundColor = [UIColor clearColor];
|
||||
_pagingView.listContainerView.backgroundColor = [UIColor clearColor];
|
||||
_pagingView.mainTableView.backgroundColor = [UIColor clearColor];
|
||||
|
@@ -16,7 +16,7 @@
|
||||
//}
|
||||
// vip/v2/getVipPageInfo
|
||||
+ (void)vipCenterLevelList:(HttpRequestHelperCompletion)completion {
|
||||
[self makeRequest:@"vip/getVipPageInfo" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil];
|
||||
[self makeRequest:@"vip/v2/getVipPageInfo" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil];
|
||||
}
|
||||
|
||||
//vip/v2/getVipPageInfo
|
||||
|
@@ -35,6 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property(nonatomic,assign) BOOL isReturnProfit;
|
||||
|
||||
@property (nonatomic, assign) NSInteger buyAmount;
|
||||
@property (nonatomic, assign) NSInteger remainSeconds;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -25,21 +25,27 @@
|
||||
|
||||
/// 获取VIP中心数据
|
||||
- (void)getNobleCenterInfo {
|
||||
@kWeakify(self);
|
||||
[Api vipCenterLevelList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
NobleCenterModel *model = [NobleCenterModel modelWithDictionary:data.data];
|
||||
[[self getView] getNobleCenterInfoSuccess:model];
|
||||
}]];
|
||||
}
|
||||
/// 获取VIP中心数据
|
||||
- (void)getNobleCenterReturnDiamond:(NSString *)recordId{
|
||||
@kWeakify(self);
|
||||
[Api getNobleCenterDiamond:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView]getNobleCenterDiamondSuccess:recordId];
|
||||
@kStrongify(self);
|
||||
[[self getView] getNobleCenterDiamondSuccess:recordId];
|
||||
} showLoading:YES errorToast:YES] returnProfitRecordId:recordId];
|
||||
}
|
||||
// 获取用户信息
|
||||
- (void)getUserInfo {
|
||||
@kWeakify(self);
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
[Api getUserInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
|
||||
[[self getView] onGetUserInfoSuccess:infoModel];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@@ -66,25 +72,30 @@
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
NSString * deviceInfo = [YYUtility deviceID];
|
||||
NSString * clientIp= [YYUtility ipAddress];
|
||||
@kWeakify(self);
|
||||
[Api requestNobleIAPRecharge:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
NSString *orderId = (NSString *)data.data[@"recordId"];
|
||||
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
|
||||
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
[[self getView] requestIAPRechargeOrderFail:msg code:code];
|
||||
}showLoading:NO errorToast:NO] chargeProdId:chargeProdId uid:uid roomUid:roomUid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
||||
}
|
||||
|
||||
/// 充值成功二次验证
|
||||
|
||||
/// @param orderId 订单编号
|
||||
/// @param transcationId 商品id
|
||||
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast{
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
@kWeakify(self);
|
||||
[Api checkReceipt:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
[[self getView] checkReceiptSuccess:transcationId];
|
||||
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
[[self getView]checkReceiptFailWithCode:code transcationId:transcationId];
|
||||
} showLoading:YES errorToast:errorToast] chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
||||
}
|
||||
@@ -93,7 +104,9 @@
|
||||
/// @param transcations 凭据的数组
|
||||
- (void)checkTranscationIds:(NSArray *)transcations {
|
||||
NSString * transcationIdStr = [transcations toJSONString];
|
||||
@kWeakify(self);
|
||||
[Api requestCheckTranscationIds:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
[[self getView] checkTranscationIdsSuccess];
|
||||
}] transcationIdStr:transcationIdStr];
|
||||
}
|
||||
@@ -101,9 +114,12 @@
|
||||
/// 切换隐身进房
|
||||
/// @param enterHide 隐身进房
|
||||
- (void)changeEnterHide:(BOOL)enterHide {
|
||||
@kWeakify(self);
|
||||
[Api changeEnterHidCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
[[self getView] changeEnterHideSuccess];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
[[self getView] changeEnterHideFail];
|
||||
}] open:[NSString stringWithFormat:@"%d", enterHide]];
|
||||
}
|
||||
@@ -111,15 +127,20 @@
|
||||
|
||||
/// @param roomUid 房主的uid
|
||||
- (void)openVipWithDiamondRoomUid:(NSString *)roomUid vipLevel:(NSString *)vipLevel{
|
||||
@kWeakify(self);
|
||||
[Api openWithDiamond:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
[[self getView] openVipWithDiamondSuccess];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
[[self getView] openVipWithDiamondFail:code];
|
||||
}showLoading:YES errorToast:YES] roomUid:roomUid vipLevel:vipLevel];
|
||||
}
|
||||
//联系客服
|
||||
-(void)getContactCustomerService{
|
||||
@kWeakify(self);
|
||||
[Api requestContactCustomerServiceCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
@kStrongify(self);
|
||||
NSString *uid = [NSString stringWithFormat:@"%@",data.data];
|
||||
[[self getView]getContactCustomerServiceSuccessWithUid:uid];
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
|
@@ -642,7 +642,7 @@
|
||||
UIImageView *coin = [[UIImageView alloc] initWithImage:kImage(@"moli_money_icon")];
|
||||
[_purchaseContainer addSubview:coin];
|
||||
[coin mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(10);
|
||||
make.centerY.mas_equalTo(self.purchaseContainer);
|
||||
make.leading.mas_equalTo(16);
|
||||
make.size.mas_equalTo(CGSizeMake(kGetScaleWidth(20), kGetScaleWidth(20)));
|
||||
}];
|
||||
@@ -954,16 +954,21 @@
|
||||
cell.svgaPath = info.vipLogo;
|
||||
[cell setPlaceHolderPath:info.vipIcon];
|
||||
|
||||
if (self.userVIPInfo) {
|
||||
if (self.userVIPInfo.vipLevel - 1 > index) {
|
||||
[cell setDueDate:@""];
|
||||
} else if (self.userVIPInfo.vipLevel - 1 == index) {
|
||||
[cell setDueDate:[NSString stringWithFormat:YMLocalizedString(@"VipCenter_6"), [self calNextVIPExpiredSeconds:self.vipModel.remainSeconds]]];
|
||||
} else {
|
||||
[cell setDueDate:[NSString stringWithFormat:YMLocalizedString(@"VipCenter_5"), index + 1]];
|
||||
}
|
||||
if (info.remainSeconds > 0) {
|
||||
[cell setDueDate:[NSString stringWithFormat:YMLocalizedString(@"VipCenter_6"), [self calNextVIPExpiredSeconds:info.remainSeconds]]];
|
||||
} else {
|
||||
[cell setDueDate:[NSString stringWithFormat:YMLocalizedString(@"VipCenter_5"), index + 1]];
|
||||
// if (self.userVIPInfo) {
|
||||
// if (self.userVIPInfo.vipLevel - 1 > index) {
|
||||
// [cell setDueDate:@""];
|
||||
// } else if (self.userVIPInfo.vipLevel - 1 == index) {
|
||||
// [cell setDueDate:[NSString stringWithFormat:YMLocalizedString(@"VipCenter_6"), [self calNextVIPExpiredSeconds:self.vipModel.remainSeconds]]];
|
||||
// } else {
|
||||
// [cell setDueDate:[NSString stringWithFormat:YMLocalizedString(@"VipCenter_5"), index + 1]];
|
||||
// }
|
||||
// } else {
|
||||
// [cell setDueDate:[NSString stringWithFormat:YMLocalizedString(@"VipCenter_5"), index + 1]];
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1151,6 +1156,7 @@
|
||||
font:kFontRegular(12)
|
||||
textColor:[DJDKMIMOMColor colorWithHexString:@"#FFE3AF"]];
|
||||
_purchaseExpiresLabel.alpha = 0.6;
|
||||
_purchaseExpiresLabel.hidden = YES;
|
||||
}
|
||||
return _purchaseExpiresLabel;
|
||||
}
|
||||
|
@@ -14,10 +14,15 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+ (instancetype)sharedManager;
|
||||
|
||||
- (void)purchase:(NSString *)productId
|
||||
success:(void(^)(void))success
|
||||
success:(void(^)(NSString *transactionID, NSString *orderID))success
|
||||
failure:(void(^)(NSError *error))failure
|
||||
contactCS:(void(^)(NSString *uid))contactCS;
|
||||
|
||||
- (void)retryCheckAllReceipt;
|
||||
|
||||
- (void)handleLogin;
|
||||
- (void)handleLogout;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -13,10 +13,18 @@
|
||||
|
||||
@interface IAPManager()
|
||||
|
||||
@property (nonatomic, assign) BOOL isLogin;
|
||||
|
||||
@property (nonatomic, assign) NSInteger recheckInterval;
|
||||
@property (nonatomic, assign) NSInteger recheckIndex;
|
||||
@property (nonatomic, strong) NSTimer *recheckTimer;
|
||||
@property (nonatomic, assign) BOOL isProcessing;
|
||||
|
||||
@property (nonatomic, copy) NSString *orderID;
|
||||
@property (nonatomic, copy) NSString *transactionID;
|
||||
|
||||
@property (nonatomic, copy) void(^successPurchase)(void);
|
||||
@property (nonatomic, copy) void(^successPurchase)(NSString *transactionID, NSString *orderID);
|
||||
@property (nonatomic, copy) void(^successRecheck)(void);
|
||||
@property (nonatomic, copy) void(^failurePurchase)(NSError *error);
|
||||
@property (nonatomic, copy) void(^contactCustomerService)(NSString *uid);
|
||||
|
||||
@@ -30,13 +38,28 @@
|
||||
|
||||
dispatch_once(&onceToken, ^{
|
||||
proxy = [[self alloc] init];
|
||||
|
||||
proxy.recheckIndex = 0;
|
||||
proxy.recheckInterval = 1.0;
|
||||
});
|
||||
|
||||
return proxy;
|
||||
}
|
||||
|
||||
- (void)handleLogin {
|
||||
self.isLogin = YES;
|
||||
}
|
||||
|
||||
- (void)handleLogout {
|
||||
self.isLogin = NO;
|
||||
if (self.recheckTimer) {
|
||||
[self.recheckTimer invalidate];
|
||||
}
|
||||
}
|
||||
|
||||
// 开始正常内购流程
|
||||
- (void)purchase:(NSString *)productId
|
||||
success:(void(^)(void))success
|
||||
success:(void(^)(NSString *transactionID, NSString *orderID))success
|
||||
failure:(void(^)(NSError *error))failure
|
||||
contactCS:(void(^)(NSString *uid))contactCS {
|
||||
|
||||
@@ -45,19 +68,82 @@
|
||||
self.contactCustomerService = contactCS;
|
||||
|
||||
[self handleIAPState];
|
||||
[self requestAPPOrderData:productId];
|
||||
[self requestAPPOrderData:productId isFroRecheck:NO];
|
||||
}
|
||||
|
||||
- (void)handleSuccessPurchase {
|
||||
// 定时轮训未完成的订单并进行验单
|
||||
- (void)retryCheckAllReceipt {
|
||||
self.recheckTimer = [NSTimer scheduledTimerWithTimeInterval:self.recheckInterval
|
||||
target:self
|
||||
selector:@selector(handleRetryCheckReceipt)
|
||||
userInfo:nil
|
||||
repeats:NO];
|
||||
}
|
||||
|
||||
// 验单逻辑
|
||||
- (void)handleRetryCheckReceipt {
|
||||
NSArray *array = [RechargeStorage getAllReceiptsWithUid:[AccountInfoStorage instance].getUid];
|
||||
NSLog(@" ------------.------------ 尝试:%@", array);
|
||||
@synchronized (array) {
|
||||
if (array.count == 0 || self.isProcessing) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self.isLogin) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.recheckIndex >= array.count) {
|
||||
self.recheckIndex = 0;
|
||||
}
|
||||
|
||||
// 尝试请求一下订单号,看看能否触发后端检查用户是否有未下发内容
|
||||
[self requestAPPOrderData:@"com.hflighting.yumi.gold.1_7000" isFroRecheck:YES];
|
||||
|
||||
self.isProcessing = YES;
|
||||
NSDictionary *dic = [array xpSafeObjectAtIndex:self.recheckIndex];
|
||||
NSString *transactionId = dic[@"transactionId"];
|
||||
[self backgroundCheckReceiptWithTransactionID:transactionId
|
||||
orderID:dic[@"orderId"]
|
||||
next:^(BOOL isSuccess){
|
||||
if (isSuccess) {
|
||||
[RechargeStorage delegateTransactionId:transactionId
|
||||
uid:[AccountInfoStorage instance].getUid];
|
||||
self.recheckInterval = 1.0;
|
||||
} else {
|
||||
self.recheckInterval = self.recheckInterval * 2;
|
||||
}
|
||||
|
||||
self.recheckIndex += 1;
|
||||
|
||||
self.isProcessing = NO;
|
||||
|
||||
[self.recheckTimer invalidate];
|
||||
[self retryCheckAllReceipt];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
// 内购成功并通知外部
|
||||
- (void)handleSuccessPurchase:(NSString *)tID order:(NSString *)orderID {
|
||||
if (self.successPurchase) {
|
||||
@kWeakify(self);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@kStrongify(self);
|
||||
self.successPurchase();
|
||||
self.successPurchase(tID, orderID);
|
||||
});
|
||||
}
|
||||
|
||||
if (self.successRecheck) {
|
||||
@kWeakify(self);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@kStrongify(self);
|
||||
self.successRecheck();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 内购失败并通知外部
|
||||
- (void)handleFailurePurchase:(NSString *)errorMsg {
|
||||
if (self.failurePurchase) {
|
||||
@kWeakify(self);
|
||||
@@ -72,6 +158,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 获取客服内容
|
||||
- (void)handleContactCS {
|
||||
@kWeakify(self);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@@ -94,10 +181,23 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 获取客服 UID
|
||||
- (void)loadCSUid {
|
||||
if (self.contactCustomerService) {
|
||||
[Api requestContactCustomerServiceCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSString *uid = [NSString stringWithFormat:@"%@",data.data];
|
||||
self.contactCustomerService(uid);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
// 监听内购流程状态
|
||||
- (void)handleIAPState {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
@kWeakify(self);
|
||||
[[PIIAPRegulate shared] setConditionBlock:^(enum StoreConditionResult state, NSDictionary<NSString *,id> * _Nullable param) {
|
||||
[[PIIAPRegulate shared] setConditionBlock:^(enum StoreConditionResult state, NSDictionary<NSString *,NSString *> * _Nullable param) {
|
||||
@kStrongify(self);
|
||||
switch (state) {
|
||||
case StoreConditionResultStart:
|
||||
@@ -135,10 +235,13 @@
|
||||
}
|
||||
|
||||
// 生成后端订单
|
||||
- (void)requestAPPOrderData:(NSString *)productId {
|
||||
- (void)requestAPPOrderData:(NSString *)productId isFroRecheck:(BOOL)isFroRecheck {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
@kWeakify(self);
|
||||
[Api requestIAPRecharge:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (isFroRecheck) {
|
||||
return;
|
||||
}
|
||||
@kStrongify(self);
|
||||
if (code == 200) {
|
||||
NSString *orderId = (NSString *)data.data[@"recordId"];
|
||||
@@ -164,28 +267,16 @@
|
||||
}
|
||||
|
||||
|
||||
// 获取客服 UID
|
||||
- (void)loadCSUid {
|
||||
if (self.contactCustomerService) {
|
||||
[Api requestContactCustomerServiceCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSString *uid = [NSString stringWithFormat:@"%@",data.data];
|
||||
self.contactCustomerService(uid);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
// 开始进行内购,查询线上是否有对应 productID 的物品,如果有,会自动拉起付费弹窗(PIIAPRegulate - purchase)
|
||||
// 获取后端订单后,查询线上是否有对应 productID 的物品,如果有,会自动拉起付费弹窗(PIIAPRegulate - purchase)
|
||||
- (void)requestIAPOrder:(NSString *)orderID productID:(NSString *)productID uuid:(NSString *)uuid {
|
||||
self.orderID = orderID;
|
||||
|
||||
if (@available(iOS 15.0, *)) {
|
||||
@kWeakify(self);
|
||||
// @kWeakify(self);
|
||||
[[PIIAPRegulate shared] demandCommodityThingWithProductId:productID
|
||||
uuid:uuid
|
||||
completionHandler:^(NSError * _Nullable error) {
|
||||
@kStrongify(self);
|
||||
// @kStrongify(self);
|
||||
if (error) {
|
||||
// 已在 ConditionBlock 中回调
|
||||
}
|
||||
@@ -195,14 +286,17 @@
|
||||
|
||||
// 处理内购付款成功
|
||||
- (void)handleIAPSuccess:(NSDictionary *)param {
|
||||
self.transactionID = [param objectForKey:@"transactionId"];
|
||||
id tid = param[@"transactionId"];
|
||||
self.transactionID = tid;
|
||||
|
||||
if (self.transactionID.length == 0) {
|
||||
[self handleFailurePurchase:YMLocalizedString(@"XPIAPRechargeViewController1")];
|
||||
return;
|
||||
}
|
||||
|
||||
[self saveTransactionID];
|
||||
[self checkReceiptWithTransactionID];
|
||||
[self checkReceiptWithTransactionID:self.transactionID
|
||||
orderID:self.orderID];
|
||||
}
|
||||
|
||||
// 内购付款成功后保存收据 id 到钥匙串
|
||||
@@ -225,62 +319,121 @@
|
||||
}
|
||||
|
||||
// 保存数据到 RechargeStorage
|
||||
[RechargeStorage saveTranscationId:self.transactionID
|
||||
recipt:[receiptInfo toJSONString]
|
||||
uid:[AccountInfoStorage instance].getUid];
|
||||
@synchronized (self.transactionID) {
|
||||
[RechargeStorage saveTransactionId:self.transactionID
|
||||
receipt:[receiptInfo toJSONString]
|
||||
uid:[AccountInfoStorage instance].getUid];
|
||||
}
|
||||
|
||||
NSLog(@" ------------.------------ 保存账单内容:%@ ", receiptInfo);
|
||||
}
|
||||
|
||||
// 通过苹果收据与后端订单进行验单与发货
|
||||
// MARK: 必须等待结果
|
||||
- (void)checkReceiptWithTransactionID {
|
||||
- (void)checkReceiptWithTransactionID:(NSString *)tID
|
||||
orderID:(NSString *)orderID {
|
||||
|
||||
NSLog(@" ------------.------------ 后端验单:%@ | %@", tID, orderID);
|
||||
|
||||
@kWeakify(self);
|
||||
[Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if (code == 200) {
|
||||
[self handleSuccessPurchase];
|
||||
[self handleCheckReceiptSuccess];
|
||||
[self handleSuccessPurchase:tID order:orderID];
|
||||
[self handleCheckReceiptSuccess:tID isFromRecheck:NO];
|
||||
} else {
|
||||
// TODO: 重试逻辑
|
||||
[self handleFailurePurchase:msg];
|
||||
if (code == 1444) {
|
||||
// 参数异常
|
||||
// 参数异常,暂不处理
|
||||
}
|
||||
}
|
||||
NSLog(@" ------------.------------ 后端验单结果:%@ ",msg);
|
||||
}
|
||||
chooseEnv:@"true"
|
||||
chargeRecordId:self.orderID
|
||||
transcationId:self.transactionID
|
||||
chargeRecordId:orderID
|
||||
transcationId:tID
|
||||
uid:[AccountInfoStorage instance].getUid
|
||||
ticket:[AccountInfoStorage instance].getTicket];
|
||||
}
|
||||
|
||||
// 查找在缓存中的 transactionID 并处理
|
||||
- (void)handleCheckReceiptSuccess {
|
||||
// 通过苹果收据与后端订单进行验单与发货,此方法是对本地未删除的订单进行检测
|
||||
- (void)backgroundCheckReceiptWithTransactionID:(NSString *)tID
|
||||
orderID:(NSString *)orderID
|
||||
next:(void(^)(BOOL isSuccess))next {
|
||||
|
||||
NSLog(@" ------------.------------ 尝试后端验单:%@ | %@", tID, orderID);
|
||||
|
||||
if (tID.length == 0 || orderID.length == 0) {
|
||||
// 本地数据异常,不重试
|
||||
[self handleCheckReceiptSuccess:tID isFromRecheck:YES];
|
||||
next(NO);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@kWeakify(self);
|
||||
[Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
if (code == 200) {
|
||||
[self handleCheckReceiptSuccess:tID isFromRecheck:YES];
|
||||
} else if (code == 1701) {
|
||||
// 交易已完成,無需重複請求
|
||||
[self handleCheckReceiptSuccess:tID isFromRecheck:YES];
|
||||
}
|
||||
|
||||
NSLog(@" ------------.------------ 尝试后端验单结果:%ld, %@ ", (long)code, msg);
|
||||
|
||||
if (next) {
|
||||
next(code == 200 || code == 1701);
|
||||
}
|
||||
}
|
||||
chooseEnv:@"true"
|
||||
chargeRecordId:orderID
|
||||
transcationId:tID
|
||||
uid:[AccountInfoStorage instance].getUid
|
||||
ticket:[AccountInfoStorage instance].getTicket];
|
||||
}
|
||||
|
||||
// 查找在缓存中的 transactionID 并告知 apple 订单已完成
|
||||
- (void)handleCheckReceiptSuccess:(NSString *)tID
|
||||
isFromRecheck:(BOOL)isFromRecheck {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
@kWeakify(self);
|
||||
[[PIIAPRegulate shared] verifyBusinessAccomplishWithTransactionID:self.transactionID
|
||||
[[PIIAPRegulate shared] verifyBusinessAccomplishWithTransactionID:tID
|
||||
completionHandler:^(BOOL success, NSError * _Nullable error) {
|
||||
@kStrongify(self);
|
||||
if (success) {
|
||||
// 移除全部缓存
|
||||
if ([RechargeStorage delegateTranscationId:self.transactionID
|
||||
uid:[AccountInfoStorage instance].getUid]) {
|
||||
self.orderID = @"";
|
||||
self.transactionID = @"";
|
||||
}
|
||||
NSLog(@" ------------.------------ apple 验单成功");
|
||||
// 流程完成,移除本地缓存账单
|
||||
[RechargeStorage delegateTransactionId:tID
|
||||
uid:[AccountInfoStorage instance].getUid];
|
||||
} else {
|
||||
// TODO: 补单
|
||||
// 出现异常
|
||||
NSLog(@" ------------.------------ apple 验单成功:%@ ",error);
|
||||
if (error == nil) {
|
||||
// 该订单在 appstore 已无法找到,不必再重试
|
||||
[RechargeStorage delegateTransactionId:tID
|
||||
uid:[AccountInfoStorage instance].getUid];
|
||||
} else {
|
||||
[self retryCheckAllReceipt];
|
||||
}
|
||||
}
|
||||
|
||||
if (!isFromRecheck) {
|
||||
// 正常购买情况,重置内存订单数据
|
||||
self.orderID = @"";
|
||||
self.transactionID = @"";
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)addValueIfNotNil:(id)value forKey:(NSString *)key toDictionary:(NSMutableDictionary *)dictionary {
|
||||
- (void)addValueIfNotNil:(id)value
|
||||
forKey:(NSString *)key
|
||||
toDictionary:(NSMutableDictionary *)dictionary {
|
||||
if (value != nil && key != nil) {
|
||||
dictionary[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - RETRY
|
||||
|
||||
@end
|
||||
|
@@ -34,9 +34,18 @@
|
||||
#import "ClientConfig.h"
|
||||
#import "Api+Main.h"
|
||||
#import "YuMi-swift.h"
|
||||
|
||||
#import "IAPManager.h"
|
||||
|
||||
#define kHeaderViewHeight 220.0/375.0*KScreenWidth
|
||||
|
||||
@interface XPIAPRechargeViewController ()<UICollectionViewDelegate, UICollectionViewDataSource,UICollectionViewDelegateFlowLayout, XPMineRechargeProtocol, XPMineRechargeNavViewDelegate,XPIAPRechargeHeadCellDelegate>
|
||||
@interface XPIAPRechargeViewController ()<
|
||||
UICollectionViewDelegate,
|
||||
UICollectionViewDataSource,
|
||||
UICollectionViewDelegateFlowLayout,
|
||||
XPMineRechargeProtocol,
|
||||
XPMineRechargeNavViewDelegate,
|
||||
XPIAPRechargeHeadCellDelegate>
|
||||
|
||||
@property (nonatomic, strong) UICollectionView *collectionView;
|
||||
/// 头部
|
||||
@@ -46,12 +55,9 @@
|
||||
///
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///同意
|
||||
|
||||
@property (nonatomic,strong) UILabel *agreeLabel;
|
||||
///充值协议
|
||||
@property (nonatomic,strong) UIButton *protcoloButton;
|
||||
|
||||
|
||||
/// 返回
|
||||
@property (nonatomic,strong) UIButton *backBtn;
|
||||
/// 标题
|
||||
@@ -62,11 +68,6 @@
|
||||
/// 选中下标
|
||||
@property (nonatomic, strong) NSIndexPath *selectedIndex;
|
||||
|
||||
/// 订单编号
|
||||
@property (nonatomic,copy) NSString *orderId;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPIAPRechargeViewController
|
||||
@@ -146,7 +147,15 @@
|
||||
[self getRechargeList];
|
||||
[self.presenter getBannerList];
|
||||
[self getUserWalletBalanceInfo];
|
||||
[self checkTransactionIds];
|
||||
|
||||
// @kWeakify(self);
|
||||
// [[IAPManager sharedManager] retryCheckAllReceipt:^{
|
||||
// @kStrongify(self);
|
||||
// [self getUserWalletBalanceInfo];
|
||||
// if(self.delegate && [self.delegate respondsToSelector:@selector(paySuccess)]){
|
||||
// [self.delegate paySuccess];
|
||||
// }
|
||||
// }];
|
||||
}
|
||||
|
||||
/// 返回
|
||||
@@ -166,19 +175,47 @@
|
||||
|
||||
/// 点击充值按钮
|
||||
- (void)rechargeBtnAction {
|
||||
self.rechargeBtn.userInteractionEnabled = NO;
|
||||
|
||||
if(self.selectedIndex == nil){
|
||||
[self showSuccessToast:YMLocalizedString(@"XPIAPRechargeViewController11")];
|
||||
return;
|
||||
}
|
||||
NSInteger index = self.selectedIndex.row;
|
||||
|
||||
NSInteger index = self.selectedIndex.row;
|
||||
if(index < self.dataSource.count){
|
||||
RechargeListModel *model = [self.dataSource xpSafeObjectAtIndex:index];
|
||||
if (model.chargeProdId) {
|
||||
[XNDJTDDLoadingTool showOnlyView:kWindow];
|
||||
[self.presenter requestIAPRechargeOrderWithChargeProdId:model.chargeProdId];
|
||||
[self showLoading];
|
||||
|
||||
@kWeakify(self);
|
||||
[[IAPManager sharedManager] purchase:model.chargeProdId
|
||||
success:^(NSString *transactionID, NSString *orderID) {
|
||||
@kStrongify(self);
|
||||
[self hideHUD];
|
||||
[self getUserWalletBalanceInfo];
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(paySuccess)]){
|
||||
[self.delegate paySuccess];
|
||||
}
|
||||
self.rechargeBtn.userInteractionEnabled = YES;
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
@kStrongify(self);
|
||||
[self hideHUD];
|
||||
if (error) {
|
||||
[self showErrorToast:error.domain];
|
||||
}
|
||||
self.rechargeBtn.userInteractionEnabled = YES;
|
||||
} contactCS:^(NSString * _Nonnull uid) {
|
||||
@kStrongify(self);
|
||||
[self hideHUD];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NIMSession * session = [NIMSession session:uid type:NIMSessionTypeP2P];
|
||||
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
|
||||
[self.navigationController pushViewController:sessionVC animated:YES];
|
||||
});
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)protcoloButtonAction:(UIButton *)sender {
|
||||
@@ -211,68 +248,10 @@
|
||||
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
///批量验证
|
||||
- (void)checkTransactionIds {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
|
||||
|
||||
// [self.presenter checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier];
|
||||
// NSMutableArray *list = [NSMutableArray array];
|
||||
// for (NSDictionary *transcationDic in array) {
|
||||
// NSString *transcationId = transcationDic[@"transcationId"];
|
||||
// if(transcationId){
|
||||
// [list addObject:transcationId];
|
||||
// }
|
||||
// }
|
||||
// if(list.count > 0){
|
||||
// if (@available(iOS 15.0, *)) {
|
||||
// PIIAPRegulate *iap = [PIIAPRegulate shared];
|
||||
// [iap allTransactionWithList:list completionHandler:^{
|
||||
//
|
||||
// }];
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
for (NSDictionary *transcation in array) {
|
||||
NSString *orderId = transcation[@"orderId"];
|
||||
NSString *transcationId = transcation[@"transcationId"];
|
||||
///二次验证
|
||||
[self.presenter checkReceiptWithOrderId:orderId transcationId:transcationId errorToast:NO];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///充值成功之后保存订单到钥匙串
|
||||
- (void)saveRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
|
||||
NSData *receipt = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
|
||||
NSString *encodeStr = [receipt base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
|
||||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
|
||||
if(transactionIdentifier != nil){
|
||||
[dictionary setObject:transactionIdentifier forKey:@"transcationId"];
|
||||
}
|
||||
if(encodeStr != nil){
|
||||
[dictionary setObject:encodeStr forKey:@"recipt"];
|
||||
}
|
||||
if(self.orderId != nil){
|
||||
[dictionary setObject:self.orderId forKey:@"orderId"];
|
||||
}
|
||||
if(dictionary.allKeys.count == 0)return;
|
||||
NSString *reciptJson = [dictionary toJSONString];
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
BOOL saveSuccess = [RechargeStorage saveTranscationId:transactionIdentifier recipt:reciptJson uid:uid];
|
||||
if (!saveSuccess) {
|
||||
#warning to do 保存失败 需要埋点
|
||||
}
|
||||
}
|
||||
|
||||
///删除本地保存的
|
||||
- (void)deleteRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
BOOL deleteSuccess = [RechargeStorage delegateTranscationId:transactionIdentifier uid:uid];
|
||||
if (deleteSuccess) {
|
||||
#warning to do 保存失败 需要埋点
|
||||
}
|
||||
- (void)requestRechargeListSucccess:(NSArray *)list {
|
||||
self.dataSource = list;
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - XPMineRechargeNavViewDelegate
|
||||
@@ -280,140 +259,15 @@
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - XPIAPHelperDelegate
|
||||
///当前充值的状态
|
||||
- (void)rechargeNewProcessStatus:(StoreConditionResult)status {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (status == StoreConditionResultPay ||
|
||||
status == StoreConditionResultStart ||
|
||||
status == StoreConditionResultVerifiedServer) {
|
||||
}else if (status == StoreConditionResultUnowned) {
|
||||
[XNDJTDDLoadingTool hideHUDInView:kWindow];
|
||||
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController1")];
|
||||
}else{
|
||||
[XNDJTDDLoadingTool hideHUDInView:kWindow];
|
||||
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController0")];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
///充值成功回调id
|
||||
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
|
||||
///保存唯一凭证
|
||||
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
|
||||
///二次验证
|
||||
[self.presenter checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier errorToast:YES];
|
||||
}
|
||||
#pragma mark - XPMineRechargeProtocol
|
||||
- (void)requestRechargeListSucccess:(NSArray *)list {
|
||||
self.dataSource = list;
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(nonnull NSString *)uuid{
|
||||
|
||||
if (orderId.length > 0) {
|
||||
|
||||
self.orderId = orderId;
|
||||
if (@available(iOS 15.0, *)) {
|
||||
|
||||
PIIAPRegulate *iap = [PIIAPRegulate shared];
|
||||
[iap demandCommodityThingWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
|
||||
|
||||
}];
|
||||
@kWeakify(self);
|
||||
iap.ConditionBlock = ^(enum StoreConditionResult state, NSDictionary<NSString *,id> * _Nullable result) {
|
||||
@kStrongify(self);
|
||||
|
||||
[self rechargeNewProcessStatus:state];
|
||||
switch (state) {
|
||||
case StoreConditionResultVerifiedServer:
|
||||
{
|
||||
NSString *transactionId = result[@"transactionId"];
|
||||
|
||||
[self rechargeSuccess:transactionId];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
[XNDJTDDLoadingTool hideHUDInView:kWindow];
|
||||
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController10")];
|
||||
}
|
||||
}else{
|
||||
[XNDJTDDLoadingTool hideHUDInView:kWindow];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)requestIAPRechargeOrderFailWithCode:(NSInteger)code {
|
||||
///获取订单失败
|
||||
[XNDJTDDLoadingTool hideHUDInView:kWindow];
|
||||
|
||||
if(code == 50000){
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc]init];
|
||||
config.title = YMLocalizedString(@"XPIAPRechargeViewController7");
|
||||
config.message = YMLocalizedString(@"XPIAPRechargeViewController8");
|
||||
TTAlertButtonConfig *confirmButtonConfig = [[TTAlertButtonConfig alloc]init];
|
||||
confirmButtonConfig.title = YMLocalizedString(@"XPIAPRechargeViewController9");
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x13E2F5),UIColorFromRGB(0x9DB4FF),UIColorFromRGB(0xCC67FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(200, 200)];
|
||||
confirmButtonConfig.backgroundColor = [UIColor colorWithPatternImage:image];
|
||||
confirmButtonConfig.cornerRadius = 38/2;
|
||||
config.confirmButtonConfig = confirmButtonConfig;
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
[self.presenter getContactCustomerService];
|
||||
} cancelHandler:^{
|
||||
}];
|
||||
}
|
||||
}
|
||||
- (void)getContactCustomerServiceSuccessWithUid:(NSString *)uid{
|
||||
[self hideHUD];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NIMSession * session = [NIMSession session:uid type:NIMSessionTypeP2P];
|
||||
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
|
||||
[self.navigationController pushViewController:sessionVC animated:YES];
|
||||
});
|
||||
|
||||
}
|
||||
///二次验证成功
|
||||
- (void)checkReceiptSuccess:(NSString *)transcationId {
|
||||
[XNDJTDDLoadingTool hideHUDInView:kWindow];
|
||||
if (@available(iOS 15.0, *)) {
|
||||
PIIAPRegulate *iap = [PIIAPRegulate shared];
|
||||
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||
|
||||
///刷新一下用户的💎
|
||||
[self getUserWalletBalanceInfo];
|
||||
self.orderId = nil;
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(paySuccess)]){
|
||||
[self.delegate paySuccess];
|
||||
}
|
||||
}
|
||||
-(void)checkReceiptFailWithCode:(NSInteger)code transcationId:(NSString *)transcationId{
|
||||
[XNDJTDDLoadingTool hideHUDInView:kWindow];
|
||||
if(code == 1444){
|
||||
if (@available(iOS 15.0, *)) {
|
||||
PIIAPRegulate *iap = [PIIAPRegulate shared];
|
||||
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||
}
|
||||
}
|
||||
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo {
|
||||
self.headerView.walletInfo = balanceInfo;
|
||||
}
|
||||
|
||||
- (void)checkTranscationIdsSuccess {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
[RechargeStorage delegateAllTranscationIdsWithUid:uid];
|
||||
}
|
||||
// MARK: 。。。没有用到?
|
||||
//- (void)checkTranscationIdsSuccess {
|
||||
// NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
// [RechargeStorage delegateAllTranscationIdsWithUid:uid];
|
||||
//}
|
||||
|
||||
#pragma mark - UICollectionViewDelegate
|
||||
|
||||
|
@@ -37,13 +37,6 @@
|
||||
// {"data":{"giftUrl":"https://image.pekolive.com/I Do.png","partitionId":2,"receiverAvatar":"https://img.molistar.xyz/default_avatar_molistar.png","roomUid":3238,"senderAvatar":"https://img.molistar.xyz/default_avatar_molistar.png"},"first":64,"second":643}
|
||||
- (void)setCpAttachment:(AttachmentModel *)cpAttachment {
|
||||
_cpAttachment = cpAttachment;
|
||||
#if DEBUG
|
||||
if (cpAttachment == nil) {
|
||||
AttachmentModel *m = [[AttachmentModel alloc] init];
|
||||
m.data = @{@"senderAvatar":@"https://img.molistar.xyz/default_avatar_molistar.png", @"receiverAvatar":@"https://img.molistar.xyz/default_avatar_molistar.png"};
|
||||
_cpAttachment = m;
|
||||
}
|
||||
#endif
|
||||
[self startPlay];
|
||||
}
|
||||
|
||||
@@ -56,13 +49,16 @@
|
||||
if (_cpVAPView) {
|
||||
@kWeakify(self);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@kStrongify(self);
|
||||
self.cpVAPView.hidden = YES;
|
||||
[self.cpVAPView stopHWDMP4];
|
||||
[self.cpVAPView removeFromSuperview];
|
||||
self.cpVAPView = nil;
|
||||
if (self.completeDisplay) {
|
||||
self.completeDisplay();
|
||||
}
|
||||
|
||||
@kStrongify(self);
|
||||
[self.cpVAPView removeFromSuperview];
|
||||
self.cpVAPView = nil;
|
||||
|
||||
[self removeFromSuperview];
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -71,6 +67,7 @@
|
||||
with:(AttachmentModel *)attachment
|
||||
complete:(void(^)(void))complete {
|
||||
CPBindingAnimation *cpBindingAnimation = [[CPBindingAnimation alloc] init];
|
||||
cpBindingAnimation.userInteractionEnabled = YES;
|
||||
cpBindingAnimation.cpAttachment = attachment;
|
||||
cpBindingAnimation.completeDisplay = complete;
|
||||
[superView addSubview:cpBindingAnimation];
|
||||
@@ -115,7 +112,7 @@
|
||||
}
|
||||
|
||||
- (void)viewDidStopPlayMP4:(NSInteger)lastFrameIndex view:(VAPView *)container {
|
||||
[self endPlay];
|
||||
// [self endPlay];
|
||||
}
|
||||
|
||||
- (void)viewDidFinishPlayMP4:(NSInteger)totalFrameCount view:(VAPView *)container {
|
||||
|
@@ -6,8 +6,10 @@
|
||||
//
|
||||
|
||||
#import "CPCard.h"
|
||||
#import <SVGA.h>
|
||||
//#import <SVGA.h>
|
||||
#import "RelationUserVO.h"
|
||||
#import "XPMineUserInfoViewController.h"
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
|
||||
@interface CPCard ()
|
||||
|
||||
@@ -16,9 +18,10 @@
|
||||
@property (nonatomic, strong) UIImageView *backgroundImage;
|
||||
@property (nonatomic, strong) UIButton *breakYourHeartButton;
|
||||
@property (nonatomic, strong) NetImageView *avatarView;
|
||||
@property (nonatomic, strong) SVGAImageView *headWearSvgaImageView;
|
||||
@property (nonatomic, strong) NetImageView *headWearImageView;
|
||||
@property (nonatomic, strong) NetImageView *avatarView_cp;
|
||||
@property (nonatomic, strong) SVGAImageView *headWearSvgaImageView_cp;
|
||||
@property (nonatomic, strong) NetImageView *headWearImageView_cp;
|
||||
@property (nonatomic, strong) UIButton *cpButton;
|
||||
@property (nonatomic, strong) UILabel *bottomLabel;
|
||||
@property (nonatomic, strong) UILabel *topLabel;
|
||||
@property (nonatomic, strong) NetImageView *bottomImageView;
|
||||
@@ -33,14 +36,6 @@
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
[self setupUI];
|
||||
|
||||
#if DEBUG
|
||||
self.topLabel.text = @"365 天";
|
||||
self.bottomLabel.text = @"Waiting for your love";
|
||||
self.bottomImageView.image = kImage(@"cp_relationship_lv_1");
|
||||
|
||||
[self.progressView setProgress:0.5 animated:NO];
|
||||
#endif
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -81,8 +76,8 @@
|
||||
make.leading.mas_equalTo(56);
|
||||
make.size.mas_equalTo(CGSizeMake(kGetScaleWidth(56), kGetScaleWidth(56)));
|
||||
}];
|
||||
[self addSubview:self.headWearSvgaImageView];
|
||||
[self.headWearSvgaImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
[self addSubview:self.headWearImageView];
|
||||
[self.headWearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.avatarView);
|
||||
make.size.mas_equalTo(CGSizeMake(kGetScaleWidth(85), kGetScaleWidth(85)));
|
||||
}];
|
||||
@@ -92,12 +87,17 @@
|
||||
make.center.mas_equalTo(avatar_placeholder);
|
||||
make.size.mas_equalTo(CGSizeMake(kGetScaleWidth(56), kGetScaleWidth(56)));
|
||||
}];
|
||||
[self addSubview:self.headWearSvgaImageView_cp];
|
||||
[self.headWearSvgaImageView_cp mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
[self addSubview:self.headWearImageView_cp];
|
||||
[self.headWearImageView_cp mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.avatarView_cp);
|
||||
make.size.mas_equalTo(CGSizeMake(kGetScaleWidth(85), kGetScaleWidth(85)));
|
||||
}];
|
||||
|
||||
[self addSubview:self.cpButton];
|
||||
[self.cpButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.headWearImageView_cp);
|
||||
}];
|
||||
|
||||
[self addSubview:self.topLabel];
|
||||
[self.topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
[self addSubview:self.progressView];
|
||||
[self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.headWearSvgaImageView.mas_bottom).offset(4);
|
||||
make.top.mas_equalTo(self.headWearImageView.mas_bottom).offset(4);
|
||||
make.leading.mas_equalTo(self.backgroundImage).offset(22);
|
||||
make.trailing.mas_equalTo(self.backgroundImage).offset(-22);
|
||||
make.height.mas_equalTo(4);
|
||||
@@ -173,12 +173,13 @@
|
||||
|
||||
NSString *imagePath = [NSString stringWithFormat:@"cp_relationship_lv_%ld", self.relationUser.cpLevel];
|
||||
self.bottomImageView.image = kImage(imagePath);
|
||||
[self playSVGA:self.relationUser.cpLevel];
|
||||
// [self playSVGA:self.relationUser.cpLevel];
|
||||
}
|
||||
|
||||
- (void)updateForUserPage:(RelationUserVO *)model {
|
||||
self.relationUser = model;
|
||||
|
||||
self.headWearImageView_cp.hidden = [model isEmptyRelation];
|
||||
if ([model isEmptyRelation]) {
|
||||
self.avatarView.imageUrl = self.usersAvatar;
|
||||
self.bottomLabel.hidden = NO;
|
||||
@@ -191,37 +192,37 @@
|
||||
|
||||
- (void)updateForCPList:(RelationUserVO *)model showBreakHeart:(BOOL)showBreakHeart {
|
||||
self.relationUser = model;
|
||||
|
||||
self.headWearImageView_cp.hidden = NO;
|
||||
self.breakYourHeartButton.hidden = !showBreakHeart;
|
||||
|
||||
[self.backgroundImage mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self).offset(-12);
|
||||
}];
|
||||
|
||||
self.progressView.progress = ((self.relationUser.endExp - self.relationUser.startExp) * 1.0) / (self.relationUser.currentExp * 1.0);
|
||||
self.progressView.progress = (self.relationUser.currentExp * 1.0) / ((self.relationUser.endExp - self.relationUser.startExp) * 1.0);
|
||||
self.progressUpgradeLabel.text = [NSString stringWithFormat:YMLocalizedString(@"UserDetail_CP_List_0"), [NSString formatNumberToKOrM:@(self.relationUser.endExp - self.relationUser.currentExp).stringValue]];
|
||||
self.progressNumLabel.text = [NSString stringWithFormat:@"(%@/%@)", [NSString formatNumberToKOrM:@(self.relationUser.currentExp).stringValue], [NSString formatNumberToKOrM:@(self.relationUser.endExp).stringValue]];
|
||||
}
|
||||
|
||||
- (void)playSVGA:(NSInteger)level {
|
||||
if (level == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@kWeakify(self);
|
||||
SVGAParser *parser = [SVGAParser new];
|
||||
[parser parseWithNamed:@(level).stringValue
|
||||
inBundle:[NSBundle mainBundle]
|
||||
completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||
@kStrongify(self);
|
||||
self.headWearSvgaImageView.videoItem = videoItem;
|
||||
[self.headWearSvgaImageView startAnimation];
|
||||
self.headWearSvgaImageView_cp.videoItem = videoItem;
|
||||
[self.headWearSvgaImageView_cp startAnimation];
|
||||
} failureBlock:^(NSError * _Nonnull error) {
|
||||
|
||||
}];
|
||||
}
|
||||
//- (void)playSVGA:(NSInteger)level {
|
||||
// if (level == 0) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// @kWeakify(self);
|
||||
// SVGAParser *parser = [SVGAParser new];
|
||||
// [parser parseWithNamed:@(level).stringValue
|
||||
// inBundle:[NSBundle mainBundle]
|
||||
// completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||
// @kStrongify(self);
|
||||
// self.headWearSvgaImageView.videoItem = videoItem;
|
||||
// [self.headWearSvgaImageView startAnimation];
|
||||
// self.headWearSvgaImageView_cp.videoItem = videoItem;
|
||||
// [self.headWearSvgaImageView_cp startAnimation];
|
||||
// } failureBlock:^(NSError * _Nonnull error) {
|
||||
//
|
||||
// }];
|
||||
//}
|
||||
|
||||
- (void)didTapBreakButton {
|
||||
if (self.breakTheHeart) {
|
||||
@@ -229,6 +230,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didTapCPAvatar {
|
||||
if (self.relationUser.cpUid > 0) {
|
||||
|
||||
}
|
||||
XPMineUserInfoViewController * infoVC = [[XPMineUserInfoViewController alloc] init];
|
||||
infoVC.uid = self.relationUser.cpUid;
|
||||
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:infoVC animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (NetImageView *)avatarView {
|
||||
if (!_avatarView) {
|
||||
@@ -251,6 +261,7 @@
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
_avatarView_cp = [[NetImageView alloc]initWithConfig:config];
|
||||
_avatarView_cp.hidden = YES;
|
||||
_avatarView_cp.layer.cornerRadius = kGetScaleWidth(56/2);
|
||||
_avatarView_cp.layer.masksToBounds = YES;
|
||||
_avatarView_cp.layer.borderWidth = 1;
|
||||
@@ -269,7 +280,7 @@
|
||||
|
||||
- (UILabel *)bottomLabel {
|
||||
if (!_bottomLabel) {
|
||||
_bottomLabel = [UILabel labelInitWithText:@"" font:kFontRegular(12) textColor:[UIColor colorWithWhite:1 alpha:0.8]];
|
||||
_bottomLabel = [UILabel labelInitWithText:YMLocalizedString(@"UserDetail_CP_List_1") font:kFontRegular(12) textColor:[UIColor colorWithWhite:1 alpha:0.8]];
|
||||
}
|
||||
return _bottomLabel;
|
||||
}
|
||||
@@ -284,6 +295,8 @@
|
||||
- (UILabel *)progressUpgradeLabel {
|
||||
if (!_progressUpgradeLabel) {
|
||||
_progressUpgradeLabel = [UILabel labelInitWithText:@"" font:kFontRegular(12) textColor:[UIColor whiteColor]];
|
||||
_progressUpgradeLabel.alpha = 0.8;
|
||||
_progressUpgradeLabel.hidden = YES;
|
||||
}
|
||||
return _progressUpgradeLabel;
|
||||
}
|
||||
@@ -291,6 +304,8 @@
|
||||
- (UILabel *)progressNumLabel {
|
||||
if (!_progressNumLabel) {
|
||||
_progressNumLabel = [UILabel labelInitWithText:@"" font:kFontRegular(12) textColor:[UIColor whiteColor]];
|
||||
_progressNumLabel.alpha = 0.8;
|
||||
_progressNumLabel.hidden = YES;
|
||||
}
|
||||
return _progressNumLabel;
|
||||
}
|
||||
@@ -298,6 +313,7 @@
|
||||
- (UIProgressView *)progressView {
|
||||
if (!_progressView) {
|
||||
_progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
|
||||
_progressView.hidden = YES;
|
||||
|
||||
// 设置背景色和前景色
|
||||
_progressView.progressTintColor = UIColorFromRGB(0xF77300);
|
||||
@@ -311,32 +327,34 @@
|
||||
return _progressView;
|
||||
}
|
||||
|
||||
- (SVGAImageView *)headWearSvgaImageView {
|
||||
if (!_headWearSvgaImageView) {
|
||||
_headWearSvgaImageView = [[SVGAImageView alloc]init];
|
||||
_headWearSvgaImageView.backgroundColor = [UIColor clearColor];
|
||||
_headWearSvgaImageView.frame = self.bounds;
|
||||
_headWearSvgaImageView.userInteractionEnabled = YES;
|
||||
_headWearSvgaImageView.autoPlay = YES;
|
||||
- (NetImageView *)headWearImageView {
|
||||
if (!_headWearImageView) {
|
||||
_headWearImageView = [[NetImageView alloc]init];
|
||||
_headWearImageView.backgroundColor = [UIColor clearColor];
|
||||
_headWearImageView.frame = self.bounds;
|
||||
_headWearImageView.userInteractionEnabled = YES;
|
||||
_headWearImageView.image = kImage(@"cp_avatar_card_head");
|
||||
}
|
||||
return _headWearSvgaImageView;
|
||||
return _headWearImageView;
|
||||
}
|
||||
|
||||
- (SVGAImageView *)headWearSvgaImageView_cp {
|
||||
if (!_headWearSvgaImageView_cp) {
|
||||
_headWearSvgaImageView_cp = [[SVGAImageView alloc]init];
|
||||
_headWearSvgaImageView_cp.backgroundColor = [UIColor clearColor];
|
||||
_headWearSvgaImageView_cp.frame = self.bounds;
|
||||
_headWearSvgaImageView_cp.userInteractionEnabled = YES;
|
||||
_headWearSvgaImageView_cp.autoPlay = YES;
|
||||
- (NetImageView *)headWearImageView_cp {
|
||||
if (!_headWearImageView_cp) {
|
||||
_headWearImageView_cp = [[NetImageView alloc] init];
|
||||
_headWearImageView_cp.backgroundColor = [UIColor clearColor];
|
||||
_headWearImageView_cp.frame = self.bounds;
|
||||
_headWearImageView_cp.userInteractionEnabled = YES;
|
||||
_headWearImageView_cp.image = kImage(@"cp_avatar_card_head");
|
||||
_headWearImageView_cp.hidden = YES;
|
||||
}
|
||||
return _headWearSvgaImageView_cp;
|
||||
return _headWearImageView_cp;
|
||||
}
|
||||
|
||||
|
||||
- (UIButton *)breakYourHeartButton {
|
||||
if (!_breakYourHeartButton) {
|
||||
_breakYourHeartButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_breakYourHeartButton.hidden = YES;
|
||||
[_breakYourHeartButton setImage:kImage(@"cp_break_heart") forState:UIControlStateNormal];
|
||||
[_breakYourHeartButton addTarget:self
|
||||
action:@selector(didTapBreakButton)
|
||||
@@ -344,4 +362,13 @@
|
||||
}
|
||||
return _breakYourHeartButton;
|
||||
}
|
||||
|
||||
- (UIButton *)cpButton {
|
||||
if (!_cpButton) {
|
||||
_cpButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_cpButton addTarget:self action:@selector(didTapCPAvatar) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _cpButton;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -107,30 +107,32 @@
|
||||
NSString *relationship = @"";
|
||||
switch (level) {
|
||||
case 1:
|
||||
relationship = @"Sweet Duo";
|
||||
relationship = YMLocalizedString(@"RoomEffect_CP_lv_0");
|
||||
break;
|
||||
case 2:
|
||||
relationship = @"Dynamic Duo";
|
||||
relationship = YMLocalizedString(@"RoomEffect_CP_lv_1");
|
||||
break;
|
||||
case 3:
|
||||
relationship = @"Ideal Duo";
|
||||
relationship = YMLocalizedString(@"RoomEffect_CP_lv_2");
|
||||
break;
|
||||
case 4:
|
||||
relationship = @"Ideal Duo";
|
||||
relationship = YMLocalizedString(@"RoomEffect_CP_lv_3");
|
||||
break;
|
||||
case 5:
|
||||
relationship = @"Perfect Duo";
|
||||
relationship = YMLocalizedString(@"RoomEffect_CP_lv_4");
|
||||
break;
|
||||
case 6:
|
||||
relationship = @"Divine Couple";
|
||||
relationship = YMLocalizedString(@"RoomEffect_CP_lv_5");
|
||||
break;
|
||||
default:
|
||||
relationship = @"Cosmic Soulmates";
|
||||
relationship = YMLocalizedString(@"RoomEffect_CP_lv_0");
|
||||
break;
|
||||
}
|
||||
|
||||
// 构造文本内容
|
||||
NSString *fullText = [NSString stringWithFormat:@"%@ %@ %@ %@ %@", name_1, YMLocalizedString(@"RoomEffect_CP_0"), name_2, YMLocalizedString(@"RoomEffect_CP_1"), relationship];
|
||||
NSString *cuttingName_1 = name_1.length <= 10 ? name_1 : [name_1 substringToIndex:10];
|
||||
NSString *cuttingName_2 = name_2.length <= 10 ? name_2 : [name_2 substringToIndex:10];
|
||||
NSString *fullText = [NSString stringWithFormat:@"%@ %@ %@ %@ %@", cuttingName_1, YMLocalizedString(@"RoomEffect_CP_0"), cuttingName_2, YMLocalizedString(@"RoomEffect_CP_1"), relationship];
|
||||
|
||||
// 创建可变的 attributed string
|
||||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:fullText];
|
||||
@@ -165,7 +167,7 @@
|
||||
|
||||
- (void)startTimer {
|
||||
@kWeakify(self);
|
||||
self.endPlayTimer = [NSTimer scheduledTimerWithTimeInterval:30 repeats:NO block:^(NSTimer * _Nonnull timer) {
|
||||
self.endPlayTimer = [NSTimer scheduledTimerWithTimeInterval:5 repeats:NO block:^(NSTimer * _Nonnull timer) {
|
||||
@kStrongify(self);
|
||||
[self removeFromSuperview];
|
||||
[self.backgroundSvga stopAnimation];
|
||||
|
@@ -122,6 +122,7 @@ return view;\
|
||||
@property (nonatomic, strong) UILabel *followersNum;
|
||||
|
||||
@property (nonatomic, strong) CPCard *cpCard;
|
||||
@property (nonatomic, strong) UIButton *cpListButton;
|
||||
|
||||
@end
|
||||
|
||||
@@ -159,7 +160,7 @@ return view;\
|
||||
numberOfLines = ceil(textRect.size.height / lineHeight);
|
||||
}
|
||||
|
||||
height = kGetScaleWidth(520) + lineHeight * numberOfLines;
|
||||
height = kGetScaleWidth(530) + lineHeight * numberOfLines;
|
||||
|
||||
return height;
|
||||
}
|
||||
@@ -459,6 +460,7 @@ return view;\
|
||||
}];
|
||||
|
||||
UIButton *cpListButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
cpListButton.hidden = YES;
|
||||
[cpListButton setImage:kImage(@"cp_menu") forState:UIControlStateNormal];
|
||||
[cpListButton addTarget:self action:@selector(clickCPListButton) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.userInfoView addSubview:cpListButton];
|
||||
@@ -467,6 +469,7 @@ return view;\
|
||||
make.trailing.mas_equalTo(kGetScaleWidth(-15));
|
||||
make.width.height.mas_equalTo(22);
|
||||
}];
|
||||
self.cpListButton = cpListButton;
|
||||
|
||||
[self.userInfoView addSubview:self.cpCard];
|
||||
[self.cpCard mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -563,6 +566,8 @@ return view;\
|
||||
[self updateRelationShipInfo];
|
||||
[self updateHeadwearInfo];
|
||||
|
||||
self.cpListButton.hidden = (userInfo.uid != [AccountInfoStorage instance].getUid.integerValue);
|
||||
|
||||
self.officialImageView.hidden = userInfo.defUser != UserLevelType_Offical;
|
||||
self.newUserImageView.hidden = !userInfo.newUser;
|
||||
|
||||
@@ -929,7 +934,7 @@ return view;\
|
||||
_onlineButton.hidden = YES;
|
||||
|
||||
_onlineButton.imageEdgeInsets = UIEdgeInsetsMake(0, 40, 0, 0);
|
||||
_onlineButton.titleEdgeInsets = UIEdgeInsetsMake(0, 24, 0, 0);
|
||||
_onlineButton.titleEdgeInsets = UIEdgeInsetsMake(0, 34, 0, 0);
|
||||
}
|
||||
return _onlineButton;
|
||||
}
|
||||
|
@@ -103,7 +103,7 @@
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
XPMomentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"XPMomentsDynamicTableViewCell" forIndexPath:indexPath];
|
||||
MomentsInfoModel * monentsInfo = [self.datasource xpSafeObjectAtIndex:indexPath.row];
|
||||
MomentsInfoModel *monentsInfo = [self.datasource xpSafeObjectAtIndex:indexPath.row];
|
||||
cell.delegate = self;
|
||||
cell.isInUserDetail = YES;
|
||||
cell.mineMomentsInfo = monentsInfo;
|
||||
|
@@ -61,6 +61,12 @@
|
||||
if (isInUserDetail) {
|
||||
self.likeLabel.textColor = [UIColor whiteColor];
|
||||
self.commentLabel.textColor = [UIColor whiteColor];
|
||||
[self.reportButton setImage:[UIImage imageNamed:@"monents_info_like_report_new"] forState:UIControlStateNormal];
|
||||
[self.reportButton setImage:[UIImage imageNamed:@"monents_info_like_report_new"] forState:UIControlStateSelected];
|
||||
[self.commentButton setImage:[UIImage imageNamed:@"monents_info_comment_count_new"] forState:UIControlStateNormal];
|
||||
[self.commentButton setImage:[UIImage imageNamed:@"monents_info_comment_count_new"] forState:UIControlStateSelected];
|
||||
[self.likeButton setImage:[UIImage imageNamed:@"monents_info_like_count_normal_new"] forState:UIControlStateNormal];
|
||||
[self.likeButton setImage:[UIImage imageNamed:@"monents_info_like_count_select_new"] forState:UIControlStateSelected];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -50,7 +50,7 @@
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
- (__kindof id)createPresenter {
|
||||
return [[XPMonentDetailPresenter alloc] init];
|
||||
return [[XPMonentDetailPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
|
@@ -304,9 +304,12 @@
|
||||
NSString* roomUid = [[AccountInfoStorage instance] getUid];
|
||||
// [XPRoomViewController openRoom:roomUid viewController:self];
|
||||
|
||||
[self showLoading];
|
||||
|
||||
@kWeakify(self);
|
||||
[Api getRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
@kStrongify(self);
|
||||
[self hideHUD];
|
||||
if (code == 200) {
|
||||
RoomInfoModel * roomInfo = [RoomInfoModel modelWithJSON:data.data];
|
||||
if (roomInfo.isReselect) {
|
||||
|
@@ -52,7 +52,7 @@
|
||||
[self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.bgView);
|
||||
make.leading.mas_equalTo(self.iconImageView.mas_trailing).offset(3);
|
||||
make.trailing.mas_equalTo(-4);
|
||||
make.trailing.mas_equalTo(-9);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ BOOL isNumeric(NSString *string) {
|
||||
- (UIView *)bgView {
|
||||
if (_bgView == nil) {
|
||||
_bgView = [[UIView alloc] init];
|
||||
_bgView.backgroundColor = UIColorRGBAlpha(0xFFFFFF, 0.4);
|
||||
_bgView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
|
||||
_bgView.layer.cornerRadius = 27/2;
|
||||
_bgView.layer.masksToBounds = YES;
|
||||
}
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#import "Api+Mine.h"
|
||||
#import "Api+Main.h"
|
||||
|
||||
#import "RechargeStorage.h"
|
||||
///Model
|
||||
#import "FirstRechargeModel.h"
|
||||
///View
|
||||
@@ -39,6 +38,9 @@
|
||||
#import "XPSkillCardPlayerManager.h"
|
||||
#import "YuMi-swift.h"
|
||||
#import "ClientConfig.h"
|
||||
|
||||
#import "IAPManager.h"
|
||||
|
||||
@interface XPFirstRechargeView ()<UICollectionViewDelegate, UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
|
||||
///
|
||||
@property (nonatomic,strong) UIButton *backBtn;
|
||||
@@ -113,9 +115,6 @@
|
||||
}
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
||||
} channelType:@"3"];
|
||||
[self checkTranscationIds];
|
||||
|
||||
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
@@ -277,225 +276,35 @@
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark - 充值
|
||||
/// 获取充值的订单编号
|
||||
/// @param chargeProdId 苹果服务器的充值 的id
|
||||
- (void)requestIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId {
|
||||
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
NSString * deviceInfo = [YYUtility deviceID];
|
||||
NSString * clientIp= [YYUtility ipAddress];
|
||||
[Api requestIAPRecharge:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSString *orderId = (NSString *)data.data[@"recordId"];
|
||||
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
|
||||
[self requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
|
||||
} else {
|
||||
[XNDJTDDLoadingTool hideOnlyView:kWindow];
|
||||
if(code == 50000){
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(contactCustomerService)]){
|
||||
[self.delegate contactCustomerService];
|
||||
}
|
||||
[self backAction];
|
||||
return;
|
||||
}
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
||||
}
|
||||
} chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
||||
}
|
||||
|
||||
|
||||
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid{
|
||||
if (orderId.length > 0) {
|
||||
self.orderId = orderId;
|
||||
|
||||
if (@available(iOS 15.0, *)) {
|
||||
|
||||
PIIAPRegulate *iap = [PIIAPRegulate shared];
|
||||
[iap demandCommodityThingWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
|
||||
|
||||
}];
|
||||
@kWeakify(self);
|
||||
iap.ConditionBlock = ^(enum StoreConditionResult state, NSDictionary<NSString *,id> * _Nullable result) {
|
||||
@kStrongify(self);
|
||||
|
||||
[self rechargeNewProcessStatus:state];
|
||||
switch (state) {
|
||||
case StoreConditionResultVerifiedServer:
|
||||
{
|
||||
NSString *transactionId = result[@"transactionId"];
|
||||
|
||||
[self rechargeSuccess:transactionId];
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
} else {
|
||||
[XNDJTDDLoadingTool hideOnlyView:kWindow];
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController10")];
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
[XNDJTDDLoadingTool hideOnlyView:kWindow];
|
||||
}
|
||||
}
|
||||
#pragma mark - XPIAPHelperDelegate
|
||||
|
||||
///当前充值的状态
|
||||
- (void)rechargeNewProcessStatus:(StoreConditionResult)status {
|
||||
|
||||
|
||||
if (status == StoreConditionResultPay || status == StoreConditionResultStart || status == StoreConditionResultVerifiedServer) {
|
||||
|
||||
}else if (status == StoreConditionResultUnowned) {
|
||||
[XNDJTDDLoadingTool hideOnlyView:kWindow];
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController1")];
|
||||
}else{
|
||||
[XNDJTDDLoadingTool hideOnlyView:kWindow];
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController0")];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///充值成功回调id
|
||||
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
|
||||
///保存唯一凭证
|
||||
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
|
||||
///二次验证
|
||||
[self checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier errorToast:YES];
|
||||
}
|
||||
|
||||
///充值成功之后保存订单到钥匙串
|
||||
- (void)saveRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
|
||||
NSData *receipt = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
|
||||
NSString *encodeStr = [receipt base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
|
||||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
|
||||
if(transactionIdentifier != nil){
|
||||
[dictionary setObject:transactionIdentifier forKey:@"transcationId"];
|
||||
}
|
||||
if(encodeStr != nil){
|
||||
[dictionary setObject:encodeStr forKey:@"recipt"];
|
||||
}
|
||||
if(self.orderId != nil){
|
||||
[dictionary setObject:self.orderId forKey:@"orderId"];
|
||||
}
|
||||
if(dictionary.allKeys.count == 0)return;
|
||||
NSString *reciptJson = [dictionary toJSONString];
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
BOOL saveSuccess = [RechargeStorage saveTranscationId:transactionIdentifier recipt:reciptJson uid:uid];
|
||||
if (!saveSuccess) {
|
||||
#warning to do 保存失败 需要埋点
|
||||
}
|
||||
}
|
||||
|
||||
///删除本地保存的
|
||||
- (void)deleteRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
BOOL deleteSuccess = [RechargeStorage delegateTranscationId:transactionIdentifier uid:uid];
|
||||
if (deleteSuccess) {
|
||||
#warning to do 保存失败 需要埋点
|
||||
}
|
||||
}
|
||||
///批量验证
|
||||
- (void)checkTranscationIds {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
|
||||
|
||||
// [self.presenter checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier];
|
||||
// NSMutableArray *list = [NSMutableArray array];
|
||||
// for (NSDictionary *transcationDic in array) {
|
||||
// NSString *transcationId = transcationDic[@"transcationId"];
|
||||
// if(transcationId){
|
||||
// [list addObject:transcationId];
|
||||
// }
|
||||
// }
|
||||
// if(list.count > 0){
|
||||
// if (@available(iOS 15.0, *)) {
|
||||
// PIIAPRegulate *iap = [PIIAPRegulate shared];
|
||||
// [iap allTransactionWithList:list completionHandler:^{
|
||||
//
|
||||
// }];
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
for (NSDictionary *transcation in array) {
|
||||
NSString *orderId = transcation[@"orderId"];
|
||||
NSString *transcationId = transcation[@"transcationId"];
|
||||
///二次验证
|
||||
[self checkReceiptWithOrderId:orderId transcationId:transcationId errorToast:NO] ;
|
||||
}
|
||||
|
||||
}
|
||||
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast{
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
|
||||
[Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
[XNDJTDDLoadingTool hideOnlyView:kWindow];
|
||||
if (code == 200) {
|
||||
[self checkReceiptSuccess:transcationId];
|
||||
} else {
|
||||
if(code == 1444){
|
||||
if (@available(iOS 15.0, *)) {
|
||||
PIIAPRegulate *iap = [PIIAPRegulate shared];
|
||||
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||
}
|
||||
if(errorToast == YES){
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
||||
}
|
||||
|
||||
}
|
||||
} chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
||||
|
||||
}
|
||||
|
||||
///二次验证成功
|
||||
- (void)checkReceiptSuccess:(NSString *)transcationId {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
PIIAPRegulate *iap = [PIIAPRegulate shared];
|
||||
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||
self.orderId = nil;
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
|
||||
|
||||
- (void)rewardHelpButtonAction:(UIButton *)sender {
|
||||
sender.selected = !sender.selected;
|
||||
self.descripBgView.hidden = !sender.selected;
|
||||
}
|
||||
|
||||
- (void)rechargeButtonAction {
|
||||
|
||||
|
||||
|
||||
if (self.currentInfo == nil|| self.currentInfo.chargeProdId == nil) {
|
||||
return;
|
||||
}
|
||||
FirstRechargeModel *model = self.currentInfo;
|
||||
if (model.chargeProdId) {
|
||||
[XNDJTDDLoadingTool showOnlyView:kWindow];
|
||||
[self requestIAPRechargeOrderWithChargeProdId:model.chargeProdId];
|
||||
@kWeakify(self);
|
||||
[[IAPManager sharedManager] purchase:model.chargeProdId
|
||||
success:^(NSString *transactionID, NSString *orderID){
|
||||
[XNDJTDDLoadingTool hideOnlyView:kWindow];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
[XNDJTDDLoadingTool hideOnlyView:kWindow];
|
||||
} contactCS:^(NSString * _Nonnull uid) {
|
||||
@kStrongify(self);
|
||||
[XNDJTDDLoadingTool hideOnlyView:kWindow];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(contactCustomerService)]){
|
||||
[self.delegate contactCustomerService];
|
||||
}
|
||||
[self backAction];
|
||||
});
|
||||
}];
|
||||
}
|
||||
}
|
||||
-(void)backAction{
|
||||
|
@@ -54,8 +54,6 @@
|
||||
@property (nonatomic,strong) UIButton *pkButton;
|
||||
///礼物
|
||||
@property (nonatomic,strong) UIButton *giftButton;
|
||||
@property (nonatomic, strong) SVGAImageView *svgDisplayView;
|
||||
@property (strong, nonatomic) SVGAParser *parser;
|
||||
///排麦
|
||||
@property (nonatomic,strong) UIButton *arrangeMicButton;
|
||||
|
||||
@@ -250,28 +248,15 @@
|
||||
[self.stackView addArrangedSubview:self.arrangeMicButton];
|
||||
[self.stackView addArrangedSubview:self.messageButton];
|
||||
[self.stackView addArrangedSubview:self.moreButton];
|
||||
[self.stackView addArrangedSubview:self.svgDisplayView];
|
||||
[self.stackView addArrangedSubview:self.giftButton];
|
||||
|
||||
[self.stackView addSubview:self.faceButton];
|
||||
[self.stackView addSubview:self.giftButton];
|
||||
|
||||
@kWeakify(self);
|
||||
[self.parser parseWithNamed:@"ms_room_gift_svga_icon" inBundle:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||
@kStrongify(self);
|
||||
self.svgDisplayView.loops = INT_MAX;
|
||||
self.svgDisplayView.clearsAfterStop = NO;
|
||||
self.svgDisplayView.videoItem = videoItem;
|
||||
[self.svgDisplayView startAnimation];
|
||||
} failureBlock:^(NSError * _Nullable error) {
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
|
||||
[self.inputButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.top.mas_equalTo(16);
|
||||
make.size.mas_equalTo(CGSizeMake(110, 36));
|
||||
// make.leading.mas_equalTo(16);
|
||||
}];
|
||||
|
||||
[self.faceButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -293,13 +278,8 @@
|
||||
make.width.height.mas_equalTo(36);
|
||||
}];
|
||||
|
||||
[self.svgDisplayView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.centerY.mas_equalTo(self.scrollView);
|
||||
make.size.mas_equalTo(CGSizeMake(46, 46));
|
||||
// make.trailing.mas_equalTo(self).offset(-15);
|
||||
}];
|
||||
[self.giftButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.svgDisplayView);
|
||||
make.size.mas_equalTo(CGSizeMake(46, 46));
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -397,9 +377,6 @@
|
||||
- (void)onRoomUpdate {
|
||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||
|
||||
[self.giftButton setImage:[UIImage imageNamed:@"room_menu_gift"] forState:UIControlStateNormal];
|
||||
[self.giftButton setImage:[UIImage imageNamed:@"room_menu_gift"] forState:UIControlStateSelected];
|
||||
|
||||
// MARK: 房主 or 超管可以看到按钮
|
||||
self.baiShunGameButton.hidden = YES;
|
||||
self.pkButton.hidden = YES;
|
||||
@@ -629,26 +606,12 @@
|
||||
- (UIButton *)giftButton {
|
||||
if (!_giftButton) {
|
||||
_giftButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_giftButton setImage:kImage(@"big_gift_button") forState:UIControlStateNormal];
|
||||
_giftButton.tag = XPRoomMenuItemType_Gift;
|
||||
[_giftButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _giftButton;
|
||||
}
|
||||
- (SVGAImageView *)svgDisplayView {
|
||||
if (!_svgDisplayView) {
|
||||
_svgDisplayView = [[SVGAImageView alloc] init];
|
||||
_svgDisplayView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
_svgDisplayView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _svgDisplayView;
|
||||
}
|
||||
|
||||
- (SVGAParser *)parser {
|
||||
if (!_parser) {
|
||||
_parser = [[SVGAParser alloc]init];
|
||||
}
|
||||
return _parser;
|
||||
}
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
|
@@ -25,6 +25,8 @@ typedef NS_ENUM(NSUInteger, GiftType) {
|
||||
GiftType_super = 16, //幸运礼物
|
||||
GiftType_Country = 17, //国家礼物
|
||||
GiftType_Lucky24 = 18, //幸运24
|
||||
GiftType_CP = 19, // CP
|
||||
GiftType_Custom = 20, // 定制
|
||||
};
|
||||
|
||||
//礼物类型
|
||||
|
@@ -30,7 +30,12 @@ MJCodingImplementation
|
||||
return GiftType_WeekStar;
|
||||
} else if ([self.key isEqualToString:@"singlePopularGift"]) {
|
||||
return GiftType_Anchor;
|
||||
} else if ([self.key isEqualToString:@"customGift"]) {
|
||||
return GiftType_Custom;
|
||||
} else if ([self.key isEqualToString:@"cpGift"]) {
|
||||
return GiftType_CP;
|
||||
}
|
||||
|
||||
return GiftType_Game;
|
||||
}
|
||||
|
||||
|
@@ -47,6 +47,12 @@
|
||||
@property (nonatomic,strong)XPGiftInfoView *superLuckyVC;
|
||||
///国家
|
||||
@property (nonatomic,strong)XPGiftInfoView *countryVC;
|
||||
/// 幸运 24
|
||||
@property (nonatomic,strong)XPGiftInfoView *lucky24VC;
|
||||
/// cp
|
||||
@property (nonatomic,strong)XPGiftInfoView *cpVC;
|
||||
/// 定制
|
||||
@property (nonatomic,strong)XPGiftInfoView *customVC;
|
||||
|
||||
@property (nonatomic, strong) UIActivityIndicatorView *loadingView;
|
||||
|
||||
@@ -197,6 +203,14 @@
|
||||
return self.countryVC;
|
||||
}
|
||||
break;
|
||||
case GiftType_CP:{
|
||||
return self.cpVC;
|
||||
}
|
||||
break;
|
||||
case GiftType_Custom:{
|
||||
return self.customVC;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return self.normalVC;
|
||||
@@ -222,6 +236,10 @@
|
||||
return i;
|
||||
} else if (tabGiftType == GiftType_Anchor && self.segmentType == GiftSegmentType_Anchor) {
|
||||
return i;
|
||||
} else if (tabGiftType == GiftType_CP && self.segmentType == GiftSegmentType_CP) {
|
||||
return i;
|
||||
} else if (tabGiftType == GiftType_Custom && self.segmentType == GiftSegmentType_Custom) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +329,7 @@
|
||||
[self.titleView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.leading.equalTo(self);
|
||||
make.height.mas_equalTo(34);
|
||||
if (tempTitles.count<5) {
|
||||
if (tempTitles.count<5 && isMSZH()) {
|
||||
make.width.mas_equalTo(kGetScaleWidth(200));
|
||||
} else {
|
||||
make.trailing.equalTo(self.packGiftButton.mas_leading).offset(-16);
|
||||
@@ -511,4 +529,20 @@
|
||||
}
|
||||
return _countryVC;
|
||||
}
|
||||
-(XPGiftInfoView *)cpVC{
|
||||
if(!_cpVC){
|
||||
_cpVC = [[XPGiftInfoView alloc]init];
|
||||
_cpVC.delegate = self;
|
||||
_cpVC.segmentType = GiftSegmentType_CP;
|
||||
}
|
||||
return _cpVC;
|
||||
}
|
||||
-(XPGiftInfoView *)customVC{
|
||||
if(!_customVC){
|
||||
_customVC = [[XPGiftInfoView alloc]init];
|
||||
_customVC.delegate = self;
|
||||
_customVC.segmentType = GiftSegmentType_Custom;
|
||||
}
|
||||
return _customVC;
|
||||
}
|
||||
@end
|
||||
|
@@ -439,6 +439,9 @@
|
||||
_countLabel.text = @"1";
|
||||
_countLabel.font = [UIFont systemFontOfSize:13];
|
||||
_countLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_countLabel.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(arrowButtonAction:)];
|
||||
[_countLabel addGestureRecognizer:tap];
|
||||
}
|
||||
return _countLabel;
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
|
||||
GiftSegmentType_Punish,///惩罚礼物
|
||||
GiftSegmentType_SuperLucky,///超级幸运礼物
|
||||
GiftSegmentType_Country,///国家礼物
|
||||
GiftSegmentType_CP,///cp礼物
|
||||
GiftSegmentType_Custom,///cp礼物
|
||||
};
|
||||
|
||||
|
||||
|
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)loginNIM;
|
||||
- (void)getUserInfo;
|
||||
/// 检查是否有未消费的内购订单
|
||||
- (void)checkTranscation;
|
||||
//- (void)checkTranscation;
|
||||
|
||||
/// 巨量广告
|
||||
- (void)juliandAdCallBackApi;
|
||||
|
@@ -73,10 +73,11 @@ static NSString * kUpdateVersionNum = @"kUpdateVersionNum";
|
||||
}] uid:[[AccountInfoStorage instance] getUid]];
|
||||
}
|
||||
|
||||
// MARK: 使用 IAPManager 替代
|
||||
- (void)checkTranscation {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
||||
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
|
||||
NSArray * array = [RechargeStorage getAllReceiptsWithUid:uid];
|
||||
if (array == nil || array.count <= 0) {
|
||||
return;
|
||||
}
|
||||
@@ -87,7 +88,7 @@ static NSString * kUpdateVersionNum = @"kUpdateVersionNum";
|
||||
[Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
[RechargeStorage delegateTranscationId:transcationId uid:uid];
|
||||
[RechargeStorage delegateTransactionId:transcationId uid:uid];
|
||||
}
|
||||
|
||||
} chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
||||
|
@@ -90,6 +90,8 @@
|
||||
|
||||
#import "XPHomePagingViewController.h"
|
||||
|
||||
#import "IAPManager.h"
|
||||
|
||||
NSString * const kUserFirstLoginKey = @"kUserFirstLoginKey";
|
||||
NSString * const kHadLaunchApp = @"kHadLaunchApp";
|
||||
NSString * const kLastShowAnchorCardTime = @"kLastShowAnchorCardTime";
|
||||
@@ -219,8 +221,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
[self.presenter getUserInfo];
|
||||
[[UploadFile share]initQCloud];
|
||||
|
||||
///登录成功之后 在验证是否有漏单的行为
|
||||
[self.presenter checkTranscation];
|
||||
|
||||
///检查更新
|
||||
[self.presenter getVersionUpdate];
|
||||
|
||||
@@ -249,6 +250,9 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kHadLaunchApp];///第一次弹主播卡片
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
[[IAPManager sharedManager] handleLogin];
|
||||
[[IAPManager sharedManager] retryCheckAllReceipt];
|
||||
}
|
||||
-(void)getRoomGameInfo{
|
||||
[Api getRoomGameDetailsForHoem:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#import "XPIncomeRecordVC.h"
|
||||
|
||||
#import "PIWebViewSavePhotoView.h"
|
||||
#import "IAPManager.h"
|
||||
|
||||
typedef NS_ENUM(NSUInteger, RightNavigationPushType){
|
||||
///跳转h5页面
|
||||
@@ -528,152 +529,28 @@ NSString * const kJSOpenPaymentCallback = @"openPaymentCallback";
|
||||
[self showLoading];
|
||||
|
||||
@kWeakify(self);
|
||||
[Api requestIAPRecharge:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
[[IAPManager sharedManager] purchase:chargeProdId
|
||||
success:^(NSString *transactionID, NSString *orderID){
|
||||
@kStrongify(self);
|
||||
|
||||
[self hideHUD];
|
||||
switch (code) {
|
||||
case 200: {
|
||||
NSString *orderId = (NSString *)data.data[@"recordId"];
|
||||
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
|
||||
[self handleGetIAPRechargeSuccess:orderId
|
||||
uuid:uuid
|
||||
chargeProdId:chargeProdId];
|
||||
}
|
||||
break;
|
||||
case 50000:
|
||||
default:
|
||||
[self showErrorToast:msg];
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
chargeProdId:chargeProdId
|
||||
uid:[AccountInfoStorage instance].getUid
|
||||
ticket:[AccountInfoStorage instance].getTicket
|
||||
deviceInfo:[YYUtility deviceID]
|
||||
clientIp:[YYUtility ipAddress]];
|
||||
}
|
||||
|
||||
- (void)handleGetIAPRechargeSuccess:(NSString *)orderID
|
||||
uuid:(NSString *)uuid
|
||||
chargeProdId:(NSString *)chargeProdId {
|
||||
if (orderID.length > 0) {
|
||||
self.orderId = orderID;
|
||||
if (@available(iOS 15.0, *)) {
|
||||
PIIAPRegulate *iap = [PIIAPRegulate shared];
|
||||
[iap demandCommodityThingWithProductId:chargeProdId
|
||||
uuid:uuid
|
||||
completionHandler:^(NSError * _Nullable error) {
|
||||
|
||||
}];
|
||||
@kWeakify(self);
|
||||
iap.ConditionBlock = ^(enum StoreConditionResult state, NSDictionary<NSString *,id> * _Nullable result) {
|
||||
@kStrongify(self);
|
||||
switch (state) {
|
||||
case StoreConditionResultVerifiedServer: {
|
||||
NSString *transactionId = result[@"transactionId"];
|
||||
NSLog(@"-- -- - -- - - transactionId: %@, orderID: %@", transactionId, orderID);
|
||||
[self rechargeSuccess:transactionId];
|
||||
}
|
||||
break;
|
||||
case StoreConditionResultUnowned: {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[XNDJTDDLoadingTool hideHUDInView:kWindow];
|
||||
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController1")];
|
||||
});
|
||||
}
|
||||
break;
|
||||
case StoreConditionResultPay:
|
||||
case StoreConditionResultStart:
|
||||
break;
|
||||
default: {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[XNDJTDDLoadingTool hideHUDInView:kWindow];
|
||||
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController1")];
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
[XNDJTDDLoadingTool hideHUDInView:kWindow];
|
||||
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController10")];
|
||||
}
|
||||
}else{
|
||||
[XNDJTDDLoadingTool hideHUDInView:kWindow];
|
||||
}
|
||||
}
|
||||
|
||||
///充值成功回调id
|
||||
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
|
||||
///保存唯一凭证
|
||||
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
|
||||
|
||||
///二次验证
|
||||
@kWeakify(self);
|
||||
[Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
[self triggerOpenPaymentCallback:200
|
||||
orderID:self.orderId
|
||||
productID:transactionID];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
@kStrongify(self);
|
||||
if (code == 200) {
|
||||
[self checkReceiptSuccess:transactionIdentifier];
|
||||
} else {
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
||||
[self hideHUD];
|
||||
if (error) {
|
||||
[self showErrorToast:error.domain];
|
||||
}
|
||||
}
|
||||
chooseEnv:@"true"
|
||||
chargeRecordId:self.orderId
|
||||
transcationId:transactionIdentifier
|
||||
uid:[AccountInfoStorage instance].getUid
|
||||
ticket:[AccountInfoStorage instance].getTicket];
|
||||
}
|
||||
|
||||
///充值成功之后保存订单到钥匙串
|
||||
- (void)saveRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
|
||||
NSData *receipt = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
|
||||
NSString *encodeStr = [receipt base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
|
||||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
|
||||
if(transactionIdentifier != nil){
|
||||
[dictionary setObject:transactionIdentifier forKey:@"transcationId"];
|
||||
}
|
||||
if(encodeStr != nil){
|
||||
[dictionary setObject:encodeStr forKey:@"recipt"];
|
||||
}
|
||||
if(self.orderId != nil){
|
||||
[dictionary setObject:self.orderId forKey:@"orderId"];
|
||||
}
|
||||
if(dictionary.allKeys.count == 0)return;
|
||||
NSString *reciptJson = [dictionary toJSONString];
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
BOOL saveSuccess = [RechargeStorage saveTranscationId:transactionIdentifier recipt:reciptJson uid:uid];
|
||||
if (!saveSuccess) {
|
||||
NSLog(@"保存订单失败");
|
||||
}
|
||||
}
|
||||
|
||||
///二次验证成功
|
||||
- (void)checkReceiptSuccess:(NSString *)transcationId {
|
||||
[XNDJTDDLoadingTool hideHUDInView:kWindow];
|
||||
if (@available(iOS 15.0, *)) {
|
||||
PIIAPRegulate *iap = [PIIAPRegulate shared];
|
||||
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||
|
||||
[self triggerOpenPaymentCallback:200
|
||||
orderID:self.orderId
|
||||
productID:transcationId];
|
||||
}
|
||||
|
||||
///删除本地保存的
|
||||
- (void)deleteRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
BOOL deleteSuccess = [RechargeStorage delegateTranscationId:transactionIdentifier
|
||||
uid:uid];
|
||||
if (deleteSuccess) {
|
||||
NSLog(@"删除本地账单失败");
|
||||
}
|
||||
} contactCS:^(NSString * _Nonnull uid) {
|
||||
@kStrongify(self);
|
||||
[self hideHUD];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NIMSession * session = [NIMSession session:uid type:NIMSessionTypeP2P];
|
||||
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
|
||||
[self.navigationController pushViewController:sessionVC animated:YES];
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)triggerOpenPaymentCallback:(NSInteger)code
|
||||
|
@@ -12,19 +12,19 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface RechargeStorage : NSObject
|
||||
|
||||
/// 根据商品id保存凭证
|
||||
+ (BOOL)saveTranscationId:(NSString *)transcationId
|
||||
recipt:(NSString *)recipt
|
||||
+ (BOOL)saveTransactionId:(NSString *)transactionId
|
||||
receipt:(NSString *)receipt
|
||||
uid:(NSString *)uid;
|
||||
|
||||
/// 获取所有凭证
|
||||
+ (NSArray *)getAllReciptsWithUid:(NSString *)uid;
|
||||
+ (NSArray *)getAllReceiptsWithUid:(NSString *)uid;
|
||||
|
||||
/// 根据订单删除凭证
|
||||
+ (BOOL)delegateTranscationId:(NSString *)transcationId
|
||||
+ (BOOL)delegateTransactionId:(NSString *)transactionId
|
||||
uid:(NSString *)uid;
|
||||
|
||||
/// 删除所有凭证
|
||||
+ (void)delegateAllTranscationIdsWithUid:(NSString *)uid;
|
||||
+ (void)delegateAllTransactionIdsWithUid:(NSString *)uid;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -8,50 +8,56 @@
|
||||
#import "RechargeStorage.h"
|
||||
#import <SSKeychain/SSKeychain.h>
|
||||
|
||||
#define kappStoreKey @"kappStoreKey"
|
||||
#define kAppStoreKey @"kAppStoreKey"
|
||||
static
|
||||
|
||||
@implementation RechargeStorage
|
||||
|
||||
/// 根据商品id保存凭证
|
||||
+ (BOOL)saveTranscationId:(NSString *)transcationId
|
||||
recipt:(NSString *)recipt
|
||||
+ (BOOL)saveTransactionId:(NSString *)transactionId
|
||||
receipt:(NSString *)receipt
|
||||
uid:(NSString *)uid {
|
||||
NSString * key = [NSString stringWithFormat:@"%@_%@", kappStoreKey, uid];
|
||||
return [SSKeychain setPassword:recipt forService:key account:transcationId error:nil];
|
||||
NSString * key = [NSString stringWithFormat:@"%@_%@", kAppStoreKey, uid];
|
||||
return [SSKeychain setPassword:receipt
|
||||
forService:key
|
||||
account:transactionId
|
||||
error:nil];
|
||||
}
|
||||
|
||||
|
||||
/// 获取所有凭证
|
||||
+ (NSArray *)getAllReciptsWithUid:(NSString *)uid {
|
||||
NSArray *transcationIds = [SSKeychain allAccounts];
|
||||
NSMutableArray *temArr = [NSMutableArray array];
|
||||
[transcationIds enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj[@"svce"] isKindOfClass:[NSString class]]) {
|
||||
NSString * key = [NSString stringWithFormat:@"%@_%@", kappStoreKey, uid];
|
||||
if ([obj[@"svce"] isEqualToString:key]) {
|
||||
NSString *recipt = [SSKeychain passwordForService:key account:obj[@"acct"] error:nil];
|
||||
NSData *data = [recipt dataUsingEncoding:NSUTF8StringEncoding];
|
||||
+ (NSArray *)getAllReceiptsWithUid:(NSString *)uid {
|
||||
NSArray *transactionIds = [SSKeychain allAccounts];
|
||||
NSMutableArray *teamArray = [NSMutableArray array];
|
||||
[transactionIds enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj[kSSKeychainWhereKey] isKindOfClass:[NSString class]]) {
|
||||
NSString * key = [NSString stringWithFormat:@"%@_%@", kAppStoreKey, uid];
|
||||
if ([obj[kSSKeychainWhereKey] isEqualToString:key]) {
|
||||
NSString *receipt = [SSKeychain passwordForService:key
|
||||
account:obj[kSSKeychainAccountKey]
|
||||
error:nil];
|
||||
NSData *data = [receipt dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
||||
[temArr addObject:json];
|
||||
[teamArray addObject:json];
|
||||
}
|
||||
}
|
||||
}];
|
||||
return temArr;
|
||||
return teamArray;
|
||||
}
|
||||
|
||||
/// 根据订单删除凭证
|
||||
+ (BOOL)delegateTranscationId:(NSString *)transcationId uid:(NSString *)uid {
|
||||
NSString * key = [NSString stringWithFormat:@"%@_%@", kappStoreKey, uid];
|
||||
return [SSKeychain deletePasswordForService:key account:transcationId error:nil];
|
||||
+ (BOOL)delegateTransactionId:(NSString *)transactionId uid:(NSString *)uid {
|
||||
NSString * key = [NSString stringWithFormat:@"%@_%@", kAppStoreKey, uid];
|
||||
return [SSKeychain deletePasswordForService:key account:transactionId error:nil];
|
||||
}
|
||||
|
||||
/// 删除所有凭证
|
||||
+ (void)delegateAllTranscationIdsWithUid:(NSString *)uid {
|
||||
NSArray *transcationIds = [SSKeychain allAccounts];
|
||||
[transcationIds enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj[@"svce"] isKindOfClass:[NSString class]]) {
|
||||
NSString * key = [NSString stringWithFormat:@"%@_%@", kappStoreKey, uid];
|
||||
if ([obj[@"svce"] isEqualToString:key]) {
|
||||
+ (void)delegateAllTransactionIdsWithUid:(NSString *)uid {
|
||||
NSArray *transactionIds = [SSKeychain allAccounts];
|
||||
[transactionIds enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj[kSSKeychainWhereKey] isKindOfClass:[NSString class]]) {
|
||||
NSString * key = [NSString stringWithFormat:@"%@_%@", kAppStoreKey, uid];
|
||||
if ([obj[kSSKeychainWhereKey] isEqualToString:key]) {
|
||||
[SSKeychain deletePasswordForService:key account:obj[@"acct"]];
|
||||
}
|
||||
}
|
||||
|
@@ -133,8 +133,8 @@ public class PIIAPRegulate: NSObject {
|
||||
// 添加进入待完成map
|
||||
let key = String(transactionId)
|
||||
transactionMap[key] = transaction
|
||||
await uploadServer(for: transactionId)
|
||||
|
||||
await uploadServer(for: key)
|
||||
|
||||
// 这里不触发完成,等服务器验证再触发完成逻辑
|
||||
await transaction.finish()
|
||||
|
||||
@@ -189,8 +189,8 @@ public class PIIAPRegulate: NSObject {
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func uploadServer(for transactionId:UInt64) async {
|
||||
let dic :Dictionary<String,Any> = ["transactionId":transactionId]
|
||||
func uploadServer(for transactionId:String) async {
|
||||
let dic :Dictionary<String,String> = ["transactionId":transactionId]
|
||||
triggerConditionBlock(.verifiedServer, dic)
|
||||
}
|
||||
|
||||
|
@@ -3918,8 +3918,15 @@ ineHeadView12" = "الحمل";
|
||||
"UserDetail_Setting_0" = "عرض الرسوم المتحركة للصفحة الرئيسية - CP";
|
||||
"UserDetail_Setting_1" = "عرض الصور الرمزية للصفحة الرئيسية- CP";
|
||||
"UserDetail_CP_List_0" = "تحتاج إلى %@ للترقية";
|
||||
"UserDetail_CP_List_1" = "Waiting for love";
|
||||
"UserDetail_CP_Toast_0" = "نصيحة";
|
||||
"UserDetail_CP_Toast_1" = "هل أنت متأكد من أنك تريد إنفاق %@ قطعة نقدية لإلغاء CP الخاص بك مع %@؟";
|
||||
"UserDetail_CP_Toast_2" = "لقد نجحت في إلغاء CP الخاص بك مع %@.";
|
||||
"RoomEffect_CP_0" = "and";
|
||||
"RoomEffect_CP_1" = "have become";
|
||||
"RoomEffect_CP_0" = "و";
|
||||
"RoomEffect_CP_1" = "لقد أصبح";
|
||||
"RoomEffect_CP_lv_0" = "ثنائي رائع";
|
||||
"RoomEffect_CP_lv_1" = "ثنائي ديناميكي";
|
||||
"RoomEffect_CP_lv_2" = "الثنائي المثالي";
|
||||
"RoomEffect_CP_lv_3" = "ثنائي الأحلام";
|
||||
"RoomEffect_CP_lv_4" = "ثنائي مثالي";
|
||||
"RoomEffect_CP_lv_5" = "ثنائي رائع";
|
||||
|
@@ -804,7 +804,7 @@
|
||||
|
||||
"XPMineDataGiftTableViewCell0" = "Normal Gifts";
|
||||
"XPMineDataGiftTableViewCell1" = "Lucky Gifts";
|
||||
"XPMineDataGiftTableViewCell2" = "medal";
|
||||
"XPMineDataGiftTableViewCell2" = "Medal";
|
||||
|
||||
"XPMineUserInfoEmptyCollectionViewCell0" = "No gifts received yet";
|
||||
|
||||
@@ -848,7 +848,7 @@
|
||||
"XPMineUserInfoViewController5" = "By adding to blacklist, you will no longer receive messages from this user";
|
||||
"XPMineUserInfoViewController6" = "Removed from blacklist successfully";
|
||||
"XPMineUserInfoViewController7" = "Added to blacklist successfully";
|
||||
"XPMineUserInfoViewController8" = "chat";
|
||||
"XPMineUserInfoViewController8" = "Chat";
|
||||
"XPMineUserInfoViewController9" = "Follow";
|
||||
"XPMineUserInfoViewController10" = "Following";
|
||||
"XPMineUserInfoViewController11" = "Profile";
|
||||
@@ -3714,8 +3714,15 @@
|
||||
"UserDetail_Setting_0" = "Homepage animation display-CP";
|
||||
"UserDetail_Setting_1" = "Homepage avatars display-CP";
|
||||
"UserDetail_CP_List_0" = "Need %@ to upgrade";
|
||||
"UserDetail_CP_List_1" = "Waiting for love";
|
||||
"UserDetail_CP_Toast_0" = "Tips";
|
||||
"UserDetail_CP_Toast_1" = "Are you sure you want to spend %@ coins to cancel your CP with %@?";
|
||||
"UserDetail_CP_Toast_2" = "You have successfully cancelled your CP with %@.";
|
||||
"RoomEffect_CP_0" = "and";
|
||||
"RoomEffect_CP_1" = "have become";
|
||||
"RoomEffect_CP_lv_0" = "Sweet Duo";
|
||||
"RoomEffect_CP_lv_1" = "Dynamic Duo";
|
||||
"RoomEffect_CP_lv_2" = "Ideal Duo";
|
||||
"RoomEffect_CP_lv_3" = "Dream Duo";
|
||||
"RoomEffect_CP_lv_4" = "Perfect Duo";
|
||||
"RoomEffect_CP_lv_5" = "Divine Couple";
|
||||
|
@@ -3378,10 +3378,15 @@
|
||||
"UserDetail_Setting_0" = "CP主页动效";
|
||||
"UserDetail_Setting_1" = "CP主页头像";
|
||||
"UserDetail_CP_List_0" = "需要 %@ 到下一级";
|
||||
"UserDetail_CP_List_1" = "Waiting for love";
|
||||
"UserDetail_CP_Toast_0" = "提示";
|
||||
"UserDetail_CP_Toast_1" = "你确定要花 %@ 金币解除与 %@ 的CP关系?";
|
||||
"UserDetail_CP_Toast_2" = "你已经成功解除和 %@ 的CP。";
|
||||
//"RoomEffect_CP_0" = "和";
|
||||
//"RoomEffect_CP_1" = "已经成为";
|
||||
"RoomEffect_CP_0" = "and";
|
||||
"RoomEffect_CP_1" = "have become";
|
||||
"RoomEffect_CP_0" = "和";
|
||||
"RoomEffect_CP_1" = "已经成为";
|
||||
"RoomEffect_CP_lv_0" = "甜蜜雙人組";
|
||||
"RoomEffect_CP_lv_1" = "動感雙人組";
|
||||
"RoomEffect_CP_lv_2" = "理想雙人組";
|
||||
"RoomEffect_CP_lv_3" = "夢幻雙人組";
|
||||
"RoomEffect_CP_lv_4" = "完美雙人組";
|
||||
"RoomEffect_CP_lv_5" = "神仙眷侶";
|
||||
|
@@ -3370,11 +3370,16 @@
|
||||
"UserDetail_Setting_0" = "主頁CP進場動效";
|
||||
"UserDetail_Setting_1" = "主頁CP頭像";
|
||||
"UserDetail_CP_List_0" = "需要 %@ 升級";
|
||||
"UserDetail_CP_List_1" = "Waiting for love";
|
||||
"UserDetail_CP_Toast_0" = "提示";
|
||||
"UserDetail_CP_Toast_1" = "您確定要花 %@ 金幣來取消您与 %@ 的 CP 嗎?";
|
||||
"UserDetail_CP_Toast_2" = "你已经成功解除和 %@ 的CP。";
|
||||
//"RoomEffect_CP_0" = "和";
|
||||
//"RoomEffect_CP_1" = "已經成為";
|
||||
"RoomEffect_CP_0" = "and";
|
||||
"RoomEffect_CP_1" = "have become";
|
||||
"RoomEffect_CP_0" = "和";
|
||||
"RoomEffect_CP_1" = "已經成為";
|
||||
"RoomEffect_CP_lv_0" = "甜蜜雙人組";
|
||||
"RoomEffect_CP_lv_1" = "動感雙人組";
|
||||
"RoomEffect_CP_lv_2" = "理想雙人組";
|
||||
"RoomEffect_CP_lv_3" = "夢幻雙人組";
|
||||
"RoomEffect_CP_lv_4" = "完美雙人組";
|
||||
"RoomEffect_CP_lv_5" = "神仙眷侶";
|
||||
|
||||
|