refactor: Convert protected methods to private (#2358)
This commit is contained in:
@@ -19,7 +19,7 @@ interface ResolvedViewTarget {
|
||||
}
|
||||
|
||||
export class ViewFactory {
|
||||
protected _api: CardViewAPI;
|
||||
private _api: CardViewAPI;
|
||||
|
||||
constructor(api: CardViewAPI) {
|
||||
this._api = api;
|
||||
@@ -43,7 +43,7 @@ export class ViewFactory {
|
||||
});
|
||||
}
|
||||
|
||||
protected _getDefaultViewName = (
|
||||
private _getDefaultViewName = (
|
||||
config: AdvancedCameraCardConfig,
|
||||
): AdvancedCameraCardView =>
|
||||
resolveViewName(
|
||||
@@ -52,7 +52,7 @@ export class ViewFactory {
|
||||
this._api.getFoldersManager(),
|
||||
);
|
||||
|
||||
protected _getDefaultCameraID(
|
||||
private _getDefaultCameraID(
|
||||
config: AdvancedCameraCardConfig,
|
||||
viewName: AdvancedCameraCardView,
|
||||
options?: ViewFactoryOptions,
|
||||
@@ -114,7 +114,7 @@ export class ViewFactory {
|
||||
return view;
|
||||
}
|
||||
|
||||
protected _resolveViewName(
|
||||
private _resolveViewName(
|
||||
config: AdvancedCameraCardConfig,
|
||||
options?: ViewFactoryOptions,
|
||||
): AdvancedCameraCardView {
|
||||
@@ -128,7 +128,7 @@ export class ViewFactory {
|
||||
return options?.baseView?.view ?? this._getDefaultViewName(config);
|
||||
}
|
||||
|
||||
protected _resolveCameraID(
|
||||
private _resolveCameraID(
|
||||
viewName: AdvancedCameraCardView,
|
||||
options?: ViewFactoryOptions,
|
||||
): string | null {
|
||||
@@ -148,7 +148,7 @@ export class ViewFactory {
|
||||
return viewCameraIDs?.keys().next().value ?? null;
|
||||
}
|
||||
|
||||
protected _ensureViewCompatibility(
|
||||
private _ensureViewCompatibility(
|
||||
viewName: AdvancedCameraCardView,
|
||||
cameraID: string | null,
|
||||
config: AdvancedCameraCardConfig,
|
||||
@@ -173,7 +173,7 @@ export class ViewFactory {
|
||||
return { viewName, cameraID };
|
||||
}
|
||||
|
||||
protected _handleNoCameraForView(
|
||||
private _handleNoCameraForView(
|
||||
viewName: AdvancedCameraCardView,
|
||||
config: AdvancedCameraCardConfig,
|
||||
options?: ViewFactoryOptions,
|
||||
@@ -195,7 +195,7 @@ export class ViewFactory {
|
||||
});
|
||||
}
|
||||
|
||||
protected _handleUnsupportedView(
|
||||
private _handleUnsupportedView(
|
||||
viewName: AdvancedCameraCardView,
|
||||
cameraID: string,
|
||||
config: AdvancedCameraCardConfig,
|
||||
@@ -229,7 +229,7 @@ export class ViewFactory {
|
||||
});
|
||||
}
|
||||
|
||||
protected _resolveDisplayMode(
|
||||
private _resolveDisplayMode(
|
||||
viewName: AdvancedCameraCardView,
|
||||
config: AdvancedCameraCardConfig,
|
||||
options?: ViewFactoryOptions,
|
||||
@@ -247,7 +247,7 @@ export class ViewFactory {
|
||||
);
|
||||
}
|
||||
|
||||
protected _getConfiguredDisplayMode(
|
||||
private _getConfiguredDisplayMode(
|
||||
viewName: AdvancedCameraCardView,
|
||||
config: AdvancedCameraCardConfig,
|
||||
): ViewDisplayMode | null {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { View } from '../../../view/view';
|
||||
import { ViewModifier } from '../types';
|
||||
|
||||
export class MergeContextViewModifier implements ViewModifier {
|
||||
protected _context?: ViewContext | null;
|
||||
private _context?: ViewContext | null;
|
||||
|
||||
constructor(context?: ViewContext | null) {
|
||||
this._context = context;
|
||||
|
||||
@@ -3,8 +3,8 @@ import { View } from '../../../view/view';
|
||||
import { ViewModifier } from '../types';
|
||||
|
||||
export class RemoveContextPropertyViewModifier implements ViewModifier {
|
||||
protected _key: keyof ViewContext;
|
||||
protected _property: PropertyKey;
|
||||
private _key: keyof ViewContext;
|
||||
private _property: PropertyKey;
|
||||
|
||||
constructor(key: keyof ViewContext, property: PropertyKey) {
|
||||
this._key = key;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { View } from '../../../view/view';
|
||||
import { ViewModifier } from '../types';
|
||||
|
||||
export class RemoveContextViewModifier implements ViewModifier {
|
||||
protected _keys: (keyof ViewContext)[];
|
||||
private _keys: (keyof ViewContext)[];
|
||||
|
||||
constructor(keys: (keyof ViewContext)[]) {
|
||||
this._keys = keys;
|
||||
|
||||
@@ -4,8 +4,8 @@ import { View } from '../../../view/view';
|
||||
import { ViewModifier } from '../types';
|
||||
|
||||
export class SetQueryViewModifier implements ViewModifier {
|
||||
protected _query?: UnifiedQuery | null;
|
||||
protected _queryResults?: QueryResults | null;
|
||||
private _query?: UnifiedQuery | null;
|
||||
private _queryResults?: QueryResults | null;
|
||||
|
||||
constructor(options?: {
|
||||
query?: UnifiedQuery | null;
|
||||
|
||||
@@ -8,7 +8,7 @@ interface SubstreamOnViewModifierAPI {
|
||||
}
|
||||
|
||||
export class SubstreamOnViewModifier implements ViewModifier {
|
||||
protected _api: SubstreamOnViewModifierAPI;
|
||||
private _api: SubstreamOnViewModifierAPI;
|
||||
|
||||
constructor(api: SubstreamOnViewModifierAPI) {
|
||||
this._api = api;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { View } from '../../../view/view';
|
||||
import { ViewModifier } from '../types';
|
||||
|
||||
export class SubstreamSelectViewModifier implements ViewModifier {
|
||||
protected _substreamID: string;
|
||||
private _substreamID: string;
|
||||
|
||||
constructor(substreamID: string) {
|
||||
this._substreamID = substreamID;
|
||||
|
||||
@@ -16,15 +16,15 @@ import {
|
||||
import { ViewQueryExecutor } from './view-query-executor';
|
||||
|
||||
export class ViewManager implements ViewManagerInterface {
|
||||
protected _view: View | null = null;
|
||||
protected _viewFactory: ViewFactory;
|
||||
protected _viewQueryExecutor: ViewQueryExecutor;
|
||||
protected _api: CardViewAPI;
|
||||
protected _epoch: ViewManagerEpoch = this._createEpoch();
|
||||
private _view: View | null = null;
|
||||
private _viewFactory: ViewFactory;
|
||||
private _viewQueryExecutor: ViewQueryExecutor;
|
||||
private _api: CardViewAPI;
|
||||
private _epoch: ViewManagerEpoch = this._createEpoch();
|
||||
|
||||
// Used to mark as a view as "loading" with a given index. Each subsequent
|
||||
// async update will use a higher index.
|
||||
protected _loadingIndex = 1;
|
||||
private _loadingIndex = 1;
|
||||
|
||||
constructor(
|
||||
api: CardViewAPI,
|
||||
@@ -41,7 +41,7 @@ export class ViewManager implements ViewManagerInterface {
|
||||
public getEpoch(): ViewManagerEpoch {
|
||||
return this._epoch;
|
||||
}
|
||||
protected _createEpoch(oldView?: View | null): ViewManagerEpoch {
|
||||
private _createEpoch(oldView?: View | null): ViewManagerEpoch {
|
||||
return {
|
||||
manager: this,
|
||||
...(oldView && { oldView }),
|
||||
@@ -97,7 +97,7 @@ export class ViewManager implements ViewManagerInterface {
|
||||
options,
|
||||
);
|
||||
|
||||
protected _setViewGeneric(
|
||||
private _setViewGeneric(
|
||||
viewFactoryFunc: (options?: ViewFactoryOptions) => View | null,
|
||||
options?: ViewFactoryOptions,
|
||||
): void {
|
||||
@@ -119,14 +119,14 @@ export class ViewManager implements ViewManagerInterface {
|
||||
}
|
||||
}
|
||||
|
||||
protected _markViewLoadingQuery(view: View, index: number): View {
|
||||
private _markViewLoadingQuery(view: View, index: number): View {
|
||||
return view.mergeInContext({ loading: { query: index } });
|
||||
}
|
||||
protected _markViewAsNotLoadingQuery(view: View): View {
|
||||
private _markViewAsNotLoadingQuery(view: View): View {
|
||||
return view.removeContextProperty('loading', 'query');
|
||||
}
|
||||
|
||||
protected _isAllowedToSetView(): boolean {
|
||||
private _isAllowedToSetView(): boolean {
|
||||
// It is possible to have a race condition where the view is being set at
|
||||
// the same time as the cameras being initialized. Test case: Open
|
||||
// folder-based media in the media viewer carousel, then attempt to edit the
|
||||
@@ -139,7 +139,7 @@ export class ViewManager implements ViewManagerInterface {
|
||||
.isInitialized(InitializationAspect.CAMERAS);
|
||||
}
|
||||
|
||||
protected async _setViewThenModifyAsync(
|
||||
private async _setViewThenModifyAsync(
|
||||
viewFactoryFunc: (options?: ViewFactoryOptions) => View | null,
|
||||
viewModifiersFunc: (
|
||||
view: View,
|
||||
@@ -229,7 +229,7 @@ export class ViewManager implements ViewManagerInterface {
|
||||
this._setView(newView);
|
||||
}
|
||||
|
||||
protected _shouldAdoptQueryAndResults(newView: View): boolean {
|
||||
private _shouldAdoptQueryAndResults(newView: View): boolean {
|
||||
// If the user is currently using the viewer, and then switches to the
|
||||
// gallery we make an attempt to keep the query/queryResults the same so
|
||||
// the gallery can be used to click back and forth to the viewer, and the
|
||||
@@ -292,7 +292,7 @@ export class ViewManager implements ViewManagerInterface {
|
||||
return true;
|
||||
};
|
||||
|
||||
protected _setView(view: Readonly<View> | null): void {
|
||||
private _setView(view: Readonly<View> | null): void {
|
||||
const oldView = this._view;
|
||||
|
||||
log(
|
||||
|
||||
Reference in New Issue
Block a user