Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kristian-mkd committed Dec 18, 2024
1 parent 5056b05 commit 7559c6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
6 changes: 2 additions & 4 deletions packages/client/src/client-details.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {
AndroidState,
AndroidThermalState,
AppleState,
AppleThermalState,
ClientDetails,
Device,
Expand Down Expand Up @@ -90,7 +88,7 @@ export const setThermalState = (state: string) => {
};
}

if (osInfo.name === 'iOS') {
if (osInfo.name.toLowerCase() === 'ios') {
const thermalState =
AppleThermalState[state as keyof typeof AppleThermalState] ||
AppleThermalState.UNSPECIFIED;
Expand Down Expand Up @@ -126,7 +124,7 @@ export const setPowerState = (powerMode: boolean) => {
};
}

if (osInfo.name === 'iOS') {
if (osInfo.name.toLowerCase() === 'ios') {
deviceState = {
oneofKind: 'apple',
apple: {
Expand Down
13 changes: 5 additions & 8 deletions packages/react-native-sdk/src/providers/StreamCall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ const ClearPushWSSubscriptions = () => {
return null;
};

const eventEmitter =
NativeModules?.StreamVideoReactNative &&
new NativeEventEmitter(NativeModules?.StreamVideoReactNative);
const eventEmitter = NativeModules?.StreamVideoReactNative
? new NativeEventEmitter(NativeModules?.StreamVideoReactNative)
: undefined;

/**
* This is a renderless component to get the device stats like thermal state and power saver mode.
Expand All @@ -166,9 +166,6 @@ const DeviceStats = () => {
const callingState = useCallCallingState();

useEffect(() => {
let powerModeSubscription: EmitterSubscription;
let thermalStateSubscription: EmitterSubscription;

if (callingState !== CallingState.JOINED) {
return;
}
Expand All @@ -177,7 +174,7 @@ const DeviceStats = () => {
(initialPowerMode: boolean) => setPowerState(initialPowerMode)
);

powerModeSubscription = eventEmitter?.addListener(
let powerModeSubscription = eventEmitter?.addListener(
'isLowPowerModeEnabled',
(isLowPowerMode: boolean) => setPowerState(isLowPowerMode)
);
Expand All @@ -186,7 +183,7 @@ const DeviceStats = () => {
(initialState: string) => setThermalState(initialState)
);

thermalStateSubscription = eventEmitter?.addListener(
let thermalStateSubscription = eventEmitter?.addListener(
'thermalStateDidChange',
(thermalState: string) => setThermalState(thermalState)
);
Expand Down

0 comments on commit 7559c6b

Please sign in to comment.