Skip to content

Commit

Permalink
Merge branch 'master' into camera
Browse files Browse the repository at this point in the history
  • Loading branch information
suhailsaqan authored Oct 28, 2023
2 parents 5510996 + 7710839 commit dd1474f
Show file tree
Hide file tree
Showing 87 changed files with 2,572 additions and 562 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
## [1.6-24] - 2023-10-22 - AppStore Rejection Cope

### Added

- Improve discoverability of profile zaps with zappability badges and profile action sheets (Daniel D’Aquino)
- Add suggested hashtags to universe view (Daniel D’Aquino)
- Suggest first post during onboarding (Daniel D’Aquino)
- Add expiry date for images in cache to be auto-deleted after a preset time to save space on storage (Daniel D’Aquino)
- Add QR scan nsec logins. (Jericho Hasselbush)


### Changed

- Improved status view design (ericholguin)
- Improve clear cache functionality (Daniel D’Aquino)


### Fixed

- Reduce size of event menu hitbox (William Casarin)
- Do not show DMs from muted users (Daniel D’Aquino)
- Add more spacing between display name and username, and prefix username with `@` character (Daniel D’Aquino)
- Broadcast quoted notes when posting a note with quotes (Daniel D’Aquino)


[1.6-24]: https://github.com/damus-io/damus/releases/tag/v1.6-24

## [1.6-23] - 2023-10-06 - Appstore Release

