Stores refactor: convert TypingStore; rename TestStores to TestSdkContext (#9454)

This commit is contained in:
kegsay
2022-10-19 14:14:14 +01:00
committed by GitHub
parent bb0c175b7e
commit 13fbd096b0
7 changed files with 26 additions and 22 deletions
+3 -10
View File
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { MatrixClientPeg } from "../MatrixClientPeg";
import { SdkContextClass } from "../contexts/SDKContext";
import SettingsStore from "../settings/SettingsStore";
import { isLocalRoom } from "../utils/localRoom/isLocalRoom";
import Timer from "../utils/Timer";
@@ -34,17 +34,10 @@ export default class TypingStore {
};
};
constructor() {
constructor(private readonly context: SdkContextClass) {
this.reset();
}
public static sharedInstance(): TypingStore {
if (window.mxTypingStore === undefined) {
window.mxTypingStore = new TypingStore();
}
return window.mxTypingStore;
}
/**
* Clears all cached typing states. Intended to be called when the
* MatrixClientPeg client changes.
@@ -108,6 +101,6 @@ export default class TypingStore {
} else currentTyping.userTimer.restart();
}
MatrixClientPeg.get().sendTyping(roomId, isTyping, TYPING_SERVER_TIMEOUT);
this.context.client?.sendTyping(roomId, isTyping, TYPING_SERVER_TIMEOUT);
}
}