Skip to content

Commit

Permalink
WIP: Remote trackers list
Browse files Browse the repository at this point in the history
  • Loading branch information
XITRIX committed Sep 22, 2024
1 parent 1ad5c18 commit 903df63
Show file tree
Hide file tree
Showing 15 changed files with 556 additions and 34 deletions.
13 changes: 0 additions & 13 deletions ProgressWidget/ProgressWidgetLiveActivity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,9 @@ struct ProgressWidgetLiveActivity: Widget {
// Lock screen/banner UI goes here

if #available(iOS 18, *) {
#if XCODE16
ProgressWidgetLiveActivityWatchSupportContent(context: context)
.tint(Color(uiColor: context.tintColor))
.padding()
#else
ProgressWidgetLiveActivityContent(context: context)
.tint(Color(uiColor: context.tintColor))
.padding()
#endif

} else {
ProgressWidgetLiveActivityContent(context: context)
.tint(Color(uiColor: context.tintColor))
Expand Down Expand Up @@ -105,18 +98,13 @@ struct ProgressWidgetLiveActivity: Widget {
}

if #available(iOS 18.0, *) {
#if XCODE16
return config.supplementalActivityFamilies([.small])
#else
return config
#endif
} else {
return config
}
}
}

#if XCODE16
@available(iOS 18.0, *)
struct ProgressWidgetLiveActivityWatchSupportContent: View {
@Environment(\.activityFamily) var activityFamily
Expand Down Expand Up @@ -180,7 +168,6 @@ struct ProgressWidgetLiveActivityWatchSupportContent: View {
}
}
}
#endif

