#If B4J
Private Sub xlbl_DownloadFile_MouseClicked (EventData As MouseEvent)
#Else
Private Sub xlbl_DownloadFile_Click
#End If
xui.SetDataFolder("supabase")
Wait For (xSupabase.Storage.DownloadFileProgress("Avatar","test.png",Me,"DownloadProfileImage",xui.DefaultFolder).Execute) Complete (StorageFile As SupabaseStorageFile)
If StorageFile.Error.Success Then
Log($"File ${"test.jpg"} successfully downloaded "$)
B4XImageView1.SetBitmap(xSupabase.Storage.BytesToImage(StorageFile.FileBody))
If File.Exists(xui.DefaultFolder,"test.png") Then File.Delete(xui.DefaultFolder,"test.png") 'Clean the download path, or do what ever you want
Else
Log("Error: " & StorageFile.Error.ErrorMessage)
End If
End Sub
Private Sub DownloadProfileImage_RangeDownloadTracker(Tracker As SupabaseRangeDownloadTracker)
If Tracker.CurrentLength > 0 Then
Log($"$1.2{Tracker.CurrentLength / 1024 / 1024}MB / $1.2{Tracker.TotalLength / 1024 / 1024}MB"$)
AnotherProgressBar1.Value = Tracker.CurrentLength / Tracker.TotalLength * 100
End If
End Sub