Skip to content

Commit 849582d

Browse files
committed
RU-T47 PR#228 fixes
1 parent 15cddd7 commit 849582d

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

src/api/calls/callFiles.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,24 @@ export const getCallAttachmentFile = async (url: string, options: DownloadOption
7878
}
7979
};
8080

81-
// Utility function to save a blob as a file (web only)
82-
export const saveBlobAsFile = (blob: Blob, fileName: string): void => {
83-
if (Platform.OS === 'web') {
84-
const url = window.URL.createObjectURL(blob);
85-
const link = document.createElement('a');
86-
link.href = url;
87-
link.download = fileName;
88-
link.click();
89-
90-
// Clean up
91-
window.URL.revokeObjectURL(url);
92-
} else {
81+
// Utility function to save a blob as a file (web only).
82+
// Returns true on web after the download is triggered, false on native platforms.
83+
// Callers should check the return value and fall back to expo-file-system / expo-sharing on native.
84+
export const saveBlobAsFile = (blob: Blob, fileName: string): boolean => {
85+
if (Platform.OS !== 'web') {
9386
console.warn('saveBlobAsFile is not supported on native platforms. Use expo-file-system and expo-sharing instead.');
87+
return false;
9488
}
89+
90+
const url = window.URL.createObjectURL(blob);
91+
const link = document.createElement('a');
92+
link.href = url;
93+
link.download = fileName;
94+
link.click();
95+
96+
// Clean up
97+
window.URL.revokeObjectURL(url);
98+
return true;
9599
};
96100

97101
export const getFiles = async (callId: string, includeData: boolean, type: number) => {

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,16 @@ export const Camera = forwardRef<any, CameraProps>(({ centerCoordinate, zoomLeve
379379
if (!map) return;
380380

381381
if (centerCoordinate && centerCoordinate.length === 2 && isFinite(centerCoordinate[0]) && isFinite(centerCoordinate[1])) {
382-
// Skip the first render — the MapView already initialized at the correct
383-
// position via initialCenter/initialZoom, so no programmatic move needed.
384382
if (!hasInitialized.current) {
385383
hasInitialized.current = true;
384+
// Use jumpTo (instant, no animation) for the initial camera position.
385+
// MapView initializes at a default center; Camera is responsible for
386+
// snapping to the correct location on first render on web.
387+
try {
388+
map.jumpTo({ center: centerCoordinate as [number, number], zoom: zoomLevel });
389+
} catch {
390+
// ignore projection errors during initialization
391+
}
386392
return;
387393
}
388394

src/components/maps/static-map.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ const StaticMap: React.FC<StaticMapProps> = ({ latitude, longitude, address, zoo
4545
compassEnabled={true}
4646
zoomEnabled={true}
4747
rotateEnabled={true}
48-
{...(Platform.OS === 'web' ? { initialCenter: [longitude, latitude] as [number, number], initialZoom: zoom } : {})}
4948
>
5049
<Mapbox.Camera zoomLevel={zoom} centerCoordinate={[longitude, latitude]} animationMode="flyTo" animationDuration={1000} />
5150
{/* Marker pin for the location */}

0 commit comments

Comments
 (0)