Skip to content
Merged
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
8 changes: 4 additions & 4 deletions iOS/PadawanWallet/App/CoreView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import SwiftUI

struct CoreView: View {
@Environment(\.padawanColors) private var colors

@EnvironmentObject private var languageManager: LanguageManager
@State private var walletPath: NavigationPath = .init()
@State private var lessonPath: NavigationPath = .init()
@State private var morePath: NavigationPath = .init()
Expand All @@ -30,7 +30,7 @@ struct CoreView: View {
}
.tabItem {
Label {
Text(Strings.bottomNavWallet)
Text(languageManager.localizedString(forKey: "bottom_nav_wallet"))
} icon: {
Image(systemName: "bitcoinsign.square")
}
Expand All @@ -43,7 +43,7 @@ struct CoreView: View {
}
.tabItem {
Label {
Text(Strings.bottomNavChapters)
Text(languageManager.localizedString(forKey: "bottom_nav_chapters"))
} icon: {
Image(systemName: "graduationcap")
}
Expand All @@ -57,7 +57,7 @@ struct CoreView: View {
}
.tabItem {
Label {
Text(Strings.bottomNavSettings)
Text(languageManager.localizedString(forKey: "bottom_nav_settings"))
} icon: {
Image(systemName: "ellipsis")
}
Expand Down
2 changes: 2 additions & 0 deletions iOS/PadawanWallet/App/PadawanWalletApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ let isIpad = UIDevice.current.userInterfaceIdiom == .pad

@main
struct PadawanWalletApp: App {
@EnvironmentObject var languageManager: LanguageManager
@State private var navigationPath = NavigationPath()
@ObservedObject var session = Session.shared

Expand All @@ -32,6 +33,7 @@ struct PadawanWalletApp: App {
}
}
.environment(\.padawanColors, session.themeChoice.colors)
.environmentObject(LanguageManager.shared)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

import Foundation
import SwiftUI
import BitcoinUI

struct LessonsDetailView: View {
@Environment(\.padawanColors) private var colors
@EnvironmentObject private var languageManager: LanguageManager
@StateObject private var viewModel: LessonsDetailViewModel

init(
Expand Down Expand Up @@ -39,15 +41,15 @@ struct LessonsDetailView: View {
.frame(maxWidth: .maxWidthScreen, maxHeight: .infinity, alignment: .leading)
.padding()
}
.navigationTitle(viewModel.lesson.navigationTitle)
.navigationTitle(languageManager.localizedString(forKey: viewModel.lesson.navigationTitle))
.navigationBarTitleDisplayMode(.inline)
}
}

@ViewBuilder
private func buildHeader() -> some View {
ZStack {
colors.errorRed
colors.background2
.ignoresSafeArea()

VStack {
Expand All @@ -59,13 +61,12 @@ struct LessonsDetailView: View {
Spacer()

Rectangle()
.frame(height: 2)
.frame(height: 1)
.frame(maxWidth: .infinity)
.foregroundStyle(colors.text)
}

}
.frame(height: 50)
.frame(height: 40)
.frame(maxWidth: .infinity)
}

Expand All @@ -85,7 +86,7 @@ struct LessonsDetailView: View {
ScrollView {
VStack(alignment: .leading, spacing: 16) {
Group {
Text(content.header)
Text(languageManager.localizedString(forKey: content.headerKey))
.font(Fonts.font(.bold, 24))

ForEach(content.texts, id: \.self) { text in
Expand All @@ -94,7 +95,6 @@ struct LessonsDetailView: View {
Spacer()
}
.foregroundStyle(colors.text)

}
.frame(maxWidth: .infinity, alignment: .leading)
}
Expand Down Expand Up @@ -134,25 +134,26 @@ struct LessonsDetailView: View {
navigationTitle: "Bitcoin Networks",
content: [
.init(
header: "Header 1",
headerKey: "Header 1",
texts: [
AnyHashableView(Text("Text 1"))
AnyHashableView(Text("Texto 1"))
]),
.init(
header: "Header 2",
headerKey: "Header 2",
texts: [
AnyHashableView(Text("Text 1"))
AnyHashableView(Text("Texto 2"))
]),
.init(
header: "Header 3",
headerKey: "Header 3",
texts: [
AnyHashableView(Text("Text 1"))
AnyHashableView(Text("Texto 3"))
])
],
sort: 1
)
)
.environment(\.padawanColors, .tatooineDesert)
.environment(\.padawanColors, PadawanColorTheme.tatooine.colors)
.environmentObject(LanguageManager.shared)
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import SwiftUI

struct LessonsListView: View {
@Environment(\.padawanColors) private var colors
@EnvironmentObject private var languageManager: LanguageManager
@StateObject private var viewModel: LessonsListViewModel

init(
Expand All @@ -21,9 +22,9 @@ struct LessonsListView: View {
ScrollView {
VStack(alignment: .leading, spacing: 12.0) {
Group {
Text(Strings.padawanJourney)
Text(languageManager.localizedString(forKey: "padawan_journey"))
.font(Fonts.title)
Text(Strings.continueOnYourJourney)
Text(languageManager.localizedString(forKey: "continue_on_your_journey"))
.font(Fonts.subtitle)
}
.foregroundStyle(colors.text)
Expand All @@ -42,25 +43,17 @@ struct LessonsListView: View {
await viewModel.updateList()
}
}
.navigationDestination(for: LessonScreenNavigation.self) { item in
Group {
switch item {
case .lessonDetails(let lesson):
LessonsDetailView(path: viewModel.$path, lesson: lesson)

case .alert(let data):
AlertModalView(data: data)
}
}
.toolbar(.hidden, for: .tabBar)
.navigationDestination(for: LessonItemList.self) { lesson in
LessonsDetailView(path: viewModel.$path, lesson: lesson)
.toolbar(.hidden, for: .tabBar)
}
}

@ViewBuilder
private func buildList() -> some View {
ForEach(viewModel.list) { item in
Section {
SectionTitleView(item.title)
SectionTitleView(languageManager.localizedString(forKey: item.title))

ForEach(item.items) { lesson in
buildListItem(
Expand All @@ -74,17 +67,22 @@ struct LessonsListView: View {

@ViewBuilder
private func buildListItem(lesson: LessonItemList) -> some View {
let lessonTitle = languageManager.localizedString(forKey: lesson.title)

PadawanToggleButton(
title: "\(lesson.sort). \(lesson.title)",
title: "\(lesson.sort). \(lessonTitle)",
isOn: lesson.isDone) {
viewModel.showLesson(for: lesson)
viewModel.path.append(lesson)
}
}
}

#if DEBUG
#Preview {
LessonsListView(path: .constant(.init()))
.environment(\.padawanColors, .tatooineDesert)
NavigationStack {
LessonsListView(path: .constant(.init()))
.environment(\.padawanColors, .tatooineDesert)
.environmentObject(LanguageManager.shared)
}
}
#endif
Loading
Loading