Skip to content

Commit 83b7835

Browse files
author
dsward2
committed
In this commit, the web view is updated from the legacy WebView to WKWebView. The functions in WebViewDelegate are updated accordingly.
1 parent a5f9fd7 commit 83b7835

File tree

5 files changed

+110
-149
lines changed

5 files changed

+110
-149
lines changed

LocalRadio/LocalRadio-Source/Base.lproj/MainMenu.xib

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ Gw
12341234
<font key="font" metaFont="system"/>
12351235
<tabViewItems>
12361236
<tabViewItem label="LocalRadio" identifier="" id="8Qy-d0-fpa">
1237-
<view key="view" id="bIe-XZ-nnh">
1237+
<view key="view" ambiguous="YES" id="bIe-XZ-nnh">
12381238
<rect key="frame" x="10" y="33" width="450" height="550"/>
12391239
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
12401240
<subviews>
@@ -1597,7 +1597,7 @@ Gw
15971597
</view>
15981598
</tabViewItem>
15991599
<tabViewItem label="Configuration" identifier="" id="Amd-pe-F7E">
1600-
<view key="view" ambiguous="YES" id="QdK-3V-Sdm">
1600+
<view key="view" id="QdK-3V-Sdm">
16011601
<rect key="frame" x="10" y="33" width="450" height="550"/>
16021602
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16031603
<subviews>
@@ -1836,7 +1836,7 @@ Gw
18361836
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18371837
<clipView key="contentView" id="aFL-0Q-zBm">
18381838
<rect key="frame" x="1" y="0.0" width="165" height="145"/>
1839-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1839+
<autoresizingMask key="autoresizingMask"/>
18401840
<subviews>
18411841
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="TBE-l0-bdo" viewBased="YES" id="hbf-Oj-gly">
18421842
<rect key="frame" x="0.0" y="0.0" width="165" height="122"/>
@@ -2101,7 +2101,7 @@ Gw
21012101
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
21022102
<clipView key="contentView" id="QV0-ek-CJh">
21032103
<rect key="frame" x="1" y="0.0" width="164" height="363"/>
2104-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2104+
<autoresizingMask key="autoresizingMask"/>
21052105
<subviews>
21062106
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="CB4-k0-f8U" viewBased="YES" id="Go3-wO-jgJ">
21072107
<rect key="frame" x="0.0" y="0.0" width="164" height="340"/>
@@ -2207,7 +2207,7 @@ Gw
22072207
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
22082208
<clipView key="contentView" id="caH-Rk-BaD">
22092209
<rect key="frame" x="1" y="0.0" width="165" height="363"/>
2210-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2210+
<autoresizingMask key="autoresizingMask"/>
22112211
<subviews>
22122212
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="spe-AD-2de" viewBased="YES" id="2yw-Em-uZv">
22132213
<rect key="frame" x="0.0" y="0.0" width="165" height="340"/>
@@ -2309,7 +2309,7 @@ Gw
23092309
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
23102310
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" copiesOnScroll="NO" id="qZz-7e-yFC">
23112311
<rect key="frame" x="0.0" y="0.0" width="166" height="340"/>
2312-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2312+
<autoresizingMask key="autoresizingMask"/>
23132313
<subviews>
23142314
<textView ambiguous="YES" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="1tw-0p-xoZ">
23152315
<rect key="frame" x="0.0" y="0.0" width="166" height="340"/>

LocalRadio/LocalRadio-Source/WebViewDelegate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#import <WebKit/WebKit.h>
1111
#import "AppDelegate.h"
1212

13-
@interface WebViewDelegate : NSObject <WebUIDelegate, WebPolicyDelegate, WebDownloadDelegate, WebFrameLoadDelegate, WebResourceLoadDelegate>
13+
@interface WebViewDelegate : NSObject <WKUIDelegate, WKNavigationDelegate>
1414

