Skip to content

Commit

Permalink
Merge pull request #260 from Planetable/improved-media-view-controls
Browse files Browse the repository at this point in the history
Improved media view controls
  • Loading branch information
livid authored Aug 15, 2023
2 parents abf8f9f + 2b93617 commit 663023a
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 2 deletions.
12 changes: 12 additions & 0 deletions Planet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
2A466FD12A809E2C009FB646 /* GIFIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A466FD02A809E2C009FB646 /* GIFIndicatorView.swift */; };
2A466FD22A809E2C009FB646 /* GIFIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A466FD02A809E2C009FB646 /* GIFIndicatorView.swift */; };
2A466FD42A809F65009FB646 /* ASMediaView in Frameworks */ = {isa = PBXBuildFile; productRef = 2A466FD32A809F65009FB646 /* ASMediaView */; };
2A4AE87A2A89EF3600A27B5B /* GroupIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A4AE8792A89EF3600A27B5B /* GroupIndicatorView.swift */; };
2A4AE87B2A89EF3600A27B5B /* GroupIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A4AE8792A89EF3600A27B5B /* GroupIndicatorView.swift */; };
2A4AE87D2A89F49B00A27B5B /* SharedAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2A4AE87C2A89F49B00A27B5B /* SharedAssets.xcassets */; };
2A4AE87E2A89F49B00A27B5B /* SharedAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2A4AE87C2A89F49B00A27B5B /* SharedAssets.xcassets */; };
2A6247AE292CC5F400714BFA /* IndicatorLabelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A6247AD292CC5F400714BFA /* IndicatorLabelView.swift */; };
2A68C6232A26F07A0079AD5F /* RebuildProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A18F2052A0F0FA700FC4050 /* RebuildProgressView.swift */; };
2A69F04727E1B53A00141DC0 /* FeedKit in Frameworks */ = {isa = PBXBuildFile; productRef = 2A69F04627E1B53A00141DC0 /* FeedKit */; };
Expand Down Expand Up @@ -447,6 +451,8 @@
2A441BAF27C4DD980008A694 /* CreatePlanetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreatePlanetView.swift; sourceTree = "<group>"; };
2A441BB227C4DF110008A694 /* FollowPlanetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FollowPlanetView.swift; sourceTree = "<group>"; };
2A466FD02A809E2C009FB646 /* GIFIndicatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GIFIndicatorView.swift; sourceTree = "<group>"; };
2A4AE8792A89EF3600A27B5B /* GroupIndicatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupIndicatorView.swift; sourceTree = "<group>"; };
2A4AE87C2A89F49B00A27B5B /* SharedAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = SharedAssets.xcassets; sourceTree = "<group>"; };
2A6247AD292CC5F400714BFA /* IndicatorLabelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndicatorLabelView.swift; sourceTree = "<group>"; };
2A6E16D52A18678E00704A08 /* AppSidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSidebarView.swift; sourceTree = "<group>"; };
2A6E16D72A18679A00704A08 /* AppContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -872,6 +878,7 @@
72114ABE784F27251FE3A0BD /* IPFS */,
721143FEE74F9B12F698E845 /* LegacyCoreData */,
6A1FD5022A75A64500391972 /* Avatars.xcassets */,
2A4AE87C2A89F49B00A27B5B /* SharedAssets.xcassets */,
);
path = Planet;
sourceTree = "<group>";
Expand Down Expand Up @@ -1186,6 +1193,7 @@
2AFFD51A28AD760400EDB020 /* HelpLinkButton.swift */,
2A052AC0290971E80028E88F /* ArtworkView.swift */,
2A466FD02A809E2C009FB646 /* GIFIndicatorView.swift */,
2A4AE8792A89EF3600A27B5B /* GroupIndicatorView.swift */,
);
path = Components;
sourceTree = "<group>";
Expand Down Expand Up @@ -1367,6 +1375,7 @@
2A95E6F02A19A777001288B8 /* Credits.html in Resources */,
6A34BE332A34B2A00031E5E4 /* Capsules-200.otf in Resources */,
2A95E6992A19A43D001288B8 /* ipfs-arm64-0.15.bin in Resources */,
2A4AE87E2A89F49B00A27B5B /* SharedAssets.xcassets in Resources */,
6A34BE3B2A34B2A00031E5E4 /* Capsules-300.otf in Resources */,
6A34BE3D2A34B2A00031E5E4 /* Capsules-700.otf in Resources */,
2A95E6982A19A43D001288B8 /* ipfs-amd64-0.15.bin in Resources */,
Expand Down Expand Up @@ -1395,6 +1404,7 @@
2AF1318927C7CE8A007792FE /* TemplatePlaceholder.html in Resources */,
6A34BE3A2A34B2A00031E5E4 /* Capsules-300.otf in Resources */,
6A34BE3C2A34B2A00031E5E4 /* Capsules-700.otf in Resources */,
2A4AE87D2A89F49B00A27B5B /* SharedAssets.xcassets in Resources */,
6A64D2DE284640A80013EABB /* Credits.html in Resources */,
6A34BE382A34B2A00031E5E4 /* Capsules-100.otf in Resources */,
72114AE8931655425CC6E5C1 /* ipfs-amd64-0.15.bin in Resources */,
Expand Down Expand Up @@ -1513,6 +1523,7 @@
2A95E6872A19A3CA001288B8 /* WriterTitleView.swift in Sources */,
2A95E65F2A19A3AA001288B8 /* TemplatePreviewView.swift in Sources */,
2A95E68E2A19A3D0001288B8 /* PlanetKeyManagerViewModel.swift in Sources */,
2A4AE87B2A89EF3600A27B5B /* GroupIndicatorView.swift in Sources */,
2A95E6DF2A19A521001288B8 /* Plausible.swift in Sources */,
2A95E6FD2A1B003D001288B8 /* MyPlanetEditView.swift in Sources */,
2A996AD62A1DA6C700BEF898 /* PlanetDownloadsViewModel.swift in Sources */,
Expand Down Expand Up @@ -1687,6 +1698,7 @@
2A7022F62897E00600022F13 /* PlanetDownloadsViewModel.swift in Sources */,
72114683927B9B11EFE02DD4 /* OnboardingView.swift in Sources */,
72114717FB02C931CE9E08E9 /* MyPlanetSidebarItem.swift in Sources */,
2A4AE87A2A89EF3600A27B5B /* GroupIndicatorView.swift in Sources */,
6AB6E4FB2915227600F17328 /* WalletManager.swift in Sources */,
2A7022F22897DF4600022F13 /* PlanetDownloadsWindow.swift in Sources */,
72114AFCB4EDB617C07192BB /* FollowingPlanetSidebarItem.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"location" : "https://github.com/airwolfspace/mediaview",
"state" : {
"branch" : "main",
"revision" : "5f3590128f613ab4b591f2ec475fbf2d596f0868"
"revision" : "596d5a0a6cfd0dbd0e28a8e12917ffc0d667d01d"
}
},
{
Expand Down
6 changes: 6 additions & 0 deletions Planet/SharedAssets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
12 changes: 12 additions & 0 deletions Planet/SharedAssets.xcassets/multi.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "multi.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions Planet/Views/Components/GroupIndicatorView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// GroupIndicatorView.swift
// Planet
//
// Created by Kai on 8/14/23.
//

import SwiftUI


struct GroupIndicatorView: View {
var body: some View {
VStack {
HStack {
Spacer()
Image("multi")
.renderingMode(.template)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 16)
.padding(1)
.foregroundColor(.white.opacity(0.85))
.background(Color.secondary.opacity(0.75))
.cornerRadius(4)
}
.padding(.trailing, 4)
.padding(.top, 4)
Spacer()
}
}
}
16 changes: 15 additions & 1 deletion PlanetLite/AppContentItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ struct AppContentItemView: View {
@State private var sharedLink: String?
@State private var thumbnail: NSImage?
@State private var thumbnailCachedPath: URL?
@State private var attachmentURLs: [URL]?

var body: some View {
itemPreviewImageView(forArticle: self.article)
.onTapGesture {
ASMediaManager.shared.activatePhotoView(withPhotos: getPhotos(fromArticle: article), title: article.title, andID: article.id)
if let attachmentURLs {
ASMediaManager.shared.activatePhotoView(withPhotos: attachmentURLs, title: article.title, andID: article.id)
} else {
let urls = self.getPhotos(fromArticle: self.article)
ASMediaManager.shared.activatePhotoView(withPhotos: urls, title: article.title, andID: article.id)
self.attachmentURLs = urls
}
}
.contextMenu {
AppContentItemMenuView(isShowingDeleteConfirmation: $isShowingDeleteConfirmation, isSharingLink: $isSharingLink, sharedLink: $sharedLink, article: article)
Expand Down Expand Up @@ -59,6 +66,10 @@ struct AppContentItemView: View {
.background(
SharingServicePicker(isPresented: $isSharingLink, sharingItems: [sharedLink ?? ""])
)
.task(id: article.id, priority: .utility) {
guard attachmentURLs == nil else { return }
attachmentURLs = getPhotos(fromArticle: article)
}
}

private func getPhotos(fromArticle article: MyArticleModel) -> [URL] {
Expand Down Expand Up @@ -142,6 +153,9 @@ struct AppContentItemView: View {
if isGIF {
GIFIndicatorView()
}
if let attachmentURLs, attachmentURLs.count > 1 {
GroupIndicatorView()
}
}
.contentShape(Rectangle())
.frame(width: size.width, height: size.height)
Expand Down

0 comments on commit 663023a

Please sign in to comment.