mirror of
https://github.com/oxen-io/session-android.git
synced 2025-03-27 01:52:17 +00:00

We have to make some changes, and it's gotten to the point where maintaining it as a separate library is more hassle than it's worth, especially with Google releasing WorkManager as the preferred job scheduling library.
37 lines
1.0 KiB
Java
37 lines
1.0 KiB
Java
package org.thoughtcrime.securesms.jobmanager.dependencies;
|
|
|
|
import android.content.Context;
|
|
|
|
import org.thoughtcrime.securesms.jobmanager.Job;
|
|
import org.thoughtcrime.securesms.jobmanager.requirements.Requirement;
|
|
|
|
public class AggregateDependencyInjector {
|
|
|
|
private final DependencyInjector dependencyInjector;
|
|
|
|
public AggregateDependencyInjector(DependencyInjector dependencyInjector) {
|
|
this.dependencyInjector = dependencyInjector;
|
|
}
|
|
|
|
public void injectDependencies(Context context, Job job) {
|
|
if (job instanceof ContextDependent) {
|
|
((ContextDependent)job).setContext(context);
|
|
}
|
|
|
|
for (Requirement requirement : job.getRequirements()) {
|
|
if (requirement instanceof ContextDependent) {
|
|
((ContextDependent)requirement).setContext(context);
|
|
}
|
|
}
|
|
|
|
if (dependencyInjector != null) {
|
|
dependencyInjector.injectDependencies(job);
|
|
|
|
for (Requirement requirement : job.getRequirements()) {
|
|
dependencyInjector.injectDependencies(requirement);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|