diff --git a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/ShareExtensionScene.swift b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/ShareExtensionScene.swift index ec54f0503..222ca0388 100644 --- a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/ShareExtensionScene.swift +++ b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/ShareExtensionScene.swift @@ -1,8 +1,11 @@ import SwiftUI import Utils +import Views public extension PlatformViewController { static func makeShareExtensionController(extensionContext: NSExtensionContext?) -> PlatformViewController { + registerFonts() + let hostingController = PlatformHostingController( rootView: ShareExtensionView(extensionContext: extensionContext) ) diff --git a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/ShareExtensionView.swift b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/ShareExtensionView.swift index 97f5593e7..39ae4486b 100644 --- a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/ShareExtensionView.swift +++ b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/ShareExtensionView.swift @@ -200,12 +200,13 @@ public struct ShareExtensionView: View { searchButton .onTapGesture { showSearchLabels = true } - VStack { + ScrollView { LabelsMasonaryView(labels: labelsViewModel.labels, selectedLabels: labelsViewModel.selectedLabels, onLabelTap: onLabelTap) Spacer() } + .padding(.bottom, 16) .background(Color.appButtonBackground) .cornerRadius(8) } diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsMasonaryView.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsMasonaryView.swift index 2eedcd1f7..7c36ff6c5 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsMasonaryView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsMasonaryView.swift @@ -37,8 +37,8 @@ struct LabelsMasonaryView: View { GeometryReader { geometry in self.generateContent(in: geometry) } - } - .frame(height: totalHeight) + }.padding(5) + .frame(height: totalHeight) } private func generateContent(in geom: GeometryProxy) -> some View { @@ -48,7 +48,7 @@ struct LabelsMasonaryView: View { return ZStack(alignment: .topLeading) { ForEach(self.labelItems, id: \.label.self) { label in self.item(for: label) - .padding(.horizontal, 10) + .padding(.horizontal, 5) .padding(.vertical, 5) .alignmentGuide(.leading, computeValue: { dim in if abs(width - dim.width) > geom.size.width { @@ -76,7 +76,7 @@ struct LabelsMasonaryView: View { } private func item(for item: (label: LinkedItemLabel, selected: Bool)) -> some View { - let chip = TextChip(feedItemLabel: item.label, negated: false, checked: item.selected) { chip in + let chip = TextChip(feedItemLabel: item.label, negated: false, checked: item.selected, padded: true) { chip in onLabelTap(item.label, chip) } return chip diff --git a/apple/OmnivoreKit/Sources/Views/Colors/Colors.xcassets/_ctaYellow.colorset/Contents.json b/apple/OmnivoreKit/Sources/Views/Colors/Colors.xcassets/_ctaYellow.colorset/Contents.json index b352ae789..08cfe7f24 100644 --- a/apple/OmnivoreKit/Sources/Views/Colors/Colors.xcassets/_ctaYellow.colorset/Contents.json +++ b/apple/OmnivoreKit/Sources/Views/Colors/Colors.xcassets/_ctaYellow.colorset/Contents.json @@ -2,12 +2,12 @@ "colors" : [ { "color" : { - "color-space" : "srgb", + "color-space" : "display-p3", "components" : { "alpha" : "1.000", - "blue" : "0x34", - "green" : "0xD2", - "red" : "0xFF" + "blue" : "0x57", + "green" : "0xD4", + "red" : "0xF8" } }, "idiom" : "universal" diff --git a/apple/OmnivoreKit/Sources/Views/Fonts.swift b/apple/OmnivoreKit/Sources/Views/Fonts.swift index c15d025d9..d3188d3be 100644 --- a/apple/OmnivoreKit/Sources/Views/Fonts.swift +++ b/apple/OmnivoreKit/Sources/Views/Fonts.swift @@ -66,8 +66,8 @@ public extension Font { } /// 12pt, Inter-Regular - static var appCaptionBold: Font { - .customFont(InterFont.bold.rawValue, size: 12, relativeTo: .caption) + static var appCaptionMedium: Font { + .customFont(InterFont.medium.rawValue, size: 12, relativeTo: .caption) } /// 11pt, Inter-Regular diff --git a/apple/OmnivoreKit/Sources/Views/TextChip.swift b/apple/OmnivoreKit/Sources/Views/TextChip.swift index b8a540af9..939cd781f 100644 --- a/apple/OmnivoreKit/Sources/Views/TextChip.swift +++ b/apple/OmnivoreKit/Sources/Views/TextChip.swift @@ -6,6 +6,7 @@ public struct TextChip: View { @Environment(\.colorScheme) var colorScheme let checked: Bool + let padded: Bool var onTap: ((TextChip) -> Void)? public init(text: String, color: Color, negated: Bool = false) { @@ -13,6 +14,7 @@ public struct TextChip: View { self.color = color self.negated = negated self.checked = false + self.padded = false } public init?(feedItemLabel: LinkedItemLabel, negated: Bool = false) { @@ -22,9 +24,10 @@ public struct TextChip: View { self.color = color self.negated = negated self.checked = false + self.padded = false } - public init?(feedItemLabel: LinkedItemLabel, negated: Bool = false, checked: Bool = false, onTap: ((TextChip) -> Void)?) { + public init?(feedItemLabel: LinkedItemLabel, negated: Bool = false, checked: Bool = false, padded: Bool = false, onTap: ((TextChip) -> Void)?) { guard let color = Color(hex: feedItemLabel.color ?? "") else { return nil } @@ -34,6 +37,7 @@ public struct TextChip: View { self.negated = negated self.onTap = onTap self.checked = checked + self.padded = padded } public let text: String @@ -45,37 +49,28 @@ public struct TextChip: View { return .white } - if colorScheme == .light { - return luminance > 0.5 ? .black : .white - } - - if luminance > 0.2 { - return color - } - - // lighten the color by 20% - return Color.lighten(color: color, by: 20) + return luminance > 0.5 ? .black : .white } var backgroundColor: Color { - color.opacity(colorScheme == .dark ? 0.2 : 1) + color.opacity(0.9) + } + + var checkedBorderColor: Color { + colorScheme == .dark ? Color.appCtaYellow : Color.black } var borderColor: Color { - if colorScheme == .dark { - return textColor - } else { - return color.opacity(0.7) - } + checked ? checkedBorderColor : Color.clear } public var body: some View { ZStack(alignment: .topTrailing) { Text(text) .strikethrough(color: negated ? textColor : .clear) - .padding(.horizontal, 8) - .padding(.vertical, 5) - .font(.appCaptionBold) + .padding(.horizontal, padded ? 10 : 8) + .padding(.vertical, padded ? 8 : 5) + .font(.appCaptionMedium) .foregroundColor(textColor) .lineLimit(1) .background( @@ -84,18 +79,9 @@ public struct TextChip: View { ) .overlay( RoundedRectangle(cornerRadius: 4) - .stroke(borderColor, lineWidth: 1) + .stroke(borderColor, lineWidth: 2) ) .padding(1) - .overlay(alignment: .topTrailing) { - if checked { - Image(systemName: "checkmark.circle.fill") - .font(.appBody) - .symbolVariant(.circle.fill) - .foregroundStyle(Color.appBackground, Color.appGreenSuccess) - .padding([.top, .trailing], -6) - } - } }.onTapGesture { if let onTap = onTap { onTap(self)