mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Increase logging for ReminderReceiver and WidgetReceiver
This commit is contained in:
@@ -77,7 +77,6 @@ public class ReminderReceiver extends BroadcastReceiver
|
|||||||
case ACTION_SHOW_REMINDER:
|
case ACTION_SHOW_REMINDER:
|
||||||
if (habit == null) return;
|
if (habit == null) return;
|
||||||
Log.d("ReminderReceiver", String.format(
|
Log.d("ReminderReceiver", String.format(
|
||||||
Locale.US,
|
|
||||||
"onShowReminder habit=%d timestamp=%d reminderTime=%d",
|
"onShowReminder habit=%d timestamp=%d reminderTime=%d",
|
||||||
habit.id,
|
habit.id,
|
||||||
timestamp,
|
timestamp,
|
||||||
@@ -88,15 +87,18 @@ public class ReminderReceiver extends BroadcastReceiver
|
|||||||
|
|
||||||
case ACTION_DISMISS_REMINDER:
|
case ACTION_DISMISS_REMINDER:
|
||||||
if (habit == null) return;
|
if (habit == null) return;
|
||||||
|
Log.d("ReminderReceiver", String.format("onDismiss habit=%d", habit.id));
|
||||||
reminderController.onDismiss(habit);
|
reminderController.onDismiss(habit);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_SNOOZE_REMINDER:
|
case ACTION_SNOOZE_REMINDER:
|
||||||
if (habit == null) return;
|
if (habit == null) return;
|
||||||
|
Log.d("ReminderReceiver", String.format("onSnoozePressed habit=%d", habit.id));
|
||||||
reminderController.onSnoozePressed(habit, context);
|
reminderController.onSnoozePressed(habit, context);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Intent.ACTION_BOOT_COMPLETED:
|
case Intent.ACTION_BOOT_COMPLETED:
|
||||||
|
Log.d("ReminderReceiver", "onBootCompleted");
|
||||||
reminderController.onBootCompleted();
|
reminderController.onBootCompleted();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,33 +38,37 @@ import dagger.*;
|
|||||||
public class WidgetReceiver extends BroadcastReceiver
|
public class WidgetReceiver extends BroadcastReceiver
|
||||||
{
|
{
|
||||||
public static final String ACTION_ADD_REPETITION =
|
public static final String ACTION_ADD_REPETITION =
|
||||||
"org.isoron.uhabits.ACTION_ADD_REPETITION";
|
"org.isoron.uhabits.ACTION_ADD_REPETITION";
|
||||||
|
|
||||||
public static final String ACTION_DISMISS_REMINDER =
|
public static final String ACTION_DISMISS_REMINDER =
|
||||||
"org.isoron.uhabits.ACTION_DISMISS_REMINDER";
|
"org.isoron.uhabits.ACTION_DISMISS_REMINDER";
|
||||||
|
|
||||||
public static final String ACTION_REMOVE_REPETITION =
|
public static final String ACTION_REMOVE_REPETITION =
|
||||||
"org.isoron.uhabits.ACTION_REMOVE_REPETITION";
|
"org.isoron.uhabits.ACTION_REMOVE_REPETITION";
|
||||||
|
|
||||||
public static final String ACTION_TOGGLE_REPETITION =
|
public static final String ACTION_TOGGLE_REPETITION =
|
||||||
"org.isoron.uhabits.ACTION_TOGGLE_REPETITION";
|
"org.isoron.uhabits.ACTION_TOGGLE_REPETITION";
|
||||||
|
|
||||||
|
private static final String TAG = "WidgetReceiver";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(final Context context, Intent intent)
|
public void onReceive(final Context context, Intent intent)
|
||||||
{
|
{
|
||||||
HabitsApplication app =
|
HabitsApplication app =
|
||||||
(HabitsApplication) context.getApplicationContext();
|
(HabitsApplication) context.getApplicationContext();
|
||||||
|
|
||||||
WidgetComponent component = DaggerWidgetReceiver_WidgetComponent
|
WidgetComponent component = DaggerWidgetReceiver_WidgetComponent
|
||||||
.builder()
|
.builder()
|
||||||
.habitsApplicationComponent(app.getComponent())
|
.habitsApplicationComponent(app.getComponent())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
IntentParser parser = app.getComponent().getIntentParser();
|
IntentParser parser = app.getComponent().getIntentParser();
|
||||||
WidgetBehavior controller = component.getWidgetController();
|
WidgetBehavior controller = component.getWidgetController();
|
||||||
Preferences prefs = app.getComponent().getPreferences();
|
Preferences prefs = app.getComponent().getPreferences();
|
||||||
|
|
||||||
if(prefs.isSyncEnabled())
|
Log.i(TAG, String.format("Received intent: %s", intent.toString()));
|
||||||
|
|
||||||
|
if (prefs.isSyncEnabled())
|
||||||
context.startService(new Intent(context, SyncService.class));
|
context.startService(new Intent(context, SyncService.class));
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -75,18 +79,30 @@ public class WidgetReceiver extends BroadcastReceiver
|
|||||||
switch (intent.getAction())
|
switch (intent.getAction())
|
||||||
{
|
{
|
||||||
case ACTION_ADD_REPETITION:
|
case ACTION_ADD_REPETITION:
|
||||||
|
Log.d(TAG, String.format(
|
||||||
|
"onAddRepetition habit=%d timestamp=%d",
|
||||||
|
data.getHabit().getId(),
|
||||||
|
data.getTimestamp().getUnixTime()));
|
||||||
controller.onAddRepetition(data.getHabit(),
|
controller.onAddRepetition(data.getHabit(),
|
||||||
data.getTimestamp());
|
data.getTimestamp());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_TOGGLE_REPETITION:
|
case ACTION_TOGGLE_REPETITION:
|
||||||
|
Log.d(TAG, String.format(
|
||||||
|
"onToggleRepetition habit=%d timestamp=%d",
|
||||||
|
data.getHabit().getId(),
|
||||||
|
data.getTimestamp().getUnixTime()));
|
||||||
controller.onToggleRepetition(data.getHabit(),
|
controller.onToggleRepetition(data.getHabit(),
|
||||||
data.getTimestamp());
|
data.getTimestamp());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_REMOVE_REPETITION:
|
case ACTION_REMOVE_REPETITION:
|
||||||
|
Log.d(TAG, String.format(
|
||||||
|
"onRemoveRepetition habit=%d timestamp=%d",
|
||||||
|
data.getHabit().getId(),
|
||||||
|
data.getTimestamp().getUnixTime()));
|
||||||
controller.onRemoveRepetition(data.getHabit(),
|
controller.onRemoveRepetition(data.getHabit(),
|
||||||
data.getTimestamp());
|
data.getTimestamp());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user