MCPcopy Create free account
hub / github.com/M66B/FairEmail / init

Method init

app/src/main/java/eu/faircode/email/WorkerFts.java:143–166  ·  view source on GitHub ↗
(Context context, boolean immediately)

Source from the content-addressed store, hash-verified

141 }
142
143 static void init(Context context, boolean immediately) {
144 try {
145 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
146 boolean fts = prefs.getBoolean("fts", true);
147 boolean pro = ActivityBilling.isPro(context);
148 if (fts && pro) {
149 Log.i("Queuing " + getName());
150
151 OneTimeWorkRequest.Builder builder = new OneTimeWorkRequest.Builder(WorkerFts.class);
152 if (!immediately)
153 builder.setInitialDelay(INDEX_DELAY, TimeUnit.SECONDS);
154 OneTimeWorkRequest workRequest = builder.build();
155
156 WorkManager.getInstance(context)
157 .enqueueUniqueWork(getName(), ExistingWorkPolicy.REPLACE, workRequest);
158
159 Log.i("Queued " + getName());
160 } else if (immediately)
161 cancel(context);
162 } catch (Throwable ex) {
163 // https://issuetracker.google.com/issues/138465476
164 Log.w(ex);
165 }
166 }
167
168 static void cancel(Context context) {
169 try {

Callers 5

onChangedMethod · 0.95
onExecuteMethod · 0.95
decodeMessageMethod · 0.95
onCheckedChangedMethod · 0.95
onExecutedMethod · 0.95

Calls 8

isProMethod · 0.95
iMethod · 0.95
getNameMethod · 0.95
buildMethod · 0.95
cancelMethod · 0.95
wMethod · 0.95
getBooleanMethod · 0.80
getInstanceMethod · 0.45

Tested by

no test coverage detected