forked from jellyfin/Swiftfin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tvOS] Media Item Menu - Refresh / Delete Items (jellyfin#1348)
* Mirror tvOS to iOS * Fix router dismiss. Remove redundent viewModel.refresh from itemView * reset dev team info * View Modifier and ViewModel cleanup * Remove testing comments / events * Cleanup `.errorMessage($error)` * Cleanup all viewModel.states for item editing, add errorViews if the data fails to load, and add errorMessage on failed events. MARK sections: Var/Func always unless only Body and Var/Lets only if there are several of varying types / functions.
- Loading branch information
Showing
24 changed files
with
672 additions
and
237 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
Shared/Extensions/ViewExtensions/Modifiers/ErrorMessage.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// 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 SwiftUI | ||
|
||
struct ErrorMessageModifier: ViewModifier { | ||
|
||
@Binding | ||
var error: Error? | ||
|
||
let dismissActions: (() -> Void)? | ||
|
||
// MARK: - Body | ||
|
||
func body(content: Content) -> some View { | ||
content | ||
.alert( | ||
L10n.error.text, | ||
isPresented: .constant(error != nil), | ||
presenting: error | ||
) { _ in | ||
Button(L10n.dismiss, role: .cancel) { | ||
error = nil | ||
dismissActions?() | ||
} | ||
} message: { error in | ||
Text(error.localizedDescription) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.