Skip to content

Commit

Permalink
fix(vscode): show a success notification when the login process is co…
Browse files Browse the repository at this point in the history
…mpleted instead of when the service runs #96
  • Loading branch information
sassanh committed May 12, 2024
1 parent 90b20f1 commit 79e198b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ChangeLog

## Version 0.14.2

- fix(vscode): show a success notification when the login process is completed instead
of when the service runs #96

## Version 0.14.1

- fix(docker): handle the case when ip interfaces are not initialized yet
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ubo-app"
version = "0.14.1"
version = "0.14.2"
description = "Ubo main app, running on device initialization. A platform for running other apps."
authors = ["Sassan Haradji <[email protected]>"]
license = "Apache-2.0"
Expand Down
9 changes: 2 additions & 7 deletions ubo_app/services/050-vscode/reducer.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,12 @@ def reducer(

if isinstance(action, VSCodeSetStatusAction):
actions = []
if (
state.status
and not state.status.is_running
and action.status
and action.status.is_running
):
if state.is_logged_in is False and action.is_logged_in:
actions.append(
NotificationsAddAction(
notification=Notification(
title='VSCode',
content='Service is running',
content='Successful Login',
icon='󰨞',
importance=Importance.MEDIUM,
color=SUCCESS_COLOR,
Expand Down
8 changes: 5 additions & 3 deletions ubo_app/services/050-vscode/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class VSCodeQRCodePage(PageWidget):
return actions


def login_actions(*, is_logged_in: bool) -> list[ActionItem | ApplicationItem]:
def login_actions(*, is_logged_in: bool | None) -> list[ActionItem | ApplicationItem]:
actions = []
if is_logged_in:
actions.extend(
Expand All @@ -153,7 +153,7 @@ def login_actions(*, is_logged_in: bool) -> list[ActionItem | ApplicationItem]:
),
],
)
else:
elif is_logged_in is False:
actions.append(
ApplicationItem(
label='Login',
Expand Down Expand Up @@ -208,7 +208,9 @@ def vscode_menu(state: VSCodeState) -> HeadedMenu:
status = 'Downloading...'
elif not state.is_binary_installed:
status = 'Code CLI not installed'
elif not state.is_logged_in:
elif state.is_logged_in is None:
status = 'Checking status...'
elif state.is_logged_in is False:
status = 'Needs authentication'
else:
status = 'Unknown status'
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/store/services/vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ class VSCodeState(Immutable):
is_pending: bool = True
is_downloading: bool = False
is_binary_installed: bool = False
is_logged_in: bool = False
is_logged_in: bool | None = None
status: VSCodeStatus | None = None

0 comments on commit 79e198b

Please sign in to comment.