Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Tizen) Add logout to exit menu #5271

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

RoboMagus
Copy link

Changes
Adds Sign Out option to Tizen TV exit menu to mitigate the hassle of switching users that would otherwise require much more interaction.

Users would either have to:

  1. Fully close the app and start it back up again
    • This has wait time, especially on older TVs (like mine)
    • Only really works nicely when users are configured to Not be remembered and have no password configured
  2. Logout through the menu
    • This requires at least 16 remote interactions. Which is just too much of a hassle.
      • From the top of the Home Screen; Up (1), Right(4), Ok(1), Down(9), Ok(1)

@RoboMagus RoboMagus requested a review from a team as a code owner March 9, 2024 11:17
@dmitrylyzo dmitrylyzo added feature New feature or request p: tizen This PR or issue mainly concerns Tizen clients labels Mar 9, 2024
Copy link
Contributor

@dmitrylyzo dmitrylyzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbf, I think it would be better to fix Remember Me behaviour:

  1. Use sessionStore (or session cookies) to store the credentials.
  2. Make Remember Me unchecked by default. This requires 1. Otherwise, opening links in the new tab doesn't sign in.
  3. Uncheck Remember Me when password-less graphical login is used.

This way, you stay logged in until you close the app/browser.

My efforts:
#2481
jellyfin-archive/jellyfin-apiclient-javascript#154

ApiClient is deprecated and we are moving to React, so I am not sure how to do all of the above.

@@ -308,12 +308,17 @@ function askForExit() {
exitPromise = actionsheet.show({
title: globalize.translate('MessageConfirmAppExit'),
items: [
{ id: 'logout', name: globalize.translate('ButtonSignOut') },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't logout menu entry be added only if the user is logged in?

Also, I don't think logout should be the default action.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't logout menu entry be added only if the user is logged in?

Good point, I should add a check for that.

Also, I don't think logout should be the default action.

That could be a point for discussion indeed. IMO not many people would actually go through this menu to close the app on their TV, if the app even is fully closed at all. More users would probably be switching between accounts.
Seeing as putting this option between 'Yes' and 'No' does not feel right aesthetically, and way at the bottom messes with the UX of having cancel / ignore as the always last option this seemed to be the best place to keep it for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO not many people would actually go through this menu to close the app on their TV, if the app even is fully closed at all.

This menu is what Samsung suggests for exiting the app on Back action. And I think it does close it compared to opening another app - it doesn't restore the state when re-launching.

Seeing as putting this option between 'Yes' and 'No' does not feel right aesthetically, and way at the bottom messes with the UX of having cancel / ignore as the always last option this seemed to be the best place to keep it for now.

In fact, No should be the default.
It can be marked as selected:

Copy link
Author

@RoboMagus RoboMagus Mar 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This menu is what Samsung suggests for exiting the app on Back action. And I think it does close it compared to opening another app - it doesn't restore the state when re-launching.

That is the way this menu currently functions, yes. What I'm suggesting is that most people are unlikely to close the app using this menu. Either the app is suspended into the background when a new app is opened, or if the app actually needs to be closed completely users would be likely to force-close it rather than going through a menu.

It can be marked as selected:

I've been testing with that, but it seems this option only puts a checkmark in front of the item. Not actually highlighting it as the active selection.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be likely to force-close it

Force-close is the last option to exit, not the correct way to close the app.

Not actually highlighting it as the active selection.

In Chrome (device mode to emulate Tizen + a hack to call the menu) it is highlighted, but the checkmark is not desirable. We need to add an option that allows us to set the current menu item.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force-close is the last option to exit, not the correct way to close the app.

Based on my experience with end users they don't care about the "correct way", but rather most convenient / easiest / or fastest way. Though that's a bit beside the point, it does illustrate why I believe the exit menu would be a good place to add a logout option. It's much more convenient than navigating through the menu to log out, and it's a better option to force closing the app to switch accounts.

I'm fine with discussing placement / sorting of the options in the exit menu and which should be highlighted by default. Though if changes need to be made to the way these menus are currently implemented that would best be handled in another issue.

@RoboMagus
Copy link
Author

Tbf, I think it would be better to fix Remember Me behaviour

I'd love to see improvements to the Login + Remember Me behavior, but that would require too many changes and must be done properly. A task I'm currently not able to take on.
Ideally I'd like to have decent password protection on my accounts whilst still being able to easily switch users on the TV without having to sign in and out. However as it stands now I believe it's not possible for users to have multiple users logged in and 'remembered' at the same time on the same client (Though I may be wrong about this?). Making it impossible to both have decent password protection of accounts and easy user switching without having to re-authenticate.
Though that is all a bit too far off topic...

The main thing this PR adds though is easier user switching. Which is still a separate issue from the remember me state of each user.
In my case, the Remember Me option is unchecked for all active users on the TV so when the app starts cold, we get to select which user to continue with.
However, this only is the case for a cold start of the app. Not when switching apps, and also not when the TV has been powered off. In both those cases the user is still retained as the app is not closed fully.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint doesn't pass. Please fix all ESLint issues.

exitPromise = null;
import('../utils/dashboard').then(() => {
import('../components/actionSheet/actionSheet').then((actionsheet) => {
const userId = Dashboard.getCurrentUserId();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Dashboard' is not defined. no-undef

if (value === 'yes') {
doExit();
} else if (value === 'logout') {
Dashboard.logout();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Dashboard' is not defined. no-undef

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint doesn't pass. Please fix all ESLint issues.

src/components/apphost.js Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Mar 11, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint doesn't pass. Please fix all ESLint issues.

}
}).finally(function () {
exitPromise = null;
import('../utils/dashboard').then(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least use the result.

Suggested change
import('../utils/dashboard').then(() => {
import('../utils/dashboard').then((Dashboard) => {

Should we use camelCase (dashboard) since it is a variable? 🤔

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utils/dashboard exports Dashboards so it is available for use without grabbing the result.

Tested on TV and working as intended.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it works, but there are ESLint errors.

I asked the team and got the answer: We should use the import in our code. The global is for use in places outside of web (plugins, wrapper apps, etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request p: tizen This PR or issue mainly concerns Tizen clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants