Exemplo n.º 1
0
  private void addComment() {
    Update update = new Update();
    update.setValue(Update.MESSAGE, addCommentField.getText().toString());
    update.setValue(Update.ACTION_CODE, "tag_comment"); // $NON-NLS-1$
    update.setValue(Update.USER_ID, 0L);
    update.setValue(Update.TAG, tagData.getId());
    update.setValue(Update.CREATION_DATE, DateUtilities.now());
    Flags.checkAndClear(Flags.SUPPRESS_SYNC);
    updateDao.createNew(update);

    addCommentField.setText(""); // $NON-NLS-1$
    refreshUpdatesList();
  }
  @Override
  public void onReceive(Context context, Intent intent) {
    ContextManager.setContext(context);
    DependencyInjectionService.getInstance().inject(this);
    long taskId = intent.getLongExtra(AstridApiConstants.EXTRAS_TASK_ID, -1);
    if (taskId == -1) return;

    Task task = PluginServices.getTaskService().fetchById(taskId, Task.PROPERTIES);
    if (task == null || !task.isCompleted()) return;

    String recurrence = task.getValue(Task.RECURRENCE);
    if (recurrence != null && recurrence.length() > 0) {
      long newDueDate;
      try {
        newDueDate = computeNextDueDate(task, recurrence);
        if (newDueDate == -1) return;
      } catch (ParseException e) {
        PluginServices.getExceptionService().reportError("repeat-parse", e); // $NON-NLS-1$
        return;
      }

      StatisticsService.reportEvent(StatisticsConstants.V2_TASK_REPEAT);

      long oldDueDate = task.getValue(Task.DUE_DATE);
      long repeatUntil = task.getValue(Task.REPEAT_UNTIL);

      boolean repeatFinished = repeatUntil > 0 && newDueDate >= repeatUntil;
      if (repeatFinished) {
        Intent repeatFinishedIntent =
            new Intent(AstridApiConstants.BROADCAST_EVENT_TASK_REPEAT_FINISHED);
        repeatFinishedIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, task.getId());
        repeatFinishedIntent.putExtra(AstridApiConstants.EXTRAS_OLD_DUE_DATE, oldDueDate);
        repeatFinishedIntent.putExtra(AstridApiConstants.EXTRAS_NEW_DUE_DATE, newDueDate);
        context.sendOrderedBroadcast(repeatFinishedIntent, null);
        return;
      }

      rescheduleTask(task, newDueDate);

      // send a broadcast
      Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_EVENT_TASK_REPEATED);
      broadcastIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, task.getId());
      broadcastIntent.putExtra(AstridApiConstants.EXTRAS_OLD_DUE_DATE, oldDueDate);
      broadcastIntent.putExtra(AstridApiConstants.EXTRAS_NEW_DUE_DATE, newDueDate);
      context.sendOrderedBroadcast(broadcastIntent, null);
      Flags.set(Flags.REFRESH);
      return;
    }
  }
Exemplo n.º 3
0
  /**
   * Get details for this tag
   *
   * @param tagData
   * @throws IOException
   * @throws JSONException
   */
  public void fetchTag(final TagData tagData) throws IOException, JSONException {
    JSONObject result;
    if (!checkForToken()) return;

    if (tagData.getValue(TagData.REMOTE_ID) == 0)
      result =
          actFmInvoker.invoke("tag_show", "name", tagData.getValue(TagData.NAME), "token", token);
    else
      result =
          actFmInvoker.invoke(
              "tag_show", "id", tagData.getValue(TagData.REMOTE_ID), "token", token);

    JsonHelper.tagFromJson(result, tagData);
    Flags.set(Flags.SUPPRESS_SYNC);
    tagDataService.save(tagData);
  }
  @Override
  public void onReceive(Context context, Intent intent) {
    super.onReceive(context, intent);

    long taskId = intent.getLongExtra(AstridApiConstants.EXTRAS_TASK_ID, -1);
    if (taskId == -1) {
      return;
    }

    Task task = taskService.fetchById(taskId, Task.PROPERTIES);
    if (task == null || !task.isCompleted()) {
      return;
    }

    String recurrence = task.sanitizedRecurrence();
    boolean repeatAfterCompletion = task.repeatAfterCompletion();

    if (recurrence != null && recurrence.length() > 0) {
      long newDueDate;
      try {
        newDueDate = computeNextDueDate(task, recurrence, repeatAfterCompletion);
        if (newDueDate == -1) {
          return;
        }
      } catch (ParseException e) {
        log.error(e.getMessage(), e);
        return;
      }

      long oldDueDate = task.getDueDate();
      long repeatUntil = task.getRepeatUntil();

      if (repeatFinished(newDueDate, repeatUntil)) {
        return;
      }

      rescheduleTask(context, gcalHelper, taskService, task, newDueDate);

      // send a broadcast
      Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_EVENT_TASK_REPEATED);
      broadcastIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, task.getId());
      broadcastIntent.putExtra(AstridApiConstants.EXTRAS_OLD_DUE_DATE, oldDueDate);
      broadcastIntent.putExtra(AstridApiConstants.EXTRAS_NEW_DUE_DATE, newDueDate);
      context.sendOrderedBroadcast(broadcastIntent, null);
      Flags.set(Flags.REFRESH);
    }
  }
Exemplo n.º 5
0
  @Override
  public void updatePreferences(final Preference preference, Object value) {
    final Resources r = getResources();

    if (r.getString(R.string.p_showNotes).equals(preference.getKey())) {
      if (value != null && !(Boolean) value)
        preference.setSummary(R.string.EPr_showNotes_desc_disabled);
      else preference.setSummary(R.string.EPr_showNotes_desc_enabled);
      if ((Boolean) value != Preferences.getBoolean(preference.getKey(), false)) {
        taskService.clearDetails(Criterion.all);
        Flags.set(Flags.REFRESH);
      }
    } else if (r.getString(R.string.p_transparent).equals(preference.getKey())) {
      if (AndroidUtilities.getSdkVersion() < 5) {
        preference.setEnabled(false);
        preference.setSummary(R.string.EPr_transparent_desc_unsupported);
      } else if (value != null && !(Boolean) value)
        preference.setSummary(R.string.EPr_transparent_desc_disabled);
      else preference.setSummary(R.string.EPr_transparent_desc_enabled);
    }

    // statistics service
    else if (r.getString(R.string.p_statistics).equals(preference.getKey())) {
      if (value != null && !(Boolean) value)
        preference.setSummary(R.string.EPr_statistics_desc_disabled);
      else preference.setSummary(R.string.EPr_statistics_desc_enabled);
    }

    // voice input and output
    if (!addOnService.hasPowerPack()) return;

    if (r.getString(R.string.p_voiceInputEnabled).equals(preference.getKey())) {
      if (value != null && !(Boolean) value)
        preference.setSummary(R.string.EPr_voiceInputEnabled_desc_disabled);
      else preference.setSummary(R.string.EPr_voiceInputEnabled_desc_enabled);
      onVoiceInputStatusChanged(preference, (Boolean) value);
    } else if (r.getString(R.string.p_voiceRemindersEnabled).equals(preference.getKey())) {
      if (value != null && !(Boolean) value)
        preference.setSummary(R.string.EPr_voiceRemindersEnabled_desc_disabled);
      else preference.setSummary(R.string.EPr_voiceRemindersEnabled_desc_enabled);
      onVoiceReminderStatusChanged(preference, (Boolean) value);
    } else if (r.getString(R.string.p_voiceInputCreatesTask).equals(preference.getKey())) {
      if (value != null && !(Boolean) value)
        preference.setSummary(R.string.EPr_voiceInputCreatesTask_desc_disabled);
      else preference.setSummary(R.string.EPr_voiceInputCreatesTask_desc_enabled);
    }
  }
Exemplo n.º 6
0
  private void saveSettings() {
    String oldName = tagData.getValue(TagData.NAME);
    String newName = tagName.getText().toString();

    if (!oldName.equals(newName)) {
      tagData.setValue(TagData.NAME, newName);
      TagService.getInstance().rename(oldName, newName);
      tagData.setFlag(TagData.FLAGS, TagData.FLAG_EMERGENT, false);
    }

    JSONArray members = tagMembers.toJSONArray();
    tagData.setValue(TagData.MEMBERS, members.toString());
    tagData.setValue(TagData.MEMBER_COUNT, members.length());
    Flags.set(Flags.TOAST_ON_SAVE);
    tagDataService.save(tagData);

    refreshMembersPage();
  }
Exemplo n.º 7
0
  @Override
  public void onResume() {
    super.onResume();

    getActivity()
        .registerReceiver(
            refreshReceiver, new IntentFilter(AstridApiConstants.BROADCAST_EVENT_REFRESH));

    if (Flags.checkAndClear(Flags.REFRESH)) {
      refresh();
    }

    setUpBackgroundJobs();

    refreshFilterCount();

    initiateAutomaticSync();
  }
Exemplo n.º 8
0
  @Override
  public void onResume() {
    super.onResume();

    getActivity()
        .registerReceiver(
            detailReceiver, new IntentFilter(AstridApiConstants.BROADCAST_SEND_DETAILS));
    getActivity()
        .registerReceiver(
            detailReceiver, new IntentFilter(AstridApiConstants.BROADCAST_SEND_DECORATIONS));
    getActivity()
        .registerReceiver(
            refreshReceiver, new IntentFilter(AstridApiConstants.BROADCAST_EVENT_REFRESH));
    syncActionHelper.register();

    if (Flags.checkAndClear(Flags.REFRESH)) {
      refresh();
    }

    setUpBackgroundJobs();

    if (!Preferences.getBoolean(WelcomeWalkthrough.KEY_SHOWED_WELCOME_LOGIN, false)) {
      Preferences.setBoolean(WelcomeWalkthrough.KEY_SHOWED_WELCOME_LOGIN, true);
      Intent showWelcomeLogin = new Intent(getActivity(), WelcomeWalkthrough.class);
      showWelcomeLogin.putExtra(ActFmLoginActivity.SHOW_TOAST, false);
      startActivity(showWelcomeLogin);
      return;
    }

    if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) {
      showTaskCreateHelpPopover();
    } else if (!Preferences.getBoolean(R.string.p_showed_tap_task_help, false)) {
      showTaskEditHelpPopover();
    } else if (!Preferences.getBoolean(R.string.p_showed_lists_help, false)) {
      showListsHelp();
    }
    refreshFilterCount();
    initiateAutomaticSync();
  }
Exemplo n.º 9
0
  @Override
  public void updatePreferences(final Preference preference, Object value) {
    final Resources r = getResources();

    if (r.getString(R.string.p_showNotes).equals(preference.getKey())) {
      if (value != null && !(Boolean) value)
        preference.setSummary(R.string.EPr_showNotes_desc_disabled);
      else preference.setSummary(R.string.EPr_showNotes_desc_enabled);
      if ((Boolean) value != Preferences.getBoolean(preference.getKey(), false)) {
        taskService.clearDetails(Criterion.all);
        Flags.set(Flags.REFRESH);
      }
    } else if (r.getString(R.string.p_fullTaskTitle).equals(preference.getKey())) {
      if (value != null && (Boolean) value)
        preference.setSummary(R.string.EPr_fullTask_desc_enabled);
      else preference.setSummary(R.string.EPr_fullTask_desc_disabled);
    } else if (r.getString(R.string.p_theme).equals(preference.getKey())) {
      if (AndroidUtilities.getSdkVersion() < 5) {
        preference.setEnabled(false);
        preference.setSummary(R.string.EPr_theme_desc_unsupported);
      } else {
        int index = 0;
        if (value instanceof String && !TextUtils.isEmpty((String) value))
          index =
              AndroidUtilities.indexOf(
                  r.getStringArray(R.array.EPr_theme_settings), (String) value);
        if (index < 0) index = 0;
        preference.setSummary(
            getString(R.string.EPr_theme_desc, r.getStringArray(R.array.EPr_themes)[index]));
      }
    } else if (r.getString(R.string.p_theme_widget).equals(preference.getKey())) {
      if (AndroidUtilities.getSdkVersion() < 5) {
        preference.setEnabled(false);
        preference.setSummary(R.string.EPr_theme_desc_unsupported);
      } else {
        int index = 0;
        if (value instanceof String && !TextUtils.isEmpty((String) value))
          index =
              AndroidUtilities.indexOf(
                  r.getStringArray(R.array.EPr_theme_widget_settings), (String) value);
        if (index < 0) index = 0;
        preference.setSummary(
            getString(R.string.EPr_theme_desc, r.getStringArray(R.array.EPr_themes_widget)[index]));
      }
    }

    // pp preferences
    else if (booleanPreference(
        preference,
        value,
        R.string.p_statistics,
        R.string.EPr_statistics_desc_disabled,
        R.string.EPr_statistics_desc_enabled)) ;
    else if (booleanPreference(
        preference,
        value,
        R.string.p_autoIdea,
        R.string.EPr_ideaAuto_desc_disabled,
        R.string.EPr_ideaAuto_desc_enabled)) ;

    // voice input and output
    if (!addOnService.hasPowerPack()) return;

    if (r.getString(R.string.p_voiceInputEnabled).equals(preference.getKey())) {
      if (value != null && !(Boolean) value)
        preference.setSummary(R.string.EPr_voiceInputEnabled_desc_disabled);
      else preference.setSummary(R.string.EPr_voiceInputEnabled_desc_enabled);
      onVoiceInputStatusChanged(preference, (Boolean) value);
    } else if (r.getString(R.string.p_voiceRemindersEnabled).equals(preference.getKey())) {
      if (value != null && !(Boolean) value)
        preference.setSummary(R.string.EPr_voiceRemindersEnabled_desc_disabled);
      else preference.setSummary(R.string.EPr_voiceRemindersEnabled_desc_enabled);
      onVoiceReminderStatusChanged(preference, (Boolean) value);
    } else if (r.getString(R.string.p_voiceInputCreatesTask).equals(preference.getKey())) {
      if (value != null && !(Boolean) value)
        preference.setSummary(R.string.EPr_voiceInputCreatesTask_desc_disabled);
      else preference.setSummary(R.string.EPr_voiceInputCreatesTask_desc_enabled);
    }
  }
Exemplo n.º 10
0
  /**
   * Send tagData changes to server
   *
   * @param setValues
   */
  public void pushTagDataOnSave(TagData tagData, ContentValues values) {
    long remoteId;
    if (tagData.containsValue(TagData.REMOTE_ID)) remoteId = tagData.getValue(TagData.REMOTE_ID);
    else {
      TagData forRemote = tagDataService.fetchById(tagData.getId(), TagData.REMOTE_ID);
      if (forRemote == null) return;
      remoteId = forRemote.getValue(TagData.REMOTE_ID);
    }
    boolean newlyCreated = remoteId == 0;

    ArrayList<Object> params = new ArrayList<Object>();

    if (values.containsKey(TagData.NAME.name)) {
      params.add("name");
      params.add(tagData.getValue(TagData.NAME));
    }

    if (values.containsKey(TagData.MEMBERS.name)) {
      params.add("members");
      try {
        JSONArray members = new JSONArray(tagData.getValue(TagData.MEMBERS));
        if (members.length() == 0) params.add("");
        else {
          ArrayList<Object> array = new ArrayList<Object>(members.length());
          for (int i = 0; i < members.length(); i++) {
            JSONObject person = members.getJSONObject(i);
            if (person.has("id")) array.add(person.getLong("id"));
            else {
              if (person.has("name"))
                array.add(person.getString("name") + " <" + person.getString("email") + ">");
              else array.add(person.getString("email"));
            }
          }
          params.add(array);
        }
      } catch (JSONException e) {
        throw new RuntimeException(e);
      }
    }

    if (params.size() == 0 || !checkForToken()) return;

    if (!newlyCreated) {
      params.add("id");
      params.add(remoteId);
    }

    boolean success;
    try {
      params.add("token");
      params.add(token);
      JSONObject result =
          actFmInvoker.invoke("tag_save", params.toArray(new Object[params.size()]));
      if (newlyCreated) {
        tagData.setValue(TagData.REMOTE_ID, result.optLong("id"));
        Flags.set(Flags.SUPPRESS_SYNC);
        tagDataDao.saveExisting(tagData);
      }
      success = true;
    } catch (IOException e) {
      handleException("tag-save", e);
      success = false;
    }
    if (!Flags.checkAndClear(Flags.TOAST_ON_SAVE)) return;

    final boolean finalSuccess = success;
    Handler handler = new Handler(Looper.getMainLooper());
    handler.post(
        new Runnable() {
          @Override
          public void run() {
            if (finalSuccess)
              Toast.makeText(
                      ContextManager.getContext(), R.string.actfm_toast_success, Toast.LENGTH_LONG)
                  .show();
            else
              Toast.makeText(
                      ContextManager.getContext(), R.string.actfm_toast_error, Toast.LENGTH_LONG)
                  .show();
          }
        });
  }
Exemplo n.º 11
0
  /** Synchronize with server when data changes */
  public void pushTaskOnSave(Task task, ContentValues values) {
    long remoteId;
    if (task.containsValue(Task.REMOTE_ID)) remoteId = task.getValue(Task.REMOTE_ID);
    else {
      Task taskForRemote = taskService.fetchById(task.getId(), Task.REMOTE_ID);
      if (taskForRemote == null) return;
      remoteId = taskForRemote.getValue(Task.REMOTE_ID);
    }
    boolean newlyCreated = remoteId == 0;

    ArrayList<Object> params = new ArrayList<Object>();

    if (values.containsKey(Task.TITLE.name)) {
      params.add("title");
      params.add(task.getValue(Task.TITLE));
    }
    if (values.containsKey(Task.DUE_DATE.name)) {
      params.add("due");
      params.add(task.getValue(Task.DUE_DATE) / 1000L);
      params.add("has_due_time");
      params.add(task.hasDueTime() ? 1 : 0);
    }
    if (values.containsKey(Task.NOTES.name)) {
      params.add("notes");
      params.add(task.getValue(Task.NOTES));
    }
    if (values.containsKey(Task.DELETION_DATE.name)) {
      params.add("deleted_at");
      params.add(task.getValue(Task.DELETION_DATE) / 1000L);
    }
    if (values.containsKey(Task.COMPLETION_DATE.name)) {
      params.add("completed");
      params.add(task.getValue(Task.COMPLETION_DATE) / 1000L);
    }
    if (values.containsKey(Task.IMPORTANCE.name)) {
      params.add("importance");
      params.add(task.getValue(Task.IMPORTANCE));
    }
    if (values.containsKey(Task.RECURRENCE.name)) {
      params.add("repeat");
      params.add(task.getValue(Task.RECURRENCE));
    }
    if (values.containsKey(Task.USER_ID.name) && task.getValue(Task.USER_ID) >= 0) {
      params.add("user_id");
      if (task.getValue(Task.USER_ID) == 0) params.add(ActFmPreferenceService.userId());
      else params.add(task.getValue(Task.USER_ID));
    }
    if (Flags.checkAndClear(Flags.TAGS_CHANGED) || newlyCreated) {
      TodorooCursor<Metadata> cursor = TagService.getInstance().getTags(task.getId());
      try {
        if (cursor.getCount() == 0) {
          params.add("tags");
          params.add("");
        } else {
          Metadata metadata = new Metadata();
          for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
            metadata.readFromCursor(cursor);
            if (metadata.containsNonNullValue(TagService.REMOTE_ID)
                && metadata.getValue(TagService.REMOTE_ID) > 0) {
              params.add("tag_ids[]");
              params.add(metadata.getValue(TagService.REMOTE_ID));
            } else {
              params.add("tags[]");
              params.add(metadata.getValue(TagService.TAG));
            }
          }
        }
      } finally {
        cursor.close();
      }
    }

    if (params.size() == 0 || !checkForToken()) return;

    System.err.println("PUSHN ON SAVE: " + task.getMergedValues());
    System.err.println("SETVALUES: " + values);

    if (!newlyCreated) {
      params.add("id");
      params.add(remoteId);
    } else if (!params.contains(Task.TITLE.name)) return;

    try {
      params.add("token");
      params.add(token);
      JSONObject result =
          actFmInvoker.invoke("task_save", params.toArray(new Object[params.size()]));
      ArrayList<Metadata> metadata = new ArrayList<Metadata>();
      JsonHelper.taskFromJson(result, task, metadata);
      task.setValue(Task.MODIFICATION_DATE, DateUtilities.now());
      task.setValue(Task.LAST_SYNC, DateUtilities.now());
      Flags.set(Flags.SUPPRESS_SYNC);
      taskDao.saveExisting(task);
    } catch (JSONException e) {
      handleException("task-save-json", e);
    } catch (IOException e) {
      handleException("task-save-io", e);
    }
  }
