From e985e99f367665c3eacac13d228a7db0990f1e56 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Tue, 22 Sep 2020 10:12:48 -0500 Subject: [PATCH] feat: reintroduce the dapp browser --- Makefile | 43 +++++++++++-------- ui/app/AppLayouts/Browser/BrowserLayout.qml | 30 +++++++++++++ .../Profile/Sections/AdvancedContainer.qml | 24 ++++++++++- ui/app/AppLayouts/qmldir | 1 + ui/app/AppMain.qml | 36 +++++++++++++++- ui/main.qml | 3 +- ui/nim-status-client.pro | 2 + ui/onboarding/Intro.qml | 11 ++++- 8 files changed, 127 insertions(+), 23 deletions(-) create mode 100644 ui/app/AppLayouts/Browser/BrowserLayout.qml diff --git a/Makefile b/Makefile index 00d30b8076..0babb14745 100644 --- a/Makefile +++ b/Makefile @@ -272,34 +272,41 @@ $(DMG_TOOL): echo -e "\e[92mInstalling:\e[39m create-dmg" npm i -MACOS_BUNDLE := tmp/macos/dist/Status.app +MACOS_OUTER_BUNDLE := tmp/macos/dist/Status.app +MACOS_INNER_BUNDLE := $(MACOS_OUTER_BUNDLE)/Contents/Frameworks/QtWebEngineCore.framework/Versions/Current/Helpers/QtWebEngineProcess.app STATUS_CLIENT_DMG ?= pkg/Status.dmg $(STATUS_CLIENT_DMG): nim_status_client $(DMG_TOOL) rm -rf tmp/macos pkg/*.dmg - mkdir -p $(MACOS_BUNDLE)/Contents/MacOS - mkdir -p $(MACOS_BUNDLE)/Contents/Resources - cp Info.plist $(MACOS_BUNDLE)/Contents/ - cp bin/nim_status_client $(MACOS_BUNDLE)/Contents/MacOS/ - cp nim_status_client.sh $(MACOS_BUNDLE)/Contents/MacOS/ - chmod +x $(MACOS_BUNDLE)/Contents/MacOS/nim_status_client.sh - cp status-icon.icns $(MACOS_BUNDLE)/Contents/Resources/ - cp status.svg $(MACOS_BUNDLE)/Contents/ - cp -R resources.rcc $(MACOS_BUNDLE)/Contents/ - mkdir -p $(MACOS_BUNDLE)/Contents/i18n - cp ui/i18n/* $(MACOS_BUNDLE)/Contents/i18n + mkdir -p $(MACOS_OUTER_BUNDLE)/Contents/MacOS + mkdir -p $(MACOS_OUTER_BUNDLE)/Contents/Resources + cp Info.plist $(MACOS_OUTER_BUNDLE)/Contents/ + cp bin/nim_status_client $(MACOS_OUTER_BUNDLE)/Contents/MacOS/ + cp nim_status_client.sh $(MACOS_OUTER_BUNDLE)/Contents/MacOS/ + chmod +x $(MACOS_OUTER_BUNDLE)/Contents/MacOS/nim_status_client.sh + cp status-icon.icns $(MACOS_OUTER_BUNDLE)/Contents/Resources/ + cp status.svg $(MACOS_OUTER_BUNDLE)/Contents/ + cp -R resources.rcc $(MACOS_OUTER_BUNDLE)/Contents/ + mkdir -p $(MACOS_OUTER_BUNDLE)/Contents/i18n + cp ui/i18n/* $(MACOS_OUTER_BUNDLE)/Contents/i18n echo -e $(BUILD_MSG) "app" macdeployqt \ - $(MACOS_BUNDLE) \ - -executable=$(MACOS_BUNDLE)/Contents/MacOS/nim_status_client \ + $(MACOS_OUTER_BUNDLE) \ + -executable=$(MACOS_OUTER_BUNDLE)/Contents/MacOS/nim_status_client \ -qmldir=ui - cp Info.runner.plist $(MACOS_BUNDLE)/Contents/Info.plist + cp Info.runner.plist $(MACOS_OUTER_BUNDLE)/Contents/Info.plist + macdeployqt \ + $(MACOS_INNER_BUNDLE) \ + -executable=$(MACOS_INNER_BUNDLE)/Contents/MacOS/QtWebEngineProcess - # if MACOS_CODESIGN_IDENT is not set then the .app bundle is not signed + # if MACOS_CODESIGN_IDENT is not set then the outer and inner .app + # bundles are not signed ifdef MACOS_CODESIGN_IDENT - scripts/sign-macos-pkg.sh $(MACOS_BUNDLE) $(MACOS_CODESIGN_IDENT) + scripts/sign-macos-pkg.sh $(MACOS_OUTER_BUNDLE) $(MACOS_CODESIGN_IDENT) + scripts/sign-macos-pkg.sh $(MACOS_INNER_BUNDLE) $(MACOS_CODESIGN_IDENT) \ + --entitlements QtWebEngineProcess.plist endif echo -e $(BUILD_MSG) "dmg" mkdir -p pkg @@ -308,7 +315,7 @@ endif # DMG icon based on app icon, but should otherwise work without it npx create-dmg \ --identity="NOBODY" \ - $(MACOS_BUNDLE) \ + $(MACOS_OUTER_BUNDLE) \ pkg || true # We ignore failure above create-dmg can't skip signing. # To work around that a dummy identity - 'NOBODY' - is specified. diff --git a/ui/app/AppLayouts/Browser/BrowserLayout.qml b/ui/app/AppLayouts/Browser/BrowserLayout.qml new file mode 100644 index 0000000000..a1100028ad --- /dev/null +++ b/ui/app/AppLayouts/Browser/BrowserLayout.qml @@ -0,0 +1,30 @@ +import QtQuick 2.13 +import QtQuick.Layouts 1.13 +import QtWebView 1.14 + +Item { + id: browserView + x: 0 + y: 0 + Layout.fillHeight: true + Layout.fillWidth: true + + WebView { + id: browserContainer + anchors.top: parent.top + anchors.topMargin: 0 + anchors.bottom: parent.bottom + anchors.bottomMargin: 0 + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + url: "https://dap.ps/" + } +} + +/*##^## +Designer { + D{i:0;autoSize:true;height:480;width:640} +} +##^##*/ diff --git a/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml b/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml index 94bfb5d9a3..798c6e52f3 100644 --- a/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml @@ -48,11 +48,33 @@ Item { } RowLayout { - id: nodeTabSettings + id: browserTabSettings anchors.top: walletTabSettings.bottom anchors.topMargin: 20 anchors.left: parent.left anchors.leftMargin: 24 + StyledText { + //% "Browser Tab" + text: qsTrId("browser-tab") + } + StatusSwitch { + checked: appSettings.browserEnabled + onCheckedChanged: function(value) { + appSettings.browserEnabled = this.checked + } + } + StyledText { + //% "experimental (web3 not supported yet)" + text: qsTrId("experimental-(web3-not-supported-yet)") + } + } + + RowLayout { + id: nodeTabSettings + anchors.top: browserTabSettings.bottom + anchors.topMargin: 20 + anchors.left: parent.left + anchors.leftMargin: 24 StyledText { //% "Node Management Tab" text: qsTrId("node-management-tab") diff --git a/ui/app/AppLayouts/qmldir b/ui/app/AppLayouts/qmldir index 4a0fe69885..d5c89add08 100644 --- a/ui/app/AppLayouts/qmldir +++ b/ui/app/AppLayouts/qmldir @@ -1,3 +1,4 @@ +BrowserLayout 1.0 Browser/BrowserLayout.qml ChatLayout 1.0 Chat/ChatLayout.qml NodeLayout 1.0 Node/NodeLayout.qml ProfileLayout 1.0 Profile/ProfileLayout.qml diff --git a/ui/app/AppMain.qml b/ui/app/AppMain.qml index 74282a0019..c91943d25a 100644 --- a/ui/app/AppMain.qml +++ b/ui/app/AppMain.qml @@ -106,6 +106,33 @@ RowLayout { } } + TabButton { + id: browserBtn + enabled: isExperimental === "1" || appSettings.browserEnabled + visible: this.enabled + width: 40 + height: this.enabled ? 40 : 0 + text: "" + anchors.topMargin: this.enabled ? 50 : 0 + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: walletBtn.top + background: Rectangle { + color: Style.current.secondaryBackground + opacity: parent.checked ? 1 : 0 + radius: 50 + } + + SVGImage { + id: image2 + height: 24 + width: 24 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + fillMode: Image.PreserveAspectFit + source: parent.checked ? "img/compassActive.svg" : "img/compass.svg" + } + } + TabButton { id: profileBtn width: 40 @@ -113,7 +140,7 @@ RowLayout { text: "" anchors.topMargin: 50 anchors.horizontalCenter: parent.horizontalCenter - anchors.top: walletBtn.top + anchors.top: browserBtn.top background: Rectangle { color: Style.current.secondaryBackground opacity: parent.checked ? 1 : 0 @@ -211,6 +238,13 @@ RowLayout { Layout.fillHeight: true } + BrowserLayout { + id: browserLayoutContainer + Layout.fillWidth: true + Layout.alignment: Qt.AlignLeft | Qt.AlignTop + Layout.fillHeight: true + } + ProfileLayout { id: profileLayoutContainer Layout.fillWidth: true diff --git a/ui/main.qml b/ui/main.qml index 6173daeaa4..80a8a6976e 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -73,6 +73,7 @@ ApplicationWindow { property var walletSplitView property var profileSplitView property bool walletEnabled: false + property bool browserEnabled: false property bool displayChatImages: false property bool compactMode property string locale: "en" @@ -195,7 +196,7 @@ ApplicationWindow { id: onboardingDoneState } } - + DSM.State { id: appState onEntered: loader.sourceComponent = app diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index 661e7b6dbe..c1dbd7f398 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -19,6 +19,7 @@ SOURCES = *.qml \ onboarding/*.qml \ onboarding/Login/*.qml \ app/AppLayouts/*.qml \ + app/AppLayouts/Browser/*.qml \ app/AppLayouts/Chat/*.qml \ app/AppLayouts/Chat/ChatColumn/*.qml \ app/AppLayouts/Chat/ChatColumn/ChatComponents/*.qml \ @@ -198,6 +199,7 @@ DISTFILES += \ fonts/InterStatus/InterStatus-Thin.otf \ fonts/InterStatus/InterStatus-ThinItalic.otf \ Theme.qml \ + app/AppLayouts/Browser/BrowserLayout.qml \ app/AppLayouts/Chat/ChatColumn.qml \ app/AppLayouts/Chat/ChatColumn/samples/MessagesData.qml \ app/AppLayouts/Chat/ChatColumn/samples/StickerData.qml \ diff --git a/ui/onboarding/Intro.qml b/ui/onboarding/Intro.qml index db6756d1f2..8a02e753a8 100644 --- a/ui/onboarding/Intro.qml +++ b/ui/onboarding/Intro.qml @@ -39,8 +39,15 @@ RowLayout { //% "Secure crypto wallet" title: qsTrId("intro-title2") //% "Send and receive digital assets anywhere in the\nworld--no bank account required" - description: qsTrId("send-and-receive-digital-assets-anywhere-in-the-nworld--no-bank-account-required") - isLast: true + description: qsTrId("send-and-receive-digital-assets-anywhere-in-the-nworld--no-bank-account-required") + } + Slide { + image: "img/browser@2x.jpg" + //% "Decentralized apps" + title: qsTrId("intro-title3") + //% "Explore games, exchanges and social networks\nwhere you alone own your data" + description: qsTrId("explore-games--exchanges-and-social-networks-nwhere-you-alone-own-your-data") + isLast: true } }