Fix dependency injection of refactoring

This commit is contained in:
Pieter Vander Vennet 2022-02-16 01:46:55 +01:00
parent f0675a026b
commit 39e6cdfda4
4 changed files with 25 additions and 15 deletions

View file

@ -20,11 +20,7 @@ export default class ElementsState extends FeatureSwitchState {
The mapping from id -> UIEventSource<properties>
*/
public allElements: ElementStorage = new ElementStorage();
/**
THe change handler
*/
public changes: Changes;
/**
The latest element that was selected
*/
@ -48,9 +44,6 @@ export default class ElementsState extends FeatureSwitchState {
constructor(layoutToUse: LayoutConfig) {
super(layoutToUse);
// @ts-ignore
this.changes = new Changes(this, layoutToUse?.isLeftRightSensitive() ?? false)
{
// -- Location control initialization
const zoom = UIEventSource.asFloat(
QueryParameters.GetQueryParameter(
@ -85,10 +78,7 @@ export default class ElementsState extends FeatureSwitchState {
lat.setData(latlonz.lat);
lon.setData(latlonz.lon);
});
}
new ChangeToElementsActor(this.changes, this.allElements)
new PendingChangesUploader(this.changes, this.selectedElement);
}
}

View file

@ -271,6 +271,7 @@ export default class MapState extends UserRelatedState {
let gpsLayerDef: FilteredLayer = this.filteredLayers.data.filter(l => l.layerDef.id === "gps_location_history")[0]
if (gpsLayerDef !== undefined) {
this.historicalUserLocations = new SimpleFeatureSource(gpsLayerDef, Tiles.tile_index(0, 0, 0), features);
this.changes.setHistoricalUserLocations(this.historicalUserLocations)
}

View file

@ -8,6 +8,9 @@ import {Utils} from "../../Utils";
import Locale from "../../UI/i18n/Locale";
import ElementsState from "./ElementsState";
import SelectedElementTagsUpdater from "../Actors/SelectedElementTagsUpdater";
import {Changes} from "../Osm/Changes";
import ChangeToElementsActor from "../Actors/ChangeToElementsActor";
import PendingChangesUploader from "../Actors/PendingChangesUploader";
/**
* The part of the state which keeps track of user-related stuff, e.g. the OSM-connection,
@ -20,6 +23,10 @@ export default class UserRelatedState extends ElementsState {
The user credentials
*/
public osmConnection: OsmConnection;
/**
THe change handler
*/
public changes: Changes;
/**
* The key for mangrove
*/
@ -44,6 +51,13 @@ export default class UserRelatedState extends ElementsState {
attemptLogin: options?.attemptLogin
})
this.changes = new Changes(this, layoutToUse?.isLeftRightSensitive() ?? false)
new ChangeToElementsActor(this.changes, this.allElements)
new PendingChangesUploader(this.changes, this.selectedElement);
this.mangroveIdentity = new MangroveIdentity(
this.osmConnection.GetLongPreference("identity", "mangrove")
);