Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Switch the network if removing the active network #566

Merged

Conversation

Nasicus
Copy link

@Nasicus Nasicus commented Feb 14, 2018

Also fixes a bug related to the background.

dependencies.min.js:1 TypeError: Cannot read property 'match' of undefined
    at scope.$watch (background-style.directive.js:40)
    at Scope.$digest (dependencies.min.js:1)
    at Scope.$apply (dependencies.min.js:1)
    at dependencies.min.js:1
    at Object.invoke (dependencies.min.js:1)
    at doBootstrap (dependencies.min.js:1)
    at bootstrap (dependencies.min.js:1)
    at angularInit (dependencies.min.js:1)
    at dependencies.min.js:1
    at HTMLDocument.trigger (dependencies.min.js:1)

Fixes: #565

@Nasicus
Copy link
Author

Nasicus commented Feb 15, 2018

added one more commit which fixes: #568

Copy link
Member

@alexbarnsley alexbarnsley left a comment

Choose a reason for hiding this comment

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

Typo change mostly. Possible UX change.
Everything else works well and didn't have any actual problems 👌

if (isActive) {
dialogService.openLoadingDialog(self.currentTheme,
gettext('Network removed succesfully'),
gettext('Network removed succesfully - will now switch the network'))
Copy link
Member

Choose a reason for hiding this comment

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

"successfully" is spelt incorrectly. Also, i'm not sure how much work it would be, but maybe changing it so it's not a loading dialog but a dialog that tells them the wallet needs to reload, with a reload button. then it just reloads on close 🤷‍♂️

Copy link
Author

@Nasicus Nasicus Feb 19, 2018

Choose a reason for hiding this comment

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

Well "the problem" is, that this is a generic loading dialog which I did either reuse here or reuse in another place (cannot remember) :P For me in this situation it's enough (because almost nobody ever deletes a network) - but of course in the end it's your decision :)

Copy link
Member

Choose a reason for hiding this comment

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

@luciorubeens and/or @j-a-m-l, what do you guys think?

Copy link
Contributor

@j-a-m-l j-a-m-l Feb 23, 2018

Choose a reason for hiding this comment

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

A simple solution would be adding a new parameter to openLoadingDialog that permits customizing its behaviour or content.

2 examples:

  • Using templateUrl, to add there the reload button.
  • Passing a options parameter that enables HTML instead of pure text (and change the template too).

Those ideas could be used to display the success removal message and the reload button, as a confirmation, instead of using the toast and the timeout.

Copy link
Author

Choose a reason for hiding this comment

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

I guess I just fail to see the advantage of showing a button to the user. He cannot do anything anyway - he HAS to reload because the network was deleted and the dialog is modal.

Copy link
Member

Choose a reason for hiding this comment

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

To me the UX didn't feel seamless. I'd rather a button I have to press to reload, because then I can press it in my own time. Loading screens I feel are used for processing in the background or waiting for something to happen, and not to display a message to the user, because I might be a slow reader who didn't manage to read the whole message before it disappeared.

Copy link
Author

@Nasicus Nasicus Feb 24, 2018

Choose a reason for hiding this comment

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

Okay, that's a valid point.
I will adjust it accordingly.
However I will open a custom dialog then, because the loading indicator is in this case not relevant anymore, you don't have to wait for anything anyway :)

Copy link
Author

Choose a reason for hiding this comment

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

Done - what do you think?

image

Copy link
Member

Choose a reason for hiding this comment

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

Looks good! I'll have a cheeky test Monday

toastService.success(gettext('Network removed succesfully!'), 3000)
if (isActive) {
dialogService.openLoadingDialog(self.currentTheme,
gettext('Network removed succesfully'),
Copy link
Member

Choose a reason for hiding this comment

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

"successfully" is spelt incorrectly

Copy link
Author

Choose a reason for hiding this comment

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

done

setTimeout(() => networkService.switchNetwork(null, true), 4000)
} else {
self.listNetworks = networkService.getNetworks()
toastService.success(gettext('Network removed succesfully!'), 3000)
Copy link
Member

Choose a reason for hiding this comment

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

"successfully" is spelt incorrectly

Copy link
Author

Choose a reason for hiding this comment

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

done

dialogService.openLoadingDialog(self.currentTheme,
gettext('Network removed succesfully'),
gettext('Network removed succesfully - will now switch the network'))
setTimeout(() => networkService.switchNetwork(null, true), 4000)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe halve the timeout as felt a bit long for me, it was enough time for me to wonder if it was going to reload.

Copy link
Author

@Nasicus Nasicus Feb 19, 2018

Choose a reason for hiding this comment

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

I set the timeout this high because I thought else the user doesn't have enough time to read the message, but I will halve it in this case.
Edit: Tested it and with 2000 I find it hard to read, set it to 3000 - so we meet in the middle :D

Copy link
Member

Choose a reason for hiding this comment

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

oh maybe take a look at my other comment. instead of doing a timeout, #566 (comment)

@alexbarnsley
Copy link
Member

Looks good and working as expected. 👍

@alexbarnsley alexbarnsley merged commit e5eac4a into ArkEcosystem:master Feb 26, 2018
@Nasicus Nasicus deleted the feat/switch-network-on-remove branch February 26, 2018 12:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants