in core/src/main/java/com/github/shadowsocks/database/Profile.kt [225:236]
fun finalize(create: (Profile) -> Profile) {
val profiles = ProfileManager.getAllProfiles() ?: emptyList()
for ((profile, fallback) in fallbackMap) {
val match = profiles.firstOrNull {
fallback.host == it.host && fallback.remotePort == it.remotePort &&
fallback.password == it.password && fallback.method == it.method &&
it.plugin.isNullOrEmpty()
}
profile.udpFallback = (match ?: create(fallback)).id
ProfileManager.updateProfile(profile)
}
}