Skip to content

Commit

Permalink
Merge branch 'main' into remove-media-link
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuatbrown authored Oct 4, 2024
2 parents fc329cf + 1ac90b7 commit 503192c
Show file tree
Hide file tree
Showing 13 changed files with 244 additions and 270 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Release Notes
- Updated the media viewer that displays images, videos, and web pages inside of notes. [#1538](https://github.com/planetary-social/nos/issues/1538)
- Removed image and video link text from notes. Now only the images and videos will appear, without the link. [#1487](https://github.com/planetary-social/nos/issues/1487)
- Added new translations for the app so you can use it in Korean, Chinese Simplified, Swedish, and more! Thanks to alternative, 안마리 (everyscreennetwork), Andypsl8, Dženan (Dzenan), ObjectifMoon, ra5pvt1n, and everyone else who contributed translations on Crowdin!

Expand Down
28 changes: 10 additions & 18 deletions Nos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@
0373CE992C0910250027C856 /* XCTestCase+FileData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0373CE982C0910250027C856 /* XCTestCase+FileData.swift */; };
0376DF622C3DBAED00C80786 /* NostrIdentifierTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0376DF612C3DBAED00C80786 /* NostrIdentifierTests.swift */; };
0378409D2BB4A2B600E5E901 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 0378409C2BB4A2B600E5E901 /* PrivacyInfo.xcprivacy */; };
037975BB2C0E24D200ADDF37 /* CompactNoteViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 037975BA2C0E24D200ADDF37 /* CompactNoteViewTests.swift */; };
037975BD2C0E25E200ADDF37 /* FeatureFlags.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0350F12C2C0A7EF20024CC15 /* FeatureFlags.swift */; };
037975BE2C0E265E00ADDF37 /* LinkPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = C905B0762A619E99009B8A78 /* LinkPreview.swift */; };
037975BE2C0E265E00ADDF37 /* LPLinkViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C905B0762A619E99009B8A78 /* LPLinkViewRepresentable.swift */; };
037975C72C0E26FC00ADDF37 /* Font+Clarity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C987F85729BA981800B44E7A /* Font+Clarity.swift */; };
037975D12C0E341500ADDF37 /* MockFeatureFlags.swift in Sources */ = {isa = PBXBuildFile; fileRef = 037975D02C0E341500ADDF37 /* MockFeatureFlags.swift */; };
037975EA2C0E695A00ADDF37 /* MockFeatureFlags.swift in Sources */ = {isa = PBXBuildFile; fileRef = 037975D02C0E341500ADDF37 /* MockFeatureFlags.swift */; };
Expand Down Expand Up @@ -125,6 +124,7 @@
04368D312C99A78800DEAA2E /* NosRadioButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04368D302C99A78800DEAA2E /* NosRadioButton.swift */; };
04368D4B2C99CFC700DEAA2E /* ContentFlagView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04368D4A2C99CFC700DEAA2E /* ContentFlagView.swift */; };
045EDCF32CAAF47600B67964 /* FlagSuccessView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EDCF22CAAF47600B67964 /* FlagSuccessView.swift */; };
045EDD052CAC025700B67964 /* ScrollViewProxy+Animate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 045EDD042CAC025700B67964 /* ScrollViewProxy+Animate.swift */; };
0496D6312C975E6900D29375 /* FlagOptionPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0496D6302C975E6900D29375 /* FlagOptionPicker.swift */; };
2D06BB9D2AE249D70085F509 /* ThreadRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D06BB9C2AE249D70085F509 /* ThreadRootView.swift */; };
2D4010A22AD87DF300F93AD4 /* KnownFollowersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D4010A12AD87DF300F93AD4 /* KnownFollowersView.swift */; };
Expand Down Expand Up @@ -250,7 +250,7 @@
C90352BA2C1235CD000A5993 /* NosNavigationDestination.swift in Sources */ = {isa = PBXBuildFile; fileRef = C90352B92C1235CD000A5993 /* NosNavigationDestination.swift */; };
C90352BB2C1235CD000A5993 /* NosNavigationDestination.swift in Sources */ = {isa = PBXBuildFile; fileRef = C90352B92C1235CD000A5993 /* NosNavigationDestination.swift */; };
C905B0752A619367009B8A78 /* DequeModule in Frameworks */ = {isa = PBXBuildFile; productRef = C905B0742A619367009B8A78 /* DequeModule */; };
C905B0772A619E99009B8A78 /* LinkPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = C905B0762A619E99009B8A78 /* LinkPreview.swift */; };
C905B0772A619E99009B8A78 /* LPLinkViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C905B0762A619E99009B8A78 /* LPLinkViewRepresentable.swift */; };
C90862BE29E9804B00C35A71 /* NosPerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C90862BD29E9804B00C35A71 /* NosPerformanceTests.swift */; };
C90B16B82AFED96300CB4B85 /* URLExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C90B16B72AFED96300CB4B85 /* URLExtensionTests.swift */; };
C913DA0A2AEAF52B003BDD6D /* NoteWarningController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C913DA092AEAF52B003BDD6D /* NoteWarningController.swift */; };
Expand Down Expand Up @@ -643,7 +643,6 @@
0373CE982C0910250027C856 /* XCTestCase+FileData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCTestCase+FileData.swift"; sourceTree = "<group>"; };
0376DF612C3DBAED00C80786 /* NostrIdentifierTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NostrIdentifierTests.swift; sourceTree = "<group>"; };
0378409C2BB4A2B600E5E901 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
037975BA2C0E24D200ADDF37 /* CompactNoteViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompactNoteViewTests.swift; sourceTree = "<group>"; };
037975D02C0E341500ADDF37 /* MockFeatureFlags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockFeatureFlags.swift; sourceTree = "<group>"; };
038196F62CA36797002A94E3 /* elmo-animated.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = "elmo-animated.webp"; sourceTree = "<group>"; };
038196F82CA367C4002A94E3 /* ImageAnimatedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageAnimatedTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -676,6 +675,7 @@
04368D302C99A78800DEAA2E /* NosRadioButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NosRadioButton.swift; sourceTree = "<group>"; };
04368D4A2C99CFC700DEAA2E /* ContentFlagView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentFlagView.swift; sourceTree = "<group>"; };
045EDCF22CAAF47600B67964 /* FlagSuccessView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlagSuccessView.swift; sourceTree = "<group>"; };
045EDD042CAC025700B67964 /* ScrollViewProxy+Animate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ScrollViewProxy+Animate.swift"; sourceTree = "<group>"; };
0496D6302C975E6900D29375 /* FlagOptionPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlagOptionPicker.swift; sourceTree = "<group>"; };
2D06BB9C2AE249D70085F509 /* ThreadRootView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThreadRootView.swift; sourceTree = "<group>"; };
2D4010A12AD87DF300F93AD4 /* KnownFollowersView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KnownFollowersView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -780,7 +780,7 @@
A3B943D4299D514800A15A08 /* Follow+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Follow+CoreDataClass.swift"; sourceTree = "<group>"; };
C9032C2D2BAE31ED001F4EC6 /* ProfileFeedType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileFeedType.swift; sourceTree = "<group>"; };
C90352B92C1235CD000A5993 /* NosNavigationDestination.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NosNavigationDestination.swift; sourceTree = "<group>"; };
C905B0762A619E99009B8A78 /* LinkPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkPreview.swift; sourceTree = "<group>"; };
C905B0762A619E99009B8A78 /* LPLinkViewRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LPLinkViewRepresentable.swift; sourceTree = "<group>"; };
C90862BB29E9804B00C35A71 /* NosPerformanceTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NosPerformanceTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
C90862BD29E9804B00C35A71 /* NosPerformanceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NosPerformanceTests.swift; sourceTree = "<group>"; };
C90B16B72AFED96300CB4B85 /* URLExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLExtensionTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1192,7 +1192,6 @@
children = (
035729BB2BE416BD005FEE85 /* EventObservationTests.swift */,
038196F32CA36773002A94E3 /* Components */,
03618C8C2C826A6E00BCBC55 /* Note */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -1339,14 +1338,6 @@
path = Event;
sourceTree = "<group>";
};
03618C8C2C826A6E00BCBC55 /* Note */ = {
isa = PBXGroup;
children = (
037975BA2C0E24D200ADDF37 /* CompactNoteViewTests.swift */,
);
path = Note;
sourceTree = "<group>";
};
03618C8D2C826AB300BCBC55 /* CoreData */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1430,8 +1421,8 @@
03E181382C75467C00886CC6 /* GalleryView.swift */,
03E1812E2C753C9B00886CC6 /* ImageButton.swift */,
03C8B4952C6D065900A07CCD /* ImageViewer.swift */,
C905B0762A619E99009B8A78 /* LinkPreview.swift */,
03E181462C754BA300886CC6 /* LinkView.swift */,
C905B0762A619E99009B8A78 /* LPLinkViewRepresentable.swift */,
C92DF80729C25FA900400561 /* SquareImage.swift */,
038863DD2C6FF51500B09797 /* ZoomableContainer.swift */,
);
Expand Down Expand Up @@ -1863,6 +1854,7 @@
DC2E54C72A700F1400C2CAAB /* UIDevice+Simulator.swift */,
C92DF80429C25DE900400561 /* URL+Extensions.swift */,
C9C2B77B29E072E400548B4A /* WebSocket+Nos.swift */,
045EDD042CAC025700B67964 /* ScrollViewProxy+Animate.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -2531,6 +2523,7 @@
C9E37E152A1E8143003D4B0A /* ReportTarget.swift in Sources */,
C9DEBFD4298941000078B43A /* PersistenceController.swift in Sources */,
5B834F692A83FC7F000C1432 /* ProfileSocialStatsView.swift in Sources */,
045EDD052CAC025700B67964 /* ScrollViewProxy+Animate.swift in Sources */,
CD09A74629A50F750063464F /* SideMenuContent.swift in Sources */,
C9DFA971299BF8CD006929C1 /* NoteView.swift in Sources */,
037071272C90C5FA00BEAEC4 /* OpenGraphService.swift in Sources */,
Expand Down Expand Up @@ -2568,7 +2561,7 @@
508B2B612C9EF65300C14034 /* NSPersistentContainer+Nos.swift in Sources */,
5B79F6552BA123D4002DA9BE /* WizardSheetBadgeText.swift in Sources */,
C9DEC04D29894BED0078B43A /* Author+CoreDataClass.swift in Sources */,
C905B0772A619E99009B8A78 /* LinkPreview.swift in Sources */,
C905B0772A619E99009B8A78 /* LPLinkViewRepresentable.swift in Sources */,
C95D68A7299E6FF000429F86 /* KeyFixture.swift in Sources */,
0304D0B22C9B731F001D16C7 /* MockOpenGraphService.swift in Sources */,
C94437E629B0DB83004D8C86 /* NotificationsView.swift in Sources */,
Expand All @@ -2584,7 +2577,7 @@
C993148E2C5BD8FC00224BA6 /* NoteEditorController.swift in Sources */,
035729CB2BE41770005FEE85 /* ContentWarningController.swift in Sources */,
CD09A76229A5220E0063464F /* AppController.swift in Sources */,
037975BE2C0E265E00ADDF37 /* LinkPreview.swift in Sources */,
037975BE2C0E265E00ADDF37 /* LPLinkViewRepresentable.swift in Sources */,
031D0BB42C826F8400D95342 /* EventProcessorIntegrationTests+InlineMetadata.swift in Sources */,
C9A0DAF929C92F4500466635 /* UNSAPI.swift in Sources */,
03A3AA3B2C5028FF008FE153 /* PublicKeyTests.swift in Sources */,
Expand Down Expand Up @@ -2746,7 +2739,6 @@
C992B32B2B3613CC00704A9C /* SubscriptionCancellable.swift in Sources */,
C92E7F6E2C4EFF9B00B80638 /* WebSocketState.swift in Sources */,
C973AB5C2A323167002AED16 /* Follow+CoreDataProperties.swift in Sources */,
037975BB2C0E24D200ADDF37 /* CompactNoteViewTests.swift in Sources */,
0376DF622C3DBAED00C80786 /* NostrIdentifierTests.swift in Sources */,
659B27312BD9D6FE00BEA6CC /* VerifiableEvent.swift in Sources */,
C90352BB2C1235CD000A5993 /* NosNavigationDestination.swift in Sources */,
Expand Down
25 changes: 25 additions & 0 deletions Nos/Extensions/ScrollViewProxy+Animate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import SwiftUI

