Skip to content

Commit

Permalink
fix(vscode): stop and uninstall vscode service when logged out and in…
Browse files Browse the repository at this point in the history
…stall and start it when logged in - fixes #114
  • Loading branch information
sassanh committed Sep 26, 2024
1 parent c043ddc commit 3ace33c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- test: better tooling for debugging uuid generation in tests
- fix(rpc): deal with messages with no prefix_package meta field
- refactor(core): prepare `REGISTERED_PATHS` earlier for each service, so that import error messages are more meaningful
- fix(vscode): stop and uninstall vscode service when logged out and install and start it when logged in - fixes #114

## Version 0.16.2

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def test_all_services_register(

app = MenuApp()
app_context.set_app(app)
load_services(ALL_SERVICES_IDS, timeout=10)
load_services(ALL_SERVICES_IDS, timeout=30, delay=1)
await stability(initial_wait=6, attempts=2, wait=2)
store_snapshot.take()
window_snapshot.take()
4 changes: 2 additions & 2 deletions ubo_app/services/050-vscode/login_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import subprocess

from _constants import CODE_BINARY_PATH
from commands import check_status
from commands import install_service
from kivy.clock import mainthread
from kivy.lang.builder import Builder
from kivy.properties import NumericProperty, StringProperty
Expand Down Expand Up @@ -102,7 +102,7 @@ def set_properties() -> None:
),
)
finally:
await check_status()
await install_service()

def on_close(self: LoginPage) -> None:
self.process.kill() if self.process.returncode is None else None
Expand Down
15 changes: 2 additions & 13 deletions ubo_app/services/050-vscode/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import TYPE_CHECKING

from _constants import CODE_BINARY_PATH, CODE_BINARY_URL, DOWNLOAD_PATH
from commands import check_status, install_service, restart, uninstall_service
from commands import check_status, restart, uninstall_service
from kivy.clock import Clock
from kivy.lang.builder import Builder
from login_page import LoginPage
Expand Down Expand Up @@ -102,7 +102,7 @@ async def act() -> None:
stderr=subprocess.DEVNULL,
)
await process.wait()
await restart()
await uninstall_service()
except subprocess.CalledProcessError:
store.dispatch(
NotificationsAddAction(
Expand Down Expand Up @@ -131,17 +131,6 @@ class VSCodeQRCodePage(PageWidget):
actions.append(
ApplicationItem(label='Show URL', icon='󰐲', application=VSCodeQRCodePage),
)
actions.append(
ActionItem(
label='Uninstall Service'
if status.is_service_installed
else 'Install Service',
icon='󰫜' if status.is_service_installed else '󰫚',
action=(lambda: create_task(uninstall_service()) and None)
if status.is_service_installed
else (lambda: create_task(install_service()) and None),
),
)
return actions


Expand Down

0 comments on commit 3ace33c

Please sign in to comment.