Skip to content

Commit

Permalink
5.3.0 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed May 17, 2024
1 parent ef5fe70 commit c49af77
Show file tree
Hide file tree
Showing 127 changed files with 2,756 additions and 1,977 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Compared to AntennaPod this project:
2. Plays in `AudioOffloadMode`, kind to device battery,
3. Is purely `Kotlin` based and mono-modular,
4. Targets Android 14 with updated dependencies,
5. Outfits with Viewbinding and modern image library Coil,
5. Outfits with Viewbinding, Coil replacing Glide, coroutines replacing RxJava, and SharedFlow replacing EventBus,
6. Boasts new UI's including streamlined drawer, subscriptions view and player controller,
7. Accepts podcast as well as plain RSS and YouTube feeds,
8. Offers Readability and Text-to-Speech for RSS contents,
Expand Down Expand Up @@ -72,6 +72,7 @@ The project aims to improve efficiency and provide more useful and user-friendly
* Sort dialog no longer dims the main view
* in episode list view, if episode has no media, TTS button is shown for fetching transcript (if not exist) and then generating audio file from the transcript. TTS audio files are playable in the same way as local media (with speed setting, pause and rewind/forward)
* Subscriptions view has sorting by "Unread publication date"
* History view shows time of last play, and allows filters and sorts

### Podcast/Episode

Expand Down Expand Up @@ -100,7 +101,7 @@ The project aims to improve efficiency and provide more useful and user-friendly
### Security and reliability

* Disabled `usesCleartextTraffic`, so that all content transmission is more private and secure
* Settings/Preferences can now to exported and imported
* Settings/Preferences can now be exported and imported

For more details of the changes, see the [Changelog](changelog.md)

