SES-697 - Add loading state when exporting logs (#1402)

* WIP

* Fixes #1401

* Cleanup from PR view

* Final cleanup

* Removed commented line of code & re-ordered comment

* Addressed PR feedback

* Re-allowed loading of avatars to throw exceptions rather than return null on failure

---------

Co-authored-by: = <=>
This commit is contained in:
Al Lansley
2024-04-03 09:53:20 +11:00
committed by GitHub
parent fef965bcb5
commit d3c8635748
8 changed files with 108 additions and 51 deletions

View File

@@ -8,9 +8,11 @@ import androidx.annotation.Nullable;
import com.annimon.stream.Stream;
import org.session.libsession.utilities.Address;
import org.session.libsignal.utilities.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -22,9 +24,9 @@ public class AvatarHelper {
private static final String AVATAR_DIRECTORY = "avatars";
public static InputStream getInputStreamFor(@NonNull Context context, @NonNull Address address)
throws IOException
throws FileNotFoundException
{
return new FileInputStream(getAvatarFile(context, address));
return new FileInputStream(getAvatarFile(context, address));
}
public static List<File> getAvatarFiles(@NonNull Context context) {

View File

@@ -8,6 +8,7 @@ import androidx.annotation.Nullable;
import org.session.libsession.utilities.Address;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
@@ -24,7 +25,7 @@ public class ProfileContactPhoto implements ContactPhoto {
}
@Override
public InputStream openInputStream(Context context) throws IOException {
public InputStream openInputStream(Context context) throws FileNotFoundException {
return AvatarHelper.getInputStreamFor(context, address);
}