Switch to importing most things from the main matrix-js-sdk export (#11406)

* Switch to importing most things from the main matrix-js-sdk export

* fix imports

* Iterate

* Fix tests
This commit is contained in:
Michael Telatynski
2023-08-15 16:00:17 +01:00
committed by GitHub
parent 0842559fb2
commit ad73b0c16e
52 changed files with 262 additions and 277 deletions

View File

@@ -14,10 +14,16 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { MatrixClient, IContent, IEventRelation, MatrixError, THREAD_RELATION_TYPE } from "matrix-js-sdk/src/matrix";
import { makeLocationContent, makeBeaconInfoContent } from "matrix-js-sdk/src/content-helpers";
import {
MatrixClient,
IContent,
IEventRelation,
MatrixError,
THREAD_RELATION_TYPE,
ContentHelpers,
LocationAssetType,
} from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { LocationAssetType } from "matrix-js-sdk/src/@types/location";
import { _t } from "../../../languageHandler";
import Modal from "../../../Modal";
@@ -109,7 +115,7 @@ export const shareLiveLocation =
try {
await OwnBeaconStore.instance.createLiveBeacon(
roomId,
makeBeaconInfoContent(
ContentHelpers.makeBeaconInfoContent(
timeout ?? DEFAULT_LIVE_DURATION,
true /* isLive */,
description,
@@ -134,7 +140,13 @@ 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;
const content = makeLocationContent(undefined, uri, timestamp, undefined, assetType) as IContent;
const content = ContentHelpers.makeLocationContent(
undefined,
uri,
timestamp,
undefined,
assetType,
) as IContent;
await doMaybeLocalRoomAction(
roomId,
(actualRoomId: string) => client.sendMessage(actualRoomId, threadId, content),