ios resources are now bundled with xcodegen beneplacito
This commit is contained in:
parent
322e7e0239
commit
6abbbf11ff
@ -28,14 +28,13 @@ PLUGIN_DIR ?= src
|
|||||||
API_DIR ?= $(PLUGIN_DIR)
|
API_DIR ?= $(PLUGIN_DIR)
|
||||||
MKINC_DIR ?= $(COMMON_DIR)
|
MKINC_DIR ?= $(COMMON_DIR)
|
||||||
|
|
||||||
BUILD_BIN_DIR := build/gen/src
|
BUILD_BIN_DIR := build/gen/res
|
||||||
BUILD_DATA_DIR := build/gen/src
|
BUILD_DATA_DIR := build/gen/res
|
||||||
|
|
||||||
-include $(MKINC_DIR)/vars-pre.mk
|
-include $(MKINC_DIR)/vars-pre.mk
|
||||||
|
|
||||||
SOURCES := \
|
SOURCES := \
|
||||||
$(DATA_DIR)/src/data.h \
|
$(DATA_DIR)/src/data.h \
|
||||||
$(DATA_DIR)/src/index.html \
|
|
||||||
$(COMMON_DIR)/src/app.swift \
|
$(COMMON_DIR)/src/app.swift \
|
||||||
$(COMMON_DIR)/src/native.mm \
|
$(COMMON_DIR)/src/native.mm \
|
||||||
$(COMMON_DIR)/src/app-Bridging-Header.h \
|
$(COMMON_DIR)/src/app-Bridging-Header.h \
|
||||||
@ -46,7 +45,10 @@ SOURCES := \
|
|||||||
$(SRCS_EXTRA)
|
$(SRCS_EXTRA)
|
||||||
SOURCES_OUT := $(addprefix build/gen/src/, $(notdir $(SOURCES)))
|
SOURCES_OUT := $(addprefix build/gen/src/, $(notdir $(SOURCES)))
|
||||||
|
|
||||||
DIRS := build build/gen build/gen/src
|
RESOURCES := $(DATA_DIR)/src/index.html
|
||||||
|
RESOURCES_OUT := $(addprefix build/gen/res/, $(notdir $(RESOURCES)))
|
||||||
|
|
||||||
|
DIRS := build build/gen build/gen/src build/gen/res
|
||||||
|
|
||||||
ALL := build/gen/$(BUNDLE_NAME).xcodeproj
|
ALL := build/gen/$(BUNDLE_NAME).xcodeproj
|
||||||
|
|
||||||
@ -54,7 +56,7 @@ ALL := build/gen/$(BUNDLE_NAME).xcodeproj
|
|||||||
|
|
||||||
all: $(ALL)
|
all: $(ALL)
|
||||||
|
|
||||||
build/gen/$(BUNDLE_NAME).xcodeproj: $(SOURCES_OUT)
|
build/gen/$(BUNDLE_NAME).xcodeproj: $(SOURCES_OUT) $(RESOURCES_OUT)
|
||||||
xcodegen generate --spec project.yml -r build/gen -p build/gen
|
xcodegen generate --spec project.yml -r build/gen -p build/gen
|
||||||
|
|
||||||
$(DIRS):
|
$(DIRS):
|
||||||
@ -74,4 +76,7 @@ PERCENT := %
|
|||||||
$(SOURCES_OUT): build/gen/src/%: $$(filter $$(PERCENT)/%,$$(SOURCES)) | build/gen/src
|
$(SOURCES_OUT): build/gen/src/%: $$(filter $$(PERCENT)/%,$$(SOURCES)) | build/gen/src
|
||||||
cp -R $^ $@
|
cp -R $^ $@
|
||||||
|
|
||||||
|
$(RESOURCES_OUT): build/gen/res/%: $$(filter $$(PERCENT)/%,$$(RESOURCES)) | build/gen/res
|
||||||
|
cp -R $^ $@
|
||||||
|
|
||||||
-include $(MKINC_DIR)/rules-secondexp-extra.mk
|
-include $(MKINC_DIR)/rules-secondexp-extra.mk
|
||||||
|
@ -30,6 +30,8 @@ targets:
|
|||||||
type: application
|
type: application
|
||||||
sources:
|
sources:
|
||||||
- path: src
|
- path: src
|
||||||
|
- path: res
|
||||||
|
type: folder
|
||||||
|
|
||||||
{{?it.ios_make.dependencies}}
|
{{?it.ios_make.dependencies}}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -67,7 +67,8 @@ struct WebView: UIViewRepresentable {
|
|||||||
|
|
||||||
func makeUIView(context: Context) -> WKWebView {
|
func makeUIView(context: Context) -> WKWebView {
|
||||||
let configuration = WKWebViewConfiguration()
|
let configuration = WKWebViewConfiguration()
|
||||||
configuration.userContentController.addScriptMessageHandler(Coordinator(), contentWorld: .page, name: "listener")
|
configuration.userContentController.addScriptMessageHandler(Coordinator(), contentWorld: .page, name: "messageHandler")
|
||||||
|
configuration.setValue(true, forKey: "allowUniversalAccessFromFileURLs")
|
||||||
let webView = WKWebView(frame: .zero, configuration: configuration)
|
let webView = WKWebView(frame: .zero, configuration: configuration)
|
||||||
//webView.isInspectable = true
|
//webView.isInspectable = true
|
||||||
return webView
|
return webView
|
||||||
@ -81,7 +82,7 @@ struct WebView: UIViewRepresentable {
|
|||||||
|
|
||||||
struct ContentView: View {
|
struct ContentView: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
let url = Bundle.main.url(forResource: "index", withExtension: "html")
|
let url = Bundle.main.url(forResource: "index", withExtension: "html", subdirectory: "res")
|
||||||
WebView(url: url!)
|
WebView(url: url!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<title>{{=it.product.name}}</title>
|
<title>{{=it.product.name}}</title>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function request(data) {
|
function request(data) {
|
||||||
return window.webkit.messageHandlers.listener.postMessage(data);
|
return window.webkit.messageHandlers.messageHandler.postMessage(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function needAudioPermission() {
|
function needAudioPermission() {
|
||||||
|
Loading…
Reference in New Issue
Block a user