1. 优化礼物面板加载

2. 百顺游戏 debug 环境添加 vConsole
This commit is contained in:
eggmanQQQ
2024-07-29 20:23:38 +08:00
parent 2805f0d858
commit e48cce107a
11 changed files with 159 additions and 87 deletions

View File

@@ -12950,7 +12950,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 20.20.30;
MARKETING_VERSION = 20.20.31;
PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -12992,7 +12992,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 20.20.30;
MARKETING_VERSION = 20.20.31;
PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@@ -49,7 +49,7 @@ isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaIns
///内置版本号
#define PI_App_Version @"1.0.16"
#define PI_App_Version @"1.0.17"
///渠道
#define PI_App_Source @"appstore"
#define PI_Test_Flight @"TestFlight"

View File

@@ -31,6 +31,10 @@
#import <ReactiveObjC/ReactiveObjC.h>
@interface XPRoomPresenter ()
@end
@implementation XPRoomPresenter
- (void)initEnterRoom:(NSString *)roomUid user:(NSString *)uid {
@@ -190,8 +194,11 @@
if (giftCacheArray.count > 0) {
delayDuration = 0.25;
}
@kWeakify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayDuration * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
[Api requestNormalGiftList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
if (data.data) {
[[XPGiftStorage shareStorage] cacheWith:data.data inRoom:roomUid];
}

View File

@@ -278,7 +278,6 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
if (roomInfo.type == RoomType_Anchor || roomInfo.roomModeType == RoomModeType_Open_Blind) {
self.pkMenuButton.hidden = YES;
} else {
self.pkMenuButton.hidden = NO;
}

View File

@@ -282,10 +282,15 @@
- (void)initSubViewConstraints {
[self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.inputButton.mas_trailing).offset(15);
make.trailing.mas_equalTo(self.giftButton.mas_leading).offset(-11);
make.top.mas_equalTo(self).offset(16);
make.height.mas_equalTo(29);
if (isMSRTL()) {
make.leading.mas_equalTo(self.inputButton.mas_trailing).offset(11);
make.trailing.mas_equalTo(self.giftButton.mas_leading).offset(-15);
} else {
make.leading.mas_equalTo(self.inputButton.mas_trailing).offset(15);
make.trailing.mas_equalTo(self.giftButton.mas_leading).offset(-11);
}
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -293,13 +298,24 @@
}];
[self.inputButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(16);
if (isMSRTL()) {
make.size.mas_equalTo(CGSizeMake(100, 28));
make.right.mas_equalTo(-16);
} else {
make.size.mas_equalTo(CGSizeMake(90, 28));
make.left.top.mas_equalTo(16);
make.left.mas_equalTo(16);
}
}];
[self.svgDisplayView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.scrollView);
make.trailing.mas_equalTo(self).offset(-15);
make.size.mas_equalTo(CGSizeMake(32, 32));
if (isMSRTL()) {
make.left.mas_equalTo(self).offset(15);
} else {
make.trailing.mas_equalTo(self).offset(-15);
}
}];
[self.giftButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.svgDisplayView);
@@ -545,7 +561,7 @@
_inputButton.titleLabel.numberOfLines = 2;
_inputButton.layer.masksToBounds = YES;
_inputButton.layer.cornerRadius = 14;
_inputButton.backgroundColor = UIColorRGBAlpha(0x184450, 0.15);
_inputButton.backgroundColor = UIColorRGBAlpha(0x184450, 0.25);
_inputButton.tag = XPRoomMenuItemType_Input;
[_inputButton addTarget:self action:@selector(menuButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}

View File

@@ -32,7 +32,9 @@
if (uid == nil) {
return;
}
@kWeakify(self);
[Api getUserInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
[[self getView] onGetUserInfoSuccess:infoModel];
}] uid:uid];
@@ -42,7 +44,9 @@
- (void)getUserWallInfo {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
@kWeakify(self);
[Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data];
[[self getView] getUserWalletInfo:model];
}] uid:uid ticket:ticket];
@@ -59,8 +63,8 @@
delayDuration = 1;
[[self getView] getNormalGiftListSuccess:arrary];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayDuration * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
@kWeakify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayDuration * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
[Api requestNormalGiftList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
[[self getView] getNormalGiftListSuccess:[[XPGiftStorage shareStorage] cacheWith:data.data inRoom:roomUid]];
@@ -131,17 +135,21 @@
///
- (void)luckyGiftBroadcastRecord {
@kWeakify(self);
[Api requestLuckGiftServerBagRecord:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
NSArray * array = [GiftLuckyBroadcastModel modelsWithArray:data.data];
[[self getView] luckyGiftBroadcastRecordSuccess:array];
}fail:^(NSInteger code, NSString * _Nullable msg) {
NSLog(@"%@",msg);
// NSLog(@"%@",msg);
}]];
}
///banner
- (void)getTwelveStarLastRankFirst:(NSString *)roomUid {
@kWeakify(self);
[Api requestTwelveStarFirst:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
GiftTwelveStarFirstModel * model = [GiftTwelveStarFirstModel modelWithDictionary:data.data];
[[self getView] getTwelveStarLastRankFirstSuccess:model];
}] roomUid:roomUid];

