mirror of
https://github.com/nextcloud/notes-android.git
synced 2025-07-29 15:11:10 +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)
|
DirectEditingRepository.getInstance(requireContext().applicationContext)
|
||||||
val urlDisposable = directEditingRepository.getDirectEditingUrl(account, note)
|
val urlDisposable = directEditingRepository.getDirectEditingUrl(account, note)
|
||||||
.observeOn(AndroidSchedulers.mainThread()).subscribe({ url ->
|
.observeOn(AndroidSchedulers.mainThread()).subscribe({ url ->
|
||||||
|
url?.let {
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
Log.d(TAG, "loadNoteInWebView: url = $url")
|
Log.d(TAG, "loadNoteInWebView: url = $url")
|
||||||
}
|
}
|
||||||
binding.noteWebview.loadUrl(url)
|
binding.noteWebview.loadUrl(url)
|
||||||
|
}
|
||||||
}, { throwable ->
|
}, { throwable ->
|
||||||
handleLoadError()
|
handleLoadError()
|
||||||
Log.e(TAG, "loadNoteInWebView:", throwable)
|
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 {
|
return Single.fromCallable {
|
||||||
val call = notesRepository.getServerSettings(account, ApiVersion.API_VERSION_1_0)
|
val call = notesRepository.getServerSettings(account, ApiVersion.API_VERSION_1_0)
|
||||||
val response = call.execute()
|
val response = call.execute()
|
||||||
response.body()?.notesPath ?: throw RuntimeException("No notes path available")
|
response.body()?.notesPath
|
||||||
}.subscribeOn(Schedulers.io())
|
}.subscribeOn(Schedulers.io())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDirectEditingUrl(
|
fun getDirectEditingUrl(
|
||||||
account: SingleSignOnAccount,
|
account: SingleSignOnAccount,
|
||||||
note: Note,
|
note: Note,
|
||||||
): Single<String> {
|
): Single<String?> {
|
||||||
return getNotesPath(account)
|
val notesPath = getNotesPath(account)
|
||||||
|
return notesPath
|
||||||
.flatMap { notesPath ->
|
.flatMap { notesPath ->
|
||||||
val filesAPI = apiProvider.getFilesAPI(applicationContext, account)
|
val filesAPI = apiProvider.getFilesAPI(applicationContext, account)
|
||||||
Single.fromCallable {
|
Single.fromCallable {
|
||||||
@ -50,7 +51,6 @@ class DirectEditingRepository private constructor(private val applicationContext
|
|||||||
)
|
)
|
||||||
val response = call.execute()
|
val response = call.execute()
|
||||||
response.body()?.ocs?.data?.url
|
response.body()?.ocs?.data?.url
|
||||||
?: throw RuntimeException("No url available")
|
|
||||||
}.subscribeOn(Schedulers.io())
|
}.subscribeOn(Schedulers.io())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user