Skip to content

Commit f238be4

Browse files
committed
RU-T47 PR#202 fixes
1 parent ce737dd commit f238be4

11 files changed

Lines changed: 55 additions & 48 deletions

File tree

.github/workflows/react-native-cicd.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -608,17 +608,15 @@ jobs:
608608

609609
- name: 📦 Prepare Electron release artifacts
610610
run: |
611-
# Find all matching Electron artifacts
612-
FILES=$(find electron-artifacts/ -type f \( -name "*.exe" -o -name "*.msi" -o -name "*.dmg" -o -name "*.zip" -o -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" \))
613-
614-
if [ -z "$FILES" ]; then
611+
# Find all matching Electron artifacts and check for existence
612+
if [ -z "$(find electron-artifacts/ -type f \( -name "*.exe" -o -name "*.msi" -o -name "*.dmg" -o -name "*.zip" -o -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" \) -print -quit)" ]; then
615613
echo "Error: No Electron artifacts found in electron-artifacts/ directory."
616614
exit 1
617615
fi
618616
619-
# Create release-artifacts directory and copy files
617+
# Create release-artifacts directory and copy files using null-delimited find/xargs
620618
mkdir -p release-artifacts
621-
echo "$FILES" | xargs -I {} cp {} release-artifacts/
619+
find electron-artifacts/ -type f \( -name "*.exe" -o -name "*.msi" -o -name "*.dmg" -o -name "*.zip" -o -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" \) -print0 | xargs -0 cp -t release-artifacts/
622620
623621
echo "Release artifacts prepared:"
624622
ls -lh release-artifacts/

src/app/(app)/calls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export default function Calls() {
106106

107107
{/* FAB button for creating new call - only show if user has permission */}
108108
{canUserCreateCalls ? (
109-
<Fab placement="bottom right" size="lg" onPress={handleNewCall} testID="new-call-fab">
109+
<Fab size="lg" onPress={handleNewCall} testID="new-call-fab">
110110
<FabIcon as={PlusIcon} size="lg" />
111111
</Fab>
112112
) : null}

src/components/calls/call-images-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ const CallImagesModal: React.FC<CallImagesModalProps> = ({ isOpen, onClose, call
262262
// At this point, imageSource is guaranteed to be non-null
263263
return (
264264
<Box className="w-full items-center justify-center px-4" style={{ width }}>
265-
<TouchableOpacity onPress={() => handleImagePress(imageSource, item.Name)} testID={`image-${item.Id}-touchable`} activeOpacity={0.7} style={{ width: '100%' }} delayPressIn={0} delayPressOut={0}>
265+
<TouchableOpacity onPress={() => handleImagePress(imageSource!, item.Name)} testID={`image-${item.Id}-touchable`} activeOpacity={0.7} style={{ width: '100%' }} delayPressIn={0} delayPressOut={0}>
266266
<Image
267267
key={`${item.Id}-${index}`}
268268
source={imageSource}

src/components/maps/map-view.web.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Env } from '@/lib/env';
1414
mapboxgl.accessToken = Env.UNIT_MAPBOX_PUBKEY;
1515

1616
// Context to share map instance with child components
17-
export const MapContext = React.createContext<mapboxgl.Map | null>(null);
17+
export const MapContext = React.createContext<any | null>(null);
1818

1919
// StyleURL constants matching native Mapbox SDK
2020
export const StyleURL = {
@@ -76,7 +76,7 @@ export const MapView = forwardRef<any, MapViewProps>(
7676
ref
7777
) => {
7878
const mapContainer = useRef<HTMLDivElement>(null);
79-
const map = useRef<mapboxgl.Map | null>(null);
79+
const map = useRef<any | null>(null);
8080
const [isLoaded, setIsLoaded] = useState(false);
8181

8282
useImperativeHandle(ref, () => ({
@@ -166,7 +166,7 @@ interface CameraProps {
166166
// Camera component
167167
export const Camera = forwardRef<any, CameraProps>(({ centerCoordinate, zoomLevel, heading, pitch, animationDuration = 1000, followUserLocation, followZoomLevel }, ref) => {
168168
const map = React.useContext(MapContext);
169-
const geolocateControl = useRef<mapboxgl.GeolocateControl | null>(null);
169+
const geolocateControl = useRef<any | null>(null);
170170

171171
useImperativeHandle(ref, () => ({
172172
setCamera: (options: { centerCoordinate?: [number, number]; zoomLevel?: number; heading?: number; pitch?: number; animationDuration?: number }) => {
@@ -203,6 +203,8 @@ export const Camera = forwardRef<any, CameraProps>(({ centerCoordinate, zoomLeve
203203
useEffect(() => {
204204
if (!map || !followUserLocation) return;
205205

206+
let triggerTimeoutId: any;
207+
206208
// Add geolocate control for following user
207209
if (!geolocateControl.current) {
208210
geolocateControl.current = new mapboxgl.GeolocateControl({
@@ -216,11 +218,14 @@ export const Camera = forwardRef<any, CameraProps>(({ centerCoordinate, zoomLeve
216218
}
217219

218220
// Trigger tracking after control is added
219-
setTimeout(() => {
221+
triggerTimeoutId = setTimeout(() => {
220222
geolocateControl.current?.trigger();
221223
}, 100);
222224

223225
return () => {
226+
if (triggerTimeoutId) {
227+
clearTimeout(triggerTimeoutId);
228+
}
224229
if (geolocateControl.current) {
225230
map.removeControl(geolocateControl.current);
226231
geolocateControl.current = null;
@@ -246,7 +251,7 @@ interface PointAnnotationProps {
246251
// PointAnnotation component
247252
export const PointAnnotation: React.FC<PointAnnotationProps> = ({ id, coordinate, title, children, anchor = { x: 0.5, y: 0.5 }, onSelected }) => {
248253
const map = React.useContext(MapContext);
249-
const markerRef = useRef<mapboxgl.Marker | null>(null);
254+
const markerRef = useRef<any | null>(null);
250255
const containerRef = useRef<HTMLDivElement | null>(null);
251256
const containerRootRef = useRef<any>(null);
252257

@@ -266,18 +271,16 @@ export const PointAnnotation: React.FC<PointAnnotationProps> = ({ id, coordinate
266271
}
267272

268273
// Determine marker options based on anchor prop
269-
const markerOptions: mapboxgl.MarkerOptions = {
274+
const markerOptions: any = {
270275
element: container,
271276
};
272277

273278
// Handle anchor prop - if it's a string, use it as mapbox anchor
274279
if (typeof anchor === 'string') {
275-
markerOptions.anchor = anchor as mapboxgl.Anchor;
280+
markerOptions.anchor = anchor as any;
276281
}
277282

278-
markerRef.current = new mapboxgl.Marker(markerOptions)
279-
.setLngLat(coordinate)
280-
.addTo(map);
283+
markerRef.current = new mapboxgl.Marker(markerOptions).setLngLat(coordinate).addTo(map);
281284

282285
// If anchor is an {x, y} object, convert to pixel offset
283286
if (typeof anchor === 'object' && anchor !== null && 'x' in anchor && 'y' in anchor) {

src/components/ui/bottomsheet/index.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ const bottomSheetItemStyle = tva({
3636

3737
const BottomSheetContext = createContext<{
3838
visible: boolean;
39-
bottomSheetRef: React.RefObject<GorhomBottomSheet | null>;
39+
bottomSheetRef: React.RefObject<GorhomBottomSheet> | null;
4040
handleClose: () => void;
4141
handleOpen: () => void;
4242
}>({
4343
visible: false,
44-
bottomSheetRef: { current: null },
45-
handleClose: () => {},
46-
handleOpen: () => {},
44+
bottomSheetRef: null,
45+
handleClose: () => { },
46+
handleOpen: () => { },
4747
});
4848

4949
type IBottomSheetProps = React.ComponentProps<typeof GorhomBottomSheet>;
@@ -68,7 +68,7 @@ export const BottomSheet = ({ snapToIndex = 1, onOpen, onClose, ...props }: { sn
6868
<BottomSheetContext.Provider
6969
value={{
7070
visible,
71-
bottomSheetRef,
71+
bottomSheetRef: bottomSheetRef as React.RefObject<GorhomBottomSheet>,
7272
handleClose,
7373
handleOpen,
7474
}}
@@ -166,14 +166,14 @@ export const BottomSheetContent = ({ ...props }: IBottomSheetContent) => {
166166
const keyDownHandlers = useMemo(() => {
167167
return Platform.OS === 'web'
168168
? {
169-
onKeyDown: (e: React.KeyboardEvent) => {
170-
if (e.key === 'Escape') {
171-
e.preventDefault();
172-
handleClose();
173-
return;
174-
}
175-
},
176-
}
169+
onKeyDown: (e: React.KeyboardEvent) => {
170+
if (e.key === 'Escape') {
171+
e.preventDefault();
172+
handleClose();
173+
return;
174+
}
175+
},
176+
}
177177
: {};
178178
}, [handleClose]);
179179

src/lib/platform.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ export const isWeb = Platform.OS === 'web';
99

1010
// Check if running in Electron (desktop app wrapped around web)
1111
// Prefer preload-exposed electronAPI for contextIsolation-enabled environments
12-
export const isElectron =
13-
typeof window !== 'undefined' &&
14-
(!!(window as any).electronAPI || window.process?.type === 'renderer');
12+
export const isElectron = typeof window !== 'undefined' && (!!(window as any).electronAPI || window.process?.type === 'renderer');
1513

1614
// Check if running on a desktop platform (Electron or native desktop)
1715
export const isDesktop = isElectron || Platform.OS === 'macos' || Platform.OS === 'windows';

src/services/__tests__/callkeep.service.ios.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,10 @@ describe('CallKeepService', () => {
157157
// Register callback
158158
service.setMuteStateCallback(mockMuteCallback);
159159

160+
// Simulate mute event
160161
// Simulate mute event
161162
const muteEventHandler = mockCallKeep.addEventListener.mock.calls.find(
162-
call => call[0] === 'didPerformSetMutedCallAction'
163+
(call: any[]) => call[0] === 'didPerformSetMutedCallAction'
163164
)?.[1] as any;
164165

165166
expect(muteEventHandler).toBeDefined();
@@ -191,7 +192,7 @@ describe('CallKeepService', () => {
191192
service.setMuteStateCallback(errorCallback);
192193

193194
const muteEventHandler = mockCallKeep.addEventListener.mock.calls.find(
194-
call => call[0] === 'didPerformSetMutedCallAction'
195+
(call: any[]) => call[0] === 'didPerformSetMutedCallAction'
195196
)?.[1] as any;
196197

197198
if (muteEventHandler) {
@@ -226,7 +227,7 @@ describe('CallKeepService', () => {
226227
service.setMuteStateCallback(null);
227228

228229
const muteEventHandler = mockCallKeep.addEventListener.mock.calls.find(
229-
call => call[0] === 'didPerformSetMutedCallAction'
230+
(call: any[]) => call[0] === 'didPerformSetMutedCallAction'
230231
)?.[1] as any;
231232

232233
if (muteEventHandler) {

src/services/callkeep.service.ios.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export class CallKeepService {
247247
});
248248

249249
// Call ended from CallKit UI
250-
RNCallKeep.addEventListener('endCall', ({ callUUID }) => {
250+
RNCallKeep.addEventListener('endCall', ({ callUUID }: { callUUID: string }) => {
251251
logger.info({
252252
message: 'CallKeep call ended from system UI',
253253
context: { callUUID },
@@ -260,15 +260,15 @@ export class CallKeepService {
260260
});
261261

262262
// Call answered (not typically used for outgoing calls, but good to handle)
263-
RNCallKeep.addEventListener('answerCall', ({ callUUID }) => {
263+
RNCallKeep.addEventListener('answerCall', ({ callUUID }: { callUUID: string }) => {
264264
logger.debug({
265265
message: 'CallKeep call answered',
266266
context: { callUUID },
267267
});
268268
});
269269

270270
// Mute/unmute events
271-
RNCallKeep.addEventListener('didPerformSetMutedCallAction', ({ muted, callUUID }) => {
271+
RNCallKeep.addEventListener('didPerformSetMutedCallAction', ({ muted, callUUID }: { muted: boolean; callUUID: string }) => {
272272
logger.debug({
273273
message: 'CallKeep mute state changed',
274274
context: { muted, callUUID },

src/services/push-notification.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class PushNotificationService {
109109
}
110110
}
111111

112-
private handleRemoteMessage = async (remoteMessage: FirebaseMessagingTypes.RemoteMessage): Promise<void> => {
112+
private handleRemoteMessage = async (remoteMessage: any): Promise<void> => {
113113
logger.info({
114114
message: 'FCM message received',
115115
context: {
@@ -238,7 +238,7 @@ class PushNotificationService {
238238

239239
// Register background message handler (only once)
240240
if (!this.backgroundMessageHandlerRegistered) {
241-
messaging().setBackgroundMessageHandler(async (remoteMessage) => {
241+
messaging().setBackgroundMessageHandler(async (remoteMessage: any) => {
242242
logger.info({
243243
message: 'Background FCM message received',
244244
context: {
@@ -278,7 +278,7 @@ class PushNotificationService {
278278
this.fcmOnMessageUnsubscribe = messaging().onMessage(this.handleRemoteMessage);
279279

280280
// Listen for notification opened app (when user taps on notification)
281-
this.fcmOnNotificationOpenedAppUnsubscribe = messaging().onNotificationOpenedApp((remoteMessage) => {
281+
this.fcmOnNotificationOpenedAppUnsubscribe = messaging().onNotificationOpenedApp((remoteMessage: any) => {
282282
logger.info({
283283
message: 'Notification opened app (from background)',
284284
context: {
@@ -319,7 +319,7 @@ class PushNotificationService {
319319
setTimeout(() => {
320320
messaging()
321321
.getInitialNotification()
322-
.then((remoteMessage) => {
322+
.then((remoteMessage: any) => {
323323
if (remoteMessage) {
324324
logger.info({
325325
message: 'App opened from notification (killed state)',
@@ -356,7 +356,7 @@ class PushNotificationService {
356356
}, 500);
357357
}
358358
})
359-
.catch((error) => {
359+
.catch((error: any) => {
360360
logger.error({
361361
message: 'Error checking initial notification',
362362
context: { error },
@@ -468,7 +468,7 @@ class PushNotificationService {
468468
// Register device with backend
469469
await registerUnitDevice({
470470
UnitId: unitId,
471-
Token: this.pushToken,
471+
Token: this.pushToken || '',
472472
Platform: Platform.OS === 'ios' ? 1 : 2,
473473
DeviceUuid: getDeviceUuid() || '',
474474
Prefix: departmentCode,

src/services/push-notification.web.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ class WebPushNotificationService {
222222
}
223223

224224
const success = await this.pushSubscription.unsubscribe();
225-
225+
226226
if (success) {
227227
this.pushSubscription = null;
228-
228+
229229
// Clear any potential persisted client-side records
230230
// Explicitly clearing any typical local storage keys as a safety measure
231231
try {

0 commit comments

Comments
 (0)