-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0639a56
commit d4dee2c
Showing
7 changed files
with
214 additions
and
67 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// View+NavTransition.swift | ||
// Luce | ||
// | ||
// Created by samara on 30.01.2025. | ||
// | ||
|
||
import SwiftUI | ||
|
||
extension View { | ||
@ViewBuilder | ||
func compatNavigationTransition(id: String, ns: Namespace.ID) -> some View { | ||
if #available(iOS 18.0, *) { | ||
self.navigationTransition(.zoom(sourceID: id, in: ns)) | ||
} else { | ||
self | ||
} | ||
} | ||
|
||
@ViewBuilder | ||
func compatMatchedTransitionSource(id: String, ns: Namespace.ID) -> some View { | ||
if #available(iOS 18.0, *) { | ||
self.matchedTransitionSource(id: id, in: ns) | ||
} else { | ||
self | ||
} | ||
} | ||
} |
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
50 changes: 50 additions & 0 deletions
50
iOS/Views/Sources/SourceAppViews/News/NewsCardContainerView.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,50 @@ | ||
// | ||
// NewsCardContainerView.swift | ||
// feather | ||
// | ||
// Created by samara on 4.02.2025. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct NewsCardContainerView: View { | ||
@Binding var isSheetPresented: Bool | ||
var news: NewsData | ||
@Namespace private var namespace | ||
|
||
let uuid = UUID().uuidString | ||
|
||
var body: some View { | ||
Button(action: { | ||
isSheetPresented = true | ||
}) { | ||
NewsCardView(news: news) | ||
.fullScreenCover(isPresented: $isSheetPresented) { | ||
CardContextMenuView(news: news) | ||
.compatNavigationTransition(id: uuid, ns: namespace) | ||
} | ||
.compatMatchedTransitionSource(id: uuid, ns: namespace) | ||
.compactContentMenuPreview(news: news) | ||
} | ||
} | ||
} | ||
|
||
extension View { | ||
func compactContentMenuPreview(news: NewsData) -> some View { | ||
if #available(iOS 16.0, *) { | ||
return self.contextMenu { | ||
if (news.url != nil) { | ||
Button(action: { | ||
UIApplication.shared.open(news.url!) | ||
}) { | ||
Label("Open URL", systemImage: "arrow.up.right") | ||
} | ||
} | ||
} preview: { | ||
CardContextMenuView(news: news) | ||
} | ||
} else { | ||
return self | ||
} | ||
} | ||
} |
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