fix restore selected proxy after update profile
This commit is contained in:
4 files changed
+9
-2
No files matched your search
@@ -180,8 +180,7 @@ class ProfilesActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
runClash { clash ->
|
||||
clash.profileService.addProfile(profile
|
||||
.copy(lastUpdate = System.currentTimeMillis()))
|
||||
clash.profileService.touchProfile(profile.id)
|
||||
}
|
||||
}
|
||||
catch (e: Exception) {
|
||||
|
||||
@@ -7,5 +7,6 @@ interface IClashProfileService {
|
||||
void setActiveProfile(int id);
|
||||
void addProfile(in ClashProfileEntity profile);
|
||||
void removeProfile(int id);
|
||||
void touchProfile(int id);
|
||||
ClashProfileEntity queryActiveProfile();
|
||||
}
|
||||
@@ -42,6 +42,10 @@ class ClashProfileService(context: Context, private val master: Master) :
|
||||
master.preformProfileChanged()
|
||||
}
|
||||
|
||||
override fun touchProfile(id: Int) {
|
||||
profileDao.touchProfile(id)
|
||||
}
|
||||
|
||||
override fun queryProfiles(): Array<ClashProfileEntity> {
|
||||
return profileDao.queryProfiles()
|
||||
}
|
||||
|
||||
@@ -21,4 +21,7 @@ interface ClashProfileDao {
|
||||
|
||||
@Query("DELETE FROM profiles WHERE id = :id")
|
||||
fun removeProfile(id: Int)
|
||||
|
||||
@Query("UPDATE profiles SET last_update = :lastUpdate WHERE id = :id")
|
||||
fun touchProfile(id: Int, lastUpdate: Long = System.currentTimeMillis())
|
||||
}
|
||||
Reference in new issue
Block a user