mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-06 20:45:00 +03:00
Default to first sub; update SubIndexId on delete
https://github.com/2dust/v2rayN/issues/9151
This commit is contained in:
@@ -1936,6 +1936,12 @@ public static class ConfigHandler
|
|||||||
await SQLiteHelper.Instance.DeleteAsync(item);
|
await SQLiteHelper.Instance.DeleteAsync(item);
|
||||||
await RemoveServersViaSubid(config, id, false);
|
await RemoveServersViaSubid(config, id, false);
|
||||||
|
|
||||||
|
if (item.Id == config.SubIndexId)
|
||||||
|
{
|
||||||
|
var subs = await AppManager.Instance.SubItems();
|
||||||
|
config.SubIndexId = subs.LastOrDefault()?.Id;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public class ProfilesSelectViewModel : MyReactiveObject
|
|||||||
}
|
}
|
||||||
SelectedSub = (_config.SubIndexId.IsNotEmpty()
|
SelectedSub = (_config.SubIndexId.IsNotEmpty()
|
||||||
? SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId)
|
? SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId)
|
||||||
: null) ?? SubItems.LastOrDefault();
|
: null) ?? SubItems.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)
|
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ public class ProfilesViewModel : MyReactiveObject
|
|||||||
}
|
}
|
||||||
SelectedSub = (_config.SubIndexId.IsNotEmpty()
|
SelectedSub = (_config.SubIndexId.IsNotEmpty()
|
||||||
? SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId)
|
? SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId)
|
||||||
: null) ?? SubItems.LastOrDefault();
|
: null) ?? SubItems.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)
|
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)
|
||||||
|
|||||||
Reference in New Issue
Block a user