-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refresh subscriptions, folders * Fetch all articles * Sync article statuses * Fetch missing articles
- Loading branch information
Showing
21 changed files
with
782 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...cmp/feedbinclient/BasicAuthInterceptor.kt → ...cmp/capy/accounts/BasicAuthInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
capy/src/main/java/com/jocmp/capy/accounts/WithErrorHandling.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.jocmp.capy.accounts | ||
|
||
import com.jocmp.capy.common.UnauthorizedError | ||
import java.net.UnknownHostException | ||
|
||
internal suspend fun <T> withErrorHandling(func: suspend () -> T?): Result<T> { | ||
return try { | ||
val result = func() | ||
|
||
if (result != null) { | ||
Result.success(result) | ||
} else { | ||
Result.failure(Throwable("Unexpected error")) | ||
} | ||
} catch (e: UnknownHostException) { | ||
return Result.failure(e) | ||
} catch (e: UnauthorizedError) { | ||
return Result.failure(e) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
capy/src/main/java/com/jocmp/capy/accounts/reader/BuildFreshRSSDelegate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.jocmp.capy.accounts.reader | ||
|
||
import com.jocmp.capy.AccountDelegate | ||
import com.jocmp.capy.AccountPreferences | ||
import com.jocmp.capy.accounts.httpClientBuilder | ||
import com.jocmp.capy.db.Database | ||
import com.jocmp.readerclient.GoogleReader | ||
import java.net.URI | ||
|
||
internal fun buildFreshRSSDelegate( | ||
database: Database, | ||
path: URI, | ||
preferences: AccountPreferences | ||
): AccountDelegate { | ||
val httpClient = ReaderOkHttpClient.forAccount(path, preferences) | ||
|
||
return ReaderAccountDelegate( | ||
database = database, | ||
httpClient = httpClientBuilder(cachePath = path).build(), | ||
googleReader = GoogleReader.create( | ||
client = httpClient, | ||
baseURL = preferences.url.get() | ||
) | ||
) | ||
} |
Oops, something went wrong.