diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index 31519a66..5280a6ea 100755 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -15,6 +15,8 @@ #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} +-keep public class com.dylanvann.fastimage.* {*;} +-keep public class com.dylanvann.fastimage.** {*;} -keep public class * implements com.bumptech.glide.module.GlideModule -keep public class * extends com.bumptech.glide.module.AppGlideModule -keep public enum com.bumptech.glide.load.ImageHeaderParser$** { diff --git a/src/components/book-item.tsx b/src/components/book-item.tsx index a416528c..718d4d6b 100644 --- a/src/components/book-item.tsx +++ b/src/components/book-item.tsx @@ -30,12 +30,15 @@ interface Props extends Partial { record?: Book; book?: Book; nextStatus?: BOOK_STATUSES; + cacheThumbnail?: boolean; } @withObservables(['book'], ({ book }) => ({ record: book.record || book, })) export class BookItem extends React.PureComponent { + static defaultProps: Props = { cacheThumbnail: true }; + get book() { return this.props.record || this.props.book; } @@ -53,12 +56,21 @@ export class BookItem extends React.PureComponent { const nextStatus = this.nextStatus; const statusIcon = book.status === BOOK_STATUSES.READ ? 'star' : STATUS_ICONS[nextStatus]; const statusColor = STATUS_COLORS[statusIcon]; + const cache = this.props.cacheThumbnail; return ( - + diff --git a/src/components/thumbnail.tsx b/src/components/thumbnail.tsx index 095f4ff1..6d7e4555 100644 --- a/src/components/thumbnail.tsx +++ b/src/components/thumbnail.tsx @@ -13,9 +13,10 @@ interface Props { auto?: string; style?: ImageStyle; resizeMode?: Image.ResizeMode; + cache?: boolean; } -export function Thumbnail({ auto, style, title, width, height, url, resizeMode }: Props) { +export function Thumbnail({ auto, style, title, width, height, url, resizeMode, cache }: Props) { if (!url) { return ; } @@ -28,9 +29,12 @@ export function Thumbnail({ auto, style, title, width, height, url, resizeMode } return ; } - return ; + const source = { uri: url, cache: cache ? Image.cacheControl.immutable : Image.cacheControl.web }; + + return ; } Thumbnail.defaultProps = { auto: 'height', + cache: true, }; diff --git a/src/screens/search/search.screen.tsx b/src/screens/search/search.screen.tsx index b217ad74..38b6775d 100644 --- a/src/screens/search/search.screen.tsx +++ b/src/screens/search/search.screen.tsx @@ -51,7 +51,7 @@ export class SearchScreen extends React.Component return ( {_.map(data, book => ( - + ))} );