BootReceiver.kt
1package com.peachpasswords.sync23import android.content.BroadcastReceiver4import android.content.Context5import android.content.Intent67/**8 * Restarts the sync service after a reboot. The service's own locked-handling9 * ([PeachSyncService.startReconnectListener] early-returns on a null master10 * key) is the gate — it comes up properly once the user unlocks for the first11 * time post-boot. Without this, a rebooted phone is unreachable until the app12 * is manually opened.13 */14class BootReceiver : BroadcastReceiver() {15 override fun onReceive(context: Context, intent: Intent?) {16 if (intent?.action != Intent.ACTION_BOOT_COMPLETED) return17 if (!BackgroundSyncPreference.isEnabled(context)) return18 PeachSyncService.start(context)19 }20}