完善新 VIP 页

This commit is contained in:
eggmanQQQ
2024-08-19 19:41:22 +08:00
parent 3d2fb62d19
commit 0f54b562e2
8 changed files with 587 additions and 69 deletions

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "矩形 91@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "按钮@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View 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
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@@ -8,23 +8,119 @@
#import "VIPCenterViewController.h"
#import <SVGA.h>
#import <NIMSDK/NIMSDK.h>
#import "YuMi-swift.h"
#import "XPWebViewController.h"
#import "XPIAPRechargeViewController.h"
#import "Api+Main.h"
#import "Api+NobleCenter.h"
#import "XPNobleCenterPresenter.h"
#import "RechargeStorage.h"
#import "XPNobleCenterProtocol.h"
#import "SVGAImageView.h"
#import "TYCyclePagerView.h"
#import "XPNobleCenterWindow.h"
#import "XPNobleCenterPayView.h"
#import "XPNobleAuthorityDescView.h"
#import "NobleInfo.h"
#import "UserInfoModel.h"
#import "AttachmentModel.h"
#import "WalletInfoModel.h"
#import "NobleCenterModel.h"
#import "RechargeListModel.h"
@interface VIPExclusivePrivilegesCard: UIView
@property (nonatomic, assign) bool enable;
@property (nonatomic, assign) NSInteger index;
@property (nonatomic, strong) NobleAuthInfo *info;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) NetImageView *imageView;
@property (nonatomic, copy) void(^didTapCard)(NSInteger index);
@end
@implementation VIPExclusivePrivilegesCard
- (instancetype)init {
if (self = [super init]) {
[self addSubview:self.imageView];
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.centerX.mas_equalTo(self);
make.width.height.mas_equalTo(kGetScaleWidth(48));
}];
[self addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.bottom.trailing.mas_equalTo(self);
make.height.mas_equalTo(18);
}];
UIGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleTapCardGesture)];
[self addGestureRecognizer:tap];
}
return self;
}
- (void)handleTapCardGesture {
// if (_didTapCard) {
// _didTapCard(self.index);
// }
XPNobleAuthorityDescView *alertView = [[XPNobleAuthorityDescView alloc] initWithFrame:CGRectMake(0, 0, 300, 286)];
alertView.vipInfo = self.info;
TTPopupService * config = [[TTPopupService alloc] init];
config.maskBackgroundAlpha = 0.6;
config.contentView = alertView;
[TTPopup popupWithConfig:config];
}
- (void)setInfo:(NobleAuthInfo *)info {
_info = info;
self.imageView.imageUrl = info.authIcon;
self.titleLabel.text = info.authName;
}
- (void)setEnable:(bool)enable {
_enable = enable;
if (enable) {
self.imageView.alpha = 1;
self.titleLabel.alpha = 1;
} else {
self.imageView.alpha = 0.5;
self.titleLabel.alpha = 0.5;
}
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [UILabel labelInitWithText:@""
font:kFontRegular(13)
textColor:[DJDKMIMOMColor colorWithHexString:@"#FFE3AF"]];
_titleLabel.textAlignment = NSTextAlignmentCenter;
}
return _titleLabel;
}
- (NetImageView *)imageView {
if (!_imageView) {
_imageView = [[NetImageView alloc] init];
_imageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _imageView;
}
@end
@interface VIPIdentificationCard : UIView
@property (nonatomic, strong) NetImageView *imageView;
@@ -176,7 +272,7 @@
@end
@interface VIPCenterViewController () <TYCyclePagerViewDataSource, TYCyclePagerViewDelegate>
@interface VIPCenterViewController () <TYCyclePagerViewDataSource, TYCyclePagerViewDelegate, XPNobleCenterPayViewDelegate, XPNobleCenterProtocol>
@property (nonatomic, strong) UIButton *backButton;
@property (nonatomic, strong) UILabel *titleLabel;
@@ -188,10 +284,14 @@
@property (nonatomic, strong) UIScrollView *mainScrollView;
@property (nonatomic, strong) UIView *scrollContentView;
@property (nonatomic, strong) NobleCenterModel *vipModel;
@property (nonatomic, strong) UserInfoModel *userInfo;
@property (nonatomic, strong) NobleInfo *currentVIPInfo;
@property (nonatomic, strong) NobleCenterModel *vipModel;
@property (nonatomic, strong) WalletInfoModel *walletInfo;
@property(nonatomic,strong) RechargeListModel *rechargeModel;
@property (nonatomic, copy) NSArray <RechargeListModel *> *rechargeList;
@property (nonatomic, copy) NSArray <VIPExclusivePrivilegesCard *> *exclusivePrivilegesCards;
@property (nonatomic, strong) UIStackView *identificationStack;
@property (nonatomic, strong) VIPIdentificationCard *identificationCard_vipIdentity;
@@ -202,6 +302,13 @@
@property (nonatomic, strong) VIPIdentificationCard *identificationCard_exclusiveBubbles;
@property (nonatomic, strong) UIStackView *exclusivePrivilegesStack;
@property (nonatomic, strong) UILabel *exclusivePrivilegesCountLabel;
@property (nonatomic, strong) UILabel *purchaseExpiresLabel;
@property (nonatomic, strong) UILabel *purchasePriceLabel;
///
@property (nonatomic,copy) NSString *orderId;
@end
@@ -215,6 +322,7 @@
[super viewDidLoad];
[self setupUI];
[self setupNIM];
[self setupData];
}
@@ -222,7 +330,13 @@
return [[XPNobleCenterPresenter alloc] init];
}
#pragma mark - Setup
- (void)setupNIM {
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
}
- (void)setupUI {
[self setupBG];
[self setupNavigationBar];
@@ -231,6 +345,7 @@
[self setupScrollContent];
[self setupVipIdentificationArea];
[self setupExclusivePrivilegesArea];
[self setupPurchaseArea];
}
- (void)setupBG {
@@ -290,37 +405,6 @@
make.edges.mas_equalTo(self.mainScrollView);
make.width.mas_equalTo(self.mainScrollView);
}];
// UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 1000)];
// CAGradientLayer *gradientLayer = [CAGradientLayer layer];
// gradientLayer.startPoint = CGPointMake(0.5, 0.0);
// gradientLayer.endPoint = CGPointMake(0.5, 1.0);
// gradientLayer.colors = @[
// (id)[UIColor redColor].CGColor,
// (id)[UIColor blueColor].CGColor
// ];
// gradientLayer.frame = self.view.bounds;
// [v.layer insertSublayer:gradientLayer atIndex:0];
// [self.scrollContentView addSubview:v];
//
// UILabel *label2 = [[UILabel alloc] init];
// label2.text = @"Label 2";
// label2.backgroundColor = [UIColor greenColor];
// [self.scrollContentView addSubview:label2];
//
// [v mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.leading.trailing.mas_equalTo(self.scrollContentView);
// make.height.mas_equalTo(1000);
// }];
//
// [label2 mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.equalTo(v.mas_bottom).offset(20); // label1 20
// make.left.right.equalTo(self.scrollContentView).insets(UIEdgeInsetsMake(0, 20, 0, 20)); // 20
// make.height.mas_equalTo(50); // 50
// make.bottom.equalTo(self.scrollContentView).offset(-20); // contentView contentView 20
// }];
}
- (void)setupVipIdentificationArea {
@@ -400,21 +484,33 @@
}
- (void)setupExclusivePrivilegesArea {
UIStackView *titlesStack = [[UIStackView alloc] init];
titlesStack.axis = UILayoutConstraintAxisVertical;
UILabel *titleLabel = [UILabel labelInitWithText:@"Exclusive Privileges"
font:kFontBold(16)
textColor:[DJDKMIMOMColor colorWithHexString:@"#FFE3AF"]];
[self.scrollContentView addSubview:titleLabel];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
[titlesStack addArrangedSubview:titleLabel];
[titlesStack addArrangedSubview:self.exclusivePrivilegesCountLabel];
[self.scrollContentView addSubview:titlesStack];
[titlesStack mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.identificationStack.mas_bottom).offset(24);
make.centerX.mas_equalTo(self.identificationStack);
make.height.mas_equalTo(22 * 2);
}];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(22);
}];
[self.exclusivePrivilegesCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(titleLabel);
}];
UIImageView *leftDecorateImageView = [[UIImageView alloc] initWithImage:kImage(@"vip_center_label_decorate")];
[self.scrollContentView addSubview:leftDecorateImageView];
[leftDecorateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(titleLabel);
make.trailing.mas_equalTo(titleLabel.mas_leading).offset(-12);
make.centerY.mas_equalTo(titlesStack);
make.trailing.mas_equalTo(titlesStack.mas_leading).offset(-12);
make.size.mas_equalTo(CGSizeMake(43, 16));
}];
@@ -422,35 +518,71 @@
rightDecorateImageView.transform = CGAffineTransformMakeScale(-1.0, 1.0);
[self.scrollContentView addSubview:rightDecorateImageView];
[rightDecorateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(titleLabel);
make.leading.mas_equalTo(titleLabel.mas_trailing).offset(12);
make.centerY.mas_equalTo(titlesStack);
make.leading.mas_equalTo(titlesStack.mas_trailing).offset(12);
make.size.mas_equalTo(CGSizeMake(43, 16));
}];
self.exclusivePrivilegesStack = [[UIStackView alloc] init];
self.exclusivePrivilegesStack.axis = UILayoutConstraintAxisVertical; //
self.exclusivePrivilegesStack.distribution = UIStackViewDistributionEqualSpacing;
self.exclusivePrivilegesStack.spacing = 10; //
[self.scrollContentView addSubview:self.exclusivePrivilegesStack];
[self.exclusivePrivilegesStack mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(titleLabel.mas_bottom);
make.top.mas_equalTo(titleLabel.mas_bottom).offset(22);
make.leading.trailing.mas_equalTo(self.scrollContentView);
make.bottom.mas_equalTo(self.scrollContentView).offset(-40);
make.bottom.mas_equalTo(self.scrollContentView).offset(-80);
}];
// UIView *bottomV = [[UIView alloc] init];
// [self.scrollContentView addSubview:bottomV];
// [bottomV mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.mas_equalTo(titleLabel.mas_bottom);
// make.height.width.mas_equalTo(100);
// make.bottom.mas_equalTo(self.scrollContentView).offset(-20);
// }];
}
- (void)setupPurchaseArea {
UIImageView *purchaseArea = [[UIImageView alloc] initWithImage:kImage(@"vip_center_purchase_bg")];
purchaseArea.userInteractionEnabled = YES;
[self.view addSubview:purchaseArea];
[purchaseArea mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.view).offset(-26);
make.leading.mas_equalTo(self.view).offset(16);
make.trailing.mas_equalTo(self.view).offset(-16);
make.height.mas_equalTo(kGetScaleWidth(54));
}];
UIButton *purchaseButton = [UIButton buttonWithType:UIButtonTypeCustom];
[purchaseButton setTitle:@"Renew"
forState:UIControlStateNormal];
[purchaseButton setTitleColor:[DJDKMIMOMColor colorWithHexString:@"#633000"]
forState:UIControlStateNormal];
[purchaseButton setBackgroundImage:kImage(@"vip_center_purchase_button_bg")
forState:UIControlStateNormal];
[purchaseButton addTarget:self
action:@selector(didTapPurchaseButton)
forControlEvents:UIControlEventTouchUpInside];
[purchaseArea addSubview:purchaseButton];
[purchaseButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.trailing.mas_equalTo(-3);
make.top.mas_equalTo(3);
make.width.mas_equalTo(kGetScaleWidth(146));
}];
UIImageView *coin = [[UIImageView alloc] initWithImage:kImage(@"vip_center_purchase_coin")];
[purchaseArea addSubview:coin];
[coin mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(6);
make.leading.mas_equalTo(16);
make.size.mas_equalTo(CGSizeMake(kGetScaleWidth(20), kGetScaleWidth(20)));
}];
[purchaseArea addSubview:self.purchasePriceLabel];
[self.purchasePriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(coin.mas_trailing).offset(4);
make.centerY.mas_equalTo(coin);
make.trailing.mas_equalTo(purchaseButton.mas_leading);
}];
[purchaseArea addSubview:self.purchaseExpiresLabel];
[self.purchaseExpiresLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(coin);
make.top.mas_equalTo(coin.mas_bottom).offset(4);
make.trailing.mas_equalTo(purchaseButton.mas_leading);
}];
}
#pragma mark - Config & Update UI
- (void)configVIPCards {
[self.vipCardCyclePager reloadData];
}
@@ -491,23 +623,25 @@
- (void)configExclusivePrivilegesArea {
int itemsPerRow = 3;
NSMutableArray *tempArray = @[].mutableCopy;
for (int row = 0; row < (self.vipModel.vipAuthInfos.count + itemsPerRow - 1)/itemsPerRow; row++) {
UIStackView *horizontalStackView = [[UIStackView alloc] init];
horizontalStackView.axis = UILayoutConstraintAxisHorizontal; //
horizontalStackView.distribution = UIStackViewDistributionFillEqually;
horizontalStackView.spacing = 60;
horizontalStackView.spacing = 14;
for (int col = 0; col < itemsPerRow; col++) {
int index = row * itemsPerRow + col;
if (index < self.vipModel.vipAuthInfos.count) {
UIView *v = [[UIView alloc] init];
v.backgroundColor = [UIColor whiteColor];
NobleAuthInfo *info = [self.vipModel.vipAuthInfos xpSafeObjectAtIndex:index];
VIPExclusivePrivilegesCard *v = [[VIPExclusivePrivilegesCard alloc] init];
v.info = info;
[horizontalStackView addArrangedSubview:v];
[v mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(48);
make.width.height.mas_equalTo(48 + 18 + 6);
}];
[tempArray addObject:v];
} else {
//
UIView *placeholderView = [[UIView alloc] init];
@@ -518,6 +652,60 @@
[self.exclusivePrivilegesStack addArrangedSubview:horizontalStackView];
}
self.exclusivePrivilegesCards = tempArray.copy;
[self updateExclusivePrivilegesArea];
}
- (void)updateExclusivePrivilegesArea {
NSInteger currentPage = self.vipCardCyclePager.curIndex;
NobleInfo *currentInfo = [self.vipModel.vipInfos xpSafeObjectAtIndex:currentPage];
NSInteger enableCount = 0;
if (currentInfo) {
for (VIPExclusivePrivilegesCard *v in self.exclusivePrivilegesCards) {
v.enable = [currentInfo.ownAuthTypes containsObject:@(v.info.authType)];
if (v.enable) {
enableCount++;
}
}
}
self.exclusivePrivilegesCountLabel.text = [NSString stringWithFormat:@"(%ld/%ld)", enableCount, self.exclusivePrivilegesCards.count];
}
- (void)updatePurchaseArea {
if (self.rechargeList.count == 0 || self.userInfo == nil) {
return;
}
self.rechargeModel = nil;
// NSInteger currentLevel = self.vipModel.currentLevel == 0 ? 1 : self.vipModel.currentLevel;
NSInteger currentPage = self.vipCardCyclePager.curIndex;
for (RechargeListModel *model in self.rechargeList) {
if (model.prodDesc.integerValue == currentPage + 1) {
self.rechargeModel = model;
break;
}
}
if (self.rechargeModel == nil) {
return;
}
// TODO:
NSInteger userLevel = self.userInfo.userVipInfoVO.vipLevel;
self.purchasePriceLabel.text = [NSString stringWithFormat:@"%.0f/30Days", self.rechargeModel.money.floatValue * 1000];
if (self.purchaseExpiresLabel.text.length == 0) {
self.purchaseExpiresLabel.text = [NSString stringWithFormat:@"%@ Expires", [self calNext30Day]];
}
}
- (NSString *)calNext30Day {
NSDate *date = [NSDate date];
NSDate *next30Date = [date dateByAddingDays:30];
return [NSDate timestampSwitchTime:next30Date.timeIntervalSince1970
formatter:@"yyyy/MM/dd hh:mm"];
}
#pragma mark - Load Data from API
@@ -536,6 +724,7 @@
UserInfoModel *infoModel = [UserInfoModel modelWithDictionary:data.data];
self.userInfo = infoModel;
[self loadVIPCenterInfo];
[self updatePurchaseArea];
}
} uid:uid];
}
@@ -547,6 +736,7 @@
if(code == 200){
NSArray *list = [RechargeListModel modelsWithArray:data.data];
self.rechargeList = list;
[self updatePurchaseArea];
}
} type:@"9"];
}
@@ -571,6 +761,8 @@
if (code == 200) {
NobleCenterModel *model = [NobleCenterModel modelWithDictionary:data.data];
self.vipModel = model;
self.currentVIPInfo = [self.vipModel.vipInfos firstObject];
[self configVIPCards];
[self configIdentificationCards];
[self configExclusivePrivilegesArea];
@@ -589,8 +781,30 @@
[self.navigationController pushViewController:webVC animated:YES];
}
#pragma mark - API Response
- (void)didTapPurchaseButton {
if (self.userInfo.userVipInfoVO.vipLevel > 0) {
XPNobleCenterWindow *window = [[XPNobleCenterWindow alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
[TTPopup popupView:window style:TTPopupStyleAlert];
window.text = [NSString stringWithFormat:YMLocalizedString(@"XPNobleCenterWindow1"),self.userInfo.userVipInfoVO.vipName, self.currentVIPInfo.vipName];
@kWeakify(self);
window.confirmBlcok = ^{
@kStrongify(self);
XPNobleCenterPayView *payView = [[XPNobleCenterPayView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
payView.money = self.rechargeModel.money;
payView.diamonds = self.walletInfo.diamonds;
payView.vipLevel = @(self.currentVIPInfo.vipLevel).stringValue;
payView.delegate = self;
[self.view addSubview:payView];
};
} else {
XPNobleCenterPayView *payView = [[XPNobleCenterPayView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
payView.money = self.rechargeModel.money;
payView.diamonds = self.walletInfo.diamonds;
payView.vipLevel = @(self.currentVIPInfo.vipLevel).stringValue;
payView.delegate = self;
[self.view addSubview:payView];
}
}
#pragma mark - TYCyclePagerView Delegate & DataSource
- (NSInteger)numberOfItemsInPagerView:(TYCyclePagerView *)pageView {
@@ -619,8 +833,212 @@
return cell;
}
- (void)pagerView:(TYCyclePagerView *)pageView didScrollFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex {
#pragma mark - properties
self.currentVIPInfo = [self.vipModel.vipInfos xpSafeObjectAtIndex:toIndex];
[self updateExclusivePrivilegesArea];
[self updatePurchaseArea];
}
#pragma mark - XPNobleCenterPayViewDelegate
- (void)payWithType:(NobleCenterPayType)type vipLevel:(NSString * _Nullable)vipLevel{
if(type == NobleCenterPayType_diamond){
// NSString *roomUid = self.roomUid > 0 ? @(self.roomUid).stringValue : @(self.userInfo.uid).stringValue;
[self.presenter openVipWithDiamondRoomUid:@(self.userInfo.uid).stringValue vipLevel:vipLevel];
} else {
[XNDJTDDLoadingTool showOnlyView:kWindow];
[self.presenter requestNobleIAPRechargeOrderWithChargeProdId:self.rechargeModel.chargeProdId
roomUid:@""];
}
}
#pragma mark - Purchase & Recharge
- (void)openVipWithDiamondSuccess {
[self setupData];
}
- (void)openVipWithDiamondFail:(NSInteger)code {
if(code == 31005){
TTAlertConfig *config = [[TTAlertConfig alloc]init];
config.message = YMLocalizedString(@"XPNobleCenterViewController3");
config.actionStyle = TTAlertActionBothStyle;
[TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{
XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init];
webVC.type = @"4";
[self.navigationController pushViewController:webVC animated:YES];
} cancelHandler:^{
}];
}
}
- (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];
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController10")];
}
} else {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
}
}
- (void)requestIAPRechargeOrderFail:(NSString *)message code:(NSInteger)code {
[XNDJTDDLoadingTool hideOnlyView: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:^{
}];
} else {
[self showErrorToast:message];
}
}
#pragma mark - XPIAPHelperDelegate
///
- (void)rechargeNewProcessStatus:(StoreConditionResult)status {
@kWeakify(self);
dispatch_async(dispatch_get_main_queue(), ^{
@kStrongify(self);
if (status == StoreConditionResultUnowned) {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController1")];
}else{
[XNDJTDDLoadingTool hideOnlyView:kWindow];
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController0")];
}
});
}
///id
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
///
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
///
[self.presenter 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) {
}
}
///
- (void)checkReceiptSuccess:(NSString *)transcationId {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
if (@available(iOS 15.0, *)) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
self.orderId = nil;
//5
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (!self.userInfo.userVipInfoVO) {
///
[self setupData];
}
});
}
- (void)checkReceiptFailWithCode:(NSInteger)code transcationId:(NSString *)transcationId{
[XNDJTDDLoadingTool hideOnlyView:kWindow];
if(code == 1444){
if (@available(iOS 15.0, *)) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
}
}
///
- (void)deleteRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
NSString * uid = [AccountInfoStorage instance].getUid;
BOOL deleteSuccess = [RechargeStorage delegateTranscationId:transactionIdentifier uid:uid];
if (deleteSuccess) {
}
}
- (void)checkTranscationIdsSuccess {
NSString * uid = [AccountInfoStorage instance].getUid;
[RechargeStorage delegateAllTranscationIdsWithUid:uid];
}
#pragma mark -NIMSystemNotificationManagerDelegate
- (void)onReceiveCustomSystemNotification:(NIMCustomSystemNotification *)notification {
if (notification.receiverType == NIMSessionTypeP2P) {
if (notification.content != nil) {
NSData *jsonData = [notification.content dataUsingEncoding:NSUTF8StringEncoding];
NSError *err;
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&err];
if(err) {
NSLog(@"json解析失败%@",err);
return;
}
if ([dic[@"first"] intValue] == CustomMessageType_Noble_VIP &&
[dic[@"second"] intValue] == Custom_Message_Sub_Open_Noble_Success) { // VIP
[self setupData];
}
}
}
}
#pragma mark - Properties
- (UIButton *)backButton {
if (!_backButton) {
@@ -676,6 +1094,7 @@
- (UIScrollView *)mainScrollView {
if (!_mainScrollView) {
_mainScrollView = [[UIScrollView alloc] init];
_mainScrollView.showsVerticalScrollIndicator = false;
}
return _mainScrollView;
}
@@ -723,4 +1142,44 @@
}
return _identificationCard_exclusiveBubbles;
}
- (UIStackView *)exclusivePrivilegesStack {
if (!_exclusivePrivilegesStack) {
_exclusivePrivilegesStack = [[UIStackView alloc] init];
_exclusivePrivilegesStack.axis = UILayoutConstraintAxisVertical; //
_exclusivePrivilegesStack.distribution = UIStackViewDistributionEqualSpacing;
_exclusivePrivilegesStack.spacing = 22; //
}
return _exclusivePrivilegesStack;
}
- (UILabel *)exclusivePrivilegesCountLabel {
if (!_exclusivePrivilegesCountLabel) {
_exclusivePrivilegesCountLabel = [UILabel labelInitWithText:@""
font:kFontMedium(13)
textColor:[DJDKMIMOMColor colorWithHexString:@"#FFE3AF"]];
_exclusivePrivilegesCountLabel.textAlignment = NSTextAlignmentCenter;
}
return _exclusivePrivilegesCountLabel;
}
- (UILabel *)purchasePriceLabel {
if (!_purchasePriceLabel) {
_purchasePriceLabel = [UILabel labelInitWithText:@""
font:kFontRegular(15)
textColor:[DJDKMIMOMColor colorWithHexString:@"#FFE3AF"]];
}
return _purchasePriceLabel;
}
- (UILabel *)purchaseExpiresLabel {
if (!_purchaseExpiresLabel) {
_purchaseExpiresLabel = [UILabel labelInitWithText:@""
font:kFontRegular(12)
textColor:[DJDKMIMOMColor colorWithHexString:@"#FFE3AF"]];
_purchaseExpiresLabel.alpha = 0.6;
}
return _purchaseExpiresLabel;
}
@end

View File

@@ -253,9 +253,6 @@
[self checkTranscationIds];
[self.presenter getNobleChargeProductListWithChannelType:@"9"];
[self getWalletInfo];
}
-(void)getWalletInfo{
NSString * uid = [AccountInfoStorage instance].getUid;
@@ -336,7 +333,6 @@
break;
}
}
}
if (self.rechargeModel != nil){