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

Feature/sdl 0189 restructuring on reset timeout #575

Conversation

LitvinenkoIra
Copy link
Contributor

@LitvinenkoIra LitvinenkoIra commented Jun 24, 2021

Implements #376

This PR is [ready] for review.

Testing Plan

0189_Restructuring OnResetTimeout_HMI_instruction.xlsx

Summary

The ability to send OnResetTimeout for RPS with different interfaces has been added.

CLA

valerii added 8 commits June 24, 2021 18:11
 - Basic implementation of ResetTimeoutPopUp
 - Updated ALertManeuverPopUp model
 - Updated AlertPopUp model
 - Updated SubtleAlertPopUp model
 - Updated TTSPopUp model
Updated InteractionChoicesView Models for PI requests
Added reset timeout input field
 - Updated ScrollableMessage Model
 - Updated SliderView model
ffw/BasicCommunicationRPC.js Outdated Show resolved Hide resolved
Reset timeout to default if value in input field is out of bound
Copy link

@atiwari9 atiwari9 left a comment

Choose a reason for hiding this comment

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

More changes are needed as per this SDL_Core comment: smartdevicelink/sdl_core#3726 (comment)

@atiwari9
Copy link

@ValeriiMalkov , @LitvinenkoIra - Please let me know when the PR is ready to be reviewed again after above mentioned changes.

@AKalinich-Luxoft
Copy link
Contributor

@ValeriiMalkov , @LitvinenkoIra - Please let me know when the PR is ready to be reviewed again after above mentioned changes.

All required changes have been provided in 99c82a9

@LitvinenkoIra
Copy link
Contributor Author

@theresalech This PR is ready for Livio review. Thank you!

app/view/sdl/ResetTimeoutPopUp.js Outdated Show resolved Hide resolved
app/model/sdl/Abstract/Model.js Outdated Show resolved Hide resolved
app/model/sdl/Abstract/Model.js Show resolved Hide resolved
app/view/sdl/ResetTimeoutPopUp.js Outdated Show resolved Hide resolved
app/view/sdl/ResetTimeoutPopUp.js Outdated Show resolved Hide resolved
app/view/sdl/shared/interactionChoicesView.js Outdated Show resolved Hide resolved
app/view/sdl/shared/interactionChoicesView.js Outdated Show resolved Hide resolved
app/view/sdl/shared/scrollableMessage.js Outdated Show resolved Hide resolved
app/view/sdl/ResetTimeoutPopUp.js Outdated Show resolved Hide resolved
app/controller/sdl/Abstract/Controller.js Show resolved Hide resolved
@iCollin
Copy link
Collaborator

iCollin commented Jul 20, 2021

When UI interactions are deactivated for reason other than timeout, they must be removed from SDL.ResetTimeoutPopUp.resetTimeoutRPCs so that a timeout is not sent later.

@iCollin
Copy link
Collaborator

iCollin commented Jul 20, 2021

Many components had their "timeout timers" moved to the ResetTimeoutPopup component like this:

SDL.ResetTimeoutPopUp.expandCallbacks(function(){
                SDL.ScrollableMessage.deactivate();
              }, request.method);

But many of these same components still have a "timer" that seems to be for timeout in the components themselves. These duplicate timers should be removed.

@iCollin
Copy link
Collaborator

iCollin commented Jul 20, 2021

It will be common for apps to have multiple pending requests at the same time. The SDL.ResetTimeoutPopUp needs to be able to handle this, and requires a few changes:

  • Remove any calls to SDL.ResetTimeoutPopUp.DeactivatePopUp when there are other pending messages
    • AlertManeuver does this already
  • Modify SDL.ResetTimeoutPopUp.resetTimeout or provide another method to be able to reset the timeout of just one message.
    • Currently this method is called from both clicking resetTimeoutButton as well as when the timer should be reset for ScrollableMessage and Slider. At least the calls from the RPCs should be for just that one RPC's timeout.