View File

@@ -54,10 +54,11 @@
///
/// @param giftId id
- (GiftInfoModel *)findGiftInfo:(NSString *)giftId {
GiftInfoModel * giftInfo = [self getGiftInfoFromDirectory:giftId];
if (giftInfo) {
return giftInfo;
}
// MARK:
// GiftInfoModel * giftInfo = [self getGiftInfoFromDirectory:giftId];
// if (giftInfo) {
// return giftInfo;
// }
if (self.currentRoomUid) {
NSArray<GiftInfoModel *> *giftLists = [self.roomGiftCache objectForKey:self.currentRoomUid];
@@ -142,7 +143,9 @@
///
[self saveGiftDatasource:info roomUid:roomUid];
[self writeGiftToDirectory:totalInfo];
// MARK:
// [self writeGiftToDirectory:totalInfo];
return info.copy;
}

View File

@@ -44,6 +44,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,assign) RoomType roomType;
///送背包礼物更新数据源
- (void)updatePackSource:(GiftReceiveInfoModel *)giftReceiveInfo numberUser:(NSInteger)numberUser;
- (void)showLoading;
- (void)hideLoading;
@end
NS_ASSUME_NONNULL_END

View File

@@ -43,6 +43,9 @@
@property (nonatomic,strong)XPGiftInfoView *nobleVC;
///
@property (nonatomic,strong)XPGiftInfoView *anchorVC;
@property (nonatomic, strong) UIActivityIndicatorView *loadingView;
@end
@implementation PIGiftInfoSegmentedView
@@ -52,15 +55,38 @@
self.segmentType = GiftSegmentType_Normal;
[self installUI];
[self installConstraints];
[self showLoading];
}
return self;
}
- (void)showLoading {
if (!_loadingView) {
_loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
_loadingView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_loadingView];
[NSLayoutConstraint activateConstraints:@[
[_loadingView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
[_loadingView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor]
]];
}
[self.loadingView startAnimating];
self.loadingView.hidden = NO;
}
- (void)hideLoading {
if (_loadingView) {
[self.loadingView stopAnimating];
self.loadingView.hidden = YES;
}
}
-(void)installUI{
[self addSubview:self.segmentBgView];
[self addSubview:self.titleView];
[self addSubview:self.pi_containerView];
[self addSubview:self.packGiftButton];
// [self addSubview:self.totalValueLabel];
[self addSubview:self.packGiftView];
}
@@ -80,17 +106,9 @@
}];
[self.packGiftButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(-15);
// make.top.mas_equalTo(2);
make.centerY.mas_equalTo(self.titleView);
// make.height.mas_equalTo(self.titleView);
// make.width.mas_equalTo(isMSRTL() ? 70:40);
make.size.mas_equalTo(CGSizeMake(14, 14));
}];
// [self.totalValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
// make.trailing.mas_equalTo(self.packGiftButton.mas_leading).mas_offset(-3);
// make.leading.equalTo(self.titleView.mas_trailing).mas_offset(5);
// make.centerY.mas_equalTo(self.packGiftButton);
// }];
[self.pi_containerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.bottom.equalTo(self);
make.top.equalTo(self.titleView.mas_bottom).mas_offset(kGetScaleWidth(0));
@@ -142,7 +160,6 @@
}
-(XPGiftInfoView *)getListVC:(NSInteger)index{
if(self.usingplaceType == SendGiftType_User){
return [@[self.normalVC,self.weekStarVC,self.nobleVC] xpSafeObjectAtIndex:index];
}
@@ -151,6 +168,7 @@
}
return [@[self.normalVC,self.luckyVC,self.weekStarVC,self.nobleVC] xpSafeObjectAtIndex:index];
}
-(NSInteger)getIndex{
if(self.usingplaceType == SendGiftType_User){
if(self.segmentType == GiftSegmentType_Normal){
@@ -168,6 +186,7 @@
NSString *index = [@[@"0",@"1",@"2",@"3"] xpSafeObjectAtIndex:self.segmentType];
return index.integerValue;
}
-(void)didClickGiftSegmentAction:(UIButton *)sender{
if (self.usingplaceType == SendGiftType_User) {
[self.packGiftButton setTitleColor:[DJDKMIMOMColor mainTextColor] forState:UIControlStateNormal];
@@ -182,30 +201,12 @@
[self.titleView reloadData];
self.packGiftView.hidden = NO;
self.pi_containerView.hidden = YES;
// self.totalValueLabel.hidden = NO;
self.segmentType = GiftSegmentType_Pack;
if(self.delegate && [self.delegate respondsToSelector:@selector(pIGiftInfoSegmentedView:didClickSegment:)]){
[self.delegate pIGiftInfoSegmentedView:self didClickSegment:self.segmentType];
}
}
//- (void)createPackTotalValueAttribute {
// __block NSInteger giftTotal = 0;
// [self.packOriginArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
// if ([obj isKindOfClass:GiftInfoModel.class]) {
// GiftInfoModel *gift = (GiftInfoModel *)obj;
// if(gift.giftId != self.freeModel.giftId.integerValue){
// giftTotal += gift.count * gift.goldPrice;
// }
// }
// }];
// NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPGiftInfoView0" ) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10],NSForegroundColorAttributeName:[DJDKMIMOMColor textThirdColor]}];
// [str appendAttributedString:[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",[self countFormatCoinStr:giftTotal]] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName:[DJDKMIMOMColor appMainColor]}]];
// NSTextAttachment *attachImage = [[NSTextAttachment alloc] init];
// attachImage.image = [UIImage imageNamed:@"exchange_gold_icon"];
// attachImage.bounds = CGRectMake(0, 0, 9, 9);
// [str appendAttributedString:[[NSMutableAttributedString alloc] initWithAttributedString:[NSAttributedString attributedStringWithAttachment:attachImage]]];
// self.totalValueLabel.attributedText = str;
//}
/**
xx.xxW29999W+
@param number
@@ -223,6 +224,7 @@
return numStr;
}
- (void)setNormalOriginArray:(NSArray *)normalOriginArray {
[self hideLoading];
_normalOriginArray = normalOriginArray;
NSMutableArray * normaleArray = [NSMutableArray array];
NSMutableArray * luckyArray = [NSMutableArray array];
@@ -257,7 +259,6 @@
-(void)setPackOriginArray:(NSArray *)packOriginArray{
_packOriginArray = packOriginArray;
self.packGiftView.packOriginArray = packOriginArray;
// [self createPackTotalValueAttribute];
}
-(void)setFreeModel:(XPFreeGiftModel *)freeModel{
_freeModel = freeModel;
@@ -366,9 +367,6 @@
- (UIButton *)packGiftButton {
if (!_packGiftButton) {
_packGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];
// [_packGiftButton setTitle:YMLocalizedString(@"XPGiftInfoView5") forState:UIControlStateNormal];
// [_packGiftButton setTitleColor:[DJDKMIMOMColor giftSegmentNormalTitleColor] forState:UIControlStateNormal];
// _packGiftButton.titleLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightSemibold];
[_packGiftButton setBackgroundImage:[UIImage imageNamed:@"gift_bag_icon"] forState:UIControlStateNormal];
_packGiftButton.tag = GiftSegmentType_Pack;
[_packGiftButton addTarget:self action:@selector(didClickGiftSegmentAction:) forControlEvents:UIControlEventTouchUpInside];

View File

@@ -95,6 +95,9 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
@property (nonatomic,strong) NSArray *records;
///
@property (nonatomic,copy) NSArray<GiftInfoModel *> * packGiftList;
@property (nonatomic, assign) bool didLoadPackGiftList;
@end
@implementation XPSendGiftView
@@ -116,6 +119,9 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
}
- (void)viewDidLoad {
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(getFreeGiftCountdownNotification:) name:kFreeGiftCountdownNotification object:nil];
[self initSubViews];
[self initSubViewConstraints];
[self initHttpRequest];
@@ -133,7 +139,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
[self.stackView addArrangedSubview:self.giftInfoView];
[self.stackView addArrangedSubview:self.giftBarView];
[self.stackView addArrangedSubview:self.bottomView];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(getFreeGiftCountdownNotification:) name:kFreeGiftCountdownNotification object:nil];
}
-(void)getFreeGiftCountdownNotification:(NSNotification *)not{
NSDictionary *freeDic = not.userInfo;
@@ -168,12 +174,14 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
}
- (void)initHttpRequest {
[self.presenter getNormalGiftList:self.roomUid];
[self.presenter getUserInfo:[AccountInfoStorage instance].getUid];
[self.presenter getUserWallInfo];
[self.presenter getNormalGiftList:self.roomUid];
[self.presenter getPackGiftList];
// [self.presenter getPackGiftList];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
[self.presenter luckyGiftBroadcastRecord];
// [self.presenter getTwelveStarLastRankFirst:self.roomUid];
});
}
#pragma mark - Send Custom Message
@@ -197,8 +205,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
[data addEntriesFromDictionary:dict];
if (receiveModel.gift.giftType == GiftType_Lucky) { //
NSArray *luckyBagGifts = (NSArray *)[data objectForKey:@"luckyBagGifts"];
// NSArray *displayGift = (NSArray *)[data objectForKey:@"displayGift"];
// NSMutableArray *displayList = [NSMutableArray array];
if (luckyBagGifts.count >0) {
for (int i = 0; i < luckyBagGifts.count; i++) {
NSMutableDictionary * data1 = [NSMutableDictionary dictionary];
@@ -207,18 +214,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
attachment.first = CustomMessageType_AllMicroSend;
attachment.second = Custom_Message_Sub_AllMicroLuckySend;
NSDictionary * obj = [luckyBagGifts xpSafeObjectAtIndex:i];
// NSArray *giftList = (NSArray *)obj[@"giftList"];
// for (NSDictionary *giftDic in giftList) {
// for (NSDictionary *displayDic in displayGift) {
// if([displayDic[@"giftId"]intValue] == [giftDic[@"giftId"]intValue]){
// NSMutableDictionary *mutDic = [[NSMutableDictionary alloc]initWithDictionary:displayDic];
// [mutDic setValue:giftDic[@"giftNum"] forKey:@"giftNum"];
// [displayList addObject:mutDic];
//
// }
// }
// }
// [data1 setValue:displayList forKey:@"displayGift"];
[data1 setObject:i == 0 ? @(YES):@(NO) forKey:@"isShowAnimation"];
[data1 setObject:obj forKey:@"luckyGiftList"];
[data1 setObject:receiveModel.gift.giftName forKey:@"giftName"];
@@ -577,6 +573,13 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
[self.superGiftView removeFromSuperview];
[self.luckyBroadcastView removeFromSuperview];
[self.constellationBanner removeFromSuperview];
if (!self.didLoadPackGiftList) {
self.didLoadPackGiftList = YES;
[self.giftInfoView showLoading];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
[self.presenter getPackGiftList];
});
}
}
}
@@ -675,6 +678,8 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
}
///
- (void)getPacketGiftListSuccess:(NSArray<GiftInfoModel *> *)giftList {
[self.giftInfoView hideLoading];
self.packGiftList = giftList;
NSMutableArray<GiftInfoModel *> *giftArray = [NSMutableArray arrayWithArray:self.packGiftList];
BOOL isHaveFreeGift = NO;
@@ -700,6 +705,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
}
- (void)getPacketGiftListFail:(NSString *)message {
[self.giftInfoView hideLoading];
self.packGiftRetryCount ++;
if (self.packGiftRetryCount <= 10) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

View File

@@ -47,7 +47,7 @@ NSString * const kMSGameLoaded = @"gameLoaded";
@interface MSRoomGameWebVC () <WKNavigationDelegate, WKScriptMessageHandler,WKUIDelegate>
@property (strong, nonatomic) WKWebView *webview;
@property (strong, nonatomic) WKWebView *webView;
@property (strong, nonatomic) UIProgressView *progressView;
@property (nonatomic, strong) WKUserContentController *ms_userContentController;
@property (nonatomic,weak) id<RoomHostDelegate> hostDelegate;
@@ -110,30 +110,58 @@ NSString * const kMSGameLoaded = @"gameLoaded";
int ScreenHeight = [[UIScreen mainScreen] bounds].size.height;
int ScreenWidth = [[UIScreen mainScreen] bounds].size.width;
self.webview = [[WKWebView alloc] initWithFrame:CGRectMake(0,0,
self.webView = [[WKWebView alloc] initWithFrame:CGRectMake(0,0,
ScreenWidth, ScreenHeight) configuration:config];
[self.webview.scrollView setBackgroundColor:[UIColor clearColor]];
[self.webview setBackgroundColor:[UIColor clearColor]];
[self.webview setUIDelegate:self];
self.webview.navigationDelegate = self;
[self.webView.scrollView setBackgroundColor:[UIColor clearColor]];
[self.webView setBackgroundColor:[UIColor clearColor]];
[self.webView setUIDelegate:self];
self.webView.navigationDelegate = self;
//
[self.webview setOpaque:NO];
[self.webView setOpaque:NO];
//
if (@available(iOS 11.0, *)) {
self.webview.scrollView.contentInsetAdjustmentBehavior =
self.webView.scrollView.contentInsetAdjustmentBehavior =
UIScrollViewContentInsetAdjustmentNever;
}
[self.view addSubview:self.webview];
[self.view addSubview:self.webView];
NSString *h5Url = self.gameModel.skipContent;
NSURL *url = [NSURL URLWithString:h5Url];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
[self.webview loadRequest:request];
[self.webView loadRequest:request];
}
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
#if DEBUG
NSString *fileName = @"vconsole.min.js"; //
NSString *directory = [[NSBundle mainBundle] resourcePath];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSDirectoryEnumerator *enumerator = [fileManager enumeratorAtPath:directory];
NSString *filePath;
for (NSString *path in enumerator) {
if ([[path lastPathComponent] containsString:fileName]) {
filePath = [directory stringByAppendingPathComponent:path];
break;
}
}
if (filePath.length > 0) {
NSString *vConsoleScript = [NSString stringWithContentsOfFile:filePath
encoding:NSUTF8StringEncoding error:nil];
[self.webView evaluateJavaScript:vConsoleScript completionHandler:nil];
// vConsole
NSString *initVConsoleScript = @"var vConsole = new VConsole();";
[self.webView evaluateJavaScript:initVConsoleScript completionHandler:nil];
}
#endif
}
- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler{
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
dispatch_async(dispatch_get_main_queue(), ^{
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSURLCredential *card = [[NSURLCredential alloc]initWithTrust:challenge.protectionSpace.serverTrust];
completionHandler(NSURLSessionAuthChallengeUseCredential,card);
});
@@ -143,6 +171,7 @@ NSString * const kMSGameLoaded = @"gameLoaded";
// JS
- (void)callJs:(NSString*)method withJavaScriptValue:(nullable id)arguments
{
@kWeakify(self);
if (arguments) {
NSData *data = [NSJSONSerialization dataWithJSONObject:arguments
options:(NSJSONWritingPrettyPrinted) error:nil];
@@ -150,15 +179,17 @@ NSString * const kMSGameLoaded = @"gameLoaded";
encoding:NSUTF8StringEncoding];
NSString *jsMethods = [NSString stringWithFormat:@"%@(%@)", method,
jsonStr];
[self.webview evaluateJavaScript:jsMethods completionHandler:^(id
[self.webView evaluateJavaScript:jsMethods completionHandler:^(id
_Nullable resp, NSError * _Nullable error) {
@kStrongify(self);
NSLog(@"error = %@ , response = %@",error, resp);
[self.backBtn removeFromSuperview];
}];
} else {
NSString *jsMethods = [NSString stringWithFormat:@"%@({})", method];
[self.webview evaluateJavaScript:jsMethods completionHandler:^(id
[self.webView evaluateJavaScript:jsMethods completionHandler:^(id
_Nullable resp, NSError * _Nullable error) {
@kStrongify(self);
NSLog(@"error = %@ , response = %@",error, resp);
[self.backBtn removeFromSuperview];
}];
@@ -189,7 +220,7 @@ NSString * const kMSGameLoaded = @"gameLoaded";
*)userContentController
didReceiveScriptMessage:(WKScriptMessage *)message
{
NSString* method = [NSString stringWithFormat:@"%@:", message.name];
// NSString* method = [NSString stringWithFormat:@"%@:", message.name];
NSDictionary *dicBody = [self dictionaryWithJsonString:message.body];
if ([message.name isEqualToString:kMSGetConfig]) {