commit 4ddf647d5f63a21e04544ae8f1dfd392ef8d150e
parent f13267aeb2f60b29edcb8e2f96a1f5b8a338e970
Author: William Casarin <jb55@jb55.com>
Date: Thu, 25 Jan 2024 14:11:11 -0800
Revert "camera: add ability to preview media taken with camera"
This reverts commit c67741983e3f07f2386eaa388cb8a1475e8e0471.
Diffstat:
3 files changed, 12 insertions(+), 107 deletions(-)
diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj
@@ -425,14 +425,16 @@
B57B4C642B312BFA00A232C0 /* RelayAuthenticationDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = B57B4C632B312BFA00A232C0 /* RelayAuthenticationDetail.swift */; };
B57B4C662B312C3700A232C0 /* NostrAuth.swift in Sources */ = {isa = PBXBuildFile; fileRef = B57B4C652B312C3700A232C0 /* NostrAuth.swift */; };
B5B4D1432B37D47600844320 /* NdbExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B4D1422B37D47600844320 /* NdbExtensions.swift */; };
- BA0F0A6F2B36207E001641B2 /* CameraMediaView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA0F0A6E2B36207E001641B2 /* CameraMediaView.swift */; };
- BA10192F2B449556009C57DA /* CameraPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA10192E2B449556009C57DA /* CameraPreview.swift */; };
+ B5C60C202B530D5100C5ECA7 /* MuteItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C60C1F2B530D5100C5ECA7 /* MuteItem.swift */; };
+ B5C60C212B530D5600C5ECA7 /* MuteItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C60C1F2B530D5100C5ECA7 /* MuteItem.swift */; };
+ B5C60C232B532A8700C5ECA7 /* DamusDuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C60C222B532A8700C5ECA7 /* DamusDuration.swift */; };
BA37598A2ABCCDE40018D73B /* ImageResizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA3759892ABCCDE30018D73B /* ImageResizer.swift */; };
BA37598D2ABCCE500018D73B /* PhotoCaptureProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA37598B2ABCCE500018D73B /* PhotoCaptureProcessor.swift */; };
BA37598E2ABCCE500018D73B /* VideoCaptureProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA37598C2ABCCE500018D73B /* VideoCaptureProcessor.swift */; };
BA3759922ABCCEBA0018D73B /* CameraService+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA37598F2ABCCEBA0018D73B /* CameraService+Extensions.swift */; };
BA3759932ABCCEBA0018D73B /* CameraModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA3759902ABCCEBA0018D73B /* CameraModel.swift */; };
BA3759942ABCCEBA0018D73B /* CameraService.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA3759912ABCCEBA0018D73B /* CameraService.swift */; };
+ BA3759972ABCCF360018D73B /* CameraPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA3759962ABCCF360018D73B /* CameraPreview.swift */; };
BA4AB0AE2A63B9270070A32A /* AddEmojiView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA4AB0AD2A63B9270070A32A /* AddEmojiView.swift */; };
BA4AB0B02A63B94D0070A32A /* EmojiListItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA4AB0AF2A63B94D0070A32A /* EmojiListItemView.swift */; };
BA693074295D649800ADDB87 /* UserSettingsStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA693073295D649800ADDB87 /* UserSettingsStore.swift */; };
@@ -1319,14 +1321,15 @@
B57B4C632B312BFA00A232C0 /* RelayAuthenticationDetail.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RelayAuthenticationDetail.swift; sourceTree = "<group>"; };
B57B4C652B312C3700A232C0 /* NostrAuth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NostrAuth.swift; sourceTree = "<group>"; };
B5B4D1422B37D47600844320 /* NdbExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NdbExtensions.swift; sourceTree = "<group>"; usesTabs = 0; };
- BA0F0A6E2B36207E001641B2 /* CameraMediaView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraMediaView.swift; sourceTree = "<group>"; };
- BA10192E2B449556009C57DA /* CameraPreview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraPreview.swift; sourceTree = "<group>"; };
+ B5C60C1F2B530D5100C5ECA7 /* MuteItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MuteItem.swift; sourceTree = "<group>"; usesTabs = 0; };
+ B5C60C222B532A8700C5ECA7 /* DamusDuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DamusDuration.swift; sourceTree = "<group>"; usesTabs = 0; };
BA3759892ABCCDE30018D73B /* ImageResizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageResizer.swift; sourceTree = "<group>"; };
BA37598B2ABCCE500018D73B /* PhotoCaptureProcessor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoCaptureProcessor.swift; sourceTree = "<group>"; };
BA37598C2ABCCE500018D73B /* VideoCaptureProcessor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoCaptureProcessor.swift; sourceTree = "<group>"; };
BA37598F2ABCCEBA0018D73B /* CameraService+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CameraService+Extensions.swift"; sourceTree = "<group>"; };
BA3759902ABCCEBA0018D73B /* CameraModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraModel.swift; sourceTree = "<group>"; };
BA3759912ABCCEBA0018D73B /* CameraService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraService.swift; sourceTree = "<group>"; };
+ BA3759962ABCCF360018D73B /* CameraPreview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraPreview.swift; sourceTree = "<group>"; };
BA4AB0AD2A63B9270070A32A /* AddEmojiView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddEmojiView.swift; sourceTree = "<group>"; };
BA4AB0AF2A63B94D0070A32A /* EmojiListItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiListItemView.swift; sourceTree = "<group>"; };
BA693073295D649800ADDB87 /* UserSettingsStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSettingsStore.swift; sourceTree = "<group>"; };
@@ -2618,9 +2621,8 @@
BA3759952ABCCF360018D73B /* Camera */ = {
isa = PBXGroup;
children = (
+ BA3759962ABCCF360018D73B /* CameraPreview.swift */,
BAA578D42AED7F4000EA8BE3 /* CameraView.swift */,
- BA10192E2B449556009C57DA /* CameraPreview.swift */,
- BA0F0A6E2B36207E001641B2 /* CameraMediaView.swift */,
);
path = Camera;
sourceTree = "<group>";
@@ -2630,6 +2632,8 @@
children = (
D72A2D042AD9C1B5002AFF62 /* MockDamusState.swift */,
D72A2D062AD9C1FB002AFF62 /* MockProfiles.swift */,
+ BAA8C3262AEC570800696158 /* CameraView.swift */,
+ BA3759962ABCCF360018D73B /* CameraPreview.swift */,
);
path = Mocking;
sourceTree = "<group>";
@@ -3033,6 +3037,7 @@
D7EDED2E2B128E8A0018B19C /* CollectionExtension.swift in Sources */,
D74AAFD62B155F0C006CF0F4 /* WalletConnect+.swift in Sources */,
4C216F382871EDE300040376 /* DirectMessageModel.swift in Sources */,
+ BA3759972ABCCF360018D73B /* CameraPreview.swift in Sources */,
4C75EFA627FF87A20006080F /* Nostr.swift in Sources */,
4CA927672A290F8B0098A105 /* RelativeTime.swift in Sources */,
4CB883A62975F83C00DC99E7 /* LNUrlPayRequest.swift in Sources */,
@@ -3257,7 +3262,6 @@
4C1253562A76C8C60004F4B8 /* BroadcastNotify.swift in Sources */,
4C3BEFD42819DE8F00B3DE84 /* NostrKind.swift in Sources */,
4C32B9532A9AD44700DC3548 /* Verifier.swift in Sources */,
- BA10192F2B449556009C57DA /* CameraPreview.swift in Sources */,
4C3EA66028FF5E7700C48A62 /* node_id.c in Sources */,
4C687C212A5F7ED00092C550 /* DamusBackground.swift in Sources */,
4CA352A02A76AE80003BB08B /* Notify.swift in Sources */,
@@ -3329,7 +3333,6 @@
4C1A9A2529DDDF2600516EAC /* ZapSettingsView.swift in Sources */,
4C2CDDF7299D4A5E00879FD5 /* Debouncer.swift in Sources */,
3AAA95CC298E07E900F3D526 /* DeepLPlan.swift in Sources */,
- BA0F0A6F2B36207E001641B2 /* CameraMediaView.swift in Sources */,
4FE60CDD295E1C5E00105A1F /* Wallet.swift in Sources */,
3AA247FF297E3D900090C62D /* RepostsView.swift in Sources */,
3AE45AF6297BB2E700C1D842 /* LibreTranslateServer.swift in Sources */,
diff --git a/damus/Views/Camera/CameraMediaView.swift b/damus/Views/Camera/CameraMediaView.swift
@@ -1,89 +0,0 @@
-//
-// MediaViewer.swift
-// damus
-//
-// Created by Suhail Saqan on 12/22/23.
-//
-
-import SwiftUI
-import Kingfisher
-
-// MARK: - Camera Media Viewer
-struct CameraMediaView: View {
- let video_controller: VideoController
- let urls: [MediaUrl]
-
- @Environment(\.presentationMode) var presentationMode
-
- @State private var selectedIndex = 0
- @State var showMenu = true
-
- let settings: UserSettingsStore
-
- var tabViewIndicator: some View {
- HStack(spacing: 10) {
- ForEach(urls.indices, id: \.self) { index in
- Capsule()
- .fill(index == selectedIndex ? Color(UIColor.label) : Color.secondary)
- .frame(width: 7, height: 7)
- .onTapGesture {
- selectedIndex = index
- }
- }
- }
- .padding()
- .background(.regularMaterial)
- .clipShape(Capsule())
- }
-
- var body: some View {
- ZStack {
- Color(.systemBackground)
- .ignoresSafeArea()
-
- TabView(selection: $selectedIndex) {
- ForEach(urls.indices, id: \.self) { index in
- ZoomableScrollView {
- ImageContainerView(video_controller: video_controller, url: urls[index], settings: settings)
- .aspectRatio(contentMode: .fit)
- .padding(.top, Theme.safeAreaInsets?.top)
- .padding(.bottom, Theme.safeAreaInsets?.bottom)
- }
- .ignoresSafeArea()
- .tag(index)
- }
- }
- .ignoresSafeArea()
- .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
- .gesture(TapGesture(count: 2).onEnded {
- // Prevents menu from hiding on double tap
- })
- .gesture(TapGesture(count: 1).onEnded {
- showMenu.toggle()
- })
- .overlay(
- GeometryReader { geo in
- VStack {
- if showMenu {
- NavDismissBarView()
- Spacer()
-
- if (urls.count > 1) {
- tabViewIndicator
- }
- }
- }
- .animation(.easeInOut, value: showMenu)
- .padding(.bottom, geo.safeAreaInsets.bottom == 0 ? 12 : 0)
- }
- )
- }
- }
-}
-
-struct CameraMediaView_Previews: PreviewProvider {
- static var previews: some View {
- let url: MediaUrl = .image(URL(string: "https://jb55.com/red-me.jpg")!)
- CameraMediaView(video_controller: test_damus_state.video, urls: [url], settings: test_damus_state.settings)
- }
-}
diff --git a/damus/Views/Camera/CameraView.swift b/damus/Views/Camera/CameraView.swift
@@ -174,16 +174,7 @@ struct CameraView: View {
HStack(alignment: .center) {
if !model.mediaItems.isEmpty {
- NavigationLink(destination: CameraMediaView(video_controller: damus_state.video, urls: model.mediaItems.map { mediaItem in
- switch mediaItem.type {
- case .image:
- return .image(mediaItem.url)
- case .video:
- return .video(mediaItem.url)
- }
- }, settings: damus_state.settings)
- .navigationBarBackButtonHidden(true)
- ) {
+ NavigationLink(destination: Text(model.mediaItems.map { $0.url.absoluteString }.joined(separator: ", "))) {
capturedPhotoThumbnail
}
.frame(width: 100, alignment: .leading)