Skip to content

Commit

Permalink
4.7.1 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Apr 12, 2024
1 parent 26b506e commit f7193b9
Show file tree
Hide file tree
Showing 23 changed files with 170 additions and 363 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ android {
// Version code schema (not used):
// "1.2.3-beta4" -> 1020304
// "1.2.3" -> 1020395
versionCode 3020128
versionName "4.7.0"
versionCode 3020129
versionName "4.7.1"

def commit = ""
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ import android.os.Build
import java.util.*

class FeedUpdateWorker(context: Context, params: WorkerParameters) : Worker(context, params) {
private val newEpisodesNotification = NewEpisodesNotification()
// private val newEpisodesNotification = NewEpisodesNotification()
private val notificationManager = NotificationManagerCompat.from(context)

@UnstableApi override fun doWork(): Result {
ClientConfigurator.initialize(applicationContext)
newEpisodesNotification.loadCountersBeforeRefresh()
// newEpisodesNotification.loadCountersBeforeRefresh()

val toUpdate: MutableList<Feed>
val feedId = inputData.getLong(FeedUpdateManager.EXTRA_FEED_ID, -1)
Expand Down Expand Up @@ -110,6 +110,7 @@ class FeedUpdateWorker(context: Context, params: WorkerParameters) : Worker(cont
Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// requestPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
Expand Down Expand Up @@ -186,7 +187,7 @@ class FeedUpdateWorker(context: Context, params: WorkerParameters) : Worker(cont
if (log.isNotEmpty() && !log[0].isSuccessful) {
DBWriter.addDownloadStatus(feedSyncTask.downloadStatus)
}
newEpisodesNotification.showIfNeeded(applicationContext, feedSyncTask.savedFeed!!)
// newEpisodesNotification.showIfNeeded(applicationContext, feedSyncTask.savedFeed!!)
if (!request.source.isNullOrEmpty()) {
when {
!downloader.permanentRedirectUrl.isNullOrEmpty() -> {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ class PlaybackService : MediaBrowserServiceCompat() {
Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// requestPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
Expand Down Expand Up @@ -590,6 +591,7 @@ class PlaybackService : MediaBrowserServiceCompat() {
Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// requestPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
Expand Down Expand Up @@ -1334,6 +1336,7 @@ class PlaybackService : MediaBrowserServiceCompat() {
Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// requestPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ object UserPreferences {
@JvmStatic
val feedCounterSetting: FeedCounter
get() {
val value = prefs.getString(PREF_DRAWER_FEED_COUNTER, "" + FeedCounter.SHOW_NEW.id)
val value = prefs.getString(PREF_DRAWER_FEED_COUNTER, "" + FeedCounter.SHOW_UNPLAYED.id)
return FeedCounter.fromOrdinal(value!!.toInt())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class NotificationPreferencesFragment : PreferenceFragmentCompat() {
}

private fun setUpScreen() {
findPreference<Preference>(ac.mdiq.podcini.preferences.fragments.NotificationPreferencesFragment.Companion.PREF_GPODNET_NOTIFICATIONS)!!.isEnabled =
SynchronizationSettings.isProviderConnected
findPreference<Preference>(PREF_GPODNET_NOTIFICATIONS)!!.isEnabled = SynchronizationSettings.isProviderConnected
}

companion object {
Expand Down
75 changes: 35 additions & 40 deletions app/src/main/java/ac/mdiq/podcini/storage/DBReader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ object DBReader {
* @param items The FeedItems whose Feed-objects should be loaded.
*/
private fun loadFeedDataOfFeedItemList(items: List<FeedItem>) {
Log.d(TAG, "loadFeedDataOfFeedItemList called")
val feedIndex: MutableMap<Long, Feed> = ArrayMap(feeds.size)
val feedsCopy = ArrayList(feeds)
for (feed in feedsCopy) {
Expand Down Expand Up @@ -235,7 +236,7 @@ object DBReader {

@JvmStatic
fun getQueue(adapter: PodDBAdapter?): List<FeedItem> {
// Log.d(TAG, "getQueue()")
Log.d(TAG, "getQueue(adapter)")
adapter?.queueCursor.use { cursor ->
val items = extractItemlistFromCursor(adapter, cursor)
loadAdditionalFeedItemListData(items)
Expand Down Expand Up @@ -323,6 +324,7 @@ object DBReader {

@JvmStatic
fun getTotalEpisodeCount(filter: FeedItemFilter?): Int {
Log.d(TAG, "getTotalEpisodeCount called")
val adapter = getInstance()
adapter.open()
try {
Expand Down Expand Up @@ -506,7 +508,7 @@ object DBReader {
}
return item
}
return item
return null
}

/**
Expand Down Expand Up @@ -582,19 +584,16 @@ object DBReader {
* Does NOT load additional attributes like feed or queue state.
*/
private fun getFeedItemByGuidOrEpisodeUrl(guid: String?, episodeUrl: String,
adapter: PodDBAdapter?
): FeedItem? {
if (adapter != null) {
adapter.getFeedItemCursor(guid, episodeUrl).use { cursor ->
if (!cursor.moveToNext()) {
return null
}
val list = extractItemlistFromCursor(adapter, cursor)
if (list.isNotEmpty()) {
return list[0]
}
adapter: PodDBAdapter?): FeedItem? {
adapter?.getFeedItemCursor(guid, episodeUrl)?.use { cursor ->
if (!cursor.moveToNext()) {
return null
}
val list = extractItemlistFromCursor(adapter, cursor)
if (list.isNotEmpty()) {
return list[0]
}
return null
}
return null
}
Expand All @@ -618,20 +617,18 @@ object DBReader {
}

private fun getImageAuthentication(imageUrl: String, adapter: PodDBAdapter?): String {
var credentials: String = ""
if (adapter != null) {
adapter.getImageAuthenticationCursor(imageUrl).use { cursor ->
if (cursor.moveToFirst()) {
val username = cursor.getString(0)
val password = cursor.getString(1)
credentials = if (!username.isNullOrEmpty() && password != null) {
"$username:$password"
} else {
""
}
var credentials = ""
adapter?.getImageAuthenticationCursor(imageUrl)?.use { cursor ->
if (cursor.moveToFirst()) {
val username = cursor.getString(0)
val password = cursor.getString(1)
credentials = if (!username.isNullOrEmpty() && password != null) {
"$username:$password"
} else {
credentials = ""
""
}
} else {
credentials = ""
}
}
return credentials
Expand All @@ -647,6 +644,7 @@ object DBReader {
*/
@JvmStatic
fun getFeedItemByGuidOrEpisodeUrl(guid: String?, episodeUrl: String): FeedItem? {
Log.d(TAG, "getFeedItemByGuidOrEpisodeUrl called")
val adapter = getInstance()
adapter.open()
try {
Expand Down Expand Up @@ -705,19 +703,17 @@ object DBReader {
}

private fun loadChaptersOfFeedItem(adapter: PodDBAdapter?, item: FeedItem): List<Chapter>? {
if (adapter != null) {
adapter.getSimpleChaptersOfFeedItemCursor(item).use { cursor ->
val chaptersCount = cursor.count
if (chaptersCount == 0) {
item.chapters = null
return null
}
val chapters = ArrayList<Chapter>()
while (cursor.moveToNext()) {
chapters.add(ChapterCursorMapper.convert(cursor))
}
return chapters
adapter?.getSimpleChaptersOfFeedItemCursor(item)?.use { cursor ->
val chaptersCount = cursor.count
if (chaptersCount == 0) {
item.chapters = null
return null
}
val chapters = ArrayList<Chapter>()
while (cursor.moveToNext()) {
chapters.add(ChapterCursorMapper.convert(cursor))
}
return chapters
}
return null
}
Expand All @@ -730,9 +726,9 @@ object DBReader {
*/
@JvmStatic
fun getFeedMedia(mediaId: Long): FeedMedia? {
Log.d(TAG, "getFeedMedia called")
val adapter = getInstance()
adapter.open()

try {
adapter.getSingleFeedMediaCursor(mediaId).use { mediaCursor ->
if (!mediaCursor.moveToFirst()) {
Expand Down Expand Up @@ -798,8 +794,7 @@ object DBReader {
* @return The list of statistics objects
*/
fun getStatistics(includeMarkedAsPlayed: Boolean,
timeFilterFrom: Long, timeFilterTo: Long
): StatisticsResult {
timeFilterFrom: Long, timeFilterTo: Long): StatisticsResult {
val adapter = getInstance()
adapter.open()

Expand Down
Loading

0 comments on commit f7193b9

Please sign in to comment.