@@ -17,6 +17,7 @@ import shared.popups.send
1717import shared.stores.send
1818
1919import AppLayouts.Browser.stores as BrowserStores
20+ import AppLayouts.Wallet.services.dapps
2021
2122import "provider/qml"
2223import "popups"
@@ -40,6 +41,7 @@ StatusSectionLayout {
4041 required property BrowserStores .BrowserRootStore browserRootStore
4142 required property BrowserStores .BrowserWalletStore browserWalletStore
4243 required property var connectorController
44+ property bool isDebugEnabled: false
4345
4446 signal sendToRecipientRequested (string address)
4547
@@ -62,6 +64,12 @@ StatusSectionLayout {
6264 }
6365 }
6466
67+ BCBrowserDappsProvider {
68+ id: browserDappsProvider
69+ connectorController: root .connectorController
70+ clientId: connectorBridge .clientId // "status-desktop/dapp-browser"
71+ }
72+
6573 QtObject {
6674 id: _internal
6775
@@ -163,11 +171,21 @@ StatusSectionLayout {
163171 canGoBack: (!! _internal .currentWebView && _internal .currentWebView .canGoBack )
164172 canGoForward: (!! _internal .currentWebView && _internal .currentWebView .canGoForward )
165173 currentTabConnected: root .browserRootStore .currentTabConnected
174+ browserDappsModel: browserDappsProvider .model
175+ browserDappsCount: browserDappsProvider .model ? browserDappsProvider .model .count : 0
166176 onOpenHistoryPopup : (xPos , yPos ) => historyMenu .popup (xPos, yPos)
167177 onGoBack: _internal .currentWebView .goBack ()
168178 onGoForward: _internal .currentWebView .goForward ()
169179 onReload: _internal .currentWebView .reload ()
170180 onStopLoading: _internal .currentWebView .stop ()
181+ onOpenDappUrl : function (url ) {
182+ if (_internal .currentWebView ) {
183+ _internal .currentWebView .url = _internal .determineRealURL (url)
184+ }
185+ }
186+ onDisconnectDapp : function (dappUrl ) {
187+ connectorBridge .disconnect (dappUrl)
188+ }
171189 onAddNewFavoriteClicked : function (xPos ) {
172190 Global .openPopup (addFavoriteModal,
173191 {
@@ -360,6 +378,7 @@ StatusSectionLayout {
360378 }
361379 }
362380 onDisconnect: {
381+ connectorBridge .disconnectCurrentTab ()
363382 _internal .currentWebView .reload ()
364383 close ()
365384 }
@@ -451,6 +470,8 @@ StatusSectionLayout {
451470 favMenu: favoriteMenu
452471 addFavModal: addFavoriteModal
453472 downloadsMenu: downloadMenu
473+ enableJsLogs: root .isDebugEnabled
474+
454475 determineRealURLFn : function (url ) {
455476 return _internal .determineRealURL (url)
456477 }
@@ -532,12 +553,23 @@ StatusSectionLayout {
532553 target: _internal .currentWebView
533554 function onUrlChanged () {
534555 browserHeader .addressBar .text = root .browserRootStore .obtainAddress (_internal .currentWebView .url )
535- root .browserRootStore .currentTabConnected = false // TODO: Will be handled by connector https://github.com/status-im/status-desktop/issues/19223
536556
557+ if (_internal .currentWebView && _internal .currentWebView .url ) {
558+ const urlStr = _internal .currentWebView .url .toString ()
559+ const hostname = Utils .getHostname (urlStr)
560+
561+ root .browserRootStore .currentTabConnected = connectorBridge .hasWalletConnected (
562+ hostname,
563+ root .browserWalletStore .dappBrowserAccount .address
564+ )
565+ } else {
566+ root .browserRootStore .currentTabConnected = false
567+ }
568+
537569 // Update ConnectorBridge with current dApp metadata
538570 if (_internal .currentWebView && _internal .currentWebView .url ) {
539571 connectorBridge .connectorManager .updateDAppUrl (
540- _internal .currentWebView .url ,
572+ _internal .currentWebView .url ,
541573 _internal .currentWebView .title ,
542574 _internal .currentWebView .icon
543575 )
0 commit comments