extension ScrollViewProxy {
/// Animates and scrolls to the bottom of the specified view using the provided namespace ID.
///
/// This function triggers two animations:
/// 1. A binding value (`isAnimating`) is set to `true` with an animation.
/// 2. The scroll view is then animated to scroll to the bottom of the view identified by the specified `id`.
///
/// - Parameters:
/// - viewID: The namespace ID of the view to scroll to.
/// - isAnimating: Controls when to animate.
func animateAndScrollTo(
_ viewID: Namespace.ID,
animating isAnimating: Binding<Bool>
) {
withAnimation(.easeInOut(duration: 0.5)) {
isAnimating.wrappedValue = true
}

withAnimation(.easeInOut(duration: 0.5)) {
scrollTo(viewID, anchor: .bottom)
}
}
}
4 changes: 0 additions & 4 deletions Nos/Service/FeatureFlags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import SwiftUI

/// Feature flags for enabling experimental or beta features.
enum FeatureFlag {
/// Whether the new media display should be enabled or not.
/// - Note: See [#1177](https://github.com/planetary-social/nos/issues/1177) for details on the new media display.
case newMediaDisplay
/// Whether the new moderation flow should be enabled or not.
/// - Note: See [#1489](https://github.com/planetary-social/nos/issues/1489) for details on the new moderation flow.
case newModerationFlow
Expand Down Expand Up @@ -36,7 +33,6 @@ protocol FeatureFlags {

/// Feature flags and their values.
private var featureFlags: [FeatureFlag: Bool] = [
.newMediaDisplay: false,
.newModerationFlow: false,
.deleteAccount: false
]
Expand Down
27 changes: 27 additions & 0 deletions Nos/Views/Components/Media/LPLinkViewRepresentable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import SwiftUI
import LinkPresentation

/// A view that displays an Open Graph Protocol preview of the given URL.
struct LPLinkViewRepresentable: UIViewRepresentable {

/// The URL of the content to display.
let url: URL

func makeUIView(context: Context) -> LPLinkView {
let linkView = LPLinkView(url: url)
linkView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
linkView.setContentCompressionResistancePriority(.defaultLow, for: .vertical)
linkView.sizeToFit()
return linkView
}

func updateUIView(_ uiView: LPLinkView, context: Context) {
let provider = LPMetadataProvider()
provider.startFetchingMetadata(for: url) { metadata, error in
guard let metadata = metadata, error == nil else { return }
DispatchQueue.main.async {
uiView.metadata = metadata
}
}
}
}
141 changes: 0 additions & 141 deletions Nos/Views/Components/Media/LinkPreview.swift

This file was deleted.

Loading

0 comments on commit 503192c

Please sign in to comment.