Package 

Class StreamShareFileManager


  • 
    public final class StreamShareFileManager
    
                        

    Class handling operations related to sharing files with external apps.

    • Method Detail

      • writeBitmapToShareableFile

         final Result<Uri> writeBitmapToShareableFile(Context context, Bitmap bitmap)

        Writes a bitmap to a shareable file in the cache directory and returns a shareable URI.

        Uses a fixed filename so that only the most recent shared bitmap is kept in cache.

        Parameters:
        context - The Android context.
        bitmap - The bitmap to write.
      • writeAttachmentToShareableFile

         final Result<Uri> writeAttachmentToShareableFile(Context context, Attachment attachment, Function2<Long, Long, Unit> onProgress, Function0<ChatClient> chatClient)

        Writes an attachment to a shareable file in the cache directory and returns a shareable URI. If the attachment is already cached, returns the cached file URI immediately. Otherwise, downloads the attachment from the server and caches it.

        Parameters:
        context - The Android context.
        attachment - The attachment to write.
        onProgress - Optional callback informing the caller about the download progress.
        chatClient - Lambda providing the ChatClient instance for downloading.
      • getShareableUriForAttachment

         final Result<Uri> getShareableUriForAttachment(Context context, Attachment attachment)

        Gets a shareable URI for an attachment that is already cached. This method does not download the attachment if it's not cached.

        Parameters:
        context - The Android context.
        attachment - The attachment to get the URI for.