Use doMaybeLocalRoomAction (#9038)

* Use doMaybeLocalRoomAction

* Revert unnecessary changes
This commit is contained in:
Michael Weimann 2022-07-13 07:56:36 +02:00 committed by GitHub
parent 9b8b8763f7
commit 3be20cf434
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 333 additions and 22 deletions

View file

@ -26,6 +26,7 @@ import Modal from "../../../Modal";
import QuestionDialog from "../dialogs/QuestionDialog";
import SdkConfig from "../../../SdkConfig";
import { OwnBeaconStore } from "../../../stores/OwnBeaconStore";
import { doMaybeLocalRoomAction } from "../../../utils/local-room";
export enum LocationShareType {
Own = 'Own',
@ -95,10 +96,11 @@ export const shareLocation = (
try {
const threadId = relation?.rel_type === THREAD_RELATION_TYPE.name ? relation.event_id : null;
const assetType = shareType === LocationShareType.Pin ? LocationAssetType.Pin : LocationAssetType.Self;
await client.sendMessage(
const content = makeLocationContent(undefined, uri, timestamp, undefined, assetType);
await doMaybeLocalRoomAction(
roomId,
threadId,
makeLocationContent(undefined, uri, timestamp, undefined, assetType),
(actualRoomId: string) => client.sendMessage(actualRoomId, threadId, content),
client,
);
} catch (error) {
handleShareError(error, openMenu, shareType);