Skip to content

Conversation

michelinewu
Copy link
Contributor

No description provided.

@michelinewu michelinewu requested review from Copilot and gettinToasty and removed request for Copilot October 1, 2025 22:01
*/
export function alertAsync(p: Omit<ModalFuncProps, 'afterClose'> | string): Promise<void> {
export function alertAsync(
p: (Omit<ModalFuncProps, 'afterClose'> | string) & { afterCloseFn?: () => void },
Copy link
Contributor

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?

Copy link
Contributor Author

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

<Button onClick={Modal.destroyAll}>{$t('Skip')}</Button>
{!p.cancelBtnPosition ||
(p.cancelBtnPosition && p.cancelBtnPosition === 'left' && (
<Button onClick={Modal.destroyAll}>{p.cancelBtnText ?? $t('Skip')}</Button>
Copy link
Contributor

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'),
);
Copy link
Contributor

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);
Copy link
Contributor

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?

Copy link
Contributor Author

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.')
Copy link
Contributor

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();
Copy link
Contributor

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);
// }
// }
// }
Copy link
Contributor

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

Copy link
Contributor Author

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);
Copy link
Contributor

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');
Copy link
Contributor

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?

Copy link
Contributor Author

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

// Note: Because the horizontal video context is the default, it does not need
// to be validated.

console.log('this.views.isDualOutputMode', this.views.isDualOutputMode);
Copy link
Contributor

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) => {
Copy link
Contributor

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 => {
Copy link
Contributor

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({
Copy link
Contributor

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"
Copy link
Contributor

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).

Copy link
Contributor

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]);
Copy link
Contributor

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}
Copy link
Contributor

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,
Copy link
Contributor

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({
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants