11import { action , makeObservable , observable } from 'mobx' ;
2+ import { isTouchDevice } from '@/components/shared/utils/screen/responsive' ;
23
34export default class UiStore {
45 is_mobile = true ;
@@ -7,6 +8,7 @@ export default class UiStore {
78 is_chart_layout_default = true ;
89 is_dark_mode_on = localStorage . getItem ( 'theme' ) === 'dark' ;
910 account_switcher_disabled_message = '' ;
11+ current_focus = null ;
1012 show_prompt = false ;
1113 is_trading_assessment_for_new_user_enabled = false ;
1214 is_accounts_switcher_on = false ;
@@ -16,20 +18,23 @@ export default class UiStore {
1618
1719 constructor ( ) {
1820 makeObservable ( this , {
19- show_prompt : observable ,
21+ account_switcher_disabled_message : observable ,
22+ current_focus : observable ,
23+ is_accounts_switcher_on : observable ,
2024 is_dark_mode_on : observable ,
21- is_mobile : observable ,
2225 is_desktop : observable ,
26+ is_mobile : observable ,
2327 is_tablet : observable ,
24- account_switcher_disabled_message : observable ,
25- setDarkMode : action ,
26- setDevice : action ,
27- setAccountSwitcherDisabledMessage : action ,
28- setPromptHandler : action ,
29- setIsTradingAssessmentForNewUserEnabled : action . bound ,
3028 is_trading_assessment_for_new_user_enabled : observable ,
31- is_accounts_switcher_on : observable ,
29+ show_prompt : observable ,
30+ setAccountSwitcherDisabledMessage : action . bound ,
31+ setCurrentFocus : action . bound ,
32+ setDarkMode : action . bound ,
33+ setDevice : action . bound ,
34+ setPromptHandler : action . bound ,
35+ setIsTradingAssessmentForNewUserEnabled : action . bound ,
3236 toggleAccountsDialog : action . bound ,
37+ toggleOnScreenKeyboard : action . bound ,
3338 } ) ;
3439 }
3540
@@ -61,4 +66,13 @@ export default class UiStore {
6166 toggleAccountsDialog ( status = ! this . is_accounts_switcher_on ) {
6267 this . is_accounts_switcher_on = status ;
6368 }
69+
70+ toggleOnScreenKeyboard ( ) {
71+ this . is_onscreen_keyboard_active = this . current_focus !== null && this . is_mobile && isTouchDevice ( ) ;
72+ }
73+
74+ setCurrentFocus ( value ) {
75+ this . current_focus = value ;
76+ this . toggleOnScreenKeyboard ( ) ;
77+ }
6478}
0 commit comments