mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 01:28:52 -06:00
Write tests for receivers
This commit is contained in:
@@ -19,12 +19,15 @@
|
||||
|
||||
package org.isoron.uhabits;
|
||||
|
||||
import android.content.*;
|
||||
|
||||
import org.isoron.uhabits.activities.habits.list.model.*;
|
||||
import org.isoron.uhabits.commands.*;
|
||||
import org.isoron.uhabits.intents.*;
|
||||
import org.isoron.uhabits.io.*;
|
||||
import org.isoron.uhabits.models.*;
|
||||
import org.isoron.uhabits.models.sqlite.*;
|
||||
import org.isoron.uhabits.notifications.*;
|
||||
import org.isoron.uhabits.preferences.*;
|
||||
import org.isoron.uhabits.tasks.*;
|
||||
import org.isoron.uhabits.utils.*;
|
||||
@@ -40,6 +43,9 @@ public interface AppComponent
|
||||
{
|
||||
CommandRunner getCommandRunner();
|
||||
|
||||
@AppContext
|
||||
Context getContext();
|
||||
|
||||
CreateHabitCommandFactory getCreateHabitCommandFactory();
|
||||
|
||||
DirFinder getDirFinder();
|
||||
@@ -48,6 +54,8 @@ public interface AppComponent
|
||||
|
||||
GenericImporter getGenericImporter();
|
||||
|
||||
HabitCardListCache getHabitCardListCache();
|
||||
|
||||
HabitList getHabitList();
|
||||
|
||||
HabitLogger getHabitsLogger();
|
||||
@@ -58,6 +66,8 @@ public interface AppComponent
|
||||
|
||||
ModelFactory getModelFactory();
|
||||
|
||||
NotificationTray getNotificationTray();
|
||||
|
||||
PendingIntentFactory getPendingIntentFactory();
|
||||
|
||||
Preferences getPreferences();
|
||||
@@ -69,6 +79,4 @@ public interface AppComponent
|
||||
WidgetPreferences getWidgetPreferences();
|
||||
|
||||
WidgetUpdater getWidgetUpdater();
|
||||
|
||||
HabitCardListCache getHabitCardListCache();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package org.isoron.uhabits.commands;
|
||||
|
||||
import org.isoron.uhabits.models.Habit;
|
||||
import org.isoron.uhabits.models.*;
|
||||
|
||||
/**
|
||||
* Command to toggle a repetition.
|
||||
|
||||
@@ -36,6 +36,7 @@ import javax.inject.*;
|
||||
import static android.graphics.BitmapFactory.*;
|
||||
import static org.isoron.uhabits.utils.RingtoneUtils.*;
|
||||
|
||||
@AppScope
|
||||
public class NotificationTray
|
||||
{
|
||||
@NonNull
|
||||
|
||||
@@ -68,8 +68,8 @@ public class ReminderController
|
||||
|
||||
long now = DateUtils.getLocalTime();
|
||||
long reminderTime = now + snoozeInterval * 60 * 1000;
|
||||
reminderScheduler.schedule(habit, reminderTime);
|
||||
|
||||
reminderScheduler.schedule(habit, reminderTime);
|
||||
notificationTray.cancel(habit);
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public class ReminderReceiver extends BroadcastReceiver
|
||||
}
|
||||
|
||||
@ReceiverScope
|
||||
@Component(dependencies = AppComponent.class, modules = AppModule.class)
|
||||
@Component(dependencies = AppComponent.class)
|
||||
interface ReminderComponent
|
||||
{
|
||||
ReminderController getReminderController();
|
||||
|
||||
@@ -87,7 +87,7 @@ public class WidgetReceiver extends BroadcastReceiver
|
||||
}
|
||||
|
||||
@ReceiverScope
|
||||
@Component(dependencies = AppComponent.class, modules = AppModule.class)
|
||||
@Component(dependencies = AppComponent.class)
|
||||
interface WidgetComponent
|
||||
{
|
||||
WidgetController getWidgetController();
|
||||
|
||||
Reference in New Issue
Block a user