-
Notifications
You must be signed in to change notification settings - Fork 706
Switcher and go live UI. #5597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Switcher and go live UI. #5597
Conversation
*/ | ||
export function alertAsync(p: Omit<ModalFuncProps, 'afterClose'> | string): Promise<void> { | ||
export function alertAsync( | ||
p: (Omit<ModalFuncProps, 'afterClose'> | string) & { afterCloseFn?: () => void }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we not just using ModalFuncProps | string
here with the existing afterClose
function prop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we use the spread operator when applying props and we need to use the afterClose
prop to execute the function, to prevent possible issues with using the same prop name I added the afterCloseFn
prop
app/components-react/modals.tsx
Outdated
<Button onClick={Modal.destroyAll}>{$t('Skip')}</Button> | ||
{!p.cancelBtnPosition || | ||
(p.cancelBtnPosition && p.cancelBtnPosition === 'left' && ( | ||
<Button onClick={Modal.destroyAll}>{p.cancelBtnText ?? $t('Skip')}</Button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't seem to include the cancelFn
callback like the right side button
JSON.stringify(event) + | ||
'\nSource: ' + | ||
(isMobileRemote ? 'Mobile' : 'Desktop'), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console debug
const streamShiftEvent = StreamingService.streamShiftEvent.subscribe(event => { | ||
const streamShiftStreamId = RestreamService.state.streamShiftStreamId; | ||
|
||
const isMobileRemote = streamShiftStreamId && /[A-Z]/.test(streamShiftStreamId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think i might need some clarification on this regex check-- any id with a capital letter signifies a mobile remote setup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct
const message = isDualOutputMode | ||
? $t( | ||
'A stream on another device has been detected. Would you like to switch your stream to Streamlabs Desktop? If you do not wish to continue this stream, please end it from the current streaming source.', | ||
) + $t('Dual Output will be disabled since not supported in this mode.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't be concatenating translated strings in case grammatical patterns of different languages require a restructure
*/ | ||
function CustomDestinationList() { | ||
const { isPrime, customDestinations, editCustomDestMode, addCustomDest } = useStreamSettings(); | ||
const { customDestinations, editCustomDestMode, addCustomDest } = useStreamSettings(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ oh nvm the above found it, but if we're decoupling from the module that much i think it might just be worth to do it all the way
// await this.stopBroadcast(streamShiftBroadcast.id); | ||
// } | ||
// } | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this is unneeded or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I coded out two possible solutions for a bug. This is the second one, the first one is currently in testing. If the first fix seems to work, we can take this out. I'll add a TODO to remove it if the first fix is working and stable
if (status.isLive) { | ||
this.streamSettingsService.setGoLiveSettings({ streamShift: true }); | ||
this.SET_STREAM_SWITCHER_STATUS('pending'); | ||
this.SET_STREAM_SWITCHER_TARGETS(status.targets); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it feels like a code smell that a status checking function would cause mutations as a side effect, not sure entirely what the intention of this function is
let categories: CategoryName[] = obs.NodeObs.OBS_settings_getListCategories(); | ||
// insert 'Multistreaming' after 'General' | ||
categories.splice(1, 0, 'Multistreaming'); | ||
// categories.splice(1, 0, 'Multistreaming'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we just removing this settings page entirely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, in favor of a less cluttered menu since it no longer had any settings managed by it
app/services/streaming/streaming.ts
Outdated
// Note: Because the horizontal video context is the default, it does not need | ||
// to be validated. | ||
|
||
console.log('this.views.isDualOutputMode', this.views.isDualOutputMode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console log
popOut() { | ||
this.platformAppsService.popOutAppPage(this.store.selectedChat, this.pageSlot); | ||
this.store.setState(s => { | ||
this.store.setState((s: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did TypeScript drop the ball on this file? These types shouldn't be needed for any of the setState
calls in this file. If they did drop the ball and can't infer (wouldn't be surprised) can you add a comment to the first one stating so?
fetchStreamShiftStatus(); | ||
} | ||
|
||
const streamShiftEvent = StreamingService.streamShiftEvent.subscribe(event => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this initially was a comment about unsubscribing from this event, but then I found it does do that so nevermind, the only useful part of that was the nudge that some RxJS operators might help with some of what we're doing in the function body (things like filtering and case switching), but totally optional and more of a nice-to-have.
stream: 'mobile-to-desktop', | ||
}); | ||
|
||
promptAction({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two calls to promptAction
seem to be the same except for the fn
and the message
, 2 is technically my limit with dupes but considering how many lines this is in an already non-trivial function, I wouldn't mind if we made an exception and abstract this and parameterize those two, for desktop/mobile/etc (wink wink). so we can reduce line count.
function SmallAddDestinationButton(p: { className?: string; onClick: () => void }) { | ||
return ( | ||
<Button | ||
data-test="default-add-destination" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really decide if we're gonna use data-test
or data-testid
. Nit: add a button
or btn
suffix, when reading a test it would easier to spot that is a button (apart from the testing API that presumably clicks it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-name is the convention we use for most of our form selectors, i think it could probably be used here too
if (!isPrime && isStreamShiftMode) { | ||
setStreamShift(false); | ||
} | ||
}, [isPrime, isStreamShiftMode, setStreamShift]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does setStreamShift
need to be a dependency? Also, depending on how it is defined, it could cause this to evaluate everytime, since it could create a function everytime or fail an equality test.
export const RadioGroup = InputComponent((p: TRadioGroupProps) => { | ||
return ( | ||
<InputWrapper | ||
// label={p.label} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left-over comment
enabledPlatforms, | ||
primaryChat, | ||
recommendedColorSpaceWarnings, | ||
isPrime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 3 fields related to stream shift we have to pull, deref and subsequently use, with no semantic relation other than their names, we have always done it like this so no action, but more of a thought provocation to maybe start grouping these in objects and pass those around.
|
||
// Prompt to confirm stream switch if the stream exists | ||
if (isLive) { | ||
promptAction({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely (probably?) have seen this function before, so technically my 2 dupes rule is no longer valid :D
No description provided.