Skip to content
Snippets Groups Projects
Commit f2c76ed5 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

vcard: catch more errors

Change-Id: I07b0e7c27cc778ca8cada7ed08b0cddcd7828b05
parent 22ff16ee
No related branches found
No related tags found
No related merge requests found
...@@ -8,8 +8,8 @@ android { ...@@ -8,8 +8,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 28
versionCode 162 versionCode 163
versionName "20190525-4" versionName "20190525-5"
} }
sourceSets { sourceSets {
......
...@@ -62,6 +62,7 @@ import cx.ring.services.DaemonService; ...@@ -62,6 +62,7 @@ import cx.ring.services.DaemonService;
import cx.ring.services.DeviceRuntimeService; import cx.ring.services.DeviceRuntimeService;
import cx.ring.services.HardwareService; import cx.ring.services.HardwareService;
import cx.ring.services.PreferencesService; import cx.ring.services.PreferencesService;
import io.reactivex.plugins.RxJavaPlugins;
public abstract class RingApplication extends Application { public abstract class RingApplication extends Application {
private static final String TAG = RingApplication.class.getSimpleName(); private static final String TAG = RingApplication.class.getSimpleName();
...@@ -221,6 +222,8 @@ public abstract class RingApplication extends Application { ...@@ -221,6 +222,8 @@ public abstract class RingApplication extends Application {
super.onCreate(); super.onCreate();
sInstance = this; sInstance = this;
RxJavaPlugins.setErrorHandler(e -> Log.e(TAG, "Unhandled RxJava error", e));
// building injection dependency tree // building injection dependency tree
mRingInjectionComponent = DaggerRingInjectionComponent.builder() mRingInjectionComponent = DaggerRingInjectionComponent.builder()
.ringInjectionModule(new RingInjectionModule(this)) .ringInjectionModule(new RingInjectionModule(this))
......
...@@ -446,7 +446,7 @@ public class NotificationServiceImpl implements NotificationService { ...@@ -446,7 +446,7 @@ public class NotificationServiceImpl implements NotificationService {
setContactPicture(c, builder); setContactPicture(c, builder);
notificationManager.notify(notificationId, builder.build()); notificationManager.notify(notificationId, builder.build());
}); }, e -> Log.w(TAG, "error showing notification", e));
} else { } else {
NotificationCompat.Builder builder = getRequestNotificationBuilder(account.getAccountID()); NotificationCompat.Builder builder = getRequestNotificationBuilder(account.getAccountID());
boolean newRequest = false; boolean newRequest = false;
......
...@@ -123,7 +123,7 @@ public class MainPresenter extends RootPresenter<MainView> { ...@@ -123,7 +123,7 @@ public class MainPresenter extends RootPresenter<MainView> {
cd.add(mContactService.observeContact(vm.getAccountId(), vm.getContact()) cd.add(mContactService.observeContact(vm.getAccountId(), vm.getContact())
.subscribeOn(Schedulers.computation()) .subscribeOn(Schedulers.computation())
.observeOn(mUiScheduler) .observeOn(mUiScheduler)
.subscribe(this::refreshContact)); .subscribe(this::refreshContact, e -> Log.d(TAG, "error loading contact", e)));
} }
mContactDisposable.clear(); mContactDisposable.clear();
mContactDisposable.add(cd); mContactDisposable.add(cd);
...@@ -162,7 +162,7 @@ public class MainPresenter extends RootPresenter<MainView> { ...@@ -162,7 +162,7 @@ public class MainPresenter extends RootPresenter<MainView> {
Log.d(TAG, "getPendingSubject " + pending.size()); Log.d(TAG, "getPendingSubject " + pending.size());
ArrayList<TVListViewModel> viewmodel = new ArrayList<>(pending.size()); ArrayList<TVListViewModel> viewmodel = new ArrayList<>(pending.size());
for (Conversation c : pending) { for (Conversation c : pending) {
mContactService.loadContactData(c.getContact()).subscribe(); mContactService.loadContactData(c.getContact()).subscribe(() -> {}, e -> Log.e(TAG, "Can't load contact data"));
viewmodel.add(new TVListViewModel(a.getAccountID(), c.getContact())); viewmodel.add(new TVListViewModel(a.getAccountID(), c.getContact()));
} }
return viewmodel; return viewmodel;
......
...@@ -182,28 +182,28 @@ public class ConversationPresenter extends RootPresenter<ConversationView> { ...@@ -182,28 +182,28 @@ public class ConversationPresenter extends RootPresenter<ConversationView> {
Account account = mAccountService.getAccount(mAccountId); Account account = mAccountService.getAccount(mAccountId);
mConversationDisposable.add(c.getSortedHistory() mConversationDisposable.add(c.getSortedHistory()
.subscribe(view::refreshView)); .subscribe(view::refreshView, e -> Log.e(TAG, "Can't update element", e)));
mConversationDisposable.add(c.getCleared() mConversationDisposable.add(c.getCleared()
.observeOn(mUiScheduler) .observeOn(mUiScheduler)
.subscribe(view::refreshView)); .subscribe(view::refreshView, e -> Log.e(TAG, "Can't update element", e)));
mConversationDisposable.add(mContactService.getLoadedContact(c.getAccountId(), c.getContact()) mConversationDisposable.add(mContactService.getLoadedContact(c.getAccountId(), c.getContact())
.observeOn(mUiScheduler) .observeOn(mUiScheduler)
.subscribe(contact -> initContact(account, mContactRingId, view))); .subscribe(contact -> initContact(account, mContactRingId, view), e -> Log.e(TAG, "Can't update element", e)));
mConversationDisposable.add(c.getNewElements() mConversationDisposable.add(c.getNewElements()
.observeOn(mUiScheduler) .observeOn(mUiScheduler)
.subscribe(view::addElement)); .subscribe(view::addElement, e -> Log.e(TAG, "Can't update element", e)));
mConversationDisposable.add(c.getUpdatedElements() mConversationDisposable.add(c.getUpdatedElements()
.observeOn(mUiScheduler) .observeOn(mUiScheduler)
.subscribe(view::updateElement)); .subscribe(view::updateElement, e -> Log.e(TAG, "Can't update element", e)));
mConversationDisposable.add(c.getRemovedElements() mConversationDisposable.add(c.getRemovedElements()
.observeOn(mUiScheduler) .observeOn(mUiScheduler)
.subscribe(view::removeElement)); .subscribe(view::removeElement, e -> Log.e(TAG, "Can't update element", e)));
mConversationDisposable.add(c.getCalls() mConversationDisposable.add(c.getCalls()
.observeOn(mUiScheduler) .observeOn(mUiScheduler)
.subscribe(calls -> updateOngoingCallView())); .subscribe(calls -> updateOngoingCallView(), e -> Log.e(TAG, "Can't update element", e)));
mConversationDisposable.add(c.getColor() mConversationDisposable.add(c.getColor()
.observeOn(mUiScheduler) .observeOn(mUiScheduler)
.subscribe(view::setConversationColor)); .subscribe(view::setConversationColor, e -> Log.e(TAG, "Can't update element", e)));
} }
public void openContact() { public void openContact() {
......
...@@ -304,7 +304,7 @@ public class SmartListPresenter extends RootPresenter<SmartListView> { ...@@ -304,7 +304,7 @@ public class SmartListPresenter extends RootPresenter<SmartListView> {
if (mSmartListViewModels.get(i).getContact() == vm.getContact()) if (mSmartListViewModels.get(i).getContact() == vm.getContact())
mSmartListViewModels.set(i, vm); mSmartListViewModels.set(i, vm);
getView().update(vm); getView().update(vm);
})); }, e -> Log.d(TAG, "loadConversations accountSubject onError", e)));
} }
private List<SmartListViewModel> filter(List<SmartListViewModel> list, String query) { private List<SmartListViewModel> filter(List<SmartListViewModel> list, String query) {
......
...@@ -31,7 +31,9 @@ import ezvcard.VCardVersion; ...@@ -31,7 +31,9 @@ import ezvcard.VCardVersion;
import ezvcard.io.text.VCardWriter; import ezvcard.io.text.VCardWriter;
import ezvcard.property.FormattedName; import ezvcard.property.FormattedName;
import ezvcard.property.Uid; import ezvcard.property.Uid;
import io.reactivex.Scheduler;
import io.reactivex.Single; import io.reactivex.Single;
import io.reactivex.schedulers.Schedulers;
public final class VCardUtils { public final class VCardUtils {
public static final String TAG = VCardUtils.class.getSimpleName(); public static final String TAG = VCardUtils.class.getSimpleName();
...@@ -206,11 +208,9 @@ public final class VCardUtils { ...@@ -206,11 +208,9 @@ public final class VCardUtils {
private static VCard setupDefaultProfile(File filesDir, String accountId) { private static VCard setupDefaultProfile(File filesDir, String accountId) {
VCard vcard = new VCard(); VCard vcard = new VCard();
vcard.setUid(new Uid(accountId)); vcard.setUid(new Uid(accountId));
try { saveLocalProfileToDisk(vcard, accountId, filesDir)
saveLocalProfileToDisk(vcard, accountId, filesDir).subscribe(); .subscribeOn(Schedulers.io())
} catch (Exception e) { .subscribe(vc -> {}, e -> Log.e(TAG, "Error while saving vcard", e));
Log.e(TAG, "Error while saving vcard", e);
}
return vcard; return vcard;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment