diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e853dfd..9bb3640 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,6 +11,43 @@ issues if you're going to work on something to avoid duplication of effort. Submit an issue for new features before submitting a PR. -## Compatibility Report +## Compatibility Reports Compatibility reports are always helpful. Use the "Compatibility Report" issue template. Ensure you have a working environment and that the site is in the whitelist (check options page). + + +## Localizations + +Missing strings: + +* `es` + * `optionsMediaSyncElementDescription` + * `optionsReceiverSelectorCategoryName` + * `optionsReceiverSelectorCategoryDescription` + * `optionsReceiverSelectorType` + * `optionsReceiverSelectorTypeBrowser` + * `optionsReceiverSelectorTypeNative` + * `optionsReceiverSelectorWaitForConnection` + * `optionsReceiverSelectorWaitForConnectionDescription` + * `optionsReceiverSelectorCloseIfFocusLost` + * `optionsMirroringAppIdDescription` +* `nl` + * `popupMediaTypeApp` + * `popupMediaTypeTab` + * `popupMediaTypeScreen` + * `popupMediaTypeFile` + * `popupMediaSelectCastLabel` + * `popupMediaSelectToLabel` + * `contextAddToWhitelist` + * `contextAddToWhitelistRecommended` + * `contextAddToWhitelistAdvancedAdd` + * `optionsMediaSyncElementDescription` + * `optionsReceiverSelectorCategoryName` + * `optionsReceiverSelectorCategoryDescription` + * `optionsReceiverSelectorType` + * `optionsReceiverSelectorTypeBrowser` + * `optionsReceiverSelectorTypeNative` + * `optionsReceiverSelectorWaitForConnection` + * `optionsReceiverSelectorWaitForConnectionDescription` + * `optionsReceiverSelectorCloseIfFocusLost` + * `optionsMirroringAppIdDescription` diff --git a/common/tsconfig.json b/common/tsconfig.json index a90baae..4300ab1 100644 --- a/common/tsconfig.json +++ b/common/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { - "allowJs": true - , "esModuleInterop": true + "esModuleInterop": true , "module": "commonjs" , "noImplicitAny": true , "removeComments": true diff --git a/ext/src/_locales/en/messages.json b/ext/src/_locales/en/messages.json index cf04c63..618da31 100755 --- a/ext/src/_locales/en/messages.json +++ b/ext/src/_locales/en/messages.json @@ -193,6 +193,10 @@ "message": "Sync receiver state with media element" , "description": "Media casting sync checkbox label." } + , "optionsMediaSyncElementDescription": { + "message": "Synchronize state (playback, volume, captions, etc...) between the media element and the receiver device." + , "description": "Media casting sync option description." + } , "optionsMediaStopOnUnload": { "message": "Stop receiver playback on page unload" , "description": "Media stop on unload checkbox label." @@ -215,6 +219,39 @@ , "description": "HTTP server port input label." } + , "optionsReceiverSelectorCategoryName": { + "message": "Receiver selector" + , "description": "Options page receiver selector category title." + } + , "optionsReceiverSelectorCategoryDescription": { + "message": "Receiver device selection interface." + , "description": "Options page receiver selector category description." + } + , "optionsReceiverSelectorType": { + "message": "Type:" + , "description": "Receiver selector type option label." + } + , "optionsReceiverSelectorTypeBrowser": { + "message": "Browser" + , "description": "Receiver selector type browser radio option label." + } + , "optionsReceiverSelectorTypeNative": { + "message": "Native" + , "description": "Receiver selector type native radio option label." + } + , "optionsReceiverSelectorWaitForConnection": { + "message": "Wait for connection" + , "description": "Receiver selector wait for connection option checkbox label." + } + , "optionsReceiverSelectorWaitForConnectionDescription": { + "message": "Keep receiver selector open until the session is established or connection fails." + , "description": "Receiver selector wait for connection option description." + } + , "optionsReceiverSelectorCloseIfFocusLost": { + "message": "Close after losing focus" + , "description": "Receiver selector close if focus lost option checkbox label." + } + , "optionsUserAgentWhitelistCategoryName": { "message": "User agent whitelist" , "description": "Options page whitelist category title." @@ -282,6 +319,10 @@ "message": "Receiver app ID:" , "description": "Mirroring app ID input label." } + , "optionsMirroringAppIdDescription": { + "message": "App ID for a registered Chromecast receiver application. Advanced use only. Must be compatible with the default app (see GitHub repo)." + , "description": "Mirroring app ID option description." + } , "optionsReset": { "message": "Restore Defaults" diff --git a/ext/src/defaultOptions.ts b/ext/src/defaultOptions.ts index 78f431e..e99e45c 100644 --- a/ext/src/defaultOptions.ts +++ b/ext/src/defaultOptions.ts @@ -1,5 +1,7 @@ "use strict"; +import { ReceiverSelectorType } from "./receiver_selectors"; + export interface Options { bridgeApplicationName: string; mediaEnabled: boolean; @@ -9,6 +11,12 @@ export interface Options { localMediaServerPort: number; mirroringEnabled: boolean; mirroringAppId: string; + receiverSelectorType: ReceiverSelectorType; + + // TODO: Implement + receiverSelectorCloseIfFocusLost: boolean; + receiverSelectorWaitForConnection: boolean; + userAgentWhitelistEnabled: boolean; userAgentWhitelist: string[]; @@ -24,6 +32,9 @@ const options: Options = { , localMediaServerPort: 9555 , mirroringEnabled: false , mirroringAppId: MIRRORING_APP_ID + , receiverSelectorType: ReceiverSelectorType.Popup + , receiverSelectorCloseIfFocusLost: true + , receiverSelectorWaitForConnection: false , userAgentWhitelistEnabled: true , userAgentWhitelist: [ "https://www.netflix.com/*" diff --git a/ext/src/main.ts b/ext/src/main.ts index 1cf1054..14009d3 100755 --- a/ext/src/main.ts +++ b/ext/src/main.ts @@ -639,11 +639,8 @@ async function onConnectShim (port: browser.runtime.Port) { } - const { os } = await browser.runtime.getPlatformInfo(); - - const receiverSelector = getReceiverSelector(os === "mac" - ? ReceiverSelectorType.NativeMac - : ReceiverSelectorType.Popup); + const receiverSelector = getReceiverSelector( + await options.get("receiverSelectorType")); function onReceiverSelectorSelected ( diff --git a/ext/src/ui/options/EditableList.tsx b/ext/src/ui/options/EditableList.tsx index cd5ec37..11b03b6 100644 --- a/ext/src/ui/options/EditableList.tsx +++ b/ext/src/ui/options/EditableList.tsx @@ -47,27 +47,13 @@ export default class EditableList extends Component< public render () { return (
-
- { this.state.rawView && - } - -
-
{ this.state.rawView ? ( @@ -88,15 +74,30 @@ export default class EditableList extends Component< onEdit={ this.handleNewItemEdit } editing={ true } /> } -
- -
)} +
+
+ { !this.state.rawView && + } + { this.state.rawView && + } + +
); } diff --git a/ext/src/ui/options/index.tsx b/ext/src/ui/options/index.tsx index 1ad5ba3..ff5637c 100644 --- a/ext/src/ui/options/index.tsx +++ b/ext/src/ui/options/index.tsx @@ -13,6 +13,8 @@ import getBridgeInfo, { BridgeInfo } from "../../lib/getBridgeInfo"; import options from "../../lib/options"; import { REMOTE_MATCH_PATTERN_REGEX } from "../../lib/utils"; +import { ReceiverSelectorType } from "../../receiver_selectors"; + const _ = browser.i18n.getMessage; @@ -73,6 +75,9 @@ class OptionsApp extends Component<{}, OptionsAppState> { this.handleInputChange = this.handleInputChange.bind(this); this.handleWhitelistChange = this.handleWhitelistChange.bind(this); + this.handleReceiverSelectorTypeChange + = this.handleReceiverSelectorTypeChange.bind(this); + this.getWhitelistItemPatternError = this.getWhitelistItemPatternError.bind(this); } @@ -117,58 +122,66 @@ class OptionsApp extends Component<{}, OptionsAppState> {

-
- -

{ _("optionsLocalMediaCategoryName") }

-
-

- { _("optionsLocalMediaCategoryDescription") } -

+
-
+ +
@@ -189,10 +202,12 @@ class OptionsApp extends Component<{}, OptionsAppState> {

+
+ +
+ +

{ _("optionsReceiverSelectorCategoryName") }

+
+

+ { _("optionsReceiverSelectorCategoryDescription") } +

+ + { this.state.platform === "mac" && + } + + + +
@@ -219,10 +294,12 @@ class OptionsApp extends Component<{}, OptionsAppState> {