new: add custom url-test for each repository

This commit is contained in:
hiddify-com
2024-07-29 13:11:51 +02:00
parent ccbc416c49
commit b9afe586bf
14 changed files with 417 additions and 157 deletions

View File

@@ -5,8 +5,7 @@ import 'package:hiddify/features/profile/model/profile_entity.dart';
extension ProfileEntityMapper on ProfileEntity {
ProfileEntriesCompanion toEntry() {
return switch (this) {
RemoteProfileEntity(:final url, :final options, :final subInfo) =>
ProfileEntriesCompanion.insert(
RemoteProfileEntity(:final url, :final options, :final subInfo) => ProfileEntriesCompanion.insert(
id: id,
type: ProfileType.remote,
active: active,
@@ -20,6 +19,7 @@ extension ProfileEntityMapper on ProfileEntity {
expire: Value(subInfo?.expire),
webPageUrl: Value(subInfo?.webPageUrl),
supportUrl: Value(subInfo?.supportUrl),
testUrl: Value(testUrl),
),
LocalProfileEntity() => ProfileEntriesCompanion.insert(
id: id,
@@ -41,6 +41,7 @@ extension RemoteProfileEntityMapper on RemoteProfileEntity {
expire: Value(subInfo?.expire),
webPageUrl: Value(subInfo?.webPageUrl),
supportUrl: Value(subInfo?.supportUrl),
testUrl: Value(testUrl),
);
}
}
@@ -73,12 +74,14 @@ extension ProfileEntryMapper on ProfileEntry {
lastUpdate: lastUpdate,
options: options,
subInfo: subInfo,
testUrl: testUrl,
),
ProfileType.local => LocalProfileEntity(
id: id,
active: active,
name: name,
lastUpdate: lastUpdate,
testUrl: testUrl,
),
};
}