LLS: rename wireError (#8401)

* rename wireError in ownbeaconstore to locationPublishError

Signed-off-by: Kerry Archibald <kerrya@element.io>

* rename getLiveBeaconIdsWithWireError -> getLiveBeaconIdsWithLocationPublishError

Signed-off-by: Kerry Archibald <kerrya@element.io>

* rename wire error variables in components

Signed-off-by: Kerry Archibald <kerrya@element.io>

* new snapshots for new test names

Signed-off-by: Kerry Archibald <kerrya@element.io>

* fix bad capitalisation on onResetLocationPublishError

Signed-off-by: Kerry Archibald <kerrya@element.io>

* missed variable

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry 2022-04-25 14:44:18 +02:00 committed by GitHub
parent a3f9123f6c
commit 8c6786bad6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 133 additions and 120 deletions

View file

@ -24,10 +24,10 @@ import { sortBeaconsByLatestExpiry } from "./duration";
type LiveBeaconsState = {
beacon?: Beacon;
onStopSharing?: () => void;
onResetWireError?: () => void;
onResetLocationPublishError?: () => void;
stoppingInProgress?: boolean;
hasStopSharingError?: boolean;
hasWireError?: boolean;
hasLocationPublishError?: boolean;
};
/**
@ -41,11 +41,11 @@ export const useOwnLiveBeacons = (liveBeaconIds: BeaconIdentifier[]): LiveBeacon
const [stoppingInProgress, setStoppingInProgress] = useState(false);
const [error, setError] = useState<Error>();
const hasWireError = useEventEmitterState(
const hasLocationPublishError = useEventEmitterState(
OwnBeaconStore.instance,
OwnBeaconStoreEvent.WireError,
OwnBeaconStoreEvent.LocationPublishError,
() =>
liveBeaconIds.some(OwnBeaconStore.instance.beaconHasWireError),
liveBeaconIds.some(OwnBeaconStore.instance.beaconHasLocationPublishError),
);
// reset stopping in progress on change in live ids
@ -72,16 +72,16 @@ export const useOwnLiveBeacons = (liveBeaconIds: BeaconIdentifier[]): LiveBeacon
}
};
const onResetWireError = () => {
liveBeaconIds.map(beaconId => OwnBeaconStore.instance.resetWireError(beaconId));
const onResetLocationPublishError = () => {
liveBeaconIds.map(beaconId => OwnBeaconStore.instance.resetLocationPublishError(beaconId));
};
return {
onStopSharing,
onResetWireError,
onResetLocationPublishError,
beacon,
stoppingInProgress,
hasWireError,
hasLocationPublishError,
hasStopSharingError: !!error,
};
};