@iCollin
Copy link
Collaborator

iCollin commented Jul 20, 2021

I recommend consolidating the objects indexed by [method] on SDL.ResetTimeoutPopUp to one object of objects. Currently we are tracking the requestIDs, timeoutSeconds, callbacks and resetTimeoutCallback data like this:

// array resetTimeoutRPCs: [
	'UI.Alert'
]
// object 1 requestIDs: {
	'UI.Alert': 1
}
// object 2 timeoutSeconds: {
	'UI.Alert': 5
}
// object 3 callbacks: {
	'UI.Alert': () => { console.log('alert timed out'); }
}
// object 4 resetTimeoutCallback: {
	'UI.Alert': () => { console.log('alert timeout reset'); }
}

And it may be easier to use in code like this:

// object resetTimeoutRPCs: {
	1: { // key is requestID
		method: 'UI.Alert',
		timeoutSeconds: 5,
		callback: () => { console.log('alert timed out'); },
		resetTimeoutCallback: () => { console.log('alert timeout reset'); }
	}
}

There are two reasons:

  • Easier to use in code
    • For example, right now only the resetTimeoutRPCs member of those 5 is cleaned up before deactivate is called.
    • Cleanup is just delete resetTimeoutRPCs[1] instead of modifying many objects
  • Supports multiple of the same method
    • Not necessary now, but may be in the future if interactions can be sent to multiple windows etc.

@iCollin
Copy link
Collaborator

iCollin commented Jul 20, 2021

Where applicable, it would be much easier to follow these changes if the code for setting up the timeout callbacks was placed within interaction components.

For example, I believe all the changes from ffw/NavigationRPC.js should be moved to the SDL.AlertManeuverPopUp.AlertManeuverActive method. This same pattern can be followed for other RPC file changes.

@iCollin
Copy link
Collaborator

iCollin commented Jul 20, 2021

Please merge in develop and feel free to message me on slack if you have any questions!

@ValeriiMalkov
Copy link
Contributor

I recommend consolidating the objects indexed by [method] on SDL.ResetTimeoutPopUp to one object of objects. Currently we are tracking the requestIDs, timeoutSeconds, callbacks and resetTimeoutCallback data like this:

// array resetTimeoutRPCs: [
	'UI.Alert'
]
// object 1 requestIDs: {
	'UI.Alert': 1
}
// object 2 timeoutSeconds: {
	'UI.Alert': 5
}
// object 3 callbacks: {
	'UI.Alert': () => { console.log('alert timed out'); }
}
// object 4 resetTimeoutCallback: {
	'UI.Alert': () => { console.log('alert timeout reset'); }
}

And it may be easier to use in code like this:

// object resetTimeoutRPCs: {
	1: { // key is requestID
		method: 'UI.Alert',
		timeoutSeconds: 5,
		callback: () => { console.log('alert timed out'); },
		resetTimeoutCallback: () => { console.log('alert timeout reset'); }
	}
}

There are two reasons:

  • Easier to use in code

    • For example, right now only the resetTimeoutRPCs member of those 5 is cleaned up before deactivate is called.
    • Cleanup is just delete resetTimeoutRPCs[1] instead of modifying many objects
  • Supports multiple of the same method

    • Not necessary now, but may be in the future if interactions can be sent to multiple windows etc.

Note that this is a significant refactoring and it will require a full testing cycle.
According to our estimates we will be able to deliver these changes by the end of next week (07.30). Are you ok with that?

Copy link
Collaborator

@iCollin iCollin left a comment

Choose a reason for hiding this comment

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

There is one comment above that I think was missed: #575 (comment)

ffw/UIRPC.js Outdated Show resolved Hide resolved
ffw/UIRPC.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@iCollin iCollin left a comment

Choose a reason for hiding this comment

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

Updates look great, thank you for the quick responses.

