Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "subscription-default-icon.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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"filename" : "subscription-intro-clock.png",
"idiom" : "universal",
"scale" : "1x"
}
],
"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.
16 changes: 16 additions & 0 deletions Bitkit/Assets.xcassets/icons/asterisk.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "asterisk.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
7 changes: 7 additions & 0 deletions Bitkit/Assets.xcassets/icons/asterisk.imageset/asterisk.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions Bitkit/Assets.xcassets/icons/timer-outline.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "timer-outline.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Bitkit/Components/MoneyCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ struct MoneyCell: View {
let sats: Int
let prefix: String
var enableHide: Bool = false
var symbol: Bool?

var body: some View {
VStack(alignment: .trailing, spacing: 2) {
MoneyText(
sats: sats,
unitType: .primary,
size: .bodyMSB,
symbol: symbol,
enableHide: enableHide,
prefix: prefix,
color: .textPrimary,
Expand Down
4 changes: 3 additions & 1 deletion Bitkit/Components/MoneyText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct MoneyText: View {
var color: Color = .textPrimary
var symbolColor: Color?
var testIdentifier: String?
var fillsWidth: Bool = true

@EnvironmentObject var currency: CurrencyViewModel
@EnvironmentObject var settings: SettingsViewModel
Expand Down Expand Up @@ -105,7 +106,8 @@ extension MoneyText {
case .display:
DisplayText(
// Cap symbol font weight to ExtraBold
text, textColor: color, accentColor: symbolColor ?? .textSecondary, accentFont: size == .display ? Fonts.extraBold : nil
text, textColor: color, accentColor: symbolColor ?? .textSecondary,
accentFont: Fonts.extraBold, fillsWidth: fillsWidth
)
case .title:
TitleText(text, textColor: color, accentColor: symbolColor ?? .textSecondary)
Expand Down
7 changes: 5 additions & 2 deletions Bitkit/Components/NoteTextEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ struct NoteTextEditor: View {
let placeholder: String
let testIdentifier: String
let isFocused: FocusState<Bool>.Binding
var minHeight: CGFloat = 30
var maxHeight: CGFloat = 50
var backgroundColor: Color = .white06

var body: some View {
ZStack(alignment: .topLeading) {
Expand All @@ -20,13 +23,13 @@ struct NoteTextEditor: View {
.submitLabel(.done)
.scrollContentBackground(.hidden)
.padding(EdgeInsets(top: -8, leading: -5, bottom: -5, trailing: -5))
.frame(minHeight: 30, maxHeight: 50)
.frame(minHeight: minHeight, maxHeight: maxHeight)
.dismissKeyboardOnReturn(text: $text, isFocused: isFocused)
.accessibilityValue(text)
.accessibilityIdentifier(testIdentifier)
}
.padding()
.background(Color.white06)
.background(backgroundColor)
.cornerRadius(8)
}
}
4 changes: 2 additions & 2 deletions Bitkit/Components/PubkyContactRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ struct PubkyContactRow: View {
HStack(spacing: 16) {
PubkyContactAvatar(contact: contact, size: 48)

VStack(alignment: .leading, spacing: 4) {
CaptionText(contact.profile.truncatedPublicKey.localizedUppercase)
VStack(alignment: .leading, spacing: 0) {
CaptionMText(contact.profile.truncatedPublicKey.localizedUppercase, textColor: .white64)
.lineLimit(1)

BodyMSBText(contact.displayName)
Expand Down
5 changes: 3 additions & 2 deletions Bitkit/Components/PubkyImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import SwiftUI
struct PubkyImage: View {
let uri: String
let size: CGFloat
var cornerRadius: CGFloat?

@State private var uiImage: UIImage?
@State private var hasFailed = false
Expand All @@ -24,15 +25,15 @@ struct PubkyImage: View {
}
}
.frame(width: size, height: size)
.clipShape(Circle())
.clipShape(RoundedRectangle(cornerRadius: cornerRadius ?? size / 2))
.accessibilityLabel(Text("Profile photo"))
.task(id: uri) {
await loadImage()
}
}

private var placeholder: some View {
Circle()
Rectangle()
.fill(Color.gray5)
.overlay {
Image("user-square")
Expand Down
17 changes: 11 additions & 6 deletions Bitkit/Components/SegmentedControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,35 @@ struct TabItem<T: Hashable & CustomStringConvertible> {
let tab: T
let activeColor: Color?
let badge: Int?
let accessibilityIdentifier: String?

init(_ tab: T, activeColor: Color? = nil, badge: Int? = nil) {
init(_ tab: T, activeColor: Color? = nil, badge: Int? = nil, accessibilityIdentifier: String? = nil) {
self.tab = tab
self.activeColor = activeColor
self.badge = badge
self.accessibilityIdentifier = accessibilityIdentifier
}
}

struct SegmentedControl<T: Hashable & CustomStringConvertible>: View {
@Binding var selectedTab: T
private let tabItems: [TabItem<T>]
private let defaultActiveColor: Color
private let inactiveColor: Color?
@Namespace private var underlineNamespace

init(selectedTab: Binding<T>, tabs: [T], activeColor: Color = .textPrimary) {
init(selectedTab: Binding<T>, tabs: [T], activeColor: Color = .textPrimary, inactiveColor: Color? = nil) {
_selectedTab = selectedTab
tabItems = tabs.map { TabItem($0) }
defaultActiveColor = activeColor
self.inactiveColor = inactiveColor
}

init(selectedTab: Binding<T>, tabItems: [TabItem<T>], defaultActiveColor: Color = .textPrimary) {
init(selectedTab: Binding<T>, tabItems: [TabItem<T>], defaultActiveColor: Color = .textPrimary, inactiveColor: Color? = nil) {
_selectedTab = selectedTab
self.tabItems = tabItems
self.defaultActiveColor = defaultActiveColor
self.inactiveColor = inactiveColor
}

var body: some View {
Expand All @@ -40,7 +45,7 @@ struct SegmentedControl<T: Hashable & CustomStringConvertible>: View {
}) {
VStack(spacing: 8) {
HStack(spacing: 8) {
CaptionBText(tabItem.tab.description, textColor: selectedTab == tabItem.tab ? .white : .secondary)
CaptionBText(tabItem.tab.description, textColor: selectedTab == tabItem.tab ? .white : inactiveColor ?? .secondary)

if let badge = tabItem.badge, badge > 0 {
CaptionBText("\(badge)", textColor: .black)
Expand All @@ -54,7 +59,7 @@ struct SegmentedControl<T: Hashable & CustomStringConvertible>: View {
ZStack {
Rectangle()
.frame(height: 2)
.foregroundColor(Color.white64)
.foregroundColor(inactiveColor ?? .white64)

if selectedTab == tabItem.tab {
Rectangle()
Expand All @@ -68,7 +73,7 @@ struct SegmentedControl<T: Hashable & CustomStringConvertible>: View {
.contentShape(Rectangle())
}
.buttonStyle(PlainButtonStyle())
.accessibilityIdentifier("Tab-\(tabItem.tab.description.lowercased())")
.accessibilityIdentifier(tabItem.accessibilityIdentifier ?? "Tab-\(tabItem.tab.description.lowercased())")
}
}
.frame(maxWidth: .infinity)
Expand Down
7 changes: 5 additions & 2 deletions Bitkit/Components/TextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ struct TextField: View {
let axis: Axis
let testIdentifier: String?
let submitLabel: SubmitLabel
let contentPadding: CGFloat
@Binding var text: String

init(
Expand All @@ -16,14 +17,16 @@ struct TextField: View {
font: Font = .custom(Fonts.semiBold, size: 15),
axis: Axis = .horizontal,
testIdentifier: String? = nil,
submitLabel: SubmitLabel = .return
submitLabel: SubmitLabel = .return,
contentPadding: CGFloat = 16
) {
self.placeholder = placeholder
self.backgroundColor = backgroundColor
self.font = font
self.axis = axis
self.testIdentifier = testIdentifier
self.submitLabel = submitLabel
self.contentPadding = contentPadding
_text = text
}

Expand All @@ -41,7 +44,7 @@ struct TextField: View {
.submitLabel(submitLabel)
.accessibilityIdentifierIfPresent(testIdentifier)
}
.padding()
.padding(contentPadding)
.background(backgroundColor)
.cornerRadius(8)
}
Expand Down
34 changes: 30 additions & 4 deletions Bitkit/Resources/Localization/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1538,9 +1538,22 @@
"subscriptions__active" = "Active";
"subscriptions__cancel" = "Cancel";
"subscriptions__cancel_subscription" = "Cancel Subscription";
"subscriptions__choose_recipient" = "Choose Recipient";
"subscriptions__create" = "Create";
"subscriptions__content_too_long" = "Shorten the subscription name or description and try again.";
"subscriptions__icon_error" = "Could not load this image. Choose another image and try again.";
"subscriptions__create_subscription" = "Create Subscription";
"subscriptions__created" = "Created";
"subscriptions__created_summary" = "1 subscriber · {count} payments";
"subscriptions__created_summary_single_payment" = "1 subscriber · 1 payment";
"subscriptions__custom_icon" = "Icon";
"subscriptions__custom_icon_description" = "Tap to upload a custom icon";
"subscriptions__daily" = "Daily";
"subscriptions__daily_subscription" = "Daily Subscription";
"subscriptions__daily_subscription" = "Daily subscription";
"subscriptions__details" = "Subscription Details";
"subscriptions__delete_subscription" = "Delete Subscription";
"subscriptions__description" = "Description";
"subscriptions__description_placeholder" = "What is this subscription for?";
"subscriptions__empty_description" = "At the moment, you don’t have any active subscriptions from any providers.";
"subscriptions__empty_headline" = "Welcome To\n<accent>Subscriptions</accent>";
"subscriptions__every_days" = "Every {count} days";
Expand All @@ -1557,7 +1570,9 @@
"subscriptions__more_info" = "More Info";
"subscriptions__monthly" = "Monthly";
"subscriptions__monthly_cost" = "Monthly Cost";
"subscriptions__monthly_subscription" = "Monthly Subscription";
"subscriptions__monthly_subscription" = "Monthly subscription";
"subscriptions__name" = "Subscription Name";
"subscriptions__name_placeholder" = "Subscription name";
"subscriptions__ongoing" = "Ongoing";
"subscriptions__overview" = "Overview";
"subscriptions__payment_due_description" = "Open Bitkit to review a subscription payment.";
Expand All @@ -1567,6 +1582,15 @@
"subscriptions__per_month" = "per month";
"subscriptions__per_week" = "per week";
"subscriptions__per_year" = "per year";
"subscriptions__pending" = "Pending";
"subscriptions__proposal_queued_description" = "Your subscription proposal is queued and will send automatically.";
"subscriptions__proposal_queued_headline" = "Queued\n<accent>Proposal</accent>";
"subscriptions__proposal_queued_title" = "Queued";
"subscriptions__proposal_queued_status" = "Proposal queued";
"subscriptions__proposal_sent_description" = "You have sent a subscription proposal to";
"subscriptions__proposal_sent_headline" = "Sent\n<accent>Proposal</accent>";
"subscriptions__proposal_sent_status" = "Proposal sent";
"subscriptions__propose_subscription" = "Propose Subscription";
"subscriptions__proposals" = "Proposals";
"subscriptions__renews" = "Renews";
"subscriptions__retry_payment" = "Retry Payment";
Expand All @@ -1575,7 +1599,9 @@
"subscriptions__status" = "Status";
"subscriptions__subscribed" = "Subscribed";
"subscriptions__subscription" = "Subscription";
"subscriptions__subscribers" = "Subscribers";
"subscriptions__swipe_to_cancel" = "Swipe To Cancel";
"subscriptions__swipe_to_delete" = "Swipe To Delete";
"subscriptions__swipe_to_subscribe" = "Swipe To Subscribe";
"subscriptions__swipe_to_subscribe_and_pay" = "Swipe To Subscribe & Pay";
"subscriptions__title" = "Subscriptions";
Expand All @@ -1584,9 +1610,9 @@
"subscriptions__unsupported_frequency" = "Unsupported frequency";
"subscriptions__unsupported_payment_description" = "This subscription uses payment details that Bitkit does not support yet.";
"subscriptions__weekly" = "Weekly";
"subscriptions__weekly_subscription" = "Weekly Subscription";
"subscriptions__weekly_subscription" = "Weekly subscription";
"subscriptions__yearly" = "Yearly";
"subscriptions__yearly_subscription" = "Yearly Subscription";
"subscriptions__yearly_subscription" = "Yearly subscription";
"wallet__instant_payment_received" = "Received Instant Bitcoin";
"wallet__error_create_tx" = "Transaction Creation Failed";
"wallet__error_create_tx_msg" = "An error occurred. Please try again {raw}";
Expand Down
Loading
Loading