Hi @chris421 ,
Below is a process I use for offline photos - I also posted this last week on another query and this may address some of your requirements.
Firstly, I use the Connection.Connected test on every screen and if not online, all other screens other than the offline photo screen have only a button in the middle to navigate to the offline screen. So from the start
At App OnStart - it loads data from olPhotos storage on device into Collection OLPhoto. The true parameter tells it to ignore the command if the phone currently has not had the storage configured.
LoadData(
OLPhoto,
"olPhotos",
true
)
Now the camera takes a picture and sends it to collection OLSample so it can be reviewed in the Image control
ClearCollect(
OLSample,
CameraScreenO.Photo
)
Now when the user accepts this picture - it is collected from camera screen and added to collection OLPhoto, then this is saved to the device collection to device storage olPhotos replacing data currently stored
Collect(
OLPhoto,
{
sPhoto:ImageDisplayO.Image,
sNotes:PhotoNotesO.Text,
sDate:Text(Now(),DateTimeFormat.ShortDateTime24,"en-GB")
}
);
SaveData(
OLPhoto,
"olPhotos"
)
When the device comes back online (and Connection.Connected is true), the users gets another button that says either return to the "normal" photo screen or choose a photo to upload. If they choose the photo (check icon in a gallery) this runs
ClearCollect(
colPhoto,
ThisItem.sPhoto
);
Navigate(PhotoScreen,Cover);
Set(vPhoto,true)
and simply puts the saved photo in the same collection that the "online" camera uses and displays the picture. This can then be saved via Flow to the SharePoint Library in the same manner as an online taken photo. Also on the main photo screen, a button appears if there are any offline photos on the device and navigates to the offline screen as above.
Now to delete an item - first bit displays a big red pop-up with the picture image for the user to confirm they want to delete it.
Set(vDelete,true);
Set(vDelItem,ThisItem)
Then if the user selects the confirmation, removes the item from the collection OLPhoto and then writes to the device replacing the data olPhotos with the updated collection. Then the pop-up disappears.
Remove(
OLPhoto,
vDelItem
);
SaveData(
OLPhoto,
"olPhotos"
)
Set(vDelete,false)
It all has worked fine for some time and we intentionally made the users clear them one at a time when they came back online and uploaded them (using the normal screen, but collecting from OLPhoto instead of the camera above).
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.