Skip to content

Commit

Permalink
Migrate to PhotoView library and remove jitpack dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves authored and JcMinarro committed Feb 22, 2024
1 parent 331c178 commit 31734c0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
9 changes: 0 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ allprojects {
repositories {
google()
mavenCentral()
maven {
url "https://jitpack.io"
content {
includeModule("com.github.chrisbanes", "PhotoView")

// https://github.com/stfalcon-studio/StfalconImageViewer/issues/69
includeModule("com.github.stfalcon-studio", "StfalconImageViewer")
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object Versions {
internal const val OK2CURL = "0.8.0"
internal const val OKHTTP = "4.11.0"
internal const val PERMISSIONX = "1.7.1"
internal const val PHOTOVIEW = "2.3.0"
internal const val PHOTOVIEW = "1.0.1"
internal const val RETROFIT = "2.9.0"
internal const val ROBOLECTRIC = "4.10.3"
internal const val ROOM = "2.5.2"
Expand Down Expand Up @@ -196,7 +196,8 @@ object Dependencies {
const val okhttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:${Versions.OKHTTP}"
const val okhttpMockWebserver = "com.squareup.okhttp3:mockwebserver:${Versions.OKHTTP}"
const val permissionx = "com.guolindev.permissionx:permissionx:${Versions.PERMISSIONX}"
const val photoview = "com.github.chrisbanes:PhotoView:${Versions.PHOTOVIEW}"
const val photoview = "io.getstream:photoview:${Versions.PHOTOVIEW}"
const val photoviewDialog = "io.getstream:photoview-dialog:${Versions.PHOTOVIEW}"
const val retrofit = "com.squareup.retrofit2:retrofit:${Versions.RETROFIT}"
const val retrofitMoshiConverter = "com.squareup.retrofit2:converter-moshi:${Versions.RETROFIT}"
const val robolectric = "org.robolectric:robolectric:${Versions.ROBOLECTRIC}"
Expand All @@ -207,7 +208,6 @@ object Dependencies {
const val shimmer = "com.facebook.shimmer:shimmer:${Versions.SHIMMER}"
const val shot = "com.karumi:shot:${Versions.SHOT}"
const val spotlessGradlePlugin = "com.diffplug.spotless:spotless-plugin-gradle:${Versions.SPOTLESS}"
const val stfalconImageViewer = "com.github.stfalcon-studio:StfalconImageViewer:${Versions.STFALCON_IMAGE_VIEWER}"
const val streamLog = "io.getstream:stream-log:${Versions.STREAM_LOG}"
const val streamLogAndroid = "io.getstream:stream-log-android:${Versions.STREAM_LOG}"
const val streamLogAndroidFile = "io.getstream:stream-log-android-file:${Versions.STREAM_LOG}"
Expand Down
3 changes: 1 addition & 2 deletions stream-chat-android-ui-components/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,11 @@ dependencies {
implementation Dependencies.androidxFragmentKtx
implementation Dependencies.androidxViewPager2
implementation Dependencies.androidxCoreKtx
implementation Dependencies.photoview
implementation Dependencies.photoviewDialog
implementation Dependencies.coil
implementation Dependencies.coilGif
implementation Dependencies.coilVideo
implementation Dependencies.androidxStartup
implementation Dependencies.stfalconImageViewer
implementation Dependencies.androidxLifecycleLiveDataKtx
implementation Dependencies.keyboardVisibilityEvent
implementation Dependencies.permissionx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import android.content.Context
import android.content.Intent
import android.widget.ImageView
import android.widget.Toast
import com.stfalcon.imageviewer.StfalconImageViewer
import io.getstream.chat.android.client.utils.attachment.isAudio
import io.getstream.chat.android.client.utils.attachment.isFile
import io.getstream.chat.android.client.utils.attachment.isImage
Expand All @@ -35,6 +34,7 @@ import io.getstream.chat.android.ui.feature.gallery.AttachmentMediaActivity
import io.getstream.chat.android.ui.utils.load
import io.getstream.chat.android.uiutils.model.MimeType
import io.getstream.log.taggedLogger
import io.getstream.photoview.dialog.PhotoViewDialog

public open class AttachmentDestination(
public var message: Message,
Expand Down Expand Up @@ -68,16 +68,19 @@ public open class AttachmentDestination(
url = attachment.titleLink ?: attachment.ogUrl ?: attachment.assetUrl
type = AttachmentType.LINK
}

attachment.isGif() -> {
url = attachment.imageUrl
type = AttachmentType.GIPHY
}

else -> {
showImageViewer(message, attachment)
return
}
}
}

AttachmentType.GIPHY -> url = attachment.thumbUrl
AttachmentType.PRODUCT -> url = attachment.url
}
Expand Down Expand Up @@ -127,6 +130,7 @@ public open class AttachmentDestination(
)
start(intent)
}

docMimeType(mimeType) -> {
val intent = Intent(context, AttachmentDocumentActivity::class.java).apply {
putExtra("url", url)
Expand Down Expand Up @@ -178,7 +182,7 @@ public open class AttachmentDestination(

val attachmentIndex = message.attachments.indexOf(attachment)

StfalconImageViewer
PhotoViewDialog
.Builder(context, imageUrls, ImageView::load)
.withStartPosition(
if (attachmentIndex in imageUrls.indices) attachmentIndex else 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
app:layout_constraintTop_toTopOf="parent"
/>

<com.github.chrisbanes.photoview.PhotoView
<io.getstream.photoview.PhotoView
android:id="@+id/photoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down

0 comments on commit 31734c0

Please sign in to comment.