struct ProgressWidgetLiveActivityContent: View {
@State var context: ActivityViewContext<ProgressWidgetAttributes>
Expand Down
2 changes: 1 addition & 1 deletion Submodules/MVVMFoundation
31 changes: 31 additions & 0 deletions iTorrent.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@
D1B99D932BEE631B00F51514 /* Benefit.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1B99D8F2BEE631B00F51514 /* Benefit.swift */; };
D1B99D942BEE631B00F51514 /* Tier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1B99D902BEE631B00F51514 /* Tier.swift */; };
D1B99D962BEE657F00F51514 /* API.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1B99D952BEE657F00F51514 /* API.swift */; };
D1BB073B2C98524B00981D5F /* TrackersListService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1BB073A2C98524A00981D5F /* TrackersListService.swift */; };
D1BB07432C985EB800981D5F /* TrackersListPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1BB07422C985EAE00981D5F /* TrackersListPreferencesView.swift */; };
D1BB07452C9869C300981D5F /* TrackersListDetailsPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1BB07442C9869B900981D5F /* TrackersListDetailsPreferencesView.swift */; };
D1CAB8852AF3B51E00EB6AFF /* ToggleCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1CAB8842AF3B51E00EB6AFF /* ToggleCellView.swift */; };
D1CAB8872AF3B52E00EB6AFF /* ToggleCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1CAB8862AF3B52E00EB6AFF /* ToggleCellViewModel.swift */; };
D1D1279B2BC7CA7600C04533 /* SwiftUILayoutGuides.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1D1279A2BC7CA7600C04533 /* SwiftUILayoutGuides.swift */; };
Expand Down Expand Up @@ -418,6 +421,9 @@
D1B99D8F2BEE631B00F51514 /* Benefit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Benefit.swift; sourceTree = "<group>"; };
D1B99D902BEE631B00F51514 /* Tier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tier.swift; sourceTree = "<group>"; };
D1B99D952BEE657F00F51514 /* API.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = API.swift; sourceTree = "<group>"; };
D1BB073A2C98524A00981D5F /* TrackersListService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackersListService.swift; sourceTree = "<group>"; };
D1BB07422C985EAE00981D5F /* TrackersListPreferencesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackersListPreferencesView.swift; sourceTree = "<group>"; };
D1BB07442C9869B900981D5F /* TrackersListDetailsPreferencesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackersListDetailsPreferencesView.swift; sourceTree = "<group>"; };
D1CAB8842AF3B51E00EB6AFF /* ToggleCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleCellView.swift; sourceTree = "<group>"; };
D1CAB8862AF3B52E00EB6AFF /* ToggleCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleCellViewModel.swift; sourceTree = "<group>"; };
D1D1279A2BC7CA7600C04533 /* SwiftUILayoutGuides.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftUILayoutGuides.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -793,6 +799,7 @@
D111384C2AF9663F008907F7 /* Preferences */ = {
isa = PBXGroup;
children = (
D1BB07412C985E9700981D5F /* TrackersList */,
7C95B7A32C34B554000EC50F /* Storage */,
D1DB718E2BD92206007F9267 /* Patreon */,
7CB6F6CC2BD82B8A00D0813B /* FileSharing */,
Expand Down Expand Up @@ -1118,6 +1125,7 @@
D1A226F02AEF018500669D6D /* Services */ = {
isa = PBXGroup;
children = (
D1BB07392C98522D00981D5F /* TrackersListService */,
7C1C08AE2C31FEF700569B45 /* IntentsService */,
7C3142D42C31ED4600397E82 /* LiveActivityService */,
D1B99D842BEE5E4100F51514 /* Patreon */,
Expand Down Expand Up @@ -1256,6 +1264,23 @@
path = Models;
sourceTree = "<group>";
};
D1BB07392C98522D00981D5F /* TrackersListService */ = {
isa = PBXGroup;
children = (
D1BB073A2C98524A00981D5F /* TrackersListService.swift */,
);
path = TrackersListService;
sourceTree = "<group>";
};
D1BB07412C985E9700981D5F /* TrackersList */ = {
isa = PBXGroup;
children = (
D1BB07442C9869B900981D5F /* TrackersListDetailsPreferencesView.swift */,
D1BB07422C985EAE00981D5F /* TrackersListPreferencesView.swift */,
);
path = TrackersList;
sourceTree = "<group>";
};
D1CAB8832AF3B50C00EB6AFF /* ToggleCell */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1539,6 +1564,7 @@
D11138552AF97511008907F7 /* TorrentAddFileItemViewModel.swift in Sources */,
D11333B52AF19C4900FA017E /* TorrentHandle+Extension.swift in Sources */,
D19E00202AEFFA1B000A17A2 /* DetailCellView.swift in Sources */,
D1BB07452C9869C300981D5F /* TrackersListDetailsPreferencesView.swift in Sources */,
D1ACFDC62AF6DB9F0098FF56 /* TorrentFilesFileListCell.swift in Sources */,
D1A227072AEF0B2C00669D6D /* TorrentListItem.swift in Sources */,
D111384B2AF965F1008907F7 /* TorrentAddViewModel.swift in Sources */,
Expand Down Expand Up @@ -1602,6 +1628,7 @@
7CFEBE7C2BC4318E0013233F /* RssChannelViewController.swift in Sources */,
7C5FBE2C2BBDD6B40069E5A0 /* UIView+LayerColors.swift in Sources */,
7C4ED08D2BE646E40034B62C /* AdView+Meta.swift in Sources */,
D1BB07432C985EB800981D5F /* TrackersListPreferencesView.swift in Sources */,
D1B538572AF1171900694AFD /* TorrentDetailProgressCellView.swift in Sources */,
7C5FBE742BC2F0A30069E5A0 /* MvvmViewModelProtocol+Alert.swift in Sources */,
D1EFCD122AF572E400D33A7A /* TorrentFilesFileItemViewModel.swift in Sources */,
Expand Down Expand Up @@ -1672,6 +1699,7 @@
D1DB71802BD6773E007F9267 /* RssSearchViewModel.swift in Sources */,
D17733EE2BBC2C5F006FC81A /* ProxyPreferencesViewModel.swift in Sources */,
7CF6DA3E2C0F9DC40033D03F /* LiveActivityService.swift in Sources */,
D1BB073B2C98524B00981D5F /* TrackersListService.swift in Sources */,
7C4ED0982BEF8B8E0034B62C /* PatreonCredentials.swift in Sources */,
D173D9E12BC0286800E4F9EB /* UIMenu+Priority.swift in Sources */,
D1AA00CE2AFA8B1000B74629 /* PreferencesStorage.swift in Sources */,
Expand Down Expand Up @@ -1744,6 +1772,7 @@
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "iTorrent2 ProgressWidget Dev";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$inherited XCODE16";
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down Expand Up @@ -1891,6 +1920,7 @@
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "iTorrent2 ProgressWidget Dev";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$inherited XCODE16";
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down Expand Up @@ -2033,6 +2063,7 @@
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "iTorrent2 ProgressWidget Distrib";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$inherited XCODE16";
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
192 changes: 192 additions & 0 deletions iTorrent/Core/Assets/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -4912,6 +4912,22 @@
}
}
},
"preferences.network.trackers" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Trackers sources"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Источники трекеров"
}
}
}
},
"preferences.notifications" : {
"localizations" : {
"en" : {
Expand Down Expand Up @@ -5780,6 +5796,182 @@
}
}
},
"preferences.trackers.add.title" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Add trackers list"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Добавить список трекеров"
}
}
}
},
"preferences.trackers.add.titlePlaceholder" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Title"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Название"
}
}
}
},
"preferences.trackers.add.urlPlaceholder" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "URL to trackers source file"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "URL на источник списка трекеров"
}
}
}
},
"preferences.trackers.autoadding" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Enable auto-addition"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Включить автодобавление"
}
}
}
},
"preferences.trackers.autoadding.footer" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Automatically add all trackers to newly added torrents"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Автоматически добавляет все трекеры в новые торренты"
}
}
}
},
"preferences.trackers.empty.message" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Add URL to trackers list source by pressing «+»"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Добавьте URL на источник списка трекеров нажав «+»"
}
}
}
},
"preferences.trackers.empty.title" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Tracker sources list is empty"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Список источников трекеров пуст"
}
}
}
},
"preferences.trackers.exists.title" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "This trackers source already added"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Этот источник уже присутствует"
}
}
}
},
"preferences.trackers.remove.message" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Do you want to remove this trackers source?"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Вы хотите удалить этот источник трекеров?"
}
}
}
},
"preferences.trackers.remove.title" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Remove source"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Удалить источник"
}
}
}
},
"preferences.trackers.rename.title" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Rename source"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Переименовать источник"
}
}
}
},
"preferences.version" : {
"localizations" : {
"en" : {
Expand Down
3 changes: 3 additions & 0 deletions iTorrent/Core/SceneDelegate/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class SceneDelegate: MvvmSceneDelegate {
container.registerSingleton(factory: { BackgroundService.shared })
container.registerSingleton(factory: NetworkMonitoringService.init)
container.registerSingleton(factory: ImageLoader.init)
container.registerSingleton(factory: TrackersListService.init)
container.registerDaemon(factory: PatreonService.init)
container.registerDaemon(factory: TorrentMonitoringService.init)
container.registerDaemon(factory: RssFeedProvider.init)
Expand Down Expand Up @@ -62,6 +63,8 @@ class SceneDelegate: MvvmSceneDelegate {

router.register(BasePreferencesViewController<PreferencesViewModel>.self)
router.register(BasePreferencesViewController<ProxyPreferencesViewModel>.self)
router.register(TrackersListPreferencesViewController.self)
router.register(TrackersListDetailsPreferencesViewController.self)
router.register(BasePreferencesViewController<ConnectionPreferencesViewModel>.self)
router.register(BasePreferencesViewController<FileSharingPreferencesViewModel>.self)
router.register(PreferencesSectionGroupingViewController.self)
Expand Down
3 changes: 3 additions & 0 deletions iTorrent/Screens/Preferences/Root/PreferencesViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ private extension PreferencesViewModel {
PRButtonViewModel(with: .init(title: %"preferences.network.proxy", accessories: [.disclosureIndicator()]) { [unowned self] in
navigate(to: ProxyPreferencesViewModel.self, by: .show)
})
PRButtonViewModel(with: .init(title: %"preferences.network.trackers", accessories: [.disclosureIndicator()]) { [unowned self] in
navigate(to: TrackersListPreferencesViewModel.self, by: .show)
})
PRButtonViewModel(with: .init(title: %"preferences.network.connection", accessories: [.disclosureIndicator()]) { [unowned self] in
navigate(to: ConnectionPreferencesViewModel.self, by: .show)
})
Expand Down
Loading

0 comments on commit 903df63

Please sign in to comment.