Skip to content

Commit

Permalink
2023.11.17 (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
mani-sh-reddy authored Nov 18, 2023
2 parents 76198ef + 8af820b commit 0e321d3
Show file tree
Hide file tree
Showing 18 changed files with 418 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
MATCH_CERTS_URL_LUNAR: ${{ secrets.MATCH_CERTS_URL_LUNAR }}
ASC_P8_KEY_ENCODED: ${{ secrets.ASC_P8_KEY_ENCODED }}
REPO_GITHUB_TOKEN: ""
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
LOCAL_KEYCHAIN_PASS: ${{ secrets.LOCAL_KEYCHAIN_PASS }}

- name: Archive IPA and dSYM artifacts
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@ All notable changes to this project will be documented in this file.

### Changed

- Hiding Create Post, Create Comment, and Reply buttons when not logged in.
- Using package (@gonzalezreal /swift-markdown-ui) to parse post headers and comment text.
- Hiding Create Post, Create Comment, and Reply buttons when not logged in.

### Fixed

- Image links now rendering images instead of showing an empty line.

## [2023.11.16]

### Changed

- Hiding Create Post, Create Comment, and Reply buttons when not logged in.

### Misc

Expand Down
Binary file modified Images/New-App-Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions Lunar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
3CEB2C0A2AB2F3A50013609E /* Defaults in Frameworks */ = {isa = PBXBuildFile; productRef = 3CEB2C092AB2F3A50013609E /* Defaults */; };
3CEB2C132AB2F45F0013609E /* SFSafeSymbols in Frameworks */ = {isa = PBXBuildFile; productRef = 3CEB2C122AB2F45F0013609E /* SFSafeSymbols */; };
3CEBF4672B08302000469008 /* CHANGELOG.md in Resources */ = {isa = PBXBuildFile; fileRef = 3CEBF4662B08302000469008 /* CHANGELOG.md */; };
3CEBF46C2B09426E00469008 /* MarkdownUI in Frameworks */ = {isa = PBXBuildFile; productRef = 3CEBF46B2B09426E00469008 /* MarkdownUI */; };
3CECCE192AACFA4B0017A605 /* MyUserView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CECCE182AACFA4B0017A605 /* MyUserView.swift */; };
3CECCE1C2AADBFFA0017A605 /* ColorTesterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CECCE1B2AADBFFA0017A605 /* ColorTesterView.swift */; };
3CECCE1E2AADDBBA0017A605 /* CircleFillIcons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CECCE1D2AADDBBA0017A605 /* CircleFillIcons.swift */; };
Expand Down Expand Up @@ -565,6 +566,7 @@
3CC4200A2AB37BCB00BE1612 /* WhatsNewKit in Frameworks */,
3C20B37F2AEB27F9003F578F /* LocalConsole in Frameworks */,
3C23F03E2AAA66E000AACA46 /* Pulse in Frameworks */,
3CEBF46C2B09426E00469008 /* MarkdownUI in Frameworks */,
3CA95F0A2A7ACF3B00626353 /* NukeUI in Frameworks */,
3CFE04BF2A7FEA71007BAD81 /* SwiftSoup in Frameworks */,
3CEB2C0A2AB2F3A50013609E /* Defaults in Frameworks */,
Expand Down Expand Up @@ -1193,6 +1195,7 @@
3CE69E972ABDCA8A00E2821E /* RealmSwift */,
3CC3E41A2ADC054000F7F9A9 /* Shiny */,
3C20B37E2AEB27F9003F578F /* LocalConsole */,
3CEBF46B2B09426E00469008 /* MarkdownUI */,
);
productName = Lunar;
productReference = 3C4F09FC2A54399F009DF8AB /* Lunar.app */;
Expand Down Expand Up @@ -1244,6 +1247,7 @@
3CE69E942ABDCA8A00E2821E /* XCRemoteSwiftPackageReference "realm-swift" */,
3CC3E4192ADC054000F7F9A9 /* XCRemoteSwiftPackageReference "shiny" */,
3C20B37D2AEB27F8003F578F /* XCRemoteSwiftPackageReference "LocalConsole" */,
3CEBF46A2B09426E00469008 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */,
);
productRefGroup = 3C4F09FD2A54399F009DF8AB /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -2039,6 +2043,14 @@
minimumVersion = 4.1.1;
};
};
3CEBF46A2B09426E00469008 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/gonzalezreal/swift-markdown-ui";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.2.0;
};
};
3CFE04BD2A7FEA71007BAD81 /* XCRemoteSwiftPackageReference "SwiftSoup" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/scinfu/SwiftSoup";
Expand Down Expand Up @@ -2132,6 +2144,11 @@
package = 3CEB2C112AB2F45F0013609E /* XCRemoteSwiftPackageReference "SFSafeSymbols" */;
productName = SFSafeSymbols;
};
3CEBF46B2B09426E00469008 /* MarkdownUI */ = {
isa = XCSwiftPackageProductDependency;
package = 3CEBF46A2B09426E00469008 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */;
productName = MarkdownUI;
};
3CFE04BE2A7FEA71007BAD81 /* SwiftSoup */ = {
isa = XCSwiftPackageProductDependency;
package = 3CFE04BD2A7FEA71007BAD81 /* XCRemoteSwiftPackageReference "SwiftSoup" */;
Expand Down
3 changes: 2 additions & 1 deletion Lunar/Account Tab/MyUserCommentsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Defaults
import MarkdownUI
import SFSafeSymbols
import SwiftUI

Expand Down Expand Up @@ -33,7 +34,7 @@ struct MyUserCommentsView: View {
if commentMetadataPosition == "Top" {
MyUserCommentMetadataView(comment: comment)
}
Text(try! AttributedString(styledMarkdown: comment.comment.content))
Markdown { comment.comment.content }
if commentMetadataPosition == "Bottom" {
MyUserCommentMetadataView(comment: comment)
}
Expand Down
3 changes: 2 additions & 1 deletion Lunar/Comment View/CommentsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Defaults
import MarkdownUI
import SFSafeSymbols
import SwiftUI

Expand Down Expand Up @@ -62,7 +63,7 @@ struct CommentsView: View {
.padding(.horizontal, -5)
if let postBody = post.postBody, !postBody.isEmpty {
DisclosureGroup(isExpanded: $postBodyExpanded) {
Text(try! AttributedString(styledMarkdown: postBody))
Markdown { postBody }
} label: {
if postBodyExpanded {
Text("")
Expand Down
5 changes: 3 additions & 2 deletions Lunar/Comment View/RecursiveComment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Defaults
import Foundation
import MarkdownUI
import SFSafeSymbols
import SwiftUI

Expand Down Expand Up @@ -74,7 +75,7 @@ struct RecursiveComment: View {

var minimisedCommentStyle: some View {
HStack {
Text(try! AttributedString(styledMarkdown: "\(nestedComment.commentViewData.comment.content)"))
Text(nestedComment.commentViewData.comment.content)
.italic()
.lineLimit(1)
.foregroundStyle(.gray)
Expand Down Expand Up @@ -160,7 +161,7 @@ struct RecursiveComment: View {
if commentMetadataPosition == "Top" {
commentMetadata
}
Text(try! AttributedString(styledMarkdown: nestedComment.commentViewData.comment.content))
Markdown { nestedComment.commentViewData.comment.content }
if commentMetadataPosition == "Bottom" {
commentMetadata
}
Expand Down
3 changes: 1 addition & 2 deletions Lunar/Legacy Views/LegacyCommentSectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ struct LegacyCommentSectionView: View {
LegacyInPostActionsView(post: post)
if !postBody.isEmpty {
VStack(alignment: .trailing) {
// Text(try! AttributedString(styledMarkdown: postBody)).font(.body)
ExpandableTextBox(LocalizedStringKey(postBody))
ExpandableTextBox(text: postBody)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Lunar/Legacy Views/LegacyPostsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct old_PostsView: View {
}
.toolbar {
ToolbarItemGroup(placement: .navigationBarTrailing) {
if isCommunitySpecific && !activeAccount.actorID.isEmpty {
if isCommunitySpecific, !activeAccount.actorID.isEmpty {
Button {
showingCreatePostPopover = true
} label: {
Expand Down
7 changes: 3 additions & 4 deletions Lunar/Legacy Views/LegacyRecursiveComment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Defaults
import Foundation
import MarkdownUI
import SFSafeSymbols
import SwiftUI

Expand Down Expand Up @@ -105,8 +106,7 @@ struct LegacyRecursiveComment: View {
}
} else {
HStack {
Text(try! AttributedString(styledMarkdown: "\(nestedComment.commentViewData.comment.content)"))
.italic()
Markdown { nestedComment.commentViewData.comment.content }
.lineLimit(1)
.foregroundStyle(.gray)
.font(.caption)
Expand Down Expand Up @@ -139,8 +139,7 @@ struct LegacyRecursiveComment: View {
if commentMetadataPosition == "Top" {
commentMetadata
}

Text(try! AttributedString(styledMarkdown: nestedComment.commentViewData.comment.content))
Markdown { nestedComment.commentViewData.comment.content }
if commentMetadataPosition == "Bottom" {
commentMetadata
}
Expand Down
2 changes: 1 addition & 1 deletion Lunar/Post Views/HeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct HeaderView: View {
.border(debugModeEnabled ? Color.purple : Color.clear)

if let description {
ExpandableTextBox(LocalizedStringKey(description))
ExpandableTextBox(text: description)
}
}
.listRowSeparator(.hidden)
Expand Down
7 changes: 4 additions & 3 deletions Lunar/Post Views/PostsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Defaults
import Foundation
import MarkdownUI
import NukeUI
import RealmSwift
import SFSafeSymbols
Expand Down Expand Up @@ -109,7 +110,7 @@ struct PostsView: View {
}
.toolbar {
ToolbarItemGroup(placement: .navigationBarTrailing) {
if communityActorID != nil && !activeAccount.actorID.isEmpty {
if communityActorID != nil, !activeAccount.actorID.isEmpty {
createPostButton
}
if debugModeEnabled {
Expand Down Expand Up @@ -156,7 +157,7 @@ struct PostsView: View {
var communitySpecificHeader: some View {
Section {
DisclosureGroup {
Text(try! AttributedString(styledMarkdown: communityDescription ?? ""))
Markdown { communityDescription ?? "" }
} label: {
HStack {
communityIconView
Expand Down Expand Up @@ -198,7 +199,7 @@ struct PostsView: View {
var personSpecificHeader: some View {
Section {
DisclosureGroup {
Text(try! AttributedString(styledMarkdown: personBio ?? ""))
Markdown { personBio ?? "" }
} label: {
HStack {
personAvatarView
Expand Down
16 changes: 16 additions & 0 deletions Lunar/Settings Views/AttributionInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,22 @@ class AttributionInfo {
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
),
Attribution(
packageName: "MarkdownUI",
developer: "gonzalezreal",
url: "https://github.com/gonzalezreal/swift-markdown-ui",
license: """
The MIT License (MIT)
Copyright (c) 2020 Guillermo Gonzalez
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
),
Expand Down
15 changes: 9 additions & 6 deletions Lunar/Tools/ExpandableTextBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,34 @@

import Defaults
import Foundation
import MarkdownUI
import SFSafeSymbols
import SwiftUI

struct ExpandableTextBox: View {
@State private var expanded: Bool = false
@State private var truncated: Bool = false
private var text: LocalizedStringKey
// private var text: LocalizedStringKey
var text: String
var lineLimit = 3

let haptics = UIImpactFeedbackGenerator(style: .soft)

init(_ text: LocalizedStringKey) {
self.text = text
}
// init(_ text: LocalizedStringKey) {
// self.text = text
// }

var body: some View {
VStack(alignment: .leading) {
Text(text)
// Text(text)
Markdown { text }
.lineLimit(expanded ? nil : lineLimit)
.background(
Text(text).lineLimit(lineLimit)
.background(
GeometryReader { displayedGeometry in
ZStack {
Text(text)
Markdown { text }
.background(
GeometryReader { fullGeometry in
Color.clear.onAppear {
Expand Down
Loading

0 comments on commit 0e321d3

Please sign in to comment.