Expand Down
24 changes: 11 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id('com.android.application')
id 'kotlin-android'
id 'kotlin-kapt'
// id 'kotlin-kapt'
id 'com.google.devtools.ksp'
id('com.github.triplet.play') version '3.8.3' apply false
}
Expand Down Expand Up @@ -159,8 +159,8 @@ android {
// Version code schema (not used):
// "1.2.3-beta4" -> 1020304
// "1.2.3" -> 1020395
versionCode 3020144
versionName "5.2.1"
versionCode 3020145
versionName "5.3.0"

def commit = ""
try {
Expand Down Expand Up @@ -232,9 +232,7 @@ dependencies {
}
}

// doesn't work with ksp??
kapt "androidx.annotation:annotation:1.8.0"

implementation "androidx.annotation:annotation:1.8.0"
implementation "androidx.appcompat:appcompat:1.6.1"
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
implementation "androidx.fragment:fragment-ktx:1.6.2"
Expand Down Expand Up @@ -266,8 +264,8 @@ dependencies {
implementation "com.squareup.okhttp3:okhttp-urlconnection:4.12.0"
implementation 'com.squareup.okio:okio:3.9.0'

implementation "org.greenrobot:eventbus:3.3.1"
kapt "org.greenrobot:eventbus-annotation-processor:3.3.1"
// implementation "org.greenrobot:eventbus:3.3.1"
// kapt "org.greenrobot:eventbus-annotation-processor:3.3.1"

implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
implementation "io.reactivex.rxjava2:rxjava:2.2.21"
Expand Down Expand Up @@ -316,11 +314,11 @@ dependencies {
playApi 'com.google.android.gms:play-services-cast-framework:21.4.0'
}

kapt {
arguments {
arg('eventBusIndex', 'ac.mdiq.podcini.ApEventBusIndex')
}
}
//kapt {
// arguments {
// arg('eventBusIndex', 'ac.mdiq.podcini.ApEventBusIndex')
// }
//}

if (project.hasProperty("podciniPlayPublisherCredentials")) {
apply plugin: 'com.github.triplet.play'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
package de.test.podcini.service.playback

import androidx.test.annotation.UiThreadTest
import androidx.test.filters.LargeTest
import androidx.test.platform.app.InstrumentationRegistry
import ac.mdiq.podcini.preferences.SleepTimerPreferences.setShakeToReset
import ac.mdiq.podcini.preferences.SleepTimerPreferences.setVibrate
import ac.mdiq.podcini.playback.base.PlayerStatus
import ac.mdiq.podcini.playback.service.PlaybackServiceTaskManager
import ac.mdiq.podcini.playback.service.PlaybackServiceTaskManager.PSTMCallback
import ac.mdiq.podcini.ui.widget.WidgetUpdater.WidgetState
import ac.mdiq.podcini.util.event.playback.SleepTimerUpdatedEvent
import ac.mdiq.podcini.storage.model.feed.Feed
import ac.mdiq.podcini.storage.model.feed.FeedItem
import ac.mdiq.podcini.storage.model.playback.Playable
import ac.mdiq.podcini.playback.base.PlayerStatus
import ac.mdiq.podcini.preferences.SleepTimerPreferences.setShakeToReset
import ac.mdiq.podcini.preferences.SleepTimerPreferences.setVibrate
import ac.mdiq.podcini.storage.database.PodDBAdapter.Companion.deleteDatabase
import ac.mdiq.podcini.storage.database.PodDBAdapter.Companion.getInstance
import ac.mdiq.podcini.storage.database.PodDBAdapter.Companion.init
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import ac.mdiq.podcini.storage.model.feed.Feed
import ac.mdiq.podcini.storage.model.feed.FeedItem
import ac.mdiq.podcini.storage.model.playback.Playable
import ac.mdiq.podcini.ui.widget.WidgetUpdater.WidgetState
import ac.mdiq.podcini.util.event.EventFlow
import ac.mdiq.podcini.util.event.FlowEvent
import androidx.test.annotation.UiThreadTest
import androidx.test.filters.LargeTest
import androidx.test.platform.app.InstrumentationRegistry
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import org.junit.After
import org.junit.Assert
import org.junit.Before
Expand All @@ -31,6 +34,9 @@ import java.util.concurrent.TimeUnit
*/
@LargeTest
class PlaybackServiceTaskManagerTest {

val scope = CoroutineScope(Dispatchers.Main)

@After
fun tearDown() {
deleteDatabase()
Expand Down Expand Up @@ -205,19 +211,29 @@ class PlaybackServiceTaskManagerTest {
val TIMEOUT = 2 * TIME
val countDownLatch = CountDownLatch(1)
val timerReceiver: Any = object : Any() {
@Subscribe
fun sleepTimerUpdate(event: SleepTimerUpdatedEvent?) {
private fun procFlowEvents() {
scope.launch {
EventFlow.events.collectLatest { event ->
when (event) {
is FlowEvent.SleepTimerUpdatedEvent -> sleepTimerUpdate(event)
else -> {}
}
}
}
}

fun sleepTimerUpdate(event: FlowEvent.SleepTimerUpdatedEvent?) {
if (countDownLatch.count == 0L) {
Assert.fail()
}
countDownLatch.countDown()
}
}
EventBus.getDefault().register(timerReceiver)
// EventBus.getDefault().register(timerReceiver)
val pstm = PlaybackServiceTaskManager(c, defaultPSTM)
pstm.setSleepTimer(TIME)
countDownLatch.await(TIMEOUT, TimeUnit.MILLISECONDS)
EventBus.getDefault().unregister(timerReceiver)
// EventBus.getDefault().unregister(timerReceiver)
pstm.shutdown()
}

Expand All @@ -230,8 +246,17 @@ class PlaybackServiceTaskManagerTest {
val TIMEOUT = 2 * TIME
val countDownLatch = CountDownLatch(1)
val timerReceiver: Any = object : Any() {
@Subscribe
fun sleepTimerUpdate(event: SleepTimerUpdatedEvent) {
private fun procFlowEvents() {
scope.launch {
EventFlow.events.collectLatest { event ->
when (event) {
is FlowEvent.SleepTimerUpdatedEvent -> sleepTimerUpdate(event)
else -> {}
}
}
}
}
fun sleepTimerUpdate(event: FlowEvent.SleepTimerUpdatedEvent) {
when {
event.isOver -> {
countDownLatch.countDown()
Expand All @@ -243,12 +268,12 @@ class PlaybackServiceTaskManagerTest {
}
}
val pstm = PlaybackServiceTaskManager(c, defaultPSTM)
EventBus.getDefault().register(timerReceiver)
// EventBus.getDefault().register(timerReceiver)
pstm.setSleepTimer(TIME)
pstm.disableSleepTimer()
Assert.assertFalse(countDownLatch.await(TIMEOUT, TimeUnit.MILLISECONDS))
pstm.shutdown()
EventBus.getDefault().unregister(timerReceiver)
// EventBus.getDefault().unregister(timerReceiver)
}

@Test
Expand Down
19 changes: 9 additions & 10 deletions app/src/androidTest/java/ac/test/podcini/ui/UITestUtils.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package de.test.podcini.ui

import android.content.Context
import android.util.Log
import androidx.test.platform.app.InstrumentationRegistry
import ac.mdiq.podcini.util.event.FeedListUpdateEvent
import ac.mdiq.podcini.util.event.QueueEvent.Companion.setQueue
import ac.mdiq.podcini.storage.database.PodDBAdapter.Companion.deleteDatabase
import ac.mdiq.podcini.storage.database.PodDBAdapter.Companion.getInstance
import ac.mdiq.podcini.storage.model.feed.Feed
import ac.mdiq.podcini.storage.model.feed.FeedItem
import ac.mdiq.podcini.storage.model.feed.FeedMedia
import ac.mdiq.podcini.storage.database.PodDBAdapter.Companion.deleteDatabase
import ac.mdiq.podcini.storage.database.PodDBAdapter.Companion.getInstance
import ac.mdiq.podcini.util.event.EventFlow
import ac.mdiq.podcini.util.event.FlowEvent
import android.content.Context
import android.util.Log
import androidx.test.platform.app.InstrumentationRegistry
import de.test.podcini.util.service.download.HTTPBin
import de.test.podcini.util.syndication.feedgenerator.Rss2Generator
import org.apache.commons.io.FileUtils
import org.apache.commons.io.IOUtils
import org.apache.commons.lang3.StringUtils
import org.greenrobot.eventbus.EventBus
import org.junit.Assert
import java.io.File
import java.io.FileOutputStream
Expand Down Expand Up @@ -193,8 +192,8 @@ class UITestUtils(private val context: Context) {
adapter.setCompleteFeed(*hostedFeeds.toTypedArray<Feed>())
adapter.setQueue(queue)
adapter.close()
EventBus.getDefault().post(FeedListUpdateEvent(hostedFeeds))
EventBus.getDefault().post(setQueue(queue))
EventFlow.postEvent(FlowEvent.FeedListUpdateEvent(hostedFeeds))
EventFlow.postEvent(FlowEvent.QueueEvent.setQueue(queue))
}

fun setMediaFileName(filename: String) {
Expand Down

This file was deleted.

29 changes: 14 additions & 15 deletions app/src/main/java/ac/mdiq/podcini/PodciniApp.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package ac.mdiq.podcini

import ac.mdiq.podcini.preferences.PreferenceUpgrader
import ac.mdiq.podcini.ui.activity.SplashActivity
import ac.mdiq.podcini.util.SPAUtil
import ac.mdiq.podcini.util.config.ApplicationCallbacksImpl
import ac.mdiq.podcini.util.config.ClientConfig
import ac.mdiq.podcini.util.config.ClientConfigurator
import ac.mdiq.podcini.util.error.CrashReportWriter
import ac.mdiq.podcini.util.error.RxJavaErrorHandlerSetup
import android.app.Application
import android.content.ComponentName
import android.content.Intent
Expand All @@ -9,15 +17,6 @@ import com.google.android.material.color.DynamicColors
import com.joanzapata.iconify.Iconify
import com.joanzapata.iconify.fonts.FontAwesomeModule
import com.joanzapata.iconify.fonts.MaterialModule
import ac.mdiq.podcini.ui.activity.SplashActivity
import ac.mdiq.podcini.util.config.ApplicationCallbacksImpl
import ac.mdiq.podcini.util.config.ClientConfig
import ac.mdiq.podcini.util.config.ClientConfigurator
import ac.mdiq.podcini.util.error.CrashReportWriter
import ac.mdiq.podcini.util.error.RxJavaErrorHandlerSetup
import ac.mdiq.podcini.preferences.PreferenceUpgrader
import ac.mdiq.podcini.util.SPAUtil
import org.greenrobot.eventbus.EventBus

/** Main application class. */
class PodciniApp : Application() {
Expand Down Expand Up @@ -50,12 +49,12 @@ class PodciniApp : Application() {
Iconify.with(MaterialModule())

SPAUtil.sendSPAppsQueryFeedsIntent(this)
EventBus.builder()
.addIndex(ApEventBusIndex())
// .addIndex(ApCoreEventBusIndex())
.logNoSubscriberMessages(false)
.sendNoSubscriberEvent(false)
.installDefaultEventBus()
// EventBus.builder()
// .addIndex(ApEventBusIndex())
//// .addIndex(ApCoreEventBusIndex())
// .logNoSubscriberMessages(false)
// .sendNoSubscriberEvent(false)
// .installDefaultEventBus()

DynamicColors.applyToActivitiesIfAvailable(this)
}
Expand Down
18 changes: 0 additions & 18 deletions app/src/main/java/ac/mdiq/podcini/feed/FeedEvent.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import java.util.*
import java.util.concurrent.CountDownLatch

class CombinedSearcher : PodcastSearcher {

override fun search(query: String): Single<List<PodcastSearchResult?>?> {
val disposables = ArrayList<Disposable>()
val singleResults: MutableList<List<PodcastSearchResult?>?> = ArrayList(
Collections.nCopies<List<PodcastSearchResult?>?>(PodcastSearcherRegistry.searchProviders.size, null))
val singleResults: MutableList<List<PodcastSearchResult?>?> =
ArrayList(Collections.nCopies<List<PodcastSearchResult?>?>(PodcastSearcherRegistry.searchProviders.size, null))
val latch = CountDownLatch(PodcastSearcherRegistry.searchProviders.size)
for (i in PodcastSearcherRegistry.searchProviders.indices) {
val searchProviderInfo = PodcastSearcherRegistry.searchProviders[i]
Expand Down
Loading

0 comments on commit c49af77

Please sign in to comment.