Thanks for your interesting question. Based on it, I experimented a bit and created a basic component that should do what you describe. The YAML for the component can be found at the bottom of this reply.
Basically the component will show a modal, asking the user if they wish to continue, or not, after a certain time. If there is no timely response, the app will be exited automatically. Certain properties are available to set the behaviour of the component:
ComponentDefinitions:
cmpAutoExit:
DefinitionType: CanvasComponent
CustomProperties:
InactivityTimerValue:
PropertyKind: Output
DisplayName: InactivityTimerValue
Description: Custom Property
DataType: Number
MaxInactivityDuration:
PropertyKind: Input
DisplayName: MaxInactivityDuration
Description: Custom Property
DataType: Number
Default: =300000
ModalHeight:
PropertyKind: Input
DisplayName: ModalHeight
Description: Custom Property
DataType: Number
Default: =200
ModalText:
PropertyKind: Input
DisplayName: ModalText
Description: Custom Property
DataType: Text
Default: |-
=$"This session will be ended automatically in {
With(
{SecondsLeft:
RoundDown((Self.MaxInactivityDuration - Self.InactivityTimerValue) / 1000, 0)
},
$"{RoundDown(SecondsLeft/60,0)} minute(s) and {Mod(SecondsLeft,60)} second(s)"
)
} due to inactivity.
Do you wish to continue?"
ModalWidth:
PropertyKind: Input
DisplayName: ModalWidth
Description: Custom Property
DataType: Number
Default: =500
Reset:
PropertyKind: Input
DisplayName: Reset
Description: Custom Property
DataType: Boolean
Default: =App.ActiveScreen.Name = Parent.Name
ShowModalDuration:
PropertyKind: Input
DisplayName: ShowModalDuration
Description: Custom Property
DataType: Number
Default: =25000
Properties:
Height: =If(cmpAutoExit.InactivityTimerValue > cmpAutoExit.ShowModalDuration, App.ActiveScreen.Height,0)
InactivityTimerValue: =timInactivity.Value
OnReset: =Reset(timInactivity)
Width: =If(cmpAutoExit.InactivityTimerValue > cmpAutoExit.ShowModalDuration, App.ActiveScreen.Width,0)
Children:
- timInactivity:
Control: Timer@2.1.0
Properties:
AutoStart: =true
BorderColor: =ColorFade(Self.Fill, -15%)
Color: =RGBA(255, 255, 255, 1)
DisabledBorderColor: =ColorFade(Self.BorderColor, 70%)
DisabledColor: =ColorFade(Self.Fill, 90%)
DisabledFill: =ColorFade(Self.Fill, 70%)
Duration: =cmpAutoExit.MaxInactivityDuration
Fill: =RGBA(56, 96, 178, 1)
Font: =Font.'Open Sans'
HoverBorderColor: =ColorFade(Self.BorderColor, 20%)
HoverColor: =RGBA(255, 255, 255, 1)
HoverFill: =ColorFade(RGBA(56, 96, 178, 1), -20%)
OnTimerEnd: =Exit()
PressedBorderColor: =Self.Fill
PressedColor: =Self.Fill
PressedFill: =Self.Color
Reset: =ResetTimer And cmpAutoExit.Reset
Start: =ResetTimer
X: =20
Y: =16
- conBackGround:
Control: GroupContainer@1.3.0
Variant: ManualLayout
Properties:
Fill: =RGBA(0, 0, 0, 0.5)
Height: =cmpAutoExit.Height
Visible: =cmpAutoExit.InactivityTimerValue > cmpAutoExit.ShowModalDuration
Width: =cmpAutoExit.Width
Children:
- conModal:
Control: GroupContainer@1.3.0
Variant: ManualLayout
Properties:
Fill: =RGBA(255, 255, 255, 1)
Width: =cmpAutoExit.ModalWidth
X: =(Parent.Width - Self.Width)/2
Y: =(Parent.Height - Self.Height)/2
Children:
- lblModalText:
Control: Label@2.5.1
Properties:
Align: =Align.Center
BorderColor: =RGBA(0, 18, 107, 1)
Font: =Font.'Open Sans'
Height: =Parent.Height-60
Text: =cmpAutoExit.ModalText
Width: =Parent.Width
- btnModalYes:
Control: Classic/Button@2.2.0
Properties:
BorderColor: =ColorFade(Self.Fill, -15%)
Color: =RGBA(255, 255, 255, 1)
DisabledBorderColor: =RGBA(166, 166, 166, 1)
Fill: =RGBA(56, 96, 178, 1)
Font: =Font.'Open Sans'
HoverBorderColor: =ColorFade(Self.BorderColor, 20%)
HoverColor: =RGBA(255, 255, 255, 1)
HoverFill: =ColorFade(RGBA(56, 96, 178, 1), -20%)
OnSelect: |-
=Set(ResetTimer,false);
Set(ResetTimer,true)
PressedBorderColor: =Self.Fill
PressedColor: =Self.Fill
PressedFill: =Self.Color
Text: ="Yes"
Width: =Parent.Width/5
X: =Parent.Width/5
Y: =lblModalText.Height + 10
- btnModalNo:
Control: Classic/Button@2.2.0
Properties:
BorderColor: =ColorFade(Self.Fill, -15%)
Color: =RGBA(255, 255, 255, 1)
DisabledBorderColor: =RGBA(166, 166, 166, 1)
Fill: =RGBA(56, 96, 178, 1)
Font: =Font.'Open Sans'
HoverBorderColor: =ColorFade(Self.BorderColor, 20%)
HoverColor: =RGBA(255, 255, 255, 1)
HoverFill: =ColorFade(RGBA(56, 96, 178, 1), -20%)
OnSelect: =Exit()
PressedBorderColor: =Self.Fill
PressedColor: =Self.Fill
PressedFill: =Self.Color
Text: ="No"
Width: =Parent.Width/5
X: =(Parent.Width/5)*3
Y: =lblModalText.Height + 10