Allow import of accounts to manually added (not imported) instances

This commit is contained in:
Arkadiusz Fal 2024-07-06 13:23:21 +02:00
parent 7755b392b7
commit 43c8484514
3 changed files with 3 additions and 3 deletions

View File

@ -68,7 +68,7 @@ struct LocationsSettingsGroupImporter {
if let password,
!password.isEmpty,
let instanceID = account.instanceID,
let instance = InstancesModel.shared.find(instanceID)
let instance = InstancesModel.shared.find(instanceID) ?? InstancesModel.shared.findByURLString(account.urlString)
{
if !instance.accounts.contains(where: { instanceAccount in
let (username, _) = instanceAccount.credentials

View File

@ -62,7 +62,7 @@ struct ImportSettingsAccountRow: View {
}
} else {
Group {
if InstancesModel.shared.find(instanceID) != nil {
if InstancesModel.shared.find(instanceID) != nil || InstancesModel.shared.findByURLString(account.urlString) != nil {
HStack {
Image(systemName: "checkmark.circle.fill")
.foregroundColor(.green)

View File

@ -42,7 +42,7 @@ final class ImportSettingsSheetViewModel: ObservableObject {
return ((account.password != nil && !account.password!.isEmpty) ||
importableAccounts.contains(account.id)) && (
(InstancesModel.shared.find(instanceID) != nil) ||
(InstancesModel.shared.find(instanceID) != nil || InstancesModel.shared.findByURLString(account.urlString) != nil) ||
selectedInstances.contains(instanceID)
)
}