Fix duplicate gallery saves and ensure FrameOverlay is captured by ViewShot on Android
This commit is contained in:
@@ -31,7 +31,6 @@ const styles = StyleSheet.create({
|
|||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
zIndex: 50,
|
|
||||||
},
|
},
|
||||||
frameImage: {
|
frameImage: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
|
|||||||
@@ -321,14 +321,6 @@ export default function CameraScreen({
|
|||||||
// to safely downsample it during rendering via resizeMethod="resize".
|
// to safely downsample it during rendering via resizeMethod="resize".
|
||||||
console.log('Photo captured successfully, proceeding to PreviewScreen.');
|
console.log('Photo captured successfully, proceeding to PreviewScreen.');
|
||||||
|
|
||||||
// Auto-save individual photo to gallery
|
|
||||||
try {
|
|
||||||
await saveToGallery(capturedUri);
|
|
||||||
console.log('Auto-saved capture to gallery');
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Failed to auto-save capture:', e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle burst mode
|
// Handle burst mode
|
||||||
const effectiveBurst = burstCount || 1;
|
const effectiveBurst = burstCount || 1;
|
||||||
const newIndex = burstIndex + 1;
|
const newIndex = burstIndex + 1;
|
||||||
|
|||||||
@@ -41,14 +41,14 @@ export async function saveToGallery(localUri: string): Promise<string> {
|
|||||||
|
|
||||||
if (!album) {
|
if (!album) {
|
||||||
// 3. If it doesn't exist, create it with our asset
|
// 3. If it doesn't exist, create it with our asset
|
||||||
// copy=true avoids Android system dialog asking "can Schnappix change the photo?"
|
// copyAsset=false MOVES the asset instead of duplicating it
|
||||||
await createAlbumAsync(ALBUM_NAME, asset, true);
|
await createAlbumAsync(ALBUM_NAME, asset, false);
|
||||||
console.log(`Created new album "${ALBUM_NAME}" and saved photo.`);
|
console.log(`Created new album "${ALBUM_NAME}" and moved photo.`);
|
||||||
} else {
|
} else {
|
||||||
// 4. If it exists, add our asset to it
|
// 4. If it exists, add our asset to it
|
||||||
// copy=true avoids Android system dialog asking "can Schnappix change the photo?"
|
// copyAsset=false MOVES the asset instead of duplicating it
|
||||||
await addAssetsToAlbumAsync([asset], album, true);
|
await addAssetsToAlbumAsync([asset], album, false);
|
||||||
console.log(`Saved photo to existing album "${ALBUM_NAME}".`);
|
console.log(`Moved photo to existing album "${ALBUM_NAME}".`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return asset.uri;
|
return asset.uri;
|
||||||
|
|||||||
Reference in New Issue
Block a user