@tokamakdev/platform-ios-simulator-x64 0.1.1-beta.55 → 0.1.1-beta.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios-simulator-x64/build/entrypoint +16 -25
- package/ios-simulator-x64/frameworks/TokamakRuntime.framework/TokamakRuntime +0 -0
- package/ios-simulator-x64/native-shell/TokamakHost.swift +21 -38
- package/ios-simulator-x64/native-shell/TokamakPlugins.swift +6 -26
- package/ios-simulator-x64/native-shell/TokamakShell.swift +20 -90
- package/ios-simulator-x64/tools/tokamak-apple-signing +0 -0
- package/package.json +1 -1
|
@@ -53,13 +53,12 @@ case "$target" in
|
|
|
53
53
|
;;
|
|
54
54
|
esac
|
|
55
55
|
|
|
56
|
+
bundle=$output
|
|
56
57
|
if [[ "$platform" == macos ]]; then
|
|
57
|
-
bundle=$output
|
|
58
58
|
contents=$bundle/Contents
|
|
59
59
|
executable_dir=$contents/MacOS
|
|
60
60
|
app_dir=$contents/Resources/app
|
|
61
61
|
else
|
|
62
|
-
bundle=$output
|
|
63
62
|
contents=$bundle
|
|
64
63
|
executable_dir=$bundle
|
|
65
64
|
app_dir=$bundle/app
|
|
@@ -77,27 +76,21 @@ write_plist() {
|
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
sign_bundle() {
|
|
80
|
-
if [[ "$platform"
|
|
81
|
-
signing_args=(
|
|
82
|
-
sign
|
|
83
|
-
--platform ios
|
|
84
|
-
--project "$project_dir"
|
|
85
|
-
--bundle "$bundle"
|
|
86
|
-
--bundle-id "$identifier"
|
|
87
|
-
)
|
|
88
|
-
if [[ -f "$metadata/device-id" ]]; then
|
|
89
|
-
signing_args+=(--device-id "$(cat "$metadata/device-id")")
|
|
90
|
-
fi
|
|
91
|
-
"$apple_tool" "${signing_args[@]}"
|
|
92
|
-
elif [[ "$platform" == macos ]]; then
|
|
93
|
-
"$apple_tool" sign \
|
|
94
|
-
--platform macos \
|
|
95
|
-
--project "$project_dir" \
|
|
96
|
-
--bundle "$bundle" \
|
|
97
|
-
--bundle-id "$identifier"
|
|
98
|
-
else
|
|
79
|
+
if [[ "$platform" != ios && "$platform" != macos ]]; then
|
|
99
80
|
codesign --force --timestamp=none --sign - "$bundle"
|
|
81
|
+
return
|
|
82
|
+
fi
|
|
83
|
+
signing_args=(
|
|
84
|
+
sign
|
|
85
|
+
--platform "$platform"
|
|
86
|
+
--project "$project_dir"
|
|
87
|
+
--bundle "$bundle"
|
|
88
|
+
--bundle-id "$identifier"
|
|
89
|
+
)
|
|
90
|
+
if [[ "$platform" == ios && -f "$metadata/device-id" ]]; then
|
|
91
|
+
signing_args+=(--device-id "$(cat "$metadata/device-id")")
|
|
100
92
|
fi
|
|
93
|
+
"$apple_tool" "${signing_args[@]}"
|
|
101
94
|
}
|
|
102
95
|
|
|
103
96
|
bundle_key_file=$output_parent/.tokamak/$(basename "$output").input-key
|
|
@@ -184,14 +177,12 @@ done
|
|
|
184
177
|
registry=$temporary/TokamakPluginRegistry.swift
|
|
185
178
|
{
|
|
186
179
|
printf '%s\n\n' 'import Foundation'
|
|
187
|
-
printf '%s\n' 'func tokamakPlugins(host: TokamakHost) -> [any TokamakPlugin] {'
|
|
188
|
-
printf '%s\n' ' ['
|
|
180
|
+
printf '%s\n' 'func tokamakPlugins(host: TokamakHost) -> [any TokamakPlugin] {' ' ['
|
|
189
181
|
for plugin in "$input/plugins"/*; do
|
|
190
182
|
[[ -d "$plugin" ]] || continue
|
|
191
183
|
printf ' %s(host: host),\n' "$(cat "$plugin/class")"
|
|
192
184
|
done
|
|
193
|
-
printf '%s\n' ' ]'
|
|
194
|
-
printf '%s\n' '}'
|
|
185
|
+
printf '%s\n' ' ]' '}'
|
|
195
186
|
} > "$registry"
|
|
196
187
|
|
|
197
188
|
# The executable exports only the entry points of the runtime parts the app
|
|
Binary file
|
|
@@ -205,9 +205,7 @@ final class RuntimeHandle {
|
|
|
205
205
|
guard handle != nil else {
|
|
206
206
|
throw RuntimeError.runtime(String(cString: error))
|
|
207
207
|
}
|
|
208
|
-
try? FileManager.default.removeItem(
|
|
209
|
-
at: state.appendingPathComponent(startupErrorFile)
|
|
210
|
-
)
|
|
208
|
+
try? FileManager.default.removeItem(at: state.appendingPathComponent(startupErrorFile))
|
|
211
209
|
}
|
|
212
210
|
|
|
213
211
|
deinit {
|
|
@@ -223,11 +221,7 @@ final class RuntimeHandle {
|
|
|
223
221
|
func restoreGateway() throws -> UInt16 {
|
|
224
222
|
var error = [CChar](repeating: 0, count: 512)
|
|
225
223
|
let port = error.withUnsafeMutableBufferPointer { error in
|
|
226
|
-
tokamak_runtime_restore_gateway(
|
|
227
|
-
handle,
|
|
228
|
-
error.baseAddress,
|
|
229
|
-
error.count
|
|
230
|
-
)
|
|
224
|
+
tokamak_runtime_restore_gateway(handle, error.baseAddress, error.count)
|
|
231
225
|
}
|
|
232
226
|
guard port != 0 else {
|
|
233
227
|
throw RuntimeError.runtime(String(cString: error))
|
|
@@ -245,7 +239,7 @@ final class RuntimeHandle {
|
|
|
245
239
|
decoding: try JSONSerialization.data(withJSONObject: body, options: .fragmentsAllowed),
|
|
246
240
|
as: UTF8.self
|
|
247
241
|
)
|
|
248
|
-
var response = TokamakBytes(
|
|
242
|
+
var response = TokamakBytes()
|
|
249
243
|
var error = [CChar](repeating: 0, count: 1024)
|
|
250
244
|
let succeeded = name.withCString { name in
|
|
251
245
|
body.withCString { body in
|
|
@@ -266,14 +260,11 @@ final class RuntimeHandle {
|
|
|
266
260
|
guard succeeded else {
|
|
267
261
|
throw RuntimeError.runtime(String(cString: error))
|
|
268
262
|
}
|
|
269
|
-
|
|
270
|
-
return Data(bytes: bytes, count: response.len)
|
|
263
|
+
return response.contents ?? Data()
|
|
271
264
|
}
|
|
272
265
|
|
|
273
|
-
func serverAuthority(
|
|
274
|
-
|
|
275
|
-
) -> AuthenticationMaterial<Data> {
|
|
276
|
-
var bytes = TokamakBytes(data: nil, len: 0)
|
|
266
|
+
func serverAuthority(host: String) -> AuthenticationMaterial<Data> {
|
|
267
|
+
var bytes = TokamakBytes()
|
|
277
268
|
let decision = host.withCString {
|
|
278
269
|
tokamak_runtime_server_authority(handle, $0, &bytes)
|
|
279
270
|
}
|
|
@@ -282,28 +273,17 @@ final class RuntimeHandle {
|
|
|
282
273
|
return .defaultHandling
|
|
283
274
|
case Int32(TOKAMAK_DECISION_USE):
|
|
284
275
|
defer { tokamak_bytes_free(bytes) }
|
|
285
|
-
guard let
|
|
286
|
-
return .use(
|
|
276
|
+
guard let authority = bytes.contents else { return .cancel }
|
|
277
|
+
return .use(authority)
|
|
287
278
|
default:
|
|
288
279
|
return .cancel
|
|
289
280
|
}
|
|
290
281
|
}
|
|
291
282
|
|
|
292
|
-
func clientIdentity(
|
|
293
|
-
|
|
294
|
-
previousFailures: Int
|
|
295
|
-
) -> AuthenticationMaterial<(Data, Data)> {
|
|
296
|
-
var identity = TokamakIdentity(
|
|
297
|
-
certificate: TokamakBytes(data: nil, len: 0),
|
|
298
|
-
private_key: TokamakBytes(data: nil, len: 0)
|
|
299
|
-
)
|
|
283
|
+
func clientIdentity(host: String, previousFailures: Int) -> AuthenticationMaterial<(Data, Data)> {
|
|
284
|
+
var identity = TokamakIdentity()
|
|
300
285
|
let decision = host.withCString {
|
|
301
|
-
tokamak_runtime_client_identity(
|
|
302
|
-
handle,
|
|
303
|
-
$0,
|
|
304
|
-
max(previousFailures, 0),
|
|
305
|
-
&identity
|
|
306
|
-
)
|
|
286
|
+
tokamak_runtime_client_identity(handle, $0, max(previousFailures, 0), &identity)
|
|
307
287
|
}
|
|
308
288
|
switch decision {
|
|
309
289
|
case Int32(TOKAMAK_DECISION_DEFAULT):
|
|
@@ -311,16 +291,12 @@ final class RuntimeHandle {
|
|
|
311
291
|
case Int32(TOKAMAK_DECISION_USE):
|
|
312
292
|
defer { tokamak_identity_free(identity) }
|
|
313
293
|
guard
|
|
314
|
-
let certificate = identity.certificate.
|
|
315
|
-
let privateKey = identity.private_key.
|
|
294
|
+
let certificate = identity.certificate.contents,
|
|
295
|
+
let privateKey = identity.private_key.contents
|
|
316
296
|
else {
|
|
317
297
|
return .cancel
|
|
318
298
|
}
|
|
319
|
-
return .use(
|
|
320
|
-
(
|
|
321
|
-
Data(bytes: certificate, count: identity.certificate.len),
|
|
322
|
-
Data(bytes: privateKey, count: identity.private_key.len)
|
|
323
|
-
))
|
|
299
|
+
return .use((certificate, privateKey))
|
|
324
300
|
default:
|
|
325
301
|
return .cancel
|
|
326
302
|
}
|
|
@@ -364,3 +340,10 @@ final class RuntimeHandle {
|
|
|
364
340
|
.appendingPathComponent(identifier, isDirectory: true)
|
|
365
341
|
}
|
|
366
342
|
}
|
|
343
|
+
|
|
344
|
+
extension TokamakBytes {
|
|
345
|
+
/// A copy of the buffer, or nil when it is null.
|
|
346
|
+
fileprivate var contents: Data? {
|
|
347
|
+
data.map { Data(bytes: $0, count: len) }
|
|
348
|
+
}
|
|
349
|
+
}
|
|
@@ -121,8 +121,7 @@ final class TokamakPluginBridge: NSObject, WKScriptMessageHandler {
|
|
|
121
121
|
message.frameInfo.securityOrigin.isAppOrigin(host),
|
|
122
122
|
let encoded = message.body as? String,
|
|
123
123
|
let data = encoded.data(using: .utf8),
|
|
124
|
-
let request = try? JSONSerialization.jsonObject(with: data)
|
|
125
|
-
as? [String: Any],
|
|
124
|
+
let request = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
|
|
126
125
|
let type = request["type"] as? String,
|
|
127
126
|
let session = request["session"] as? String
|
|
128
127
|
else {
|
|
@@ -142,21 +141,13 @@ final class TokamakPluginBridge: NSObject, WKScriptMessageHandler {
|
|
|
142
141
|
dispatch(type: type, key: key, request: request)
|
|
143
142
|
}
|
|
144
143
|
|
|
145
|
-
private func dispatch(
|
|
146
|
-
type: String,
|
|
147
|
-
key: RequestKey,
|
|
148
|
-
request: [String: Any]
|
|
149
|
-
) {
|
|
144
|
+
private func dispatch(type: String, key: RequestKey, request: [String: Any]) {
|
|
150
145
|
guard
|
|
151
146
|
let pluginId = request["plugin"] as? String,
|
|
152
147
|
let method = request["method"] as? String,
|
|
153
148
|
let plugin = plugins[pluginId]
|
|
154
149
|
else {
|
|
155
|
-
send(
|
|
156
|
-
key: key,
|
|
157
|
-
result: .failure(.notSupported("Plugin is not supported")),
|
|
158
|
-
done: true
|
|
159
|
-
)
|
|
150
|
+
send(key: key, result: .failure(.notSupported("Plugin is not supported")), done: true)
|
|
160
151
|
return
|
|
161
152
|
}
|
|
162
153
|
let arguments = request["arguments"] ?? NSNull()
|
|
@@ -175,29 +166,18 @@ final class TokamakPluginBridge: NSObject, WKScriptMessageHandler {
|
|
|
175
166
|
cancellations[key] = cancellation
|
|
176
167
|
default:
|
|
177
168
|
send(
|
|
178
|
-
key: key,
|
|
179
|
-
result: .failure(.notSupported("Plugin operation is not supported")),
|
|
180
|
-
done: true
|
|
181
|
-
)
|
|
169
|
+
key: key, result: .failure(.notSupported("Plugin operation is not supported")), done: true)
|
|
182
170
|
}
|
|
183
171
|
}
|
|
184
172
|
|
|
185
173
|
/// Plugins reply from any thread; delivery happens on the main thread.
|
|
186
|
-
private func send(
|
|
187
|
-
key: RequestKey,
|
|
188
|
-
result: Result<Any?, TokamakPluginError>,
|
|
189
|
-
done: Bool
|
|
190
|
-
) {
|
|
174
|
+
private func send(key: RequestKey, result: Result<Any?, TokamakPluginError>, done: Bool) {
|
|
191
175
|
DispatchQueue.main.async { [weak self] in
|
|
192
176
|
self?.deliver(key: key, result: result, done: done)
|
|
193
177
|
}
|
|
194
178
|
}
|
|
195
179
|
|
|
196
|
-
private func deliver(
|
|
197
|
-
key: RequestKey,
|
|
198
|
-
result: Result<Any?, TokamakPluginError>,
|
|
199
|
-
done: Bool
|
|
200
|
-
) {
|
|
180
|
+
private func deliver(key: RequestKey, result: Result<Any?, TokamakPluginError>, done: Bool) {
|
|
201
181
|
if done {
|
|
202
182
|
cancellations.removeValue(forKey: key)?()
|
|
203
183
|
}
|
|
@@ -84,7 +84,6 @@ private final class NavigationDelegate: NSObject, WKNavigationDelegate, WKUIDele
|
|
|
84
84
|
for navigationAction: WKNavigationAction,
|
|
85
85
|
windowFeatures: WKWindowFeatures
|
|
86
86
|
) -> WKWebView? {
|
|
87
|
-
_ = (configuration, windowFeatures)
|
|
88
87
|
guard let url = navigationAction.request.url else { return nil }
|
|
89
88
|
if url.isAppOrigin(runtime.appHost) {
|
|
90
89
|
webView.load(navigationAction.request)
|
|
@@ -109,11 +108,7 @@ private final class NavigationDelegate: NSObject, WKNavigationDelegate, WKUIDele
|
|
|
109
108
|
func webView(
|
|
110
109
|
_ webView: WKWebView,
|
|
111
110
|
didReceive challenge: URLAuthenticationChallenge,
|
|
112
|
-
completionHandler:
|
|
113
|
-
@escaping (
|
|
114
|
-
URLSession.AuthChallengeDisposition,
|
|
115
|
-
URLCredential?
|
|
116
|
-
) -> Void
|
|
111
|
+
completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void
|
|
117
112
|
) {
|
|
118
113
|
let space = challenge.protectionSpace
|
|
119
114
|
switch space.authenticationMethod {
|
|
@@ -155,11 +150,7 @@ private final class NavigationDelegate: NSObject, WKNavigationDelegate, WKUIDele
|
|
|
155
150
|
private func answer(
|
|
156
151
|
_ material: AuthenticationMaterial<Data>,
|
|
157
152
|
trust: SecTrust?,
|
|
158
|
-
completion:
|
|
159
|
-
@escaping (
|
|
160
|
-
URLSession.AuthChallengeDisposition,
|
|
161
|
-
URLCredential?
|
|
162
|
-
) -> Void
|
|
153
|
+
completion: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void
|
|
163
154
|
) {
|
|
164
155
|
switch material {
|
|
165
156
|
case .defaultHandling:
|
|
@@ -169,14 +160,8 @@ private final class NavigationDelegate: NSObject, WKNavigationDelegate, WKUIDele
|
|
|
169
160
|
case .use(let authority):
|
|
170
161
|
guard
|
|
171
162
|
let trust,
|
|
172
|
-
let certificate = SecCertificateCreateWithData(
|
|
173
|
-
|
|
174
|
-
authority as CFData
|
|
175
|
-
),
|
|
176
|
-
SecTrustSetAnchorCertificates(
|
|
177
|
-
trust,
|
|
178
|
-
[certificate] as CFArray
|
|
179
|
-
) == errSecSuccess,
|
|
163
|
+
let certificate = SecCertificateCreateWithData(nil, authority as CFData),
|
|
164
|
+
SecTrustSetAnchorCertificates(trust, [certificate] as CFArray) == errSecSuccess,
|
|
180
165
|
SecTrustSetAnchorCertificatesOnly(trust, true) == errSecSuccess
|
|
181
166
|
else {
|
|
182
167
|
completion(.cancelAuthenticationChallenge, nil)
|
|
@@ -199,10 +184,7 @@ private final class NavigationDelegate: NSObject, WKNavigationDelegate, WKUIDele
|
|
|
199
184
|
|
|
200
185
|
private func answer(
|
|
201
186
|
_ material: AuthenticationMaterial<(Data, Data)>,
|
|
202
|
-
completion: (
|
|
203
|
-
URLSession.AuthChallengeDisposition,
|
|
204
|
-
URLCredential?
|
|
205
|
-
) -> Void
|
|
187
|
+
completion: (URLSession.AuthChallengeDisposition, URLCredential?) -> Void
|
|
206
188
|
) {
|
|
207
189
|
switch material {
|
|
208
190
|
case .defaultHandling:
|
|
@@ -210,36 +192,17 @@ private final class NavigationDelegate: NSObject, WKNavigationDelegate, WKUIDele
|
|
|
210
192
|
case .cancel:
|
|
211
193
|
completion(.cancelAuthenticationChallenge, nil)
|
|
212
194
|
case .use(let value):
|
|
213
|
-
guard
|
|
214
|
-
let identity = identity(
|
|
215
|
-
certificate: value.0,
|
|
216
|
-
privateKey: value.1
|
|
217
|
-
)
|
|
218
|
-
else {
|
|
195
|
+
guard let identity = identity(certificate: value.0, privateKey: value.1) else {
|
|
219
196
|
completion(.cancelAuthenticationChallenge, nil)
|
|
220
197
|
return
|
|
221
198
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
URLCredential(
|
|
225
|
-
identity: identity,
|
|
226
|
-
certificates: nil,
|
|
227
|
-
persistence: .none
|
|
228
|
-
)
|
|
229
|
-
)
|
|
199
|
+
let credential = URLCredential(identity: identity, certificates: nil, persistence: .none)
|
|
200
|
+
completion(.useCredential, credential)
|
|
230
201
|
}
|
|
231
202
|
}
|
|
232
203
|
|
|
233
|
-
private func identity(
|
|
234
|
-
certificate
|
|
235
|
-
privateKey: Data
|
|
236
|
-
) -> SecIdentity? {
|
|
237
|
-
guard
|
|
238
|
-
let certificate = SecCertificateCreateWithData(
|
|
239
|
-
nil,
|
|
240
|
-
certificate as CFData
|
|
241
|
-
)
|
|
242
|
-
else {
|
|
204
|
+
private func identity(certificate: Data, privateKey: Data) -> SecIdentity? {
|
|
205
|
+
guard let certificate = SecCertificateCreateWithData(nil, certificate as CFData) else {
|
|
243
206
|
return nil
|
|
244
207
|
}
|
|
245
208
|
let attributes: [CFString: Any] = [
|
|
@@ -247,12 +210,7 @@ private final class NavigationDelegate: NSObject, WKNavigationDelegate, WKUIDele
|
|
|
247
210
|
kSecAttrKeyClass: kSecAttrKeyClassPrivate,
|
|
248
211
|
kSecAttrKeySizeInBits: 256,
|
|
249
212
|
]
|
|
250
|
-
guard
|
|
251
|
-
let key = SecKeyCreateWithData(
|
|
252
|
-
privateKey as CFData,
|
|
253
|
-
attributes as CFDictionary,
|
|
254
|
-
nil
|
|
255
|
-
)
|
|
213
|
+
guard let key = SecKeyCreateWithData(privateKey as CFData, attributes as CFDictionary, nil)
|
|
256
214
|
else {
|
|
257
215
|
return nil
|
|
258
216
|
}
|
|
@@ -273,10 +231,7 @@ private final class TokamakController {
|
|
|
273
231
|
self.host = host
|
|
274
232
|
}
|
|
275
233
|
|
|
276
|
-
func start(
|
|
277
|
-
frame: CGRect,
|
|
278
|
-
completion: @escaping (WKWebView) -> Void
|
|
279
|
-
) {
|
|
234
|
+
func start(frame: CGRect, completion: @escaping (WKWebView) -> Void) {
|
|
280
235
|
host.whenStarted { result in
|
|
281
236
|
switch result {
|
|
282
237
|
case .success(let runtime):
|
|
@@ -315,15 +270,9 @@ private final class TokamakController {
|
|
|
315
270
|
#endif
|
|
316
271
|
configuration.mediaTypesRequiringUserActionForPlayback = []
|
|
317
272
|
|
|
318
|
-
let pluginBridge = TokamakPluginBridge(
|
|
319
|
-
host: runtime.appHost,
|
|
320
|
-
plugins: host.plugins
|
|
321
|
-
)
|
|
273
|
+
let pluginBridge = TokamakPluginBridge(host: runtime.appHost, plugins: host.plugins)
|
|
322
274
|
pluginBridge.install(in: configuration.userContentController)
|
|
323
|
-
let navigation = NavigationDelegate(
|
|
324
|
-
runtime: runtime,
|
|
325
|
-
pluginBridge: pluginBridge
|
|
326
|
-
)
|
|
275
|
+
let navigation = NavigationDelegate(runtime: runtime, pluginBridge: pluginBridge)
|
|
327
276
|
self.navigation = navigation
|
|
328
277
|
let webView = WKWebView(frame: frame, configuration: configuration)
|
|
329
278
|
#if os(iOS)
|
|
@@ -339,16 +288,9 @@ private final class TokamakController {
|
|
|
339
288
|
return webView
|
|
340
289
|
}
|
|
341
290
|
|
|
342
|
-
private func setProxy(
|
|
343
|
-
port: UInt16,
|
|
344
|
-
host: String,
|
|
345
|
-
dataStore: WKWebsiteDataStore
|
|
346
|
-
) {
|
|
291
|
+
private func setProxy(port: UInt16, host: String, dataStore: WKWebsiteDataStore) {
|
|
347
292
|
var proxy = ProxyConfiguration(
|
|
348
|
-
httpCONNECTProxy: .hostPort(
|
|
349
|
-
host: "127.0.0.1",
|
|
350
|
-
port: NWEndpoint.Port(rawValue: port)!
|
|
351
|
-
)
|
|
293
|
+
httpCONNECTProxy: .hostPort(host: "127.0.0.1", port: NWEndpoint.Port(rawValue: port)!)
|
|
352
294
|
)
|
|
353
295
|
proxy.matchDomains = [host]
|
|
354
296
|
proxy.allowFailover = false
|
|
@@ -371,19 +313,12 @@ private final class TokamakController {
|
|
|
371
313
|
func applicationDidFinishLaunching(_ notification: Notification) {
|
|
372
314
|
let window = NSWindow(
|
|
373
315
|
contentRect: NSRect(x: 0, y: 0, width: 1024, height: 768),
|
|
374
|
-
styleMask: [
|
|
375
|
-
.titled,
|
|
376
|
-
.closable,
|
|
377
|
-
.miniaturizable,
|
|
378
|
-
.resizable,
|
|
379
|
-
],
|
|
316
|
+
styleMask: [.titled, .closable, .miniaturizable, .resizable],
|
|
380
317
|
backing: .buffered,
|
|
381
318
|
defer: false
|
|
382
319
|
)
|
|
383
320
|
window.title =
|
|
384
|
-
Bundle.main.object(
|
|
385
|
-
forInfoDictionaryKey: "CFBundleName"
|
|
386
|
-
) as? String ?? "tokamak"
|
|
321
|
+
Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String ?? "tokamak"
|
|
387
322
|
window.center()
|
|
388
323
|
window.makeKeyAndOrderFront(nil)
|
|
389
324
|
NSApplication.shared.activate(ignoringOtherApps: true)
|
|
@@ -396,9 +331,7 @@ private final class TokamakController {
|
|
|
396
331
|
}
|
|
397
332
|
}
|
|
398
333
|
|
|
399
|
-
func applicationShouldTerminateAfterLastWindowClosed(
|
|
400
|
-
_ sender: NSApplication
|
|
401
|
-
) -> Bool {
|
|
334
|
+
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
|
402
335
|
true
|
|
403
336
|
}
|
|
404
337
|
|
|
@@ -451,10 +384,7 @@ private final class TokamakController {
|
|
|
451
384
|
self.window = window
|
|
452
385
|
|
|
453
386
|
controller.start(frame: viewController.view.bounds) { webView in
|
|
454
|
-
webView.autoresizingMask = [
|
|
455
|
-
.flexibleWidth,
|
|
456
|
-
.flexibleHeight,
|
|
457
|
-
]
|
|
387
|
+
webView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
458
388
|
viewController.view.addSubview(webView)
|
|
459
389
|
}
|
|
460
390
|
return true
|
|
Binary file
|