This commit is contained in:
Yao
2025-01-11 14:58:16 +08:00
parent f82486e8b0
commit 1095c32599
262 changed files with 62730 additions and 36131 deletions

View File

@@ -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;