diff --git a/Vernissage.xcodeproj/project.pbxproj b/Vernissage.xcodeproj/project.pbxproj index 87dbaeb..76b205d 100644 --- a/Vernissage.xcodeproj/project.pbxproj +++ b/Vernissage.xcodeproj/project.pbxproj @@ -317,6 +317,7 @@ F8C937A929882CA90004D782 /* Vernissage-001.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Vernissage-001.xcdatamodel"; sourceTree = ""; }; F8CAE63D29B8902D001E0372 /* ClearButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClearButton.swift; sourceTree = ""; }; F8CAE63F29B8E6E1001E0372 /* UIApplication+Window.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+Window.swift"; sourceTree = ""; }; + F8CAE64129B8F1AF001E0372 /* Vernissage-005.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Vernissage-005.xcdatamodel"; sourceTree = ""; }; F8CC95CD2970761D00C9C2AC /* TintColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TintColor.swift; sourceTree = ""; }; F8CEEDF729ABADDD00DBED66 /* UIImage+Size.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Size.swift"; sourceTree = ""; }; F8CEEDF929ABAFD200DBED66 /* ImageFileTranseferable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageFileTranseferable.swift; sourceTree = ""; }; @@ -1105,7 +1106,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 56; + CURRENT_PROJECT_VERSION = 58; DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\""; DEVELOPMENT_TEAM = B2U9FEKYP8; ENABLE_PREVIEWS = YES; @@ -1142,7 +1143,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 56; + CURRENT_PROJECT_VERSION = 58; DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\""; DEVELOPMENT_TEAM = B2U9FEKYP8; ENABLE_PREVIEWS = YES; @@ -1271,13 +1272,14 @@ F88C2476295C37BB0006098B /* Vernissage.xcdatamodeld */ = { isa = XCVersionGroup; children = ( + F8CAE64129B8F1AF001E0372 /* Vernissage-005.xcdatamodel */, F8B05ACC29B48DD000857221 /* Vernissage-004.xcdatamodel */, F8B05AC929B488C600857221 /* Vernissage-003.xcdatamodel */, F89F0605299139F6003DC875 /* Vernissage-002.xcdatamodel */, F8C937A929882CA90004D782 /* Vernissage-001.xcdatamodel */, F88C2477295C37BB0006098B /* Vernissage.xcdatamodel */, ); - currentVersion = F8B05ACC29B48DD000857221 /* Vernissage-004.xcdatamodel */; + currentVersion = F8CAE64129B8F1AF001E0372 /* Vernissage-005.xcdatamodel */; path = Vernissage.xcdatamodeld; sourceTree = ""; versionGroupType = wrapper.xcdatamodel; diff --git a/Vernissage/CoreData/ApplicationSettings+CoreDataProperties.swift b/Vernissage/CoreData/ApplicationSettings+CoreDataProperties.swift index 19b5862..4fed573 100644 --- a/Vernissage/CoreData/ApplicationSettings+CoreDataProperties.swift +++ b/Vernissage/CoreData/ApplicationSettings+CoreDataProperties.swift @@ -26,6 +26,7 @@ extension ApplicationSettings { @NSManaged public var hapticNotificationEnabled: Bool @NSManaged public var showSensitive: Bool + @NSManaged public var showPhotoDescription: Bool } extension ApplicationSettings : Identifiable { diff --git a/Vernissage/CoreData/ApplicationSettingsHandler.swift b/Vernissage/CoreData/ApplicationSettingsHandler.swift index 60cb5f7..0fc0fcb 100644 --- a/Vernissage/CoreData/ApplicationSettingsHandler.swift +++ b/Vernissage/CoreData/ApplicationSettingsHandler.swift @@ -98,4 +98,10 @@ class ApplicationSettingsHandler { defaultSettings.showSensitive = value CoreDataHandler.shared.save() } + + func setShowPhotoDescription(value: Bool) { + let defaultSettings = self.getDefaultSettings() + defaultSettings.showPhotoDescription = value + CoreDataHandler.shared.save() + } } diff --git a/Vernissage/EnvironmentObjects/ApplicationState.swift b/Vernissage/EnvironmentObjects/ApplicationState.swift index de68703..2477ae0 100644 --- a/Vernissage/EnvironmentObjects/ApplicationState.swift +++ b/Vernissage/EnvironmentObjects/ApplicationState.swift @@ -73,6 +73,9 @@ public class ApplicationState: ObservableObject { /// Should sensitive photos without mask. @Published var showSensitive = false + /// Should photo description for visually impaired be displayed. + @Published var showPhotoDescription = false + public func changeApplicationState(accountModel: AccountModel, instance: Instance?, lastSeenStatusId: String?) { self.account = accountModel self.lastSeenStatusId = lastSeenStatusId diff --git a/Vernissage/Vernissage.xcdatamodeld/.xccurrentversion b/Vernissage/Vernissage.xcdatamodeld/.xccurrentversion index 6ab7daf..dc94c1e 100644 --- a/Vernissage/Vernissage.xcdatamodeld/.xccurrentversion +++ b/Vernissage/Vernissage.xcdatamodeld/.xccurrentversion @@ -3,6 +3,6 @@ _XCCurrentVersionName - Vernissage-004.xcdatamodel + Vernissage-005.xcdatamodel diff --git a/Vernissage/Vernissage.xcdatamodeld/Vernissage-005.xcdatamodel/contents b/Vernissage/Vernissage.xcdatamodeld/Vernissage-005.xcdatamodel/contents new file mode 100644 index 0000000..24308b0 --- /dev/null +++ b/Vernissage/Vernissage.xcdatamodeld/Vernissage-005.xcdatamodel/contents @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Vernissage/VernissageApp.swift b/Vernissage/VernissageApp.swift index a8e9db1..23b0b0e 100644 --- a/Vernissage/VernissageApp.swift +++ b/Vernissage/VernissageApp.swift @@ -146,6 +146,9 @@ struct VernissageApp: App { if let avatarShape = AvatarShape(rawValue: Int(defaultSettings.avatarShape)) { self.applicationState.avatarShape = avatarShape } + + self.applicationState.showSensitive = defaultSettings.showSensitive + self.applicationState.showPhotoDescription = defaultSettings.showPhotoDescription } private func setImagePipelines() { diff --git a/Vernissage/Views/SettingsView/Subviews/MediaSettingsView.swift b/Vernissage/Views/SettingsView/Subviews/MediaSettingsView.swift index 93f00d7..a6425d0 100644 --- a/Vernissage/Views/SettingsView/Subviews/MediaSettingsView.swift +++ b/Vernissage/Views/SettingsView/Subviews/MediaSettingsView.swift @@ -11,6 +11,7 @@ struct MediaSettingsView: View { @Environment(\.colorScheme) var colorScheme @State var showSensitive = true + @State var showPhotoDescription = true var body: some View { Section("Media settings") { @@ -20,10 +21,17 @@ struct MediaSettingsView: View { self.applicationState.showSensitive = newValue ApplicationSettingsHandler.shared.setShowSensitive(value: newValue) } + + Toggle("Show photo description", isOn: $showPhotoDescription) + .onChange(of: showPhotoDescription) { newValue in + self.applicationState.showPhotoDescription = newValue + ApplicationSettingsHandler.shared.setShowPhotoDescription(value: newValue) + } } .onAppear { let defaultSettings = ApplicationSettingsHandler.shared.getDefaultSettings() self.showSensitive = defaultSettings.showSensitive + self.showPhotoDescription = defaultSettings.showPhotoDescription } } } diff --git a/Vernissage/Views/StatusView/StatusView.swift b/Vernissage/Views/StatusView/StatusView.swift index 6376839..caf177b 100644 --- a/Vernissage/Views/StatusView/StatusView.swift +++ b/Vernissage/Views/StatusView/StatusView.swift @@ -31,6 +31,7 @@ struct StatusView: View { @State private var exifExposure: String? @State private var exifCreatedDate: String? @State private var exifLens: String? + @State private var description: String? @State var image: Image? @@ -61,7 +62,8 @@ struct StatusView: View { exifCamera: $exifCamera, exifExposure: $exifExposure, exifCreatedDate: $exifCreatedDate, - exifLens: $exifLens) + exifLens: $exifLens, + description: $description) .onTapGesture { withoutAnimation { if let attachment = self.statusViewModel?.mediaAttachments.first(where: { $0.id == self.selectedAttachmentId }), @@ -100,6 +102,10 @@ struct StatusView: View { LabelIcon(iconName: "camera.aperture", value: self.exifLens) LabelIcon(iconName: "timelapse", value: self.exifExposure) LabelIcon(iconName: "calendar", value: self.exifCreatedDate?.toDate(.isoDateTimeSec)?.formatted()) + + if self.applicationState.showPhotoDescription { + LabelIcon(iconName: "eye.trianglebadge.exclamationmark", value: self.description) + } } .padding(.bottom, 2) .foregroundColor(.lightGrayColor) diff --git a/Vernissage/Widgets/ImagesCarousel.swift b/Vernissage/Widgets/ImagesCarousel.swift index c73a33a..ede13f8 100644 --- a/Vernissage/Widgets/ImagesCarousel.swift +++ b/Vernissage/Widgets/ImagesCarousel.swift @@ -19,19 +19,22 @@ struct ImagesCarousel: View { @Binding public var exifExposure: String? @Binding public var exifCreatedDate: String? @Binding public var exifLens: String? + @Binding public var description: String? init(attachments: [AttachmentModel], selectedAttachmentId: Binding, exifCamera: Binding, exifExposure: Binding, exifCreatedDate: Binding, - exifLens: Binding + exifLens: Binding, + description: Binding ) { _selectedAttachmentId = selectedAttachmentId _exifCamera = exifCamera _exifExposure = exifExposure _exifCreatedDate = exifCreatedDate _exifLens = exifLens + _description = description self.attachments = attachments self.selected = String.empty() @@ -85,6 +88,7 @@ struct ImagesCarousel: View { self.exifExposure = attachment.exifExposure self.exifCreatedDate = attachment.exifCreatedDate self.exifLens = attachment.exifLens + self.description = attachment.description } }) .onAppear {