迁移仓库
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#import "MainOldViewController.h"
|
||||
|
||||
|
||||
#import <Contacts/Contacts.h>
|
||||
#import <WebKit/WebKit.h>
|
||||
#import <SVProgressHUD.h>
|
||||
@@ -22,6 +23,8 @@
|
||||
#import "LinkConfig.h"
|
||||
|
||||
#import "NotiCenterViewController.h"
|
||||
#import "GDWebURLSchemeHandler.h"
|
||||
#import "GameWebViewController.h"
|
||||
|
||||
@interface MainOldViewController () <WKUIDelegate,WKNavigationDelegate,DSWebMenuDelegate>
|
||||
|
||||
@@ -32,6 +35,7 @@
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *dragHeightConstarint;
|
||||
@property (weak, nonatomic) IBOutlet DSWebMenuCollectionView *webMenuCollectionView;
|
||||
@property (nonatomic, strong) UIView *subBgView;
|
||||
//@property (nonatomic, copy) NSString *redirectUrl;
|
||||
|
||||
@end
|
||||
|
||||
@@ -52,6 +56,7 @@
|
||||
|
||||
WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init];
|
||||
wkWebConfig.preferences.javaScriptCanOpenWindowsAutomatically = YES;
|
||||
// [wkWebConfig setURLSchemeHandler:[GDWebURLSchemeHandler new] forURLScheme:@"https"];
|
||||
|
||||
_wkUController = [[WKUserContentController alloc] init];
|
||||
|
||||
@@ -63,18 +68,29 @@
|
||||
_webView.navigationDelegate = self;
|
||||
[self.view addSubview:_webView];
|
||||
|
||||
self.subBgView = [[UIView alloc] initWithFrame:self.view.frame];
|
||||
self.subBgView = [[UIView alloc] init];
|
||||
self.subBgView.backgroundColor = [UIColor whiteColor];
|
||||
self.subBgView.hidden = YES;
|
||||
[self.view addSubview:self.subBgView];
|
||||
self.subBgView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
// 上下左右边距均为0
|
||||
NSLayoutConstraint *top = [NSLayoutConstraint constraintWithItem:self.subBgView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
|
||||
|
||||
NSLayoutConstraint *left = [NSLayoutConstraint constraintWithItem:self.subBgView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0];
|
||||
|
||||
NSLayoutConstraint *right = [NSLayoutConstraint constraintWithItem:self.subBgView attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0];
|
||||
|
||||
NSLayoutConstraint *bottom = [NSLayoutConstraint constraintWithItem:self.subBgView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
|
||||
|
||||
[self.view addConstraints:@[top, left, right, bottom]];
|
||||
|
||||
NSMutableArray *menuArray = @[].mutableCopy;
|
||||
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
||||
NSInteger height = 0 ;
|
||||
if (self.isPresent != YES) {
|
||||
// if (self.isPresent != YES) {
|
||||
// 回到菜单按钮
|
||||
height = 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuHomeType]];
|
||||
// height = 60;
|
||||
// [menuArray addObject:[NSNumber numberWithInteger:DSWebMenuHomeType]];
|
||||
// 回到主页
|
||||
height = height + 60;
|
||||
LinkConfig *config = [[LinkConfig alloc] init];
|
||||
@@ -84,47 +100,39 @@
|
||||
config.linkUrl = appDelegate.mainURLString;
|
||||
[menuArray addObject:config];
|
||||
|
||||
// height = height + 70;
|
||||
//
|
||||
// LinkConfig *config2 = [[LinkConfig alloc] init];
|
||||
// config2.isGoBack = NO;
|
||||
// config2.icon = @"missav2";
|
||||
// config2.name = @"missav2";
|
||||
// config2.linkUrl = @"https://zh.xhamster.com";
|
||||
// [menuArray addObject:config2];
|
||||
// 菜单
|
||||
if (!ISNULLSTR(appDelegate.data.linkConfig)) {
|
||||
NSError *jsonError;
|
||||
id linkConfigResponse = [NSJSONSerialization JSONObjectWithData:[appDelegate.data.linkConfig dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&jsonError];
|
||||
if (jsonError==nil && [linkConfigResponse isKindOfClass:[NSArray class]]) {
|
||||
NSArray *linkConfigArray = linkConfigResponse;
|
||||
height = height + linkConfigArray.count*70;
|
||||
for (NSDictionary *dic in linkConfigArray) {
|
||||
LinkConfig *linkModel = [LinkConfig modelWithDictionary:dic];
|
||||
[menuArray addObject:linkModel];
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (!ISNULLSTR(appDelegate.data.linkConfig)) {
|
||||
// NSError *jsonError;
|
||||
// id linkConfigResponse = [NSJSONSerialization JSONObjectWithData:[appDelegate.data.linkConfig dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&jsonError];
|
||||
// if (jsonError==nil && [linkConfigResponse isKindOfClass:[NSArray class]]) {
|
||||
// NSArray *linkConfigArray = linkConfigResponse;
|
||||
// height = height + linkConfigArray.count*70;
|
||||
// for (NSDictionary *dic in linkConfigArray) {
|
||||
// LinkConfig *linkModel = [LinkConfig modelWithDictionary:dic];
|
||||
// [menuArray addObject:linkModel];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 客服平台
|
||||
if (!ISNULLSTR(appDelegate.data.fbUrl)) {
|
||||
height = height + 70;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuFacebookType]];
|
||||
}
|
||||
if (!ISNULLSTR(appDelegate.data.tgUrl)) {
|
||||
height = height + 70;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuTelegramType]];
|
||||
}
|
||||
if (!ISNULLSTR(appDelegate.data.wsUrl)) {
|
||||
height = height + 70;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuWhatsAppType]];
|
||||
}
|
||||
// if (!ISNULLSTR(appDelegate.data.fbUrl)) {
|
||||
// height = height + 70;
|
||||
// [menuArray addObject:[NSNumber numberWithInteger:DSWebMenuFacebookType]];
|
||||
// }
|
||||
// if (!ISNULLSTR(appDelegate.data.tgUrl)) {
|
||||
// height = height + 70;
|
||||
// [menuArray addObject:[NSNumber numberWithInteger:DSWebMenuTelegramType]];
|
||||
// }
|
||||
// if (!ISNULLSTR(appDelegate.data.wsUrl)) {
|
||||
// height = height + 70;
|
||||
// [menuArray addObject:[NSNumber numberWithInteger:DSWebMenuWhatsAppType]];
|
||||
// }
|
||||
// 刷新按钮
|
||||
height = height + 70;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuRefreshType]];
|
||||
// height = height + 70;
|
||||
// [menuArray addObject:[NSNumber numberWithInteger:DSWebMenuRefreshType]];
|
||||
// 推送中心按钮
|
||||
height = height + 70;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuNotiType]];
|
||||
}
|
||||
// }
|
||||
|
||||
self.webMenuCollectionView.shareArray = menuArray;
|
||||
self.webMenuCollectionView.webMenuDelegate = self;
|
||||
@@ -143,8 +151,8 @@
|
||||
if (self.isPresent == YES) {
|
||||
[self dismissViewControllerAnimated:YES completion:^{}];
|
||||
}else{
|
||||
self.webDragView.hidden = YES;
|
||||
self.webMenuCollectionView.hidden = NO;
|
||||
// self.webDragView.hidden = YES;
|
||||
// self.webMenuCollectionView.hidden = NO;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -229,8 +237,8 @@
|
||||
[self presentViewController:notiCenterViewController animated:NO completion:nil];
|
||||
}
|
||||
}
|
||||
self.webDragView.hidden = NO;
|
||||
self.webMenuCollectionView.hidden = YES;
|
||||
// self.webDragView.hidden = NO;
|
||||
// self.webMenuCollectionView.hidden = YES;
|
||||
}
|
||||
|
||||
-(void)intoMainWebView
|
||||
@@ -261,6 +269,17 @@
|
||||
newWebView.UIDelegate = self;
|
||||
newWebView.navigationDelegate = self;
|
||||
[self.subBgView addSubview:newWebView];
|
||||
newWebView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
// 上下左右边距均为0
|
||||
NSLayoutConstraint *top = [NSLayoutConstraint constraintWithItem:newWebView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.subBgView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
|
||||
|
||||
NSLayoutConstraint *left = [NSLayoutConstraint constraintWithItem:newWebView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.subBgView attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0];
|
||||
|
||||
NSLayoutConstraint *right = [NSLayoutConstraint constraintWithItem:newWebView attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.subBgView attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0];
|
||||
|
||||
NSLayoutConstraint *bottom = [NSLayoutConstraint constraintWithItem:newWebView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.subBgView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
|
||||
|
||||
[self.subBgView addConstraints:@[top, left, right, bottom]];
|
||||
|
||||
return newWebView;
|
||||
}else if (navigationAction.request.URL) {
|
||||
@@ -272,7 +291,10 @@
|
||||
view.isPresent = YES;
|
||||
view.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
[self presentViewController:view animated:YES completion:^{}];
|
||||
[view.view bringSubviewToFront:self.webMenuCollectionView];
|
||||
}
|
||||
|
||||
[self.view bringSubviewToFront:self.webMenuCollectionView];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user