Files
PojavLauncher_iOS/Natives/LauncherNewsViewController.m
T
Eilionoir Tunnicliff ab5bd8469e Changes
- Removed FAQ, About Launcher, and Update History buttons
- Moved *.png to Assets.xcassets
- Moved LPVC2 to LPVC
2022-11-10 00:03:37 -05:00

42 lines
1.4 KiB
Objective-C

#import <SafariServices/SafariServices.h>
#import <WebKit/WebKit.h>
#import "LauncherNewsViewController.h"
@interface LauncherNewsViewController()<WKNavigationDelegate>
@end
@implementation LauncherNewsViewController
- (NSString *)imageName {
return @"MenuJava";
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://pojavlauncherteam.github.io/changelogs/IOS.html"]];
WKWebViewConfiguration *webConfig = [[WKWebViewConfiguration alloc] init];
WKWebView *webView = [[WKWebView alloc] initWithFrame:self.view.frame configuration:webConfig];
webView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
webView.navigationDelegate = self;
webView.opaque = NO;
[webView loadRequest:request];
[self.view addSubview:webView];
}
- (void)webView:(WKWebView *)webView
decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
if (navigationAction.navigationType == WKNavigationTypeLinkActivated) {
SFSafariViewController *vc = [[SFSafariViewController alloc] initWithURL:navigationAction.request.URL];
[self presentViewController:vc animated:YES completion:nil];
decisionHandler(WKNavigationActionPolicyCancel);
return;
}
decisionHandler(WKNavigationActionPolicyAllow);
}
@end