|
80 | 80 | import java.util.NoSuchElementException; |
81 | 81 | import java.util.concurrent.Callable; |
82 | 82 |
|
83 | | -import io.reactivex.Completable; |
84 | | -import io.reactivex.Maybe; |
85 | | -import io.reactivex.Observable; |
86 | | -import io.reactivex.ObservableSource; |
87 | | -import io.reactivex.Single; |
88 | | -import io.reactivex.android.schedulers.AndroidSchedulers; |
89 | | -import io.reactivex.disposables.CompositeDisposable; |
90 | | -import io.reactivex.disposables.Disposable; |
91 | | -import io.reactivex.functions.Function; |
92 | | -import io.reactivex.schedulers.Schedulers; |
93 | | -import io.reactivex.subjects.BehaviorSubject; |
| 83 | +import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; |
| 84 | +import io.reactivex.rxjava3.core.Completable; |
| 85 | +import io.reactivex.rxjava3.core.Maybe; |
| 86 | +import io.reactivex.rxjava3.core.Observable; |
| 87 | +import io.reactivex.rxjava3.core.ObservableSource; |
| 88 | +import io.reactivex.rxjava3.core.Single; |
| 89 | +import io.reactivex.rxjava3.disposables.CompositeDisposable; |
| 90 | +import io.reactivex.rxjava3.disposables.Disposable; |
| 91 | +import io.reactivex.rxjava3.functions.Function; |
| 92 | +import io.reactivex.rxjava3.schedulers.Schedulers; |
| 93 | +import io.reactivex.rxjava3.subjects.BehaviorSubject; |
| 94 | + |
94 | 95 |
|
95 | 96 | import static com.pspdfkit.react.helper.ConversionHelpers.getAnnotationTypeFromString; |
96 | 97 |
|
@@ -625,13 +626,13 @@ public Single<JSONObject> getAllUnsavedAnnotations() { |
625 | 626 | return DocumentJsonFormatter.exportDocumentJsonAsync(document, outputStream) |
626 | 627 | .subscribeOn(Schedulers.io()) |
627 | 628 | .observeOn(AndroidSchedulers.mainThread()) |
628 | | - .toSingle(new Callable<JSONObject>() { |
629 | | - @Override |
630 | | - public JSONObject call() throws Exception { |
631 | | - final String jsonString = outputStream.toString(); |
632 | | - return new JSONObject(jsonString); |
633 | | - } |
634 | | - }); |
| 629 | + .toSingle(() -> { |
| 630 | + try { |
| 631 | + return new JSONObject(outputStream.toString()); |
| 632 | + } catch (JSONException e) { |
| 633 | + throw new RuntimeException(e); |
| 634 | + } |
| 635 | + }); |
635 | 636 | } |
636 | 637 |
|
637 | 638 | public Disposable addAnnotations(final int requestId, ReadableMap annotation) { |
|
0 commit comments