This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 833
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix infinite loop when pinning/unpinning persistent widgets
Pinning or unpinning a persistent widget, such as Jitsi, could cause the PiP view and the app drawer to fight for control over the widget, since the PiP view never realized that it was supposed to relinquish control. This was due to a race between the WidgetLayoutStore update and the AppTile lifecycle tracking update.
- Loading branch information
Showing
5 changed files
with
124 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
Copyright 2022 The Matrix.org Foundation C.I.C. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import ActiveWidgetStore from "../../src/stores/ActiveWidgetStore"; | ||
|
||
describe("ActiveWidgetStore", () => { | ||
const store = ActiveWidgetStore.instance; | ||
|
||
it("tracks docked and live tiles correctly", () => { | ||
expect(store.isDocked("1", "r1")).toEqual(false); | ||
expect(store.isLive("1", "r1")).toEqual(false); | ||
|
||
// Try undocking the widget before it gets docked | ||
store.undockWidget("1", "r1"); | ||
expect(store.isDocked("1", "r1")).toEqual(false); | ||
expect(store.isLive("1", "r1")).toEqual(false); | ||
|
||
store.dockWidget("1", "r1"); | ||
expect(store.isDocked("1", "r1")).toEqual(true); | ||
expect(store.isLive("1", "r1")).toEqual(true); | ||
|
||
store.dockWidget("1", "r1"); | ||
expect(store.isDocked("1", "r1")).toEqual(true); | ||
expect(store.isLive("1", "r1")).toEqual(true); | ||
|
||
store.undockWidget("1", "r1"); | ||
expect(store.isDocked("1", "r1")).toEqual(true); | ||
expect(store.isLive("1", "r1")).toEqual(true); | ||
|
||
// Ensure that persistent widgets remain live even while undocked | ||
store.setWidgetPersistence("1", "r1", true); | ||
store.undockWidget("1", "r1"); | ||
expect(store.isDocked("1", "r1")).toEqual(false); | ||
expect(store.isLive("1", "r1")).toEqual(true); | ||
|
||
store.setWidgetPersistence("1", "r1", false); | ||
expect(store.isDocked("1", "r1")).toEqual(false); | ||
expect(store.isLive("1", "r1")).toEqual(false); | ||
}); | ||
}); |