From c24f431a6bfb33f3e6486cf0537c28f4ac5074fa Mon Sep 17 00:00:00 2001 From: Davide Ficano Date: Fri, 23 Aug 2019 08:37:57 +0200 Subject: [PATCH] updated to new feedly client library --- .../ternaryop/photoshelf/PhotoShelfApplication.kt | 7 ++++++- .../photoshelf/fragment/feedly/FeedlyListFragment.kt | 12 ++++-------- build.gradle | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/ternaryop/photoshelf/PhotoShelfApplication.kt b/app/src/main/java/com/ternaryop/photoshelf/PhotoShelfApplication.kt index 84aec592..2758da24 100644 --- a/app/src/main/java/com/ternaryop/photoshelf/PhotoShelfApplication.kt +++ b/app/src/main/java/com/ternaryop/photoshelf/PhotoShelfApplication.kt @@ -3,6 +3,7 @@ package com.ternaryop.photoshelf import android.app.Application import com.ternaryop.feedly.FeedlyClient +import com.ternaryop.feedly.FeedlyClientInfo import com.ternaryop.photoshelf.api.ApiManager import com.ternaryop.photoshelf.customsearch.GoogleCustomSearchClient import com.ternaryop.tumblr.android.TumblrManager @@ -29,7 +30,11 @@ class PhotoShelfApplication : Application() { ApiManager .setup(AppSupport(this) .photoShelfApikey, BuildConfig.PHOTOSHELF_API_PREFIX, okHttpClient) - FeedlyClient.setup(okHttpClient) + FeedlyClient.setup(FeedlyClientInfo( + getString(R.string.FEEDLY_USER_ID), + getString(R.string.FEEDLY_REFRESH_TOKEN), + getString(R.string.FEEDLY_CLIENT_ID), + getString(R.string.FEEDLY_CLIENT_SECRET)), okHttpClient) GoogleCustomSearchClient.setup( getString(R.string.GOOGLE_CSE_APIKEY), getString(R.string.GOOGLE_CSE_CX), diff --git a/app/src/main/java/com/ternaryop/photoshelf/fragment/feedly/FeedlyListFragment.kt b/app/src/main/java/com/ternaryop/photoshelf/fragment/feedly/FeedlyListFragment.kt index db4cc425..6659a9f1 100644 --- a/app/src/main/java/com/ternaryop/photoshelf/fragment/feedly/FeedlyListFragment.kt +++ b/app/src/main/java/com/ternaryop/photoshelf/fragment/feedly/FeedlyListFragment.kt @@ -47,6 +47,7 @@ import io.reactivex.Single import io.reactivex.SingleObserver import io.reactivex.disposables.Disposable import java.io.InputStreamReader +import java.util.Locale class FeedlyListFragment : AbsPhotoShelfFragment(), OnFeedlyContentClick { private lateinit var adapter: FeedlyContentAdapter @@ -86,10 +87,7 @@ class FeedlyListFragment : AbsPhotoShelfFragment(), OnFeedlyContentClick { adapter.sortSwitcher.setType(preferences.getSortType()) adapter.clickListener = this - feedlyClient = FeedlyClient( - preferences.accessToken ?: getString(R.string.FEEDLY_ACCESS_TOKEN), - getString(R.string.FEEDLY_USER_ID), - getString(R.string.FEEDLY_REFRESH_TOKEN)) + feedlyClient = FeedlyClient(preferences.accessToken ?: "") refresh(false) } @@ -240,9 +238,7 @@ class FeedlyListFragment : AbsPhotoShelfFragment(), OnFeedlyContentClick { } private fun refreshToken() { - feedlyClient.refreshAccessToken( - getString(R.string.FEEDLY_CLIENT_ID), - getString(R.string.FEEDLY_CLIENT_SECRET)) + feedlyClient.refreshAccessToken() .compose(photoShelfSwipe.applySwipe()) .subscribe(object : FeedlyObserver() { override fun onSuccess(accessToken: AccessToken) { @@ -332,7 +328,7 @@ class FeedlyListFragment : AbsPhotoShelfFragment(), OnFeedlyContentClick { val snackbar = Snackbar.make(recyclerView, R.string.token_expired, Snackbar.LENGTH_INDEFINITE) snackbar .setActionTextColor(ContextCompat.getColor(context!!, R.color.snack_error_color)) - .setAction(resources.getString(R.string.refresh).toLowerCase()) { refreshToken() } + .setAction(resources.getString(R.string.refresh).toLowerCase(Locale.getDefault())) { refreshToken() } return snackbar } return super.makeSnake(view, t) diff --git a/build.gradle b/build.gradle index 176bf8c9..add310fb 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ apply plugin: "com.github.ben-manes.versions" apply plugin: "org.jetbrains.kotlin.jvm" buildscript { - ext.kotlin_version = '1.3.41' + ext.kotlin_version = '1.3.50' ext { minSdkVersion = 26 targetSdkVersion = 29 @@ -38,7 +38,7 @@ buildscript { ternaryOpUtilLibVersion = '1.4.4' ternaryOpDomSelectorLibVersion = '1.0.4' - ternaryOpFeedlyLibVersion = '1.0.1' + ternaryOpFeedlyLibVersion = '1.0.2' ternaryOpTumblrLibVersion = '1.0.1' rxjavaLibVersion = '2.2.11'