Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pantasystem committed Jun 26, 2023
1 parent 79718bf commit b8d4842
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
15 changes: 14 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,17 @@
# databinding
-dontwarn androidx.databinding.**
-keep class androidx.databinding.** { *; }
-keep class * extends androidx.databinding.DataBinderMapper
-keep class * extends androidx.databinding.DataBinderMapper

# glide
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule {
<init>(...);
}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
*** rewind();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package net.pantasystem.milktea.data.infrastructure.image

import android.content.Context
import android.content.Intent
import android.graphics.BitmapFactory
import android.net.Uri
import dagger.hilt.android.qualifiers.ApplicationContext
import io.objectbox.BoxStore
import io.objectbox.kotlin.awaitCallInTx
Expand Down Expand Up @@ -58,6 +60,10 @@ class ImageCacheRepositoryImpl @Inject constructor(
}
}.resolve(fileName)

context.contentResolver.takePersistableUriPermission(
Uri.fromFile(file),
Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION
)
downloadAndSaveFile(url, file)

val cache = ImageCache(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class EmojiListItemsAdapter(
binding.root.context
)
)

.into(binding.reactionImagePreview)

binding.reactionStringPreview.setMemoVisibility(View.GONE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ package net.pantasystem.milktea.worker.emoji.cache

import android.content.Context
import androidx.hilt.work.HiltWorker
import androidx.work.*
import androidx.work.Constraints
import androidx.work.CoroutineWorker
import androidx.work.NetworkType
import androidx.work.PeriodicWorkRequest
import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkerParameters
import dagger.assisted.Assisted
import dagger.assisted.AssistedInject
import kotlinx.coroutines.coroutineScope
Expand Down Expand Up @@ -31,7 +36,7 @@ class CacheCustomEmojiImageWorker @AssistedInject constructor(
.setRequiredNetworkType(NetworkType.UNMETERED) // Wi-Fi (or Ethernet etc) required
.build()

return PeriodicWorkRequestBuilder<CacheCustomEmojiImageWorker>(3, TimeUnit.DAYS)
return PeriodicWorkRequestBuilder<CacheCustomEmojiImageWorker>(1, TimeUnit.DAYS)
.setConstraints(constraints)
.build()
}
Expand Down

0 comments on commit b8d4842

Please sign in to comment.