Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observation #200

Merged
merged 65 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
c8ded4e
Bump
stephencelis Dec 7, 2023
bf0c97a
wip
stephencelis Dec 7, 2023
84fb895
wip
stephencelis Dec 7, 2023
7a12f8b
wip
stephencelis Dec 8, 2023
e67c0c9
wip
stephencelis Dec 8, 2023
5b24ecf
wip
stephencelis Dec 8, 2023
015932b
wip
stephencelis Dec 8, 2023
57d676d
wip
stephencelis Dec 8, 2023
816d53f
wip
stephencelis Dec 8, 2023
286618f
wip
stephencelis Dec 8, 2023
49df034
wip
stephencelis Dec 8, 2023
0c5270b
wip
stephencelis Dec 8, 2023
852d16c
wip
stephencelis Dec 8, 2023
39c9bb7
wip
stephencelis Dec 8, 2023
19c35f6
wip
stephencelis Dec 8, 2023
fda7be3
wip
stephencelis Dec 8, 2023
3e5a8aa
wip
stephencelis Dec 8, 2023
810fcf3
wip
stephencelis Dec 8, 2023
0932033
wip
stephencelis Dec 8, 2023
4db019c
wip
stephencelis Dec 8, 2023
7b9ae18
wip
stephencelis Dec 8, 2023
70b7e3b
wip
stephencelis Dec 8, 2023
d7da8fc
wip
stephencelis Dec 8, 2023
27e4812
wip
stephencelis Dec 8, 2023
efa9f2b
wip
stephencelis Dec 8, 2023
716bf9c
wip
stephencelis Dec 8, 2023
0aaa62e
wip
stephencelis Dec 8, 2023
7e009ff
wip
stephencelis Dec 8, 2023
de50bc5
wip
stephencelis Dec 8, 2023
319387e
wip
stephencelis Dec 8, 2023
c2f288f
wip
stephencelis Dec 8, 2023
be08617
wip
stephencelis Dec 8, 2023
8abe58f
wip
stephencelis Dec 8, 2023
4a1b154
Merge remote-tracking branch 'origin/main' into observation-beta
stephencelis Dec 8, 2023
f59b3de
wip
stephencelis Dec 8, 2023
e57166f
wip
stephencelis Dec 9, 2023
8a8ff1f
wip
stephencelis Dec 9, 2023
a34be6f
wip
stephencelis Dec 9, 2023
380ce12
wip
stephencelis Dec 9, 2023
eb75020
wip
stephencelis Dec 9, 2023
2fc8dc6
wip
stephencelis Dec 9, 2023
5233f32
wip
stephencelis Dec 9, 2023
cf5f10e
wip
stephencelis Dec 9, 2023
eab3475
wip
stephencelis Dec 9, 2023
2a30738
wip
stephencelis Dec 9, 2023
0740836
wip
stephencelis Dec 9, 2023
db145d3
wip
stephencelis Dec 9, 2023
fa6251d
wip
stephencelis Dec 9, 2023
fd47050
wip
stephencelis Dec 9, 2023
29fae99
Merge branch 'main' into observation-beta
stephencelis Jan 10, 2024
7199286
wip
stephencelis Jan 10, 2024
bc41412
wip
stephencelis Jan 25, 2024
cee0c1c
Merge remote-tracking branch 'origin/main' into observation-beta
stephencelis Jan 25, 2024
098df9f
wip
stephencelis Jan 25, 2024
03716cf
wip
stephencelis Jan 25, 2024
d39632d
Remove firstLaunchOnboarding (#198)
imjn Jan 25, 2024
07e5628
Merge remote-tracking branch 'origin/main' into observation-beta
mbrandonw Apr 7, 2024
beeda8f
use enum reducers
mbrandonw Apr 7, 2024
29d1884
fix some warnings
mbrandonw Apr 7, 2024
b93b94c
udpate last destination reducer
mbrandonw Apr 8, 2024
b9d6bed
ignore some errors
mbrandonw Apr 8, 2024
dae32ea
wip
mbrandonw Apr 9, 2024
ba30ab2
wip
stephencelis Apr 9, 2024
9af2a17
wip
stephencelis Apr 9, 2024
f68c1cd
wip
stephencelis Apr 9, 2024
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
Prev Previous commit
Next Next commit
wip
  • Loading branch information
stephencelis committed Dec 8, 2023
commit 716bf9c8c92673b2da5f43a0a34cd4d142146546
26 changes: 6 additions & 20 deletions Sources/Bloom/BloomBackground.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,11 @@ public struct Blooms: View {
}

public struct BloomBackground: View {
public struct ViewState: Equatable {
let bloomCount: Int
let word: String

public init(
bloomCount: Int,
word: String
) {
self.bloomCount = bloomCount
self.word = word
}
}
let word: String

@State var blooms: [Bloom] = []
@Environment(\.colorScheme) var colorScheme
let size: CGSize
let store: Store<ViewState, Never>
@State var vertexGenerator: AnyIterator<CGPoint> = {
var rng = Xoshiro(seed: 0)
var vertices: [CGPoint] = [
Expand All @@ -100,29 +88,27 @@ public struct BloomBackground: View {
return vertices[index % vertices.count]
}
}()
@ObservedObject var viewStore: ViewStore<ViewState, Never>

public init(size: CGSize, store: Store<ViewState, Never>) {
public init(size: CGSize, word: String) {
self.size = size
self.store = store
self.viewStore = ViewStore(self.store, observe: { $0 })
self.word = word
}

public var body: some View {
Blooms(blooms: self.blooms)
.onChange(of: self.viewStore.bloomCount) { _, count in
.onChange(of: self.word.count) { _, count in
withAnimation(.easeOut(duration: 1)) {
self.renderBlooms(count: count)
}
}
.onAppear { self.renderBlooms(count: self.viewStore.bloomCount) }
.onAppear { self.renderBlooms(count: self.word.count) }
}

func renderBlooms(count: Int) {
if count > self.blooms.count {
let colors =
Styleguide.letterColors.first { key, _ in
key.contains(self.viewStore.word)
key.contains(self.word)
}?
.value ?? []
guard colors.count > 0
Expand Down
21 changes: 6 additions & 15 deletions Sources/CubePreview/CubePreviewView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,23 +274,14 @@ public struct CubePreviewView: View {
CubeView(store: self.store.scope(state: \.cubeScenePreview, action: \.cubeScene))
.task { await self.viewStore.send(.task).finish() }
}
.background(
self.viewStore.isAnimationReduced
? nil
: BloomBackground(
.background {
if !self.viewStore.isAnimationReduced {
BloomBackground(
size: proxy.size,
store: self.store
.scope(
state: { _ in
BloomBackground.ViewState(
bloomCount: self.viewStore.selectedWordString.count,
word: self.viewStore.selectedWordString
)
},
action: absurd
)
word: self.viewStore.selectedWordString
)
)
}
}
}
.onTapGesture {
UIView.setAnimationsEnabled(false)
Expand Down
20 changes: 6 additions & 14 deletions Sources/GameCore/Views/GameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,14 @@ public struct GameView<Content>: View where Content: View {
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(
store.isAnimationReduced
? nil
: BloomBackground(
.background {
if !store.isAnimationReduced {
BloomBackground(
size: proxy.size,
store: store.scope(
state: {
BloomBackground.ViewState(
bloomCount: $0.selectedWord.count,
word: $0.selectedWordString
)
},
action: absurd
)
word: store.selectedWordString
)
)
}
}
.background(
Color(self.colorScheme == .dark ? .hex(0x111111) : .white)
.ignoresSafeArea()
Expand Down
14 changes: 3 additions & 11 deletions Sources/TrailerFeature/Trailer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,12 @@ public struct TrailerView: View {
.grid(30)
)
}
.background(
.background {
BloomBackground(
size: proxy.size,
store: store.scope(
state: {
BloomBackground.ViewState(
bloomCount: $0.game.selectedWord.count,
word: $0.game.selectedWordString
)
},
action: absurd
)
word: store.game.selectedWordString
)
)
}
}
.padding(
self.deviceState.idiom == .pad ? .vertical : [],
Expand Down