1515
@property (weak) IBOutlet AppDelegate * appDelegate;
16-
@property (strong) IBOutlet WebView * webView; // allocated in code
16+
@property (strong) IBOutlet WKWebView * webView; // allocated in code
1717
@property (weak) IBOutlet NSView * webViewParentView;
1818
@property (weak) IBOutlet NSWindow * webViewWindow;
1919

LocalRadio/LocalRadio-Source/WebViewDelegate.m

Lines changed: 22 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -23,95 +23,56 @@ -( void)loadMainPageOnMainThread
2323
if (self.webView == NULL)
2424
{
2525
NSRect webViewFrame = self.webViewParentView.bounds;
26-
self.webView = [[WebView alloc] initWithFrame:webViewFrame];
26+
self.webView = [[WKWebView alloc] initWithFrame:webViewFrame];
2727
[self.webViewParentView addSubview:self.webView];
2828
self.webView.UIDelegate = self;
29-
self.webView.policyDelegate = self;
30-
self.webView.downloadDelegate = self;
31-
self.webView.frameLoadDelegate = self;
32-
self.webView.resourceLoadDelegate = self;
29+
self.webView.navigationDelegate = self;
3330

3431
self.webView.customUserAgent = @"LocalRadio/1.0";
3532

3633
NSString * urlString = [self.appDelegate httpWebServerControllerURLString];
3734
NSURL * url = [NSURL URLWithString:urlString];
3835
NSURLRequest * urlRequest = [NSURLRequest requestWithURL:url];
39-
[[self.webView mainFrame] loadRequest:urlRequest];
36+
[self.webView loadRequest:urlRequest];
4037
}
4138
}
4239

4340

44-
45-
- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame
41+
- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler
4642
{
4743
[self.appDelegate showInformationSheetWithMessage:@"LocalRadio" informativeText:message];
4844
}
4945

5046

51-
52-
- (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(id)frame
47+
- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler
5348
{
54-
BOOL result = NO;
55-
NSInteger resultInteger = -1;
56-
49+
// this delegate method is called via JavaScript's confirm() function in localradio.js when a frequency or category record deletion is requested
5750
NSString * informativeText = @"Click OK button to delete the record.";
5851

5952
NSAlert * alert = [[NSAlert alloc] init];
6053
[alert setMessageText:message];
6154
[alert setInformativeText:informativeText];
6255
[alert addButtonWithTitle:@"OK"];
6356
[alert addButtonWithTitle:@"Cancel"];
64-
[alert setAlertStyle:NSWarningAlertStyle];
57+
[alert setAlertStyle:NSAlertStyleWarning];
6558

66-
[alert beginSheetModalForWindow:self.webViewWindow modalDelegate:self
67-
didEndSelector:@selector(confirmPanelAlertDidEnd:returnCode:contextInfo:) contextInfo:&resultInteger];
68-
69-
[NSApp runModalForWindow:self.webViewWindow];
70-
71-
if (resultInteger == 1)
59+
[alert beginSheetModalForWindow:self.webViewWindow completionHandler:^(NSModalResponse returnCode)
7260
{
73-
result = YES;
74-
}
75-
76-
return result;
77-
}
78-
79-
80-
- (void)confirmPanelAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo {
81-
NSInteger * resultPtr = contextInfo;
82-
if (returnCode == NSAlertFirstButtonReturn) {
83-
*resultPtr = 1;
84-
[[NSApplication sharedApplication] stopModal];
85-
}
86-
else if (returnCode == NSAlertSecondButtonReturn) {
87-
*resultPtr = 0;
88-
[[NSApplication sharedApplication] stopModal];
89-
}
90-
}
91-
92-
93-
94-
95-
- (void)webView:(WebView *)webView decidePolicyForNewWindowAction:(NSDictionary *)actionInformation
96-
request:(NSURLRequest *)request newFrameName:(NSString *)frameName
97-
decisionListener:(id<WebPolicyDecisionListener>)listener
98-
{
99-
[listener ignore]; // Ignore requests for new WebView window
100-
101-
// handle URL request with default web browser
102-
NSString * urlString = request.URL.absoluteString;
103-
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:urlString]];
104-
}
105-
106-
61+
// return NSAlertFirstButtonReturn for OK button or
62+
// NSAlertSecondButtonReturn for Cancel button
63+
64+
[[NSApplication sharedApplication] stopModalWithCode:returnCode];
65+
66+
BOOL result = NO;
67+
if (returnCode == NSAlertFirstButtonReturn)
68+
{
69+
result = YES;
70+
}
71+
72+
completionHandler(result);
73+
}];
10774

