Skip to content

Commit

Permalink
chore: Remove unneeded success messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ShridharGoel committed Jul 29, 2019
1 parent 4bb7e51 commit 026682e
Show file tree
Hide file tree
Showing 32 changed files with 20 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ public void showProgress(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success)
ViewUtils.showSnackbar(binding.getRoot(), R.string.refresh_complete);
// Nothing to do
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,7 @@ public void showProgress(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success)
ViewUtils.showSnackbar(binding.rvAttendeeList, R.string.refresh_complete);
// Nothing to do
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ public void showProgress(boolean show) {
@Override
public void onRefreshComplete(boolean success) {
refreshLayout.setRefreshing(false);
if (success)
ViewUtils.showSnackbar(binding.mainContent, R.string.refresh_complete);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ public void showProgress(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success)
ViewUtils.showSnackbar(container, R.string.refresh_complete);
// Nothing to do
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,7 @@ public void showProgress(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success) {
ViewUtils.showSnackbar(binding.getRoot(), R.string.refresh_complete);
}
// Nothing to do
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public void loadDetails(long eventId, boolean forceReload) {
})
.toList()
.subscribe(attendees -> {
success.setValue("Loaded Successfully");
this.attendees = attendees;
ticketAnalyser.analyseSoldTickets(event, attendees);
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ public void showProgress(boolean show) {
public void onRefreshComplete(boolean success) {
faqListViewModel.resetToDefaultState();
exitContextualMenuMode();
if (success)
ViewUtils.showSnackbar(binding.faqsRecyclerView, R.string.refresh_complete);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public void loadFaqs(boolean forceReload) {
.subscribe(loadedFaqs -> {
faqs.clear();
faqs.addAll(loadedFaqs);
success.setValue("FAQs Loaded Successfully");
faqsLiveData.setValue(loadedFaqs);
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ public void showProgress(boolean show) {
@Override
public void onRefreshComplete(boolean success) {
refreshLayout.setRefreshing(false);
if (success)
ViewUtils.showSnackbar(binding.feedbacksRecyclerView, R.string.refresh_complete);
}

private void showMessage(String message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public void loadFeedbacks(boolean forceReload) {
.doFinally(() -> progress.setValue(false))
.toList()
.subscribe(feedbacks -> {
success.setValue("Feedbacks Loaded Successfully");
feedbacksLiveData.setValue(feedbacks);
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ public void showProgress(boolean show) {
@Override
public void onRefreshComplete(boolean success) {
refreshLayout.setRefreshing(false);
if (success)
ViewUtils.showSnackbar(binding.notificationsRecyclerView, R.string.refresh_complete);
}

private void showMessage(String message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public void loadNotifications(boolean forceReload) {
Collections.reverse(notificationsList);
notifications.clear();
notifications.addAll(notificationsList);
success.setValue("Notifications Loaded Successfully");
notificationsLiveData.setValue(notifications);
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ public void showEmptyView(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success)
ViewUtils.showSnackbar(binding.getRoot(), R.string.refresh_complete);
// Nothing to do
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ public void showEmptyView(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success)
ViewUtils.showSnackbar(binding.getRoot(), R.string.refresh_complete);
// Nothing to do
}

public void showOrderDetails(Order order) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ public void showEmptyView(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success)
ViewUtils.showSnackbar(binding.ordersRecyclerView, R.string.refresh_complete);
// Nothing to do
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,5 @@ public void showSnackbar(String message) {
@Override
public void onRefreshComplete(boolean success) {
refreshLayout.setRefreshing(false);
if (success)
ViewUtils.showSnackbar(binding.mainContent, R.string.refresh_complete);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public void loadOrganizer(boolean forceReload) {
.subscribe(loadedUser -> {
this.user = loadedUser;
resendVerificationMail.setEmail(user.getEmail());
success.setValue("Organizer Details Loaded Successfully");
userLiveData.setValue(user);
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
Expand Down Expand Up @@ -109,7 +108,6 @@ public void uploadImage(ImageData imageData) {
.doOnSubscribe(disposable -> progress.setValue(true))
.doFinally(() -> progress.setValue(false))
.subscribe(uploadedImage -> {
success.setValue("Image Uploaded Successfully");
Timber.e(uploadedImage.getUrl());
user.setAvatarUrl(uploadedImage.getUrl());
updateOrganizer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ public void showProgress(boolean show) {
@Override
public void onRefreshComplete(boolean success) {
refreshLayout.setRefreshing(false);
if (success)
ViewUtils.showSnackbar(binding.rolesRecyclerView, R.string.refresh_complete);
}

private void showMessage(String message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public void loadRoles(boolean forceReload) {
.subscribe(roleList -> {
roles.clear();
roles.addAll(roleList);
success.setValue("Roles Loaded Successfully");
rolesLiveData.setValue(roles);
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ public void showProgress(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success)
ViewUtils.showSnackbar(binding.sessionsRecyclerView, R.string.refresh_complete);
// Nothing to do
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ public void showResult(Event event) {
@Override
public void onRefreshComplete(boolean success) {
refreshLayout.setRefreshing(false);
if (success)
ViewUtils.showSnackbar(binding.getRoot(), R.string.refresh_complete);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,5 @@ public void showProgress(boolean show) {
@Override
public void onRefreshComplete(boolean success) {
refreshLayout.setRefreshing(false);
if (success)
ViewUtils.showSnackbar(binding.mainContent, R.string.refresh_complete);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ public void showProgress(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success)
ViewUtils.showSnackbar(binding.speakersRecyclerView, R.string.refresh_complete);
// Nothing to do
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ public void showProgress(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success)
ViewUtils.showSnackbar(binding.getRoot(), R.string.refresh_complete);
// Nothing to do
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ public void showProgress(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success)
ViewUtils.showSnackbar(binding.sponsorsRecyclerView, R.string.refresh_complete);
// Nothing to do
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ public void showProgress(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success)
ViewUtils.showSnackbar(binding.ticketsRecyclerView, R.string.refresh_complete);
// Nothing to do
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ public void showProgress(boolean show) {

@Override
public void onRefreshComplete(boolean success) {
if (success)
ViewUtils.showSnackbar(binding.tracksRecyclerView, R.string.refresh_complete);
// Nothing to do
}

@Override
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<string name="event_state_draft">Draft</string>
<string name="gross_sales">Gross Sales</string>
<string name="sales_summary">Sales Summary</string>
<string name="refresh_complete">Refresh Complete</string>
<string name="search_title">Search</string>
<string name="search_placeholder">Search Attendees</string>
<string name="tickets">Tickets</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public class SalesSummaryViewModelTest {
@Mock
Observer<Boolean> progress;
@Mock
Observer<String> success;
@Mock
Observer<Event> event;

private static final List<Attendee> ATTENDEES = Arrays.asList(
Expand Down Expand Up @@ -89,10 +87,9 @@ public void shouldLoadDetailsSuccessfully() {
when(eventRepository.getEvent(ID, false))
.thenReturn(Observable.just(EVENT));

InOrder inOrder = Mockito.inOrder(event, eventRepository, progress, success);
InOrder inOrder = Mockito.inOrder(event, eventRepository, progress);

salesSummaryViewModel.getProgress().observeForever(progress);
salesSummaryViewModel.getSuccess().observeForever(success);
salesSummaryViewModel.getEventLiveData().observeForever(event);

salesSummaryViewModel.loadDetails(ID, false);
Expand All @@ -111,16 +108,14 @@ public void shouldLoadAttendeesSuccessfully() {
when(attendeeRepository.getAttendees(ID, false))
.thenReturn(Observable.fromIterable(ATTENDEES));

InOrder inOrder = Mockito.inOrder(event, attendeeRepository, progress, success);
InOrder inOrder = Mockito.inOrder(event, attendeeRepository, progress);

salesSummaryViewModel.getProgress().observeForever(progress);
salesSummaryViewModel.getSuccess().observeForever(success);

salesSummaryViewModel.loadDetails(ID, false);

inOrder.verify(attendeeRepository).getAttendees(ID, false);
inOrder.verify(progress).onChanged(true);
inOrder.verify(success).onChanged("Loaded Successfully");
inOrder.verify(progress).onChanged(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ public class FaqListViewModelTest {
@Mock
Observer<Boolean> progress;
@Mock
Observer<String> success;
@Mock
Observer<String> error;

private static final List<Faq> FAQS = Arrays.asList(
Expand Down Expand Up @@ -96,15 +94,13 @@ public void shouldLoadFaqsSuccessfully() {
.thenReturn(Observable.fromIterable(FAQS));
when(faqChangeListener.getNotifier()).thenReturn(PublishSubject.create());

InOrder inOrder = Mockito.inOrder(progress, success);
InOrder inOrder = Mockito.inOrder(progress);

faqListViewModel.getProgress().observeForever(progress);
faqListViewModel.getSuccess().observeForever(success);

faqListViewModel.loadFaqs(false);

inOrder.verify(progress).onChanged(true);
inOrder.verify(success).onChanged(anyString());
inOrder.verify(progress).onChanged(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public class FeedbackListViewModelTest {
@Mock
Observer<Boolean> progress;
@Mock
Observer<String> success;
@Mock
Observer<String> error;

private static final List<Feedback> FEEDBACKS = Arrays.asList(
Expand Down Expand Up @@ -85,15 +83,13 @@ public void shouldLoadFeedbacksSuccessfully() {
when(feedbackRepository.getFeedbacks(anyLong(), anyBoolean()))
.thenReturn(Observable.fromIterable(FEEDBACKS));

InOrder inOrder = Mockito.inOrder(progress, success);
InOrder inOrder = Mockito.inOrder(progress);

feedbackListViewModel.getProgress().observeForever(progress);
feedbackListViewModel.getSuccess().observeForever(success);

feedbackListViewModel.loadFeedbacks(false);

inOrder.verify(progress).onChanged(true);
inOrder.verify(success).onChanged(anyString());
inOrder.verify(progress).onChanged(false);
}

Expand Down
Loading

0 comments on commit 026682e

Please sign in to comment.