ios: Replace the browser navigation buttons with gestures, disable pinch to zoom, and round a button to make it feel more like a native app.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 18m30s

This commit is contained in:
2025-11-12 19:31:33 -05:00
parent 50b2c0c7f4
commit 42df0d830e
3 changed files with 15 additions and 28 deletions

View File

@@ -59,7 +59,7 @@
delete it now.
</p>
<div class="w3-center w3-margin">
<a class="w3-button w3-blue" href="/eula/accept">Accept Agreement</a>
<a class="w3-button w3-blue w3-round-large" href="/eula/accept">Accept Agreement</a>
</div>
</body>
</html>

View File

@@ -5,7 +5,7 @@
<link type="text/css" rel="stylesheet" href="/static/style.css" />
<link type="text/css" rel="stylesheet" href="/static/w3.css" />
<link type="image/svg+xml" rel="icon" href="/static/tildefriends.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta
name="title"
content="Tilde Friends - Make friends and apps from your web browser."

View File

@@ -35,20 +35,17 @@ static void _start_initial_load(WKWebView* web_view)
{
[super viewDidLoad];
[self setToolbarHidden:false animated:false];
self.toolbar.items = @[
[[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(goBack)],
[[UIBarButtonItem alloc] initWithTitle:@"Forward" style:UIBarButtonItemStylePlain target:self action:@selector(goForward)],
[[UIBarButtonItem alloc] initWithTitle:@"Refresh" style:UIBarButtonItemStylePlain target:self action:@selector(reload)]
];
WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init];
self.web_view = [[WKWebView alloc] initWithFrame:self.view.frame configuration:configuration];
self.web_view.UIDelegate = self;
self.web_view.navigationDelegate = self;
self.web_view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
self.web_view.translatesAutoresizingMaskIntoConstraints = false;
self.web_view.allowsBackForwardNavigationGestures = true;
[self.view addSubview:self.web_view];
UIRefreshControl* refresh = [[UIRefreshControl alloc] init];
[refresh addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];
self.web_view.scrollView.refreshControl = refresh;
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.web_view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view
attribute:NSLayoutAttributeTop
@@ -70,31 +67,21 @@ static void _start_initial_load(WKWebView* web_view)
_start_initial_load(self.web_view);
}
- (void)goBack
{
if (self.web_view.canGoBack)
{
[self.web_view goBack];
}
}
- (void)goForward
{
if (self.web_view.canGoForward)
{
[self.web_view goForward];
}
}
- (void)reload
- (void)handleRefresh:(id)sender
{
tf_printf("refresh\n");
[self.web_view reload];
}
- (void)webView:(WKWebView*)webView didFinishNavigation:(WKNavigation*)navigation
{
self.initial_load_complete = true;
tf_printf("initial load complete\n");
if (!self.initial_load_complete)
{
tf_printf("initial load complete\n");
self.initial_load_complete = true;
}
self.navigationController.interactivePopGestureRecognizer.enabled = self.web_view.canGoBack;
[self.web_view.scrollView.refreshControl endRefreshing];
}
- (void)webView:(WKWebView*)webView didFailProvisionalNavigation:(WKNavigation*)navigation withError:(NSError*)error