this.resetTimeoutRPCs[requestID].callback();
document.getElementById(this.resetTimeoutRPCs[requestID].method + 'checkBox').disabled = true;
} else {
if(TIME_OUT_EXPIRATION_SECONDS === this.resetTimeoutRPCs[requestID].timeoutSeconds) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is checked when the key is added to timeoutExpired, i think this check is redundant.

Copy link
Contributor

Choose a reason for hiding this comment

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

Removed timeout decrement. Currently this logic implemented
the SDL side
@ValeriiMalkov
Copy link
Contributor

@iCollin Implemented according a comment in commit e9d199d

@iCollin
Copy link
Collaborator

iCollin commented Aug 3, 2021

It seems resetting the timeout for DialNumber was missed, but it was mentioned explicitly in the proposal.
This currently works because Core enforces no timeout for this RPC.

@iCollin
Copy link
Collaborator

iCollin commented Aug 3, 2021

If an app sends a ScrollableMessage with a timeout of 50000ms, and then clicks the scroll bar to scroll down after say 10 seconds, the SDL HMI will send an OnResetTimeout(resetPeriod=10000ms), essentially now shortening the timeout of the ScrollableMessage to 20000ms.
Previously the timeout would have been reset to the original value. This is also the case with PerformInteraction, and with Slider when the data is changed.
I think the resetPeriod we send needs to be the original timeout value to preserve the timeout functionality.

To solve this we could add a line like this to the object created in addRpc:

originalTimeout: timeoutSeconds

And then check for this value when resetting the timeout.

Added originalTimeout value to exclude case when the reset period is less
than requested timeout
@ValeriiMalkov
Copy link
Contributor

ValeriiMalkov commented Aug 4, 2021

If an app sends a ScrollableMessage with a timeout of 50000ms, and then clicks the scroll bar to scroll down after say 10 seconds, the SDL HMI will send an OnResetTimeout(resetPeriod=10000ms), essentially now shortening the timeout of the ScrollableMessage to 20000ms.
Previously the timeout would have been reset to the original value. This is also the case with PerformInteraction, and with Slider when the data is changed.
I think the resetPeriod we send needs to be the original timeout value to preserve the timeout functionality.

To solve this we could add a line like this to the object created in addRpc:

originalTimeout: timeoutSeconds

And then check for this value when resetting the timeout.

@iCollin Implemented in commit 22d6fb1
Please take a look changes

@iCollin
Copy link
Collaborator

iCollin commented Aug 6, 2021

@iCollin Implemented in commit 22d6fb1

These changes need to also be applied to resetTimeoutSpecificRpc

@ValeriiMalkov
Copy link
Contributor

ValeriiMalkov commented Aug 9, 2021

@iCollin Implemented in commit 22d6fb1

These changes need to also be applied to resetTimeoutSpecificRpc

@iCollin Applied 10efb8b
and here f1416cb

@iCollin
Copy link
Collaborator

iCollin commented Aug 9, 2021

@ValeriiMalkov Keep context soft buttons are not resetting the timeout. Cases for some UI Components need to be re-added to keepContextSoftButton in app/controller/sdl/Abstract/Controller.js

@ValeriiMalkov
Copy link
Contributor

@ValeriiMalkov Keep context soft buttons are not resetting the timeout. Cases for some UI Components need to be re-added to keepContextSoftButton in app/controller/sdl/Abstract/Controller.js

@iCollin Added for Alert and SubtleAlert cf12e81

app/view/sdl/SubtleAlertPopUp.js Show resolved Hide resolved
app/view/sdl/SubtleAlertPopUp.js Outdated Show resolved Hide resolved
app/model/sdl/Abstract/Model.js Outdated Show resolved Hide resolved
app/view/sdl/ResetTimeoutPopUp.js Outdated Show resolved Hide resolved
@iCollin iCollin merged commit ada1ee3 into smartdevicelink:develop Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants