Skip to content

Commit

Permalink
Forward information whether Syncthing should start or stop
Browse files Browse the repository at this point in the history
  • Loading branch information
Helium314 authored Sep 7, 2021
1 parent f23383e commit c1b3804
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import com.nutomic.syncthingandroid.util.JobUtils;

import static com.nutomic.syncthingandroid.service.RunConditionMonitor.EXTRA_BEGIN_ACTIVE_TIME_WINDOW;

/**
* SyncTriggerJobService to be scheduled by the JobScheduler.
* See {@link JobUtils#scheduleSyncTriggerServiceJob} for more details.
Expand All @@ -24,6 +26,11 @@ public boolean onStartJob(JobParameters params) {
Context context = getApplicationContext();
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(context);
Intent intent = new Intent(RunConditionMonitor.ACTION_SYNC_TRIGGER_FIRED);

// if Syncthing should start, forward this information to SyncTriggerReceiver
// otherwise Syncthing will stop
if (params.getExtras().getInt(EXTRA_BEGIN_ACTIVE_TIME_WINDOW, 0) == 1)
intent.putExtra(EXTRA_BEGIN_ACTIVE_TIME_WINDOW, true);
localBroadcastManager.sendBroadcast(intent);
return true;
}
Expand Down

0 comments on commit c1b3804

Please sign in to comment.