diff --git a/.DS_Store b/.DS_Store index 4e50445..e733060 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Tanuki's Stash.xcodeproj/project.pbxproj b/Tanuki's Stash.xcodeproj/project.pbxproj index b10221f..ff1ea73 100644 --- a/Tanuki's Stash.xcodeproj/project.pbxproj +++ b/Tanuki's Stash.xcodeproj/project.pbxproj @@ -11,9 +11,6 @@ 0202880D2783C74500341901 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0202880C2783C74500341901 /* ContentView.swift */; }; 0202880F2783C74B00341901 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0202880E2783C74B00341901 /* Assets.xcassets */; }; 020288122783C74B00341901 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 020288112783C74B00341901 /* Preview Assets.xcassets */; }; - 0202881C2783C74B00341901 /* Tanuki_s_StashTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0202881B2783C74B00341901 /* Tanuki_s_StashTests.swift */; }; - 020288262783C74B00341901 /* Tanuki_s_StashUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020288252783C74B00341901 /* Tanuki_s_StashUITests.swift */; }; - 020288282783C74B00341901 /* Tanuki_s_StashUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020288272783C74B00341901 /* Tanuki_s_StashUITestsLaunchTests.swift */; }; 020288352783E96600341901 /* PostModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020288342783E96600341901 /* PostModel.swift */; }; 026C76DE27D6CC3D00BBE65A /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 026C76DD27D6CC3D00BBE65A /* SearchView.swift */; }; 027E2B302784CF9700FCEDB2 /* PostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 027E2B2F2784CF9700FCEDB2 /* PostView.swift */; }; @@ -25,6 +22,7 @@ 027E2B492789487000FCEDB2 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 027E2B482789486F00FCEDB2 /* SettingsView.swift */; }; 02D21B1E288279C800239990 /* TagModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02D21B1D288279C800239990 /* TagModel.swift */; }; 02D21B2028827AA700239990 /* TagManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02D21B1F28827AA700239990 /* TagManager.swift */; }; + 50914FA92C26652000E52BD0 /* AttributedText in Frameworks */ = {isa = PBXBuildFile; productRef = 50914FA82C26652000E52BD0 /* AttributedText */; }; 50C1182B2B648B18003F5D4E /* AlertToast in Frameworks */ = {isa = PBXBuildFile; productRef = 50C1182A2B648B18003F5D4E /* AlertToast */; }; /* End PBXBuildFile section */ @@ -52,13 +50,10 @@ 0202880E2783C74B00341901 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 020288112783C74B00341901 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 020288172783C74B00341901 /* Tanuki's StashTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tanuki's StashTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 0202881B2783C74B00341901 /* Tanuki_s_StashTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tanuki_s_StashTests.swift; sourceTree = ""; }; 020288212783C74B00341901 /* Tanuki's StashUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tanuki's StashUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 020288252783C74B00341901 /* Tanuki_s_StashUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tanuki_s_StashUITests.swift; sourceTree = ""; }; - 020288272783C74B00341901 /* Tanuki_s_StashUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tanuki_s_StashUITestsLaunchTests.swift; sourceTree = ""; }; 020288342783E96600341901 /* PostModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostModel.swift; sourceTree = ""; }; 026C76DD27D6CC3D00BBE65A /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = ""; }; - 027E2B2F2784CF9700FCEDB2 /* PostView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostView.swift; sourceTree = ""; }; + 027E2B2F2784CF9700FCEDB2 /* PostView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostView.swift; sourceTree = ""; usesTabs = 0; }; 027E2B312784DDFD00FCEDB2 /* Tanuki's Stash.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Tanuki's Stash.entitlements"; sourceTree = ""; }; 027E2B332784DFA200FCEDB2 /* libswift_Concurrency.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libswift_Concurrency.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/lib/swift/libswift_Concurrency.tbd; sourceTree = DEVELOPER_DIR; }; 027E2B482789486F00FCEDB2 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; @@ -77,6 +72,7 @@ 50C1182B2B648B18003F5D4E /* AlertToast in Frameworks */, 027E2B3A2784E7DC00FCEDB2 /* ImageViewerRemote in Frameworks */, 027E2B4527850E2E00FCEDB2 /* VideoPlayer in Frameworks */, + 50914FA92C26652000E52BD0 /* AttributedText in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -101,8 +97,6 @@ isa = PBXGroup; children = ( 020288092783C74500341901 /* Tanuki's Stash */, - 0202881A2783C74B00341901 /* Tanuki's StashTests */, - 020288242783C74B00341901 /* Tanuki's StashUITests */, 020288082783C74500341901 /* Products */, 027E2B322784DFA100FCEDB2 /* Frameworks */, ); @@ -144,23 +138,6 @@ path = "Preview Content"; sourceTree = ""; }; - 0202881A2783C74B00341901 /* Tanuki's StashTests */ = { - isa = PBXGroup; - children = ( - 0202881B2783C74B00341901 /* Tanuki_s_StashTests.swift */, - ); - path = "Tanuki's StashTests"; - sourceTree = ""; - }; - 020288242783C74B00341901 /* Tanuki's StashUITests */ = { - isa = PBXGroup; - children = ( - 020288252783C74B00341901 /* Tanuki_s_StashUITests.swift */, - 020288272783C74B00341901 /* Tanuki_s_StashUITestsLaunchTests.swift */, - ); - path = "Tanuki's StashUITests"; - sourceTree = ""; - }; 027E2B322784DFA100FCEDB2 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -191,6 +168,7 @@ 027E2B412785004600FCEDB2 /* SwiftUIGIF */, 027E2B4427850E2E00FCEDB2 /* VideoPlayer */, 50C1182A2B648B18003F5D4E /* AlertToast */, + 50914FA82C26652000E52BD0 /* AttributedText */, ); productName = "Tanuki's Stash"; productReference = 020288072783C74500341901 /* Tanuki's Stash.app */; @@ -269,6 +247,7 @@ 027E2B402785004600FCEDB2 /* XCRemoteSwiftPackageReference "swiftui-gif" */, 027E2B4327850E2E00FCEDB2 /* XCRemoteSwiftPackageReference "VideoPlayer" */, 50C118292B648B18003F5D4E /* XCRemoteSwiftPackageReference "AlertToast" */, + 50914FA72C26652000E52BD0 /* XCRemoteSwiftPackageReference "AttributedText" */, ); productRefGroup = 020288082783C74500341901 /* Products */; projectDirPath = ""; @@ -327,7 +306,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 0202881C2783C74B00341901 /* Tanuki_s_StashTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -335,8 +313,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 020288282783C74B00341901 /* Tanuki_s_StashUITestsLaunchTests.swift in Sources */, - 020288262783C74B00341901 /* Tanuki_s_StashUITests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -502,10 +478,11 @@ MARKETING_VERSION = 0.0.3; PRODUCT_BUNDLE_IDENTIFIER = dev.jemsoftware.tanukistash; PRODUCT_NAME = "$(TARGET_NAME)"; - SUPPORTS_MACCATALYST = YES; + SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,3"; }; name = Debug; }; @@ -539,10 +516,11 @@ MARKETING_VERSION = 0.0.3; PRODUCT_BUNDLE_IDENTIFIER = dev.jemsoftware.tanukistash; PRODUCT_NAME = "$(TARGET_NAME)"; - SUPPORTS_MACCATALYST = YES; + SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,3"; }; name = Release; }; @@ -688,6 +666,14 @@ minimumVersion = 1.0.0; }; }; + 50914FA72C26652000E52BD0 /* XCRemoteSwiftPackageReference "AttributedText" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/Iaenhaall/AttributedText.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 1.2.0; + }; + }; 50C118292B648B18003F5D4E /* XCRemoteSwiftPackageReference "AlertToast" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/elai950/AlertToast.git"; @@ -719,6 +705,11 @@ package = 027E2B4327850E2E00FCEDB2 /* XCRemoteSwiftPackageReference "VideoPlayer" */; productName = VideoPlayer; }; + 50914FA82C26652000E52BD0 /* AttributedText */ = { + isa = XCSwiftPackageProductDependency; + package = 50914FA72C26652000E52BD0 /* XCRemoteSwiftPackageReference "AttributedText" */; + productName = AttributedText; + }; 50C1182A2B648B18003F5D4E /* AlertToast */ = { isa = XCSwiftPackageProductDependency; package = 50C118292B648B18003F5D4E /* XCRemoteSwiftPackageReference "AlertToast" */; diff --git a/Tanuki's Stash.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Tanuki's Stash.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index ab749c3..14f84bc 100644 --- a/Tanuki's Stash.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Tanuki's Stash.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,4 +1,5 @@ { + "originHash" : "64da82aab5469082e974a1623007b601877abe93212dead659a8e94170f85930", "pins" : [ { "identity" : "alerttoast", @@ -9,6 +10,15 @@ "version" : "1.3.9" } }, + { + "identity" : "attributedtext", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Iaenhaall/AttributedText.git", + "state" : { + "revision" : "26a8be0285d664449e352d0e9b1b4a79ee9cecba", + "version" : "1.2.0" + } + }, { "identity" : "gsplayer", "kind" : "remoteSourceControl", @@ -55,5 +65,5 @@ } } ], - "version" : 2 + "version" : 3 } diff --git a/Tanuki's Stash.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate b/Tanuki's Stash.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate index 280e445..00f15fb 100644 Binary files a/Tanuki's Stash.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate and b/Tanuki's Stash.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Tanuki's Stash.xcodeproj/xcuserdata/max.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Tanuki's Stash.xcodeproj/xcuserdata/max.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..c7774c3 --- /dev/null +++ b/Tanuki's Stash.xcodeproj/xcuserdata/max.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,40 @@ + + + + + + + + + + + + + diff --git a/Tanuki's Stash/.DS_Store b/Tanuki's Stash/.DS_Store new file mode 100644 index 0000000..ff42409 Binary files /dev/null and b/Tanuki's Stash/.DS_Store differ diff --git a/Tanuki's Stash/PostView.swift b/Tanuki's Stash/PostView.swift index a235457..a8c224f 100644 --- a/Tanuki's Stash/PostView.swift +++ b/Tanuki's Stash/PostView.swift @@ -2,7 +2,7 @@ // PostView.swift // Tanuki's Stash // -// Created by Jay Poffinbarger on 1/4/22. +// Created by Jemma Poffinbarger on 1/4/22. // import SwiftUI @@ -11,6 +11,7 @@ import SwiftUIGIF import AVKit import Photos import AlertToast +import AttributedText struct PostView: View { @State var showImageViewer: Bool = false; @@ -18,11 +19,40 @@ struct PostView: View { @State var post: PostContent; @State var search: String; @State var url: String = ""; + @State private var parentPost: PostContent?; var body: some View { ScrollView(.vertical) { VStack { ImageView(post: post); + HStack { + if((post.relationships.parent_id) != nil) { + NavigationLink(destination: PostView(post: parentPost ?? post, search: search)) { + Text("Parent") + .foregroundColor(Color.red) + .font(.headline) + } + .task { + await fetchRecentPosts(postID: post.relationships.parent_id!); + } + Spacer() + } + if(post.relationships.has_active_children) { + NavigationLink(destination: SearchView(search: "parent:" + String(post.id))) { + Text("Children") + .foregroundColor(Color.red) + .font(.headline) + } + } + if(post.pools.count > 0) { + Spacer() + NavigationLink(destination: SearchView(search: "pool:" + String(post.pools[0]))) { + Text("Pool") + .foregroundColor(Color.green) + .font(.headline) + } + } + } Spacer(); VStack { HStack { @@ -38,116 +68,16 @@ struct PostView: View { .background(Color.gray) .cornerRadius(10) - Text(.init(post.description)) + + VStack(alignment: .leading) { + AttributedText(descParser(text: .init(post.description))) + .frame(maxWidth: .infinity, alignment: .leading) + } Spacer() HStack { - VStack(alignment:.leading) { - Text("Artist") - .font(.title3) - .fontWeight(.heavy) - .padding(EdgeInsets(top: 0, leading: 0, bottom: -3, trailing: 0)) - - ForEach(post.tags.artist, id: \.self) { tag in - Menu() { - NavigationLink(destination: SearchView(search: String(tag))) { - Text("New Search") - } - NavigationLink(destination: SearchView(search: String(search + " " + tag))) { - Text("Add to Current Search") - } - } label: { - Text(tag) - .font(.body) - .foregroundColor(Color.yellow) - } - .padding(EdgeInsets(top: -5, leading: 0, bottom: -2, trailing: 0)) - } - - Text("Character") - .font(.title3) - .fontWeight(.heavy) - .padding(EdgeInsets(top: 0, leading: 0, bottom: -3, trailing: 0)) - - ForEach(post.tags.character, id: \.self) { tag in - Menu() { - NavigationLink(destination: SearchView(search: String(tag))) { - Text("New Search") - } - NavigationLink(destination: SearchView(search: String(search + " " + tag))) { - Text("Add to Current Search") - } - } label: { - Text(tag) - .font(.body) - .foregroundColor(Color.green) - } - .padding(EdgeInsets(top: -5, leading: 0, bottom: -2, trailing: 0)) - } - - Text("Copyright") - .font(.title3) - .fontWeight(.heavy) - .padding(EdgeInsets(top: 0, leading: 0, bottom: -3, trailing: 0)) - - ForEach(post.tags.copyright, id: \.self) { tag in - Menu() { - NavigationLink(destination: SearchView(search: String(tag))) { - Text("New Search") - } - NavigationLink(destination: SearchView(search: String(search + " " + tag))) { - Text("Add to Current Search") - } - } label: { - Text(tag) - .font(.body) - .foregroundColor(Color.purple) - } - .padding(EdgeInsets(top: -5, leading: 0, bottom: -2, trailing: 0)) - } - - Text("Species") - .font(.title3) - .fontWeight(.heavy) - .padding(EdgeInsets(top: 0, leading: 0, bottom: -3, trailing: 0)) - - ForEach(post.tags.species, id: \.self) { tag in - Menu() { - NavigationLink(destination: SearchView(search: String(tag))) { - Text("New Search") - } - NavigationLink(destination: SearchView(search: String(search + " " + tag))) { - Text("Add to Current Search") - } - } label: { - Text(tag) - .font(.body) - .foregroundColor(Color.red) - } - .padding(EdgeInsets(top: -5, leading: 0, bottom: -2, trailing: 0)) - } - - Text("General") - .font(.title3) - .fontWeight(.heavy) - .padding(EdgeInsets(top: 0, leading: 0, bottom: -3, trailing: 0)) - - ForEach(post.tags.general, id: \.self) { tag in - Menu() { - NavigationLink(destination: SearchView(search: String(tag))) { - Text("New Search") - } - NavigationLink(destination: SearchView(search: String(search + " " + tag))) { - Text("Add to Current Search") - } - } label: { - Text(tag) - .font(.body) - } - .padding(EdgeInsets(top: -5, leading: 0, bottom: -2, trailing: 0)) - } - } + postTags(post: post, search: search) Spacer() VStack(alignment:.trailing) { Text("Post Details") @@ -167,17 +97,6 @@ struct PostView: View { Text(String(post.relationships.parent_id!)) .font(.footnote) } - - if(post.relationships.has_active_children) { - Text("Children") - .font(.headline) - .fontWeight(.heavy) - ForEach(post.relationships.children, id: \.self) { child in - Text(String(child)) - .font(.footnote) - } - } - Text("Sources") .font(.headline) .fontWeight(.heavy) @@ -196,8 +115,131 @@ struct PostView: View { .navigationBarTitle("Post", displayMode: .inline) .overlay(ImageViewerRemote(imageURL: self.$url, viewerShown: self.$showImageViewer)) } + func fetchRecentPosts(postID: Int) async { + do { + let userAgent = "Tanukis%20Stash/1.0%20(by%20JayDaBirb%20on%20e621)" + let url = URL(string: "https://\(source)/posts/\(postID).json?_client=\(userAgent)")! + let (data, _) = try await URLSession.shared.data(from: url) + let parsedData = try JSONDecoder().decode(Post.self, from: data) + parentPost = parsedData.post; + } catch { + print(error); + } + } } +struct postTags: View { + @State var post: PostContent; + @State var search: String; + + var body: some View { + VStack(alignment:.leading) { + Text("Artist") + .font(.title3) + .fontWeight(.heavy) + .padding(EdgeInsets(top: 0, leading: 0, bottom: -3, trailing: 0)) + + ForEach(post.tags.artist, id: \.self) { tag in + Menu() { + NavigationLink(destination: SearchView(search: String(tag))) { + Text("New Search") + } + NavigationLink(destination: SearchView(search: String(search + " " + tag))) { + Text("Add to Current Search") + } + } label: { + Text(tag) + .font(.body) + .foregroundColor(Color.yellow) + } + .padding(EdgeInsets(top: -5, leading: 0, bottom: -2, trailing: 0)) + } + + Text("Character") + .font(.title3) + .fontWeight(.heavy) + .padding(EdgeInsets(top: 0, leading: 0, bottom: -3, trailing: 0)) + + ForEach(post.tags.character, id: \.self) { tag in + Menu() { + NavigationLink(destination: SearchView(search: String(tag))) { + Text("New Search") + } + NavigationLink(destination: SearchView(search: String(search + " " + tag))) { + Text("Add to Current Search") + } + } label: { + Text(tag) + .font(.body) + .foregroundColor(Color.green) + } + .padding(EdgeInsets(top: -5, leading: 0, bottom: -2, trailing: 0)) + } + + Text("Copyright") + .font(.title3) + .fontWeight(.heavy) + .padding(EdgeInsets(top: 0, leading: 0, bottom: -3, trailing: 0)) + + ForEach(post.tags.copyright, id: \.self) { tag in + Menu() { + NavigationLink(destination: SearchView(search: String(tag))) { + Text("New Search") + } + NavigationLink(destination: SearchView(search: String(search + " " + tag))) { + Text("Add to Current Search") + } + } label: { + Text(tag) + .font(.body) + .foregroundColor(Color.purple) + } + .padding(EdgeInsets(top: -5, leading: 0, bottom: -2, trailing: 0)) + } + + Text("Species") + .font(.title3) + .fontWeight(.heavy) + .padding(EdgeInsets(top: 0, leading: 0, bottom: -3, trailing: 0)) + + ForEach(post.tags.species, id: \.self) { tag in + Menu() { + NavigationLink(destination: SearchView(search: String(tag))) { + Text("New Search") + } + NavigationLink(destination: SearchView(search: String(search + " " + tag))) { + Text("Add to Current Search") + } + } label: { + Text(tag) + .font(.body) + .foregroundColor(Color.red) + } + .padding(EdgeInsets(top: -5, leading: 0, bottom: -2, trailing: 0)) + } + + Text("General") + .font(.title3) + .fontWeight(.heavy) + .padding(EdgeInsets(top: 0, leading: 0, bottom: -3, trailing: 0)) + + ForEach(post.tags.general, id: \.self) { tag in + Menu() { + NavigationLink(destination: SearchView(search: String(tag))) { + Text("New Search") + } + NavigationLink(destination: SearchView(search: String(search + " " + tag))) { + Text("Add to Current Search") + } + } label: { + Text(tag) + .font(.body) + } + .padding(EdgeInsets(top: -5, leading: 0, bottom: -2, trailing: 0)) + } + } + } +} struct ImageView: View { @@ -378,3 +420,13 @@ struct ImageView: View { } } + +func descParser(text: String)-> String { + var newText = text.replacingOccurrences(of: "[b]", with: ""); + newText = newText.replacingOccurrences(of: "[/b]", with: ""); + newText = newText.replacingOccurrences(of: "[u]", with: ""); + newText = newText.replacingOccurrences(of: "[/u]", with: ""); + newText = newText.replacingOccurrences(of: "[quote]", with: "\""); + newText = newText.replacingOccurrences(of: "[/quote]", with: "\""); + return newText; +} diff --git a/Tanuki's Stash/SearchView.swift b/Tanuki's Stash/SearchView.swift index 660130b..36bafb6 100644 --- a/Tanuki's Stash/SearchView.swift +++ b/Tanuki's Stash/SearchView.swift @@ -71,7 +71,7 @@ struct SearchView: View { ZStack { Text("Deleted") .frame(minWidth: 0, maxWidth: .infinity) - .frame(width: .infinity, height: 150) + .frame(height: 150) .background(Color.gray.opacity(0.90)) VStack() { Spacer() @@ -107,13 +107,13 @@ struct SearchView: View { } } .navigationBarTitle("Posts", displayMode: .inline) - .navigationBarItems(leading: Button(action: { + .navigationBarItems(trailing: Button(action: { }) { NavigationLink(destination: SearchView(search: String("fav:\(defaults.string(forKey: "username") ?? "default")"))) { Image(systemName: "heart").imageScale(.large) } }) - .navigationBarItems(trailing: Button(action: { + .navigationBarItems(leading: Button(action: { self.showSettings = true }) { Image(systemName: "person.crop.circle").imageScale(.large) @@ -122,14 +122,15 @@ struct SearchView: View { SettingsView() }) .searchable(text: $search, placement: .navigationBarDrawer(displayMode: .always), prompt: "Search for tags") { - - ForEach(searchSuggestions, id: \.self) { tag in - Button(action: { - updateSearch(tag); - }) { - Text(tag); + //List { + ForEach(searchSuggestions, id: \.self) { tag in + Button(action: { + updateSearch(tag); + }) { + Text(tag); + } } - } + //} } .onChange(of: search) { newQuery in Task.init { if(search.count >= 3) { @@ -190,7 +191,7 @@ struct SearchView: View { func fetchRecentPosts(_ page: Int, _ limit: Int, _ tags: String) async { do { let encoded = tags.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) - let userAgent = "Tanukis%20Stash/1.0%20(by%20JayDaBirb%20on%20e621)" + let userAgent = "Tanukis%20Stash/1.0%20(by%20JemTanuki%20on%20e621)" let url = URL(string: "https://\(source)/posts.json?tags=\(encoded ?? "")&limit=\(limit)&page=\(page)&_client=\(userAgent)")! let (data, _) = try await URLSession.shared.data(from: url) let parsedData = try JSONDecoder().decode(Posts.self, from: data) diff --git a/Tanuki's StashTests/Tanuki_s_StashTests.swift b/Tanuki's StashTests/Tanuki_s_StashTests.swift deleted file mode 100644 index 629ab7b..0000000 --- a/Tanuki's StashTests/Tanuki_s_StashTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// Tanuki_s_StashTests.swift -// Tanuki's StashTests -// -// Created by Jay Poffinbarger on 1/3/22. -// - -import XCTest -@testable import Tanuki_s_Stash - -class Tanuki_s_StashTests: XCTestCase { - - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - // Any test you write for XCTest can be annotated as throws and async. - // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. - // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. - } - - func testPerformanceExample() throws { - // This is an example of a performance test case. - self.measure { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/Tanuki's StashUITests/Tanuki_s_StashUITests.swift b/Tanuki's StashUITests/Tanuki_s_StashUITests.swift deleted file mode 100644 index 6296c1f..0000000 --- a/Tanuki's StashUITests/Tanuki_s_StashUITests.swift +++ /dev/null @@ -1,42 +0,0 @@ -// -// Tanuki_s_StashUITests.swift -// Tanuki's StashUITests -// -// Created by Jay Poffinbarger on 1/3/22. -// - -import XCTest - -class Tanuki_s_StashUITests: XCTestCase { - - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - - // In UI tests it is usually best to stop immediately when a failure occurs. - continueAfterFailure = false - - // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() throws { - // UI tests must launch the application that they test. - let app = XCUIApplication() - app.launch() - - // Use recording to get started writing UI tests. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testLaunchPerformance() throws { - if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { - // This measures how long it takes to launch your application. - measure(metrics: [XCTApplicationLaunchMetric()]) { - XCUIApplication().launch() - } - } - } -} diff --git a/Tanuki's StashUITests/Tanuki_s_StashUITestsLaunchTests.swift b/Tanuki's StashUITests/Tanuki_s_StashUITestsLaunchTests.swift deleted file mode 100644 index af3411d..0000000 --- a/Tanuki's StashUITests/Tanuki_s_StashUITestsLaunchTests.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// Tanuki_s_StashUITestsLaunchTests.swift -// Tanuki's StashUITests -// -// Created by Jay Poffinbarger on 1/3/22. -// - -import XCTest - -class Tanuki_s_StashUITestsLaunchTests: XCTestCase { - - override class var runsForEachTargetApplicationUIConfiguration: Bool { - true - } - - override func setUpWithError() throws { - continueAfterFailure = false - } - - func testLaunch() throws { - let app = XCUIApplication() - app.launch() - - // Insert steps here to perform after app launch but before taking a screenshot, - // such as logging into a test account or navigating somewhere in the app - - let attachment = XCTAttachment(screenshot: app.screenshot()) - attachment.name = "Launch Screen" - attachment.lifetime = .keepAlways - add(attachment) - } -}