### Added
Expand Down
110 changes: 87 additions & 23 deletions damus.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@
"state" : {
"revision" : "76bb7971da7fbf429de1c84f1244adf657242fee"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "5b356adceabff6ca027f6574aac79e9fee145d26",
"version" : "1.14.1"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "74203046135342e4a4a627476dd6caf8b28fe11b",
"version" : "509.0.0"
}
}
],
"version" : 2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFF",
"green" : "0xFF",
"red" : "0xFF"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x00",
"red" : "0x00"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
1 change: 1 addition & 0 deletions damus/Components/DamusColors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import SwiftUI
class DamusColors {
static let adaptableGrey = Color("DamusAdaptableGrey")
static let adaptableBlack = Color("DamusAdaptableBlack")
static let adaptableWhite = Color("DamusAdaptableWhite")
static let white = Color("DamusWhite")
static let black = Color("DamusBlack")
static let brown = Color("DamusBrown")
Expand Down
22 changes: 16 additions & 6 deletions damus/Components/InvoiceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ struct InvoiceView: View {
if settings.show_wallet_selector {
present_sheet(.select_wallet(invoice: invoice.string))
} else {
open_with_wallet(wallet: settings.default_wallet.model, invoice: invoice.string)
do {
try open_with_wallet(wallet: settings.default_wallet.model, invoice: invoice.string)
}
catch {
present_sheet(.select_wallet(invoice: invoice.string))
}
}
} label: {
RoundedRectangle(cornerRadius: 20, style: .circular)
Expand Down Expand Up @@ -82,21 +87,26 @@ struct InvoiceView: View {
}
}

func open_with_wallet(wallet: Wallet.Model, invoice: String) {
enum OpenWalletError: Error {
case no_wallet_to_open
case store_link_invalid
case system_cannot_open_store_link
}

func open_with_wallet(wallet: Wallet.Model, invoice: String) throws {
if let url = URL(string: "\(wallet.link)\(invoice)"), UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url)
} else {
guard let store_link = wallet.appStoreLink else {
// TODO: do something here if we don't have an appstore link
return
throw OpenWalletError.no_wallet_to_open
}

guard let url = URL(string: store_link) else {
return
throw OpenWalletError.store_link_invalid
}

guard UIApplication.shared.canOpenURL(url) else {
return
throw OpenWalletError.system_cannot_open_store_link
}

UIApplication.shared.open(url)
Expand Down
14 changes: 14 additions & 0 deletions damus/Components/NeutralButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ struct NeutralButtonStyle: ButtonStyle {
}
}

struct NeutralCircleButtonStyle: ButtonStyle {
func makeBody(configuration: Self.Configuration) -> some View {
return configuration.label
.padding(20)
.background(DamusColors.neutral1)
.cornerRadius(9999)
.overlay(
RoundedRectangle(cornerRadius: 9999)
.stroke(DamusColors.neutral3, lineWidth: 1)
)
.scaleEffect(configuration.isPressed ? 0.95 : 1)
}
}


struct NeutralButtonStyle_Previews: PreviewProvider {
static var previews: some View {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// ZapButton.swift
// NoteZapButton.swift
// damus
//
// Created by William Casarin on 2023-01-17.
Expand All @@ -18,6 +18,19 @@ enum ZappingError {
case bad_lnurl
case canceled
case send_failed

func humanReadableMessage() -> String {
switch self {
case .fetching_invoice:
return NSLocalizedString("Error fetching lightning invoice", comment: "Message to display when there was an error fetching a lightning invoice while attempting to zap.")
case .bad_lnurl:
return NSLocalizedString("Invalid lightning address", comment: "Message to display when there was an error attempting to zap due to an invalid lightning address.")
case .canceled:
return NSLocalizedString("Zap attempt from connected wallet was canceled.", comment: "Message to display when a zap from the user's connected wallet was canceled.")
case .send_failed:
return NSLocalizedString("Zap attempt from connected wallet failed.", comment: "Message to display when sending a zap from the user's connected wallet failed.")
}
}
}

struct ZappingEvent {
Expand All @@ -26,7 +39,7 @@ struct ZappingEvent {
let target: ZapTarget
}

struct ZapButton: View {
struct NoteZapButton: View {
let damus_state: DamusState
let target: ZapTarget
let lnurl: String
Expand Down Expand Up @@ -144,7 +157,7 @@ struct ZapButton_Previews: PreviewProvider {
let pending_zap = PendingZap(amount_msat: 1000, target: ZapTarget.note(id: test_note.id, author: test_note.pubkey), request: .normal(test_zap_request), type: .pub, state: .external(.init(state: .fetching_invoice)))
let zaps = ZapsDataModel([.pending(pending_zap)])

ZapButton(damus_state: test_damus_state, target: ZapTarget.note(id: test_note.id, author: test_note.pubkey), lnurl: "lnurl", zaps: zaps)
NoteZapButton(damus_state: test_damus_state, target: ZapTarget.note(id: test_note.id, author: test_note.pubkey), lnurl: "lnurl", zaps: zaps)
}
}

Expand Down
11 changes: 11 additions & 0 deletions damus/Components/SelectableText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,27 @@ import SwiftUI
struct SelectableText: View {

let attributedString: AttributedString
let textAlignment: NSTextAlignment

@State private var selectedTextHeight: CGFloat = .zero
@State private var selectedTextWidth: CGFloat = .zero

let size: EventViewKind

init(attributedString: AttributedString, textAlignment: NSTextAlignment? = nil, size: EventViewKind) {
self.attributedString = attributedString
self.textAlignment = textAlignment ?? NSTextAlignment.natural
self.size = size
}

var body: some View {
GeometryReader { geo in
TextViewRepresentable(
attributedString: attributedString,
textColor: UIColor.label,
font: eventviewsize_to_uifont(size),
fixedWidth: selectedTextWidth,
textAlignment: self.textAlignment,
height: $selectedTextHeight
)
.padding([.leading, .trailing], -1.0)
Expand All @@ -48,6 +56,7 @@ struct SelectableText: View {
let textColor: UIColor
let font: UIFont
let fixedWidth: CGFloat
let textAlignment: NSTextAlignment

@Binding var height: CGFloat

Expand All @@ -61,12 +70,14 @@ struct SelectableText: View {
view.textContainerInset = .zero
view.textContainerInset.left = 1.0
view.textContainerInset.right = 1.0
view.textAlignment = textAlignment
return view
}

func updateUIView(_ uiView: UITextView, context: UIViewRepresentableContext<Self>) {
let mutableAttributedString = createNSAttributedString()
uiView.attributedText = mutableAttributedString
uiView.textAlignment = self.textAlignment

let newHeight = mutableAttributedString.height(containerWidth: fixedWidth)

Expand Down
Loading

0 comments on commit dd1474f

Please sign in to comment.