| 9 | { |
| 10 | public: |
| 11 | MainViewController() |
| 12 | { |
| 13 | _window = std::make_shared<ui::Window>(); |
| 14 | _window->title = "KeeWeb"; |
| 15 | _window->geometry = Rect{0, 0, 1024, 768}; |
| 16 | _window->setLayout(std::make_shared<ui::yoga::Layout>()); |
| 17 | _window->stylesheet = |
| 18 | JsonStringify({"status-bar-style" : "light", "background-color" : "#000000", "use-unsafe-area" : true}); |
| 19 | |
| 20 | auto mainContainer = std::make_shared<ui::ContainerView>(); |
| 21 | mainContainer->stylesheet = FlexJsonStringify({"flexGrow" : 1.0}); |
| 22 | |
| 23 | auto webView = std::make_shared<ui::WebView>(); |
| 24 | webView->stylesheet = FlexJsonStringify({"flexGrow" : 1.0}); |
| 25 | webView->userAgent = "boden/0.1"; |
| 26 | webView->url = App()->uriToBundledFileUri("asset://main/keeweb/index.html"); |
| 27 | mainContainer->addChildView(webView); |
| 28 | |
| 29 | webView->redirectHandler = [=](const ui::WebView::RedirectRequest &request) { |
| 30 | logstream() << "Redirecting to: " << request.url; |
| 31 | return true; |
| 32 | }; |
| 33 | |
| 34 | _window->contentView = mainContainer; |
| 35 | _window->visible = true; |
| 36 | } |
| 37 | |
| 38 | protected: |
| 39 | std::shared_ptr<ui::Window> _window; |
| 40 | }; |
| 41 | |
| 42 | class WebViewDemoApplicationController : public ui::UIApplicationController |
| 43 | { |
nothing calls this directly
no test coverage detected