Exemplo n.º 12
0
  @Override
  public void onReceive(Context context, Intent intent) {
    if (!Preferences.getBoolean(R.string.p_rmd_enabled, true)) return;

    DependencyInjectionService.getInstance().inject(this);

    int reengagementReminders = Preferences.getInt(ReengagementService.PREF_REENGAGEMENT_COUNT, 1);
    Preferences.setInt(ReengagementService.PREF_REENGAGEMENT_COUNT, reengagementReminders + 1);

    Intent notifIntent = new Intent(context, TaskListActivity.class);

    QueryTemplate template = new QueryTemplate().where(TaskCriteria.activeVisibleMine());
    String sql =
        SortHelper.adjustQueryForFlagsAndSort(template.toString(), 0, SortHelper.SORT_AUTO)
            + " LIMIT "
            + TASK_LIMIT; //$NON-NLS-1$

    boolean hasTasks = false;
    TodorooCursor<Task> tasks =
        taskService.query(
            Query.select(Task.ID).where(TaskCriteria.activeVisibleMine()).limit(TASK_LIMIT));
    try {
      hasTasks = tasks.getCount() > 0;
    } finally {
      tasks.close();
    }

    String title =
        Notifications.getRandomReminder(
            context.getResources().getStringArray(R.array.rmd_reengage_notif_titles));
    if (title.contains("%s")) { // $NON-NLS-1$
      String name = ""; // $NON-NLS-1$
      if (actFmPreferenceService.isLoggedIn()) {
        JSONObject thisUser = ActFmPreferenceService.thisUser();
        name = thisUser.optString("first_name"); // $NON-NLS-1$
        if (TextUtils.isEmpty(name)) name = thisUser.optString("name"); // $NON-NLS-1$
        if (TextUtils.isEmpty(name)) name = context.getString(R.string.rmd_reengage_name_default);
      }
      title = String.format(title, name);
    }

    String text =
        Notifications.getRandomReminder(
            context
                .getResources()
                .getStringArray(
                    hasTasks
                        ? R.array.rmd_reengage_dialog_options
                        : R.array.rmd_reengage_dialog_empty_options));

    FilterWithCustomIntent filter =
        new FilterWithCustomIntent(
            context.getString(R.string.rmd_NoA_filter),
            context.getString(R.string.rmd_NoA_filter),
            sql,
            null);
    filter.customTaskList = new ComponentName(context, ReengagementFragment.class);
    filter.customExtras = new Bundle();
    filter.customExtras.putString(ReengagementFragment.EXTRA_TEXT, text);

    notifIntent.setAction("NOTIFY_reengagement"); // $NON-NLS-1$
    notifIntent.putExtra(TaskListFragment.TOKEN_FILTER, filter);
    notifIntent.putExtra(ReengagementFragment.EXTRA_TEXT, text);
    notifIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
    notifIntent.putExtra(TaskListActivity.TOKEN_SOURCE, Constants.SOURCE_REENGAGEMENT);

    NotificationManager manager = new AndroidNotificationManager(context);
    Notification notification =
        new Notification(R.drawable.notif_astrid, text, System.currentTimeMillis());

    PendingIntent pendingIntent =
        PendingIntent.getActivity(context, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    notification.setLatestEventInfo(context, title, text, pendingIntent);

    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    if (Preferences.getBoolean(R.string.p_rmd_persistent, true)) {
      notification.flags |= Notification.FLAG_NO_CLEAR | Notification.FLAG_SHOW_LIGHTS;
      notification.ledOffMS = 5000;
      notification.ledOnMS = 700;
      notification.ledARGB = Color.YELLOW;
    } else {
      notification.defaults = Notification.DEFAULT_LIGHTS;
    }

    manager.notify(0, notification);
    Flags.set(Flags.REFRESH); // Forces a reload when app launches

    ReengagementService.scheduleReengagementAlarm(context);
  }