Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Admin Dashboard - Task Triggers, Device Management, & Device Posters #1255

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Shared/Coordinators/SettingsCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ final class SettingsCoordinator: NavigationCoordinatable {
var tasks = makeTasks
@Route(.push)
var editScheduledTask = makeEditScheduledTask
@Route(.modal)
var addScheduledTaskTrigger = makeAddScheduledTaskTrigger
@Route(.push)
var serverLogs = makeServerLogs

Expand Down Expand Up @@ -193,6 +195,12 @@ final class SettingsCoordinator: NavigationCoordinatable {
EditScheduledTaskView(observer: observer)
}

func makeAddScheduledTaskTrigger(observer: ServerTaskObserver) -> NavigationViewCoordinator<BasicNavigationViewCoordinator> {
NavigationViewCoordinator {
AddTaskTriggerView(observer: observer)
}
}

@ViewBuilder
func makeServerLogs() -> some View {
ServerLogsView()
Expand Down
32 changes: 32 additions & 0 deletions Shared/Extensions/JellyfinAPI/DayOfWeek.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// Swiftfin is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//

import Foundation
import JellyfinAPI

extension DayOfWeek {

var displayTitle: String {
switch self {
case .sunday:
return L10n.dayOfWeekSunday
case .monday:
return L10n.dayOfWeekMonday
case .tuesday:
return L10n.dayOfWeekTuesday
case .wednesday:
return L10n.dayOfWeekWednesday
case .thursday:
return L10n.dayOfWeekThursday
case .friday:
return L10n.dayOfWeekFriday
case .saturday:
return L10n.dayOfWeekSaturday
JPKribs marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
24 changes: 24 additions & 0 deletions Shared/Extensions/JellyfinAPI/TaskInfo.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Swiftfin is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//

import Foundation
import JellyfinAPI

extension TaskState {

var displayTitle: String {
switch self {
case .idle:
return L10n.taskStateIdle
case .cancelling:
return L10n.taskStateCancelling
case .running:
return L10n.taskStateRunning
}
}
}
45 changes: 45 additions & 0 deletions Shared/Extensions/TaskTriggerType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// Swiftfin is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//

import Foundation

// TODO: move to SDK as patch file

enum TaskTriggerType: String, Codable, CaseIterable, Displayable, SystemImageable {

case daily = "DailyTrigger"
case weekly = "WeeklyTrigger"
case interval = "IntervalTrigger"
case startup = "StartupTrigger"

var displayTitle: String {
switch self {
case .daily:
return L10n.daily
case .weekly:
return L10n.weekly
case .interval:
return L10n.interval
case .startup:
return L10n.onApplicationStartup
}
}

var systemImage: String {
switch self {
case .daily:
return "clock"
case .weekly:
return "calendar"
case .interval:
return "timer"
case .startup:
return "power"
}
}
}
102 changes: 102 additions & 0 deletions Shared/Strings/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ internal enum L10n {
internal static let accessibility = L10n.tr("Localizable", "accessibility", fallback: "Accessibility")
/// Active Devices
internal static let activeDevices = L10n.tr("Localizable", "activeDevices", fallback: "Active Devices")
/// Add
internal static let add = L10n.tr("Localizable", "add", fallback: "Add")
/// Add Server
internal static let addServer = L10n.tr("Localizable", "addServer", fallback: "Add Server")
/// Add Task Trigger
internal static let addTaskTrigger = L10n.tr("Localizable", "addTaskTrigger", fallback: "Add Task Trigger")
/// Add URL
internal static let addURL = L10n.tr("Localizable", "addURL", fallback: "Add URL")
/// Administration
Expand Down Expand Up @@ -146,6 +150,8 @@ internal enum L10n {
internal static let category = L10n.tr("Localizable", "category", fallback: "Category")
/// Change Server
internal static let changeServer = L10n.tr("Localizable", "changeServer", fallback: "Change Server")
/// Changes not saved
internal static let changesNotSaved = L10n.tr("Localizable", "changesNotSaved", fallback: "Changes not saved")
/// Channels
internal static let channels = L10n.tr("Localizable", "channels", fallback: "Channels")
/// Chapters
Expand Down Expand Up @@ -222,20 +228,44 @@ internal enum L10n {
internal static let customize = L10n.tr("Localizable", "customize", fallback: "Customize")
/// Custom Profile
internal static let customProfile = L10n.tr("Localizable", "customProfile", fallback: "Custom Profile")
/// Daily
internal static let daily = L10n.tr("Localizable", "daily", fallback: "Daily")
/// Dark
internal static let dark = L10n.tr("Localizable", "dark", fallback: "Dark")
/// Dashboard
internal static let dashboard = L10n.tr("Localizable", "dashboard", fallback: "Dashboard")
/// Perform administrative tasks for your Jellyfin server.
internal static let dashboardDescription = L10n.tr("Localizable", "dashboardDescription", fallback: "Perform administrative tasks for your Jellyfin server.")
/// Day of Week
internal static let dayOfWeek = L10n.tr("Localizable", "dayOfWeek", fallback: "Day of Week")
/// Friday
internal static let dayOfWeekFriday = L10n.tr("Localizable", "dayOfWeekFriday", fallback: "Friday")
/// Monday
internal static let dayOfWeekMonday = L10n.tr("Localizable", "dayOfWeekMonday", fallback: "Monday")
/// Saturday
internal static let dayOfWeekSaturday = L10n.tr("Localizable", "dayOfWeekSaturday", fallback: "Saturday")
/// Sunday
internal static let dayOfWeekSunday = L10n.tr("Localizable", "dayOfWeekSunday", fallback: "Sunday")
/// Thursday
internal static let dayOfWeekThursday = L10n.tr("Localizable", "dayOfWeekThursday", fallback: "Thursday")
/// Tuesday
internal static let dayOfWeekTuesday = L10n.tr("Localizable", "dayOfWeekTuesday", fallback: "Tuesday")
/// Wednesday
internal static let dayOfWeekWednesday = L10n.tr("Localizable", "dayOfWeekWednesday", fallback: "Wednesday")
/// Default Scheme
internal static let defaultScheme = L10n.tr("Localizable", "defaultScheme", fallback: "Default Scheme")
/// Delete
internal static let delete = L10n.tr("Localizable", "delete", fallback: "Delete")
/// Delete Server
internal static let deleteServer = L10n.tr("Localizable", "deleteServer", fallback: "Delete Server")
/// Delete Trigger
internal static let deleteTrigger = L10n.tr("Localizable", "deleteTrigger", fallback: "Delete Trigger")
/// Are you sure you want to delete this trigger? This action cannot be undone.
internal static let deleteTriggerConfirmationMessage = L10n.tr("Localizable", "deleteTriggerConfirmationMessage", fallback: "Are you sure you want to delete this trigger? This action cannot be undone.")
/// Delivery
internal static let delivery = L10n.tr("Localizable", "delivery", fallback: "Delivery")
/// Details
internal static let details = L10n.tr("Localizable", "details", fallback: "Details")
/// Device
internal static let device = L10n.tr("Localizable", "device", fallback: "Device")
/// Device Profile
Expand All @@ -252,6 +282,8 @@ internal enum L10n {
internal static let directStream = L10n.tr("Localizable", "directStream", fallback: "Direct Stream")
/// Disabled
internal static let disabled = L10n.tr("Localizable", "disabled", fallback: "Disabled")
/// Discard Changes
internal static let discardChanges = L10n.tr("Localizable", "discardChanges", fallback: "Discard Changes")
/// Discovered Servers
internal static let discoveredServers = L10n.tr("Localizable", "discoveredServers", fallback: "Discovered Servers")
/// Dismiss
Expand Down Expand Up @@ -282,6 +314,16 @@ internal enum L10n {
internal static let episodes = L10n.tr("Localizable", "episodes", fallback: "Episodes")
/// Error
internal static let error = L10n.tr("Localizable", "error", fallback: "Error")
/// Error Details
internal static let errorDetails = L10n.tr("Localizable", "errorDetails", fallback: "Error Details")
/// Every
internal static let every = L10n.tr("Localizable", "every", fallback: "Every")
/// Every %1$@
internal static func everyInterval(_ p1: Any) -> String {
return L10n.tr("Localizable", "everyInterval", String(describing: p1), fallback: "Every %1$@")
}
/// Executed
internal static let executed = L10n.tr("Localizable", "executed", fallback: "Executed")
/// Existing Server
internal static let existingServer = L10n.tr("Localizable", "existingServer", fallback: "Existing Server")
/// Existing User
Expand Down Expand Up @@ -314,16 +356,36 @@ internal enum L10n {
internal static let hapticFeedback = L10n.tr("Localizable", "hapticFeedback", fallback: "Haptic Feedback")
/// Home
internal static let home = L10n.tr("Localizable", "home", fallback: "Home")
/// Hours
internal static let hours = L10n.tr("Localizable", "hours", fallback: "Hours")
/// Indicators
internal static let indicators = L10n.tr("Localizable", "indicators", fallback: "Indicators")
/// Information
internal static let information = L10n.tr("Localizable", "information", fallback: "Information")
/// Interlaced video is not supported
internal static let interlacedVideoNotSupported = L10n.tr("Localizable", "interlacedVideoNotSupported", fallback: "Interlaced video is not supported")
/// Interval
internal static let interval = L10n.tr("Localizable", "interval", fallback: "Interval")
/// %d hour
internal static func intervalHour(_ p1: Int) -> String {
return L10n.tr("Localizable", "intervalHour", p1, fallback: "%d hour")
}
/// %d hours
internal static func intervalHours(_ p1: Int) -> String {
return L10n.tr("Localizable", "intervalHours", p1, fallback: "%d hours")
}
/// %d minutes
internal static func intervalMinutes(_ p1: Int) -> String {
return L10n.tr("Localizable", "intervalMinutes", p1, fallback: "%d minutes")
}
/// Inverted Dark
internal static let invertedDark = L10n.tr("Localizable", "invertedDark", fallback: "Inverted Dark")
/// Inverted Light
internal static let invertedLight = L10n.tr("Localizable", "invertedLight", fallback: "Inverted Light")
/// %1$@ at %2$@
internal static func itemAtItem(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "itemAtItem", String(describing: p1), String(describing: p2), fallback: "%1$@ at %2$@")
}
/// %1$@ / %2$@
internal static func itemOverItem(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "itemOverItem", String(describing: p1), String(describing: p2), fallback: "%1$@ / %2$@")
Expand Down Expand Up @@ -390,6 +452,8 @@ internal enum L10n {
}
/// Logs
internal static let logs = L10n.tr("Localizable", "logs", fallback: "Logs")
/// Manual
internal static let manual = L10n.tr("Localizable", "manual", fallback: "Manual")
/// Maximum Bitrate
internal static let maximumBitrate = L10n.tr("Localizable", "maximumBitrate", fallback: "Maximum Bitrate")
/// This setting may result in media failing to start playback
Expand Down Expand Up @@ -454,6 +518,8 @@ internal enum L10n {
internal static let noResults = L10n.tr("Localizable", "noResults", fallback: "No results.")
/// Normal
internal static let normal = L10n.tr("Localizable", "normal", fallback: "Normal")
/// No runtime limit
internal static let noRuntimeLimit = L10n.tr("Localizable", "noRuntimeLimit", fallback: "No runtime limit")
/// No session
internal static let noSession = L10n.tr("Localizable", "noSession", fallback: "No session")
/// N/A
Expand All @@ -468,6 +534,8 @@ internal enum L10n {
internal static let offset = L10n.tr("Localizable", "offset", fallback: "Offset")
/// Ok
internal static let ok = L10n.tr("Localizable", "ok", fallback: "Ok")
/// On application startup
internal static let onApplicationStartup = L10n.tr("Localizable", "onApplicationStartup", fallback: "On application startup")
/// 1 user
internal static let oneUser = L10n.tr("Localizable", "oneUser", fallback: "1 user")
/// Online
Expand Down Expand Up @@ -636,6 +704,8 @@ internal enum L10n {
internal static let running = L10n.tr("Localizable", "running", fallback: "Running...")
/// Runtime
internal static let runtime = L10n.tr("Localizable", "runtime", fallback: "Runtime")
/// Save
internal static let save = L10n.tr("Localizable", "save", fallback: "Save")
/// Scan All Libraries
internal static let scanAllLibraries = L10n.tr("Localizable", "scanAllLibraries", fallback: "Scan All Libraries")
/// Scheduled Tasks
Expand Down Expand Up @@ -754,6 +824,8 @@ internal enum L10n {
internal static let specialFeatures = L10n.tr("Localizable", "specialFeatures", fallback: "Special Features")
/// Sports
internal static let sports = L10n.tr("Localizable", "sports", fallback: "Sports")
/// Status
internal static let status = L10n.tr("Localizable", "status", fallback: "Status")
/// Stop
internal static let stop = L10n.tr("Localizable", "stop", fallback: "Stop")
/// Streams
Expand Down Expand Up @@ -786,6 +858,8 @@ internal enum L10n {
internal static let system = L10n.tr("Localizable", "system", fallback: "System")
/// System Control Gestures Enabled
internal static let systemControlGesturesEnabled = L10n.tr("Localizable", "systemControlGesturesEnabled", fallback: "System Control Gestures Enabled")
/// System Event
internal static let systemEvent = L10n.tr("Localizable", "systemEvent", fallback: "System Event")
/// Tags
internal static let tags = L10n.tr("Localizable", "tags", fallback: "Tags")
/// Task
Expand All @@ -802,8 +876,28 @@ internal enum L10n {
internal static let tasks = L10n.tr("Localizable", "tasks", fallback: "Tasks")
/// Tasks are operations that are scheduled to run periodically or can be triggered manually.
internal static let tasksDescription = L10n.tr("Localizable", "tasksDescription", fallback: "Tasks are operations that are scheduled to run periodically or can be triggered manually.")
/// Cancelling
internal static let taskStateCancelling = L10n.tr("Localizable", "taskStateCancelling", fallback: "Cancelling")
/// Idle
internal static let taskStateIdle = L10n.tr("Localizable", "taskStateIdle", fallback: "Idle")
/// Running
internal static let taskStateRunning = L10n.tr("Localizable", "taskStateRunning", fallback: "Running")
/// Sets the maximum runtime (in hours) for this task trigger
internal static let taskTriggerTimeLimit = L10n.tr("Localizable", "taskTriggerTimeLimit", fallback: "Sets the maximum runtime (in hours) for this task trigger")
/// Test Size
internal static let testSize = L10n.tr("Localizable", "testSize", fallback: "Test Size")
/// Time
internal static let time = L10n.tr("Localizable", "time", fallback: "Time")
/// Time Limit
internal static let timeLimit = L10n.tr("Localizable", "timeLimit", fallback: "Time Limit")
/// Time limit: %1$@
internal static func timeLimitLabelWithHours(_ p1: Any) -> String {
return L10n.tr("Localizable", "timeLimitLabelWithHours", String(describing: p1), fallback: "Time limit: %1$@")
}
/// Time Limit (%@)
internal static func timeLimitWithUnit(_ p1: Any) -> String {
return L10n.tr("Localizable", "timeLimitWithUnit", String(describing: p1), fallback: "Time Limit (%@)")
}
/// Timestamp
internal static let timestamp = L10n.tr("Localizable", "timestamp", fallback: "Timestamp")
/// Timestamp Type
Expand All @@ -818,6 +912,10 @@ internal enum L10n {
internal static let transcodeReasons = L10n.tr("Localizable", "transcodeReasons", fallback: "Transcode Reason(s)")
/// Transition
internal static let transition = L10n.tr("Localizable", "transition", fallback: "Transition")
/// Triggers
internal static let triggers = L10n.tr("Localizable", "triggers", fallback: "Triggers")
/// Trigger Type
internal static let triggerType = L10n.tr("Localizable", "triggerType", fallback: "Trigger Type")
/// Try again
internal static let tryAgain = L10n.tr("Localizable", "tryAgain", fallback: "Try again")
/// TV Shows
Expand All @@ -842,6 +940,8 @@ internal enum L10n {
internal static let unknownVideoStreamInfo = L10n.tr("Localizable", "unknownVideoStreamInfo", fallback: "The video stream information is unknown")
/// Unplayed
internal static let unplayed = L10n.tr("Localizable", "unplayed", fallback: "Unplayed")
/// You have unsaved changes. Are you sure you want to discard them?
internal static let unsavedChangesMessage = L10n.tr("Localizable", "unsavedChangesMessage", fallback: "You have unsaved changes. Are you sure you want to discard them?")
/// URL
internal static let url = L10n.tr("Localizable", "url", fallback: "URL")
/// Use as Transcoding Profile
Expand Down Expand Up @@ -882,6 +982,8 @@ internal enum L10n {
internal static let videoRangeTypeNotSupported = L10n.tr("Localizable", "videoRangeTypeNotSupported", fallback: "The video range type is not supported")
/// The video resolution is not supported
internal static let videoResolutionNotSupported = L10n.tr("Localizable", "videoResolutionNotSupported", fallback: "The video resolution is not supported")
/// Weekly
internal static let weekly = L10n.tr("Localizable", "weekly", fallback: "Weekly")
/// Who's watching?
internal static let whosWatching = L10n.tr("Localizable", "WhosWatching", fallback: "Who's watching?")
/// WIP
Expand Down
Loading
Loading