mirror of
https://github.com/nextcloud/notes-android.git
synced 2025-07-22 07:01:09 +00:00
getNotesPath - java.lang.RuntimeException
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
@ -182,10 +182,12 @@ class NoteDirectEditFragment : BaseNoteFragment(), Branded {
|
||||
DirectEditingRepository.getInstance(requireContext().applicationContext)
|
||||
val urlDisposable = directEditingRepository.getDirectEditingUrl(account, note)
|
||||
.observeOn(AndroidSchedulers.mainThread()).subscribe({ url ->
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "loadNoteInWebView: url = $url")
|
||||
url?.let {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "loadNoteInWebView: url = $url")
|
||||
}
|
||||
binding.noteWebview.loadUrl(url)
|
||||
}
|
||||
binding.noteWebview.loadUrl(url)
|
||||
}, { throwable ->
|
||||
handleLoadError()
|
||||
Log.e(TAG, "loadNoteInWebView:", throwable)
|
||||
|
@ -24,19 +24,20 @@ class DirectEditingRepository private constructor(private val applicationContext
|
||||
)
|
||||
}
|
||||
|
||||
private fun getNotesPath(account: SingleSignOnAccount): Single<String> {
|
||||
private fun getNotesPath(account: SingleSignOnAccount): Single<String?> {
|
||||
return Single.fromCallable {
|
||||
val call = notesRepository.getServerSettings(account, ApiVersion.API_VERSION_1_0)
|
||||
val response = call.execute()
|
||||
response.body()?.notesPath ?: throw RuntimeException("No notes path available")
|
||||
response.body()?.notesPath
|
||||
}.subscribeOn(Schedulers.io())
|
||||
}
|
||||
|
||||
fun getDirectEditingUrl(
|
||||
account: SingleSignOnAccount,
|
||||
note: Note,
|
||||
): Single<String> {
|
||||
return getNotesPath(account)
|
||||
): Single<String?> {
|
||||
val notesPath = getNotesPath(account)
|
||||
return notesPath
|
||||
.flatMap { notesPath ->
|
||||
val filesAPI = apiProvider.getFilesAPI(applicationContext, account)
|
||||
Single.fromCallable {
|
||||
@ -50,7 +51,6 @@ class DirectEditingRepository private constructor(private val applicationContext
|
||||
)
|
||||
val response = call.execute()
|
||||
response.body()?.ocs?.data?.url
|
||||
?: throw RuntimeException("No url available")
|
||||
}.subscribeOn(Schedulers.io())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user