11
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#import "ConfigDataModel.h"
|
||||
#import "LinkConfig.h"
|
||||
|
||||
#import "NotiCenterViewController.h"
|
||||
|
||||
@interface MainOldViewController () <WKUIDelegate,WKNavigationDelegate,DSWebMenuDelegate>
|
||||
|
||||
@property (strong, nonatomic) WKWebView *webView;
|
||||
@@ -45,7 +47,7 @@
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.mainUserId = Tinju55UserID;
|
||||
self.mainUserId = TESTUserID;
|
||||
|
||||
WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init];
|
||||
wkWebConfig.preferences.javaScriptCanOpenWindowsAutomatically = YES;
|
||||
@@ -62,92 +64,73 @@
|
||||
|
||||
NSMutableArray *menuArray = @[].mutableCopy;
|
||||
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
||||
// 回到菜单按钮
|
||||
NSInteger height = 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuHomeType]];
|
||||
// 回到主页
|
||||
height = height + 60;
|
||||
LinkConfig *config = [[LinkConfig alloc] init];
|
||||
config.isGoBack = YES;
|
||||
config.icon = @"";
|
||||
config.name = @"HOME";
|
||||
config.linkUrl = appDelegate.mainURLString;
|
||||
[menuArray addObject:config];
|
||||
// 菜单
|
||||
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*60;
|
||||
for (NSDictionary *dic in linkConfigArray) {
|
||||
LinkConfig *linkModel = [LinkConfig modelWithDictionary:dic];
|
||||
[menuArray addObject:linkModel];
|
||||
NSInteger height = 0 ;
|
||||
if (self.isPresent != YES) {
|
||||
// 回到菜单按钮
|
||||
height = 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuHomeType]];
|
||||
// 回到主页
|
||||
height = height + 60;
|
||||
LinkConfig *config = [[LinkConfig alloc] init];
|
||||
config.isGoBack = YES;
|
||||
config.icon = @"";
|
||||
config.name = @"HOME";
|
||||
config.linkUrl = appDelegate.mainURLString;
|
||||
[menuArray addObject:config];
|
||||
// 菜单
|
||||
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]];
|
||||
}
|
||||
// 刷新按钮
|
||||
height = height + 70;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuRefreshType]];
|
||||
// 推送中心按钮
|
||||
height = height + 70;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuNotiType]];
|
||||
}
|
||||
// 客服平台
|
||||
if (!ISNULLSTR(appDelegate.data.fbUrl)) {
|
||||
height = height + 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuFacebookType]];
|
||||
}
|
||||
if (!ISNULLSTR(appDelegate.data.tgUrl)) {
|
||||
height = height + 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuTelegramType]];
|
||||
}
|
||||
if (!ISNULLSTR(appDelegate.data.wsUrl)) {
|
||||
height = height + 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuWhatsAppType]];
|
||||
}
|
||||
// 刷新按钮
|
||||
height = height + 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuRefreshType]];
|
||||
|
||||
self.webMenuCollectionView.shareArray = menuArray;
|
||||
self.webMenuCollectionView.webMenuDelegate = self;
|
||||
|
||||
height = height + 10;
|
||||
if (height > self.view.frame.size.height) {
|
||||
height = self.view.frame.size.height;
|
||||
self.webMenuCollectionView.scrollEnabled = YES;
|
||||
}else{
|
||||
self.webMenuCollectionView.scrollEnabled = NO;
|
||||
}
|
||||
self.dragHeightConstarint.constant = height;
|
||||
self.webDragView.freeRect = CGRectMake(0, 128, self.view.frame.size.width, self.view.frame.size.height-128);
|
||||
self.webDragView.isKeepBounds = YES;
|
||||
self.webDragView.clickDragViewBlock = ^(WMDragView *dragView) {
|
||||
self.webDragView.hidden = YES;
|
||||
self.webMenuCollectionView.hidden = NO;
|
||||
/*
|
||||
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
||||
UIAlertController *alertview = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:(UIAlertControllerStyleActionSheet)];
|
||||
UIAlertAction *homepageAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"HOMEPAGE", nil) style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
if (weakSelf.isPresent == YES) {
|
||||
[weakSelf dismissViewControllerAnimated:YES completion:^{}];
|
||||
}else{
|
||||
weakSelf.isPresent = NO;
|
||||
[weakSelf intoMainWebView];
|
||||
}
|
||||
}];
|
||||
[alertview addAction:homepageAction];
|
||||
if (!ISNULLSTR(appDelegate.data.wsUrl)) {
|
||||
UIAlertAction *whatsAppAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Share With WhatsApp", nil) style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://wa.me/message/%@",appDelegate.data.wsUrl]] options:@{UIApplicationOpenURLOptionUniversalLinksOnly:@NO} completionHandler:^(BOOL success) {}];
|
||||
}];
|
||||
[alertview addAction:whatsAppAction];
|
||||
if (self.isPresent == YES) {
|
||||
[self dismissViewControllerAnimated:YES completion:^{}];
|
||||
}else{
|
||||
self.webDragView.hidden = YES;
|
||||
self.webMenuCollectionView.hidden = NO;
|
||||
}
|
||||
if (!ISNULLSTR(appDelegate.data.tgUrl)) {
|
||||
UIAlertAction *telegramAppAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Share With Telegram", nil) style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://t.me/%@",appDelegate.data.tgUrl]] options:@{UIApplicationOpenURLOptionUniversalLinksOnly:@NO} completionHandler:^(BOOL success) {}];
|
||||
}];
|
||||
[alertview addAction:telegramAppAction];
|
||||
}
|
||||
if (!ISNULLSTR(appDelegate.data.fbUrl)) {
|
||||
UIAlertAction *fbAppAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Share With Facebook", nil) style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"fb://profile/%@",appDelegate.data.fbUrl]] options:@{UIApplicationOpenURLOptionUniversalLinksOnly:@NO} completionHandler:^(BOOL success) {}];
|
||||
}];
|
||||
[alertview addAction:fbAppAction];
|
||||
}
|
||||
UIAlertAction *cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"CANCEL", nil) style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) {}];
|
||||
[alertview addAction:cancel];
|
||||
[weakSelf presentViewController:alertview animated:YES completion:^{}];
|
||||
*/
|
||||
};
|
||||
|
||||
if (self.isPresent == YES) {
|
||||
@@ -207,6 +190,10 @@
|
||||
if (!ISNULLSTR(appDelegate.data.fbUrl)) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",appDelegate.data.fbUrl]] options:@{UIApplicationOpenURLOptionUniversalLinksOnly:@NO} completionHandler:^(BOOL success) {}];
|
||||
}
|
||||
}else if (menuType == DSWebMenuNotiType) {
|
||||
NotiCenterViewController *notiCenterViewController = [[NotiCenterViewController alloc] initWithNibName:@"NotiCenterViewController" bundle:nil];
|
||||
notiCenterViewController.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
[self presentViewController:notiCenterViewController animated:NO completion:nil];
|
||||
}
|
||||
}
|
||||
self.webDragView.hidden = NO;
|
||||
|
||||
Reference in New Issue
Block a user