SynQApp / Extension

Your music companion for the web, with a portable mini player and the ability to listen to any music link on your preferred service!
https://www.synqapp.io
Apache License 2.0
24 stars 2 forks source link

Implement tab select screen #23

Closed tekkeon closed 11 months ago

tekkeon commented 11 months ago

Overview

This PR implements the tab selection screen on the popup which is needed when there is more than one music service tab open at a time, as we cannot automatically know which tab the user would like to use. Implementing this screen required quite a bit of work not because of the screen itself but because, up til this point, the extension assumed one tab was open and didn't need to differentiate how it sent messages to tabs or which tab to utilize for updating the player state.

State

With the change to Redux and persisted state, I made the following changes to handle the state of the tabs:

Commands

In addition to ensuring only one tab gets to update state at a time, only one tab should be able to listen to messages at a time. To accomplish that, I enhanced the broadcast function provided by Plasmo to allow a specific tab to be specified. With that, the sendMessage util can now specify a tab. This allows both the popup and the sidebar to determine which tab to select and to send messages to.