import { EventEmitter } from "eventemitter3"; import type { Content, Settings, Logging, Focus } from "./api"; import type { Channel, Topic, Asset, Tag, Participant } from "./types"; import { Store } from "./store"; import { Crypto } from "./crypto"; export class ContentModule implements Content { private log: Logging; private store: Store; private crypto: Crypto | null; private guid: string; private token: string; private node: string; private secure: boolean; private settings: Settings; private emitter: EventEmitter; constructor(log: Logging, settings: Settings, store: Store, crypto: Crypto | null, guid: string, token: string, node: string, secure: boolean) { this.guid = guid; this.token = token; this.node = node; this.secure = secure; this.log = log; this.store = store; this.crypto = crypto; this.settings = settings; this.emitter = new EventEmitter(); } public addChannelListener(ev: (channels: Channel[]) => void): void { this.emitter.on("channel", ev); } public removeChannelListener(ev: (channels: Channel[]) => void): void { this.emitter.off("channel", ev); } public async close(): void {} public async setRevision(rev: number): Promise { console.log("set content revision:", rev); } public async addChannel(sealed: boolean, type: string, subject: string, cardIds: string[], groupIds: string[]): Promise { return ""; } public async removeChannel(channelId: string): Promise {} public async setChannelSubject(channelId: string, subject: string): Promise {} public async setChannelCard(channelId: string, cardId: string): Promise {} public async clearChannelCard(channelId: string, cardId: string): Promise {} public async setChannelGroup(channelId: string, groupId: string): Promise {} public async clearChannelGroup(channelId: string, groupId: string): Promise {} public async addTopic(channelId: string, type: string, subject: string, assets: Asset[]): Promise { return ""; } public async removeTopic(channelId: string, topicId: string): Promise {} public async flagTopic(channelId: string, topicId: string): Promise {} public async setTopicSubject(channelId: string, topicId: string, subject: string): Promise {} public async setTopicSort(channelId: string, topicId: string, sort: number): Promise {} public async addTag(channelId: string, topicId: string, type: string, value: string): Promise { return ""; } public async removeTag(channelId: string, topicId: string, tagId: string): Promise {} public async setTagSubject(channelId: string, topicId: string, tagId: string, subject: string): Promise {} public async setTagSort(channelId: string, topicId: string, tagId: string, sort: number): Promise {} public async flagTag(channelId: string, topicId: string, tagId: string): Promise {} public async setBlockTopic(channelId: string, topicId: string): Promise {} public async setBlockTag(channelId: string, topicId: string, tagId: string): Promise {} public async clearBlockTopic(channelId: string, topicId: string): Promise {} public async clearBlockTag(channelId: string, topicId: string, tagId: string): Promise {} public async getBlockedTopics(): Promise<{ channelId: string; topicId: string }[]> { return []; } public async getBlockedTags(): Promise<{ channelId: string; topicId: string; tagId: string }[]> { return []; } public async enableNotifications(channelId: string, memberId: string): Promise {} public async disableNotifications(channelId: string, memberId: string): Promise {} public async enableSortTopic(channelId: string, memberId: string): Promise {} public async disableSortTopic(channelId: string, memberId: string): Promise {} public async enableSortTag(channelId: string, memberId: string): Promise {} public async disableSortTag(channelId: string, memberId: string): Promise {} public async enableAddTopic(channelId: string, memberId: string): Promise {} public async disableAddTopic(channelId: string, memberId: string): Promise {} public async enableAddTag(channelId: string, memberId: string): Promise {} public async disableAddTag(channelId: string, memberId: string): Promise {} public async enableAddAsset(channelId: string, memberId: string): Promise {} public async disableAddAsset(channelId: string, memberId: string): Promise {} public async enableAddParticipant(channelId: string, memberId: string): Promise {} public async disableAddParticipant(channelId: string, memberId: string): Promise {} public getTopicAssetUrl(channelId: string, topicId: string, assetId: string): string { return ""; } public async getTopics(channelId: string): Promise { return []; } public async getMoreTopics(channelId: string): Promise { return []; } public async getTags(channelId: string, topicId: string): Promise { return []; } public async getMoreTags(channelId: string, topicId: string): Promise { return []; } public async setUnreadChannel(channelId: string): Promise {} public async clearUnreadChannel(channelId: string): Promise {} public async setFocus(chanenlId: string): Focus { return new FocusModule(this.log, this.store, this.crypto, null, channelId, null); } public async clearFocus() {} public async addParticipantAccess(channelId: string, name: string): Promise { return { id: "", guid: "", name: "", server: "", token: "" }; } public async removeParticipantAccess(channelId: string, repeaterId: string): Promise {} i}