diff --git a/android/app/src/main/java/com/audiobookshelf/app/MainActivity.kt b/android/app/src/main/java/com/audiobookshelf/app/MainActivity.kt index 4d8df4c9..5d1ec154 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/MainActivity.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/MainActivity.kt @@ -26,7 +26,6 @@ class MainActivity : BridgeActivity() { private lateinit var mConnection : ServiceConnection lateinit var pluginCallback : () -> Unit - lateinit var downloaderCallback : (String, Long) -> Unit val storageHelper = SimpleStorageHelper(this) val storage = SimpleStorage(this) @@ -36,21 +35,6 @@ class MainActivity : BridgeActivity() { Manifest.permission.READ_EXTERNAL_STORAGE ) - val broadcastReceiver = object: BroadcastReceiver() { - override fun onReceive(context: Context?, intent: Intent?) { - when (intent?.action) { - DownloadManager.ACTION_DOWNLOAD_COMPLETE -> { - var thisdlid = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0L) - downloaderCallback("complete", thisdlid) - } - DownloadManager.ACTION_NOTIFICATION_CLICKED -> { - var thisdlid = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0L) - downloaderCallback("clicked", thisdlid) - } - } - } - } - public override fun onCreate(savedInstanceState: Bundle?) { // TODO: Optimize using strict mode logs // StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.Builder() @@ -85,17 +69,11 @@ class MainActivity : BridgeActivity() { registerPlugin(AbsFileSystem::class.java) registerPlugin(AbsDatabase::class.java) - var filter = IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE).apply { - addAction(DownloadManager.ACTION_NOTIFICATION_CLICKED) - } - registerReceiver(broadcastReceiver, filter) - Paper.init(applicationContext) } override fun onDestroy() { super.onDestroy() - unregisterReceiver(broadcastReceiver) } override fun onPostCreate(savedInstanceState: Bundle?) { @@ -138,10 +116,6 @@ class MainActivity : BridgeActivity() { stopService(stopIntent) } - fun registerBroadcastReceiver(cb: (String, Long) -> Unit) { - downloaderCallback = cb - } - override fun onSaveInstanceState(outState: Bundle) { storageHelper.onSaveInstanceState(outState) super.onSaveInstanceState(outState) diff --git a/components/covers/AuthorImage.vue b/components/covers/AuthorImage.vue index 61e1c94b..a4bd8f38 100644 --- a/components/covers/AuthorImage.vue +++ b/components/covers/AuthorImage.vue @@ -54,13 +54,16 @@ export default { updatedAt() { return this._author.updatedAt }, + serverAddres() { + return this.$store.getters['user/getServerAddress'] + }, imgSrc() { - if (!this.imagePath) return null + if (!this.imagePath || !this.serverAddres) return null if (process.env.NODE_ENV !== 'production') { // Testing return `http://localhost:3333/api/authors/${this.authorId}/image?token=${this.userToken}&ts=${this.updatedAt}` } - return `/api/authors/${this.authorId}/image?token=${this.userToken}&ts=${this.updatedAt}` + return `${this.serverAddres}/api/authors/${this.authorId}/image?token=${this.userToken}&ts=${this.updatedAt}` } }, methods: {