55// ----------------------------------------------------------------------------
66
77import { clo , logDebug , logError , logInfo , logWarn } from '@helpers/dev'
8+ import { usersVersionHas } from '@helpers/NPVersions'
89import { caseInsensitiveMatch , caseInsensitiveStartsWith } from '@helpers/search'
910import { inputIntegerBounded } from '@helpers/userInput'
1011
11- // ----------------------------------------------------------------------------
12- // CONSTANTS
13-
14- export const MAIN_SIDEBAR_CONTROL_BUILD_VERSION = 1440 // v3.19.2
15- export const FOLDER_VIEWS_CONTROL_BUILD_VERSION = 1340 // v3.18???
16-
1712// ----------------------------------------------------------------------------
1813// TYPES
1914
@@ -78,7 +73,7 @@ export async function setEditorWidth(widthIn?: number, mainSidebarWidth?: number
7873 }
7974
8075 logDebug ( 'setEditorWidth' , `Attempting to set width for main NP Window to ${ String ( width ) } ` )
81- if ( NotePlan . environment . buildVersion >= MAIN_SIDEBAR_CONTROL_BUILD_VERSION && mainSidebarWidth && ! isNaN ( mainSidebarWidth ) ) {
76+ if ( usersVersionHas ( 'mainSidebarControl' ) && mainSidebarWidth && ! isNaN ( mainSidebarWidth ) ) {
8277 if ( mainSidebarWidth === 0 ) {
8378 logDebug ( 'setEditorWidth' , `- will hide main sidebar` )
8479 NotePlan . toggleSidebar ( true , false , true )
@@ -690,7 +685,7 @@ export async function constrainMainWindow(): Promise<void> {
690685}
691686
692687export function logSidebarWidth ( ) : void {
693- if ( NotePlan . environment . buildVersion >= MAIN_SIDEBAR_CONTROL_BUILD_VERSION ) {
688+ if ( usersVersionHas ( 'mainSidebarControl' ) ) {
694689 const sidebarWidth = NotePlan . getSidebarWidth ( )
695690 logInfo ( 'logSidebarWidth' , `Sidebar width: ${ sidebarWidth } -- WARNING: This cannot tell if the sidebar is actually visible or not!` )
696691 } else {
@@ -700,7 +695,7 @@ export function logSidebarWidth(): void {
700695
701696// eslint-disable-next-line require-await
702697export async function setSidebarWidth ( widthIn ? : number ) : Promise < void > {
703- if ( NotePlan . environment . buildVersion >= MAIN_SIDEBAR_CONTROL_BUILD_VERSION ) {
698+ if ( usersVersionHas ( 'mainSidebarControl' ) ) {
704699 const width = widthIn ?? await inputIntegerBounded ( 'Set Width for main NP Window' , `Width (pixels)? (up to ${ String ( NotePlan . environment . screenWidth ) } )` , NotePlan . environment . screenWidth )
705700 NotePlan . setSidebarWidth ( width )
706701 logDebug ( 'setSidebarWidth' , `Sidebar width set to ${ width } ` )
0 commit comments