108-
- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation
109-
request:(NSURLRequest *)request
110-
frame:(WebFrame *)frame
111-
decisionListener:(id<WebPolicyDecisionListener>)listener
112-
{
113-
[listener use];
75+
[NSApp runModalForWindow:self.webViewWindow];
11476
}
11577

116-
11778
@end

wfm-tools/stereodemux/autom4te.cache/requests

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -34,47 +34,47 @@
3434
'configure.ac'
3535
],
3636
{
37-
'_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
38-
'AC_DEFUN_ONCE' => 1,
39-
'AC_CONFIG_MACRO_DIR_TRACE' => 1,
40-
'AC_CONFIG_MACRO_DIR' => 1,
41-
'AM_SET_LEADING_DOT' => 1,
42-
'_AM_PROG_CC_C_O' => 1,
37+
'AM_MISSING_PROG' => 1,
38+
'_AC_AM_CONFIG_HEADER_HOOK' => 1,
4339
'm4_include' => 1,
44-
'_AM_SET_OPTIONS' => 1,
45-
'_AM_DEPENDENCIES' => 1,
46-
'm4_pattern_forbid' => 1,
40+
'_AM_AUTOCONF_VERSION' => 1,
41+
'AM_SET_DEPDIR' => 1,
42+
'AM_SET_LEADING_DOT' => 1,
43+
'AM_SANITY_CHECK' => 1,
44+
'_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
45+
'AM_PROG_INSTALL_SH' => 1,
4746
'_AM_CONFIG_MACRO_DIRS' => 1,
48-
'AM_SUBST_NOTMAKE' => 1,
49-
'include' => 1,
5047
'AM_AUX_DIR_EXPAND' => 1,
51-
'AM_SILENT_RULES' => 1,
52-
'_AM_MANGLE_OPTION' => 1,
5348
'AM_PROG_CC_C_O' => 1,
54-
'_AM_SUBST_NOTMAKE' => 1,
5549
'AM_INIT_AUTOMAKE' => 1,
50+
'_AM_SET_OPTIONS' => 1,
51+
'AM_CONDITIONAL' => 1,
52+
'AU_DEFUN' => 1,
53+
'_AM_DEPENDENCIES' => 1,
54+
'AC_DEFUN_ONCE' => 1,
55+
'AM_MISSING_HAS_RUN' => 1,
56+
'_AM_PROG_CC_C_O' => 1,
5657
'AM_MAKE_INCLUDE' => 1,
57-
'_AM_PROG_TAR' => 1,
58-
'AM_DEP_TRACK' => 1,
5958
'm4_pattern_allow' => 1,
60-
'AM_MISSING_HAS_RUN' => 1,
61-
'AC_DEFUN' => 1,
62-
'_AM_IF_OPTION' => 1,
63-
'AM_PROG_INSTALL_STRIP' => 1,
64-
'AM_PROG_INSTALL_SH' => 1,
59+
'AC_CONFIG_MACRO_DIR_TRACE' => 1,
60+
'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1,
61+
'm4_pattern_forbid' => 1,
62+
'_AM_MANGLE_OPTION' => 1,
6563
'AM_RUN_LOG' => 1,
66-
'AU_DEFUN' => 1,
67-
'_AC_AM_CONFIG_HEADER_HOOK' => 1,
68-
'AM_SANITY_CHECK' => 1,
69-
'AM_AUTOMAKE_VERSION' => 1,
70-
'AM_SET_DEPDIR' => 1,
64+
'AM_DEP_TRACK' => 1,
65+
'AM_SILENT_RULES' => 1,
66+
'_AM_PROG_TAR' => 1,
67+
'AC_DEFUN' => 1,
68+
'_AM_SUBST_NOTMAKE' => 1,
7169
'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
72-
'AM_MISSING_PROG' => 1,
73-
'_AM_AUTOCONF_VERSION' => 1,
70+
'AM_SUBST_NOTMAKE' => 1,
7471
'_AM_SET_OPTION' => 1,
75-
'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1,
72+
'AM_PROG_INSTALL_STRIP' => 1,
73+
'_AM_IF_OPTION' => 1,
7674
'_m4_warn' => 1,
77-
'AM_CONDITIONAL' => 1
75+
'include' => 1,
76+
'AC_CONFIG_MACRO_DIR' => 1,
77+
'AM_AUTOMAKE_VERSION' => 1
7878
}
7979
], 'Autom4te::Request' ),
8080
bless( [
@@ -89,65 +89,65 @@
8989
'configure.ac'
9090
],
9191
{
92-
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
93-
'AH_OUTPUT' => 1,
94-
'AM_NLS' => 1,
95-
'AC_CANONICAL_BUILD' => 1,
96-
'LT_SUPPORTED_TAG' => 1,
97-
'_AM_COND_ELSE' => 1,
92+
'AC_DEFINE_TRACE_LITERAL' => 1,
9893
'AM_PROG_FC_C_O' => 1,
99-
'AM_MAKEFILE_INCLUDE' => 1,
100-
'AC_SUBST_TRACE' => 1,
101-
'AM_INIT_AUTOMAKE' => 1,
102-
'AC_FC_PP_DEFINE' => 1,
103-
'_AM_SUBST_NOTMAKE' => 1,
94+
'm4_pattern_forbid' => 1,
95+
'AM_ENABLE_MULTILIB' => 1,
96+
'_AM_COND_IF' => 1,
97+
'AM_PROG_F77_C_O' => 1,
10498
'AC_CANONICAL_TARGET' => 1,
105-
'AM_PROG_AR' => 1,
106-
'AC_LIBSOURCE' => 1,
107-
'_AM_MAKEFILE_INCLUDE' => 1,
108-
'AM_PROG_MOC' => 1,
109-
'_AM_COND_ENDIF' => 1,
110-
'AC_FC_SRCEXT' => 1,
99+
'AM_POT_TOOLS' => 1,
100+
'AC_CANONICAL_HOST' => 1,
101+
'AM_XGETTEXT_OPTION' => 1,
111102
'm4_pattern_allow' => 1,
112-
'AC_CONFIG_LIBOBJ_DIR' => 1,
103+
'AM_MAINTAINER_MODE' => 1,
104+
'AH_OUTPUT' => 1,
105+
'AM_MAKEFILE_INCLUDE' => 1,
106+
'AC_FC_FREEFORM' => 1,
113107
'AM_AUTOMAKE_VERSION' => 1,
114-
'AM_PROG_CXX_C_O' => 1,
108+
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
109+
'AC_CONFIG_HEADERS' => 1,
110+
'AC_CONFIG_AUX_DIR' => 1,
115111
'm4_sinclude' => 1,
116-
'AM_MAINTAINER_MODE' => 1,
117-
'AM_CONDITIONAL' => 1,
118-
'AC_DEFINE_TRACE_LITERAL' => 1,
112+
'AC_CONFIG_LIBOBJ_DIR' => 1,
113+
'AC_CANONICAL_SYSTEM' => 1,
114+
'sinclude' => 1,
115+
'AM_SILENT_RULES' => 1,
116+
'AM_PROG_AR' => 1,
117+
'_AM_SUBST_NOTMAKE' => 1,
118+
'LT_CONFIG_LTDL_DIR' => 1,
119119
'LT_INIT' => 1,
120+
'AC_SUBST_TRACE' => 1,
121+
'include' => 1,
120122
'_m4_warn' => 1,
123+
'LT_SUPPORTED_TAG' => 1,
124+
'AM_GNU_GETTEXT' => 1,
125+
'_AM_COND_ENDIF' => 1,
126+
'AC_FC_PP_DEFINE' => 1,
127+
'AM_NLS' => 1,
128+
'AC_INIT' => 1,
129+
'_AM_MAKEFILE_INCLUDE' => 1,
130+
'AM_PROG_CXX_C_O' => 1,
121131
'AC_CONFIG_SUBDIRS' => 1,
122-
'_AM_COND_IF' => 1,
123-
'AC_CANONICAL_HOST' => 1,
124-
'AC_CONFIG_AUX_DIR' => 1,
125-
'AC_REQUIRE_AUX_FILE' => 1,
126-
'm4_include' => 1,
127-
'AC_SUBST' => 1,
128-
'AM_PATH_GUILE' => 1,
129-
'AM_ENABLE_MULTILIB' => 1,
132+
'AC_CANONICAL_BUILD' => 1,
133+
'AC_FC_PP_SRCEXT' => 1,
130134
'AC_PROG_LIBTOOL' => 1,
131-
'AM_PROG_MKDIR_P' => 1,
132-
'AM_EXTRA_RECURSIVE_TARGETS' => 1,
133-
'sinclude' => 1,
134-
'AM_POT_TOOLS' => 1,
135-
'AC_CONFIG_HEADERS' => 1,
136-
'm4_pattern_forbid' => 1,
137-
'AM_GNU_GETTEXT' => 1,
135+
'm4_include' => 1,
136+
'AM_CONDITIONAL' => 1,
137+
'AC_CONFIG_LINKS' => 1,
138138
'AC_CONFIG_FILES' => 1,
139+
'AC_REQUIRE_AUX_FILE' => 1,
140+
'AM_PROG_MOC' => 1,
139141
'_LT_AC_TAGCONFIG' => 1,
140-
'AM_PROG_F77_C_O' => 1,
141-
'AC_FC_PP_SRCEXT' => 1,
142-
'AC_CONFIG_LINKS' => 1,
143-
'LT_CONFIG_LTDL_DIR' => 1,
144-
'AC_CANONICAL_SYSTEM' => 1,
145-
'AC_FC_FREEFORM' => 1,
146-
'include' => 1,
147-
'AC_INIT' => 1,
148-
'AM_PROG_CC_C_O' => 1,
149-
'AM_XGETTEXT_OPTION' => 1,
150-
'AM_SILENT_RULES' => 1
142+
'AC_FC_SRCEXT' => 1,
143+
'AM_PROG_MKDIR_P' => 1,
144+
'_AM_COND_ELSE' => 1,
145+
'AM_EXTRA_RECURSIVE_TARGETS' => 1,
146+
'AC_SUBST' => 1,
147+
'AM_PATH_GUILE' => 1,
148+
'AM_INIT_AUTOMAKE' => 1,
149+
'AC_LIBSOURCE' => 1,
150+
'AM_PROG_CC_C_O' => 1
151151
}
152152
], 'Autom4te::Request' )
153153
);

wfm-tools/stereodemux/config.log

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Kernel configured for up to 12 processors.
3030
Processor type: i486 (Intel 80486)
3131
Processors active: 0 1 2 3 4 5 6 7 8 9 10 11
3232
Primary memory available: 16.00 gigabytes
33-
Default processor set: 418 tasks, 1556 threads, 12 processors
34-
Load average: 1.44, Mach factor: 10.55
33+
Default processor set: 447 tasks, 1742 threads, 12 processors
34+
Load average: 1.92, Mach factor: 10.06
3535
/bin/machine = unknown
3636
/usr/bin/oslevel = unknown
3737
/bin/universe = unknown

0 commit comments

Comments
 (0)