Skip to content

Commit

Permalink
Merge pull request #18 from loloop/mc/friday-tweaks
Browse files Browse the repository at this point in the history
A bunch of changes, see each commit for more details
  • Loading branch information
loloop authored Nov 24, 2023
2 parents 0683fd1 + 71c6968 commit 7887334
Show file tree
Hide file tree
Showing 24 changed files with 115 additions and 140 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Race Car Illustration DALL·E.png",
"filename" : "Race Car Illustration Sao Paulo.png",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 15 additions & 13 deletions app/LandinhoLib/Sources/BetaSheet/BetaSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,20 @@ public struct BetaSheet: View {
let issues: LocalizedStringKey = """
• Design obviamente não está nem um pouco próximo de estar pronto
• App não tem cache em nada. Tudo vai ser recarregado quando o app inicia
• A tela de categorias não tem função alguma. Quer ver as corridas de alguma categoria específica? Entra na tela de Admin pra ver
• Eventos principais na tela de detalhe não tem informação da data
• Quando existem apenas dois eventos principais na tela de detalhe, o layout é meio esquisito
• O botão de um Widget pequeno não está funcionando quando colocado na Home
• Na home provisória, passar para o próximo evento de um widget pequeno afeta TODOS os widgets pequenos
• Erros atualmente mostram o payload completo do erro
• Erros atualmente mostram o payload completo do erro (Intencional, por enquanto)
"""

let latestRelease: LocalizedStringKey = """
24/11
• Melhora o layout quando existe mais de um evento principal em uma corrida
• Remove aquele monte de widgets da home por uma lista que faz um pouco mais de sentido
• É possível compartilhar uma corrida a partir da Home agora
• Simplifica o fluxo de compartilhar uma corrida
• Adiciona a opção de remover sessões de treino de um Widget
22/11
• Corrige um crash quando o app troca de telas
• Corrige um problema onde o botão de voltar na tela de compartilhar não aparece em iPhones de tela pequena
Expand All @@ -107,25 +112,22 @@ public struct BetaSheet: View {
"""

let nextSteps: LocalizedStringKey = """
Esta lista será completamente limpa antes do lançamento público do aplicativo
Esta lista será completamente limpa antes do lançamento público do aplicativo (em ordem de prioridade)
Ícone de verdade desenhado por um ser humano e não a aberração atual
Compartilhar uma corrida direto da Home
Os widgets deixarão de mostrar os horários de eventos que já se passaram (ex.: deixa de mostrar o treino livre se é a hora da classificação)
Tela Sobre o desenvolvedor
• Imagem de fundo ao compartilhar uma corrida por imagem
• Opção de remover sessões de treino de um Widget pequeno
• Compartilhar texto de uma corrida -> Estilo o bot
• Botão de voltar tela será reposicionado na tela de compartilhar corrida
• App Clip
• Botão de compartilhar o app em Ajustes -> App Clip ou Link
• Parte de administração das categorias será escondida e protegida por senha
• Adicionar cores para as categorias
• O widget pequeno deixará de mostrar os horários de eventos que já se passaram (ex.: deixa de mostrar o treino livre se é a hora da classificação)
• Categorias terão uma "accent color"
• Home de verdade, com os horários de todas as categorias, categorias favoritas aparecendo primeiro e paginação
• App Clip
• Botão de compartilhar o app em Ajustes -> App Clip ou Link
• Tela sobre o desenvolvedor
• Ações rápidas no ícone do aplicativo
• Design final da Home, Tela de Corrida, Categorias, Ajustes, Compartilhar, etc para iOS e iPadOS
• Widget extra-largo para iPads
• Ícone de verdade desenhado por um ser humano e não a aberração atual
• Compartilhar texto de uma corrida -> Estilo o bot
Para o futuro:
• Notificações quando eventos específicos forem começar
Expand Down
2 changes: 1 addition & 1 deletion app/LandinhoLib/Sources/Categories/Categories.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public struct CategoriesView: View {
}
}
}
.buttonStyle(.plain)
.foregroundStyle(.primary)
}
case .finished(.failure(let error)):
APIErrorView(error: error)
Expand Down
2 changes: 1 addition & 1 deletion app/LandinhoLib/Sources/Common/Race.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public struct Race: Codable, Equatable, Identifiable, Hashable {
public let id: UUID
public let title: String
public let shortTitle: String
public let events: [RaceEvent]
public var events: [RaceEvent]
}

// TODO: Consolidate this into Race instead
Expand Down
2 changes: 1 addition & 1 deletion app/LandinhoLib/Sources/Common/RaceBundle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public struct RaceBundle: Codable, Equatable, Identifiable {
}

public let category: RaceCategory
public let nextRace: Race
public var nextRace: Race
public var id: UUID { nextRace.id }
}
35 changes: 19 additions & 16 deletions app/LandinhoLib/Sources/EventDetail/EventDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public struct EventDetail: Reducer {
}

public enum DelegateAction: Equatable {
case onShareTap(race: MegaRace, isSquareAspectRatio: Bool)
case onShareTap(race: MegaRace)
}

public var body: some ReducerOf<Self> {
Expand Down Expand Up @@ -140,15 +140,8 @@ struct InnerEventDetailView: View {
.navigationTitle(race.shortTitle)
.toolbar {
ToolbarItem {
Menu {
Button("Instagram", systemImage: "photo") {
store.send(.delegate(.onShareTap(race: race, isSquareAspectRatio: false)))
}
Button("Quadrado", systemImage: "crop") {
store.send(.delegate(.onShareTap(race: race, isSquareAspectRatio: true)))
}
} label: {
Image(systemName: "square.and.arrow.up")
Button("Compartilhar", systemImage: "square.and.arrow.up") {
store.send(.delegate(.onShareTap(race: race)))
}
}
}
Expand All @@ -168,27 +161,34 @@ struct MainEventsView: View {
let events: [RaceEvent]

var body: some View {
if events.count == 1 {
if events.count <= 2 {
singleEventView
} else {
multipleEventsView
}
}

var singleEventView: some View {
VStack {
VStack(alignment: .leading) {
ForEach(events) { event in
HStack {
Text(event.title)
.font(.title)
.scaledToFit()
.minimumScaleFactor(0.01)

Spacer()
Text(event.date.formatted(.dateTime.hour().minute()))
.font(.title)

VStack(alignment: .trailing) {
Text(event.date.formatted(.dateTime.day().weekday()))
.font(.caption)
Text(event.date.formatted(.dateTime.hour().minute()))
.font(.title)
}
}
.padding()
.padding(.horizontal)
.background(Color(.systemBackground))
.clipShape(RoundedRectangle(cornerRadius: 25.0, style: .continuous))
.clipShape(RoundedRectangle(cornerRadius: 15.0, style: .continuous))
.shadow(color: .black.opacity(0.1), radius: 1)
}
}
Expand All @@ -202,6 +202,9 @@ struct MainEventsView: View {
Text(event.title)
.font(.title2)
Spacer()

Text(event.date.formatted(.dateTime.day().weekday()))
.font(.caption)
Text(event.date.formatted(.dateTime.hour().minute()))
.font(.title)
}
Expand Down
7 changes: 5 additions & 2 deletions app/LandinhoLib/Sources/Router/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ public struct Router {
state.path.append(.eventDetail(.init(race: race)))
return .none

case .path(.element(id: _, action: .eventDetail(.delegate(.onShareTap(let race, let isSquareAspectRatio))))):
state.path.append(.sharing(.init(race: race, isSquareAspectRatio: isSquareAspectRatio)))
case
.home(.scheduleList(.delegate(.onShareTap(let race)))),
.path(.element(id: _, action: .eventDetail(.delegate(.onShareTap(let race))))),
.path(.element(id: _, action: .scheduleList(.delegate(.onShareTap(let race))))):
state.path.append(.sharing(.init(race: race)))
return .none

case .onAppear:
Expand Down
1 change: 1 addition & 0 deletions app/LandinhoLib/Sources/ScheduleList/ScheduleList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public struct ScheduleList: Reducer {

public enum DelegateAction: Equatable {
case onWidgetTap(MegaRace)
case onShareTap(MegaRace)
}

public var body: some ReducerOf<Self> {
Expand Down
73 changes: 12 additions & 61 deletions app/LandinhoLib/Sources/ScheduleList/Views/ScheduleListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,73 +30,24 @@ public struct ScheduleListView: View {
case .loading:
ProgressView()
case .reloading(let response), .finished(.success(let response)):
// TODO: Empty State
ScrollView {
VStack(spacing: 20) {
VStack {
Text("Ainda não tem nada por aqui, mas se você quiser ver, esse são os Widgets do app por enquanto:")
.frame(maxWidth: .infinity, alignment: .leading)
Text("*Toca neles pra ir pra tela da corrida*")
.font(.caption)
.foregroundStyle(.secondary)
.frame(maxWidth: .infinity, alignment: .leading)
}
.padding(.horizontal)

ScrollView(.horizontal) {
HStack {
Spacer().padding(.leading, 5)
ForEach(response.items) { item in
NextRaceSmallWidgetView(bundle: item.bundled, lastUpdatedDate: Date())
.widgetBackground()
.widgetFrame(family: .systemSmall)
.onTapAnimate {
viewStore.send(.delegate(.onWidgetTap(item)))
}
}
Spacer().padding(.trailing, 5)
}
}
.scrollClipDisabled()
.scrollIndicators(.hidden)

ScrollView(.horizontal) {
HStack {
Spacer().padding(.leading, 5)
ForEach(response.items) { item in
NextRaceMediumWidgetView(bundle: item.bundled, lastUpdatedDate: Date())
.widgetBackground()
.widgetFrame(family: .systemMedium)
.onTapAnimate {
viewStore.send(.delegate(.onWidgetTap(item)))
}
LazyVStack(spacing: 20) {
ForEach(response.items) { item in
NextRaceMediumWidgetView(bundle: item.bundled, lastUpdatedDate: Date())
.widgetBackground()
.widgetFrame(family: .systemMedium)
.onTapAnimate {
viewStore.send(.delegate(.onWidgetTap(item)))
}
Spacer().padding(.trailing, 5)
}
}
.scrollClipDisabled()
.scrollIndicators(.hidden)

ScrollView(.horizontal) {
HStack {
Spacer().padding(.leading, 5)
ForEach(response.items) { item in
NextRaceLargeWidgetView(bundle: item.bundled, lastUpdatedDate: Date())
.widgetBackground()
.widgetFrame(family: .systemLarge)
.onTapAnimate {
viewStore.send(.delegate(.onWidgetTap(item)))
}
.contextMenu {
Button("Compartilhar", systemImage: "square.and.arrow.up") {
viewStore.send(.delegate(.onShareTap(item)))
}
}
Spacer().padding(.trailing, 5)
}
}
.scrollClipDisabled()
.scrollIndicators(.hidden)

Spacer().frame(height: 50)
}
}
.frame(maxWidth: .infinity)
.background(
.background.secondary
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Race Car Illustration DALL·E.png",
"filename" : "Race Car Illustration Sao Paulo.png",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions app/LandinhoLib/Sources/Sharing/Sharing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@ public struct Sharing {
public init() {}

public struct State: Equatable {
public init(
race: MegaRace,
isSquareAspectRatio: Bool
) {
public init(race: MegaRace) {
self.race = race
self.isSquareAspectRatio = isSquareAspectRatio
}

let race: MegaRace
let isSquareAspectRatio: Bool
var isSquareAspectRatio: Bool = true
var currentWidgetType: ShareableWidgetType = .systemMedium
var hasTappedShare: Bool = false
var renderedImage: UIImage? = nil
Expand All @@ -36,6 +32,7 @@ public struct Sharing {
case onWidgetTap
case onShareTap
case onDismissShare
case toggleAspectRatio
case onRender(UIImage)
case binding(BindingAction<State>)
}
Expand All @@ -54,6 +51,9 @@ public struct Sharing {
case .onWidgetTap:
state.currentWidgetType = ShareableWidgetType.allCases.next(element: state.currentWidgetType)
return .none
case .toggleAspectRatio:
state.isSquareAspectRatio.toggle()
return .none
case .onRender(let image):
state.renderedImage = image
state.isSharing = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ struct SharingRenderableView: View {
}
}

#Preview("Instagram Renderable") {
var state = Sharing.State(race: .mock, isSquareAspectRatio: true)
#Preview("16/9 Renderable") {
var state = Sharing.State(race: .mock)
state.hasTappedShare = true
let store = Store(initialState: state) {
Sharing()
Expand All @@ -49,7 +49,7 @@ struct SharingRenderableView: View {
}

#Preview("Square Renderable", traits: .fixedLayout(width: 360, height: 360)) {
var state = Sharing.State(race: .mock, isSquareAspectRatio: true)
var state = Sharing.State(race: .mock)
state.hasTappedShare = true
let store = Store(initialState: state) {
Sharing()
Expand Down
Loading

0 comments on commit 7887334

Please sign in to comment.