diff --git a/js/ui/status/network.js b/dev/shm/tw/gnome-shell-js/ui/status/network.js index c3f0aa0..d9a5a86 100644 --- a/js/ui/status/network.js +++ b/dev/shm/tw/gnome-shell-js/ui/status/network.js @@ -1975,6 +1975,7 @@ class Indicator extends SystemIndicator { this._mainConnection = null; this._notification = null; + this._PortalNotification = null; this._wiredToggle = new NMWiredToggle(); this._wirelessToggle = new NMWirelessToggle(); @@ -2083,8 +2084,10 @@ class Indicator extends SystemIndicator { } _mainConnectionStateChanged() { - if (this._mainConnection.state === NM.ActiveConnectionState.ACTIVATED) + if (this._mainConnection.state === NM.ActiveConnectionState.ACTIVATED) { this._notification?.destroy(); + this._PortalNotification?.destroy(); + } } _flushConnectivityQueue() { @@ -2119,7 +2122,7 @@ class Indicator extends SystemIndicator { } } - async _syncConnectivity() { + _syncConnectivity() { if (this._mainConnection == null || this._mainConnection.state !== NM.ActiveConnectionState.ACTIVATED) { this._flushConnectivityQueue(); @@ -2137,10 +2140,28 @@ class Indicator extends SystemIndicator { if (!isPortal || Main.sessionMode.isGreeter) return; + let name = this._mainConnection.get_id(); let path = this._mainConnection.get_path(); if (this._connectivityQueue.has(path)) return; + this._PortalNotification?.destroy(); + const source = MessageTray.getSystemSource(); + + this._PortalNotification = new MessageTray.Notification({ + source, + title: _('Sign Into Wi–Fi Network'), + body: _(name), + }); + this._PortalNotification.connect('activated', + () => this._onNotificationActivated(path)); + this._PortalNotification.connect('destroy', + () => (this._PortalNotification = null)); + + source.addNotification(this._PortalNotification); + } + + async _onNotificationActivated(path) { let timestamp = global.get_current_time(); if (!this._portalHelperProxy) { this._portalHelperProxy = new Gio.DBusProxy({