Skip to content

Commit

Permalink
Merge pull request #60 from DroidKaigi/MrSmart00/feature/about-footer…
Browse files Browse the repository at this point in the history
…-links

Add footer buttons on AboutFeature
  • Loading branch information
MrSmart00 authored Jun 20, 2024
2 parents 693a40f + b26ea10 commit f9cb0d1
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app-ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.4;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = io.github.droidkaigi.DroidKaigi2024;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand Down Expand Up @@ -497,7 +497,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.4;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = io.github.droidkaigi.DroidKaigi2024;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand Down
15 changes: 15 additions & 0 deletions app-ios/Sources/AboutFeature/AboutReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,19 @@ public struct AboutReducer {
case codeOfConductTapped
case acknowledgementsTapped
case privacyPolicyTapped
case youtubeTapped
case xcomTapped
case mediumTapped
}
}

@Reducer(state: .equatable)
public enum Destination {
case codeOfConduct
case privacyPolicy
case youtube
case xcom
case medium
}

@Reducer(state: .equatable)
Expand Down Expand Up @@ -65,6 +71,15 @@ public struct AboutReducer {
case .view(.privacyPolicyTapped):
state.destination = .privacyPolicy
return .none
case .view(.youtubeTapped):
state.destination = .youtube
return .none
case .view(.xcomTapped):
state.destination = .xcom
return .none
case .view(.mediumTapped):
state.destination = .medium
return .none
case .presentation:
return .none
case .path:
Expand Down
54 changes: 54 additions & 0 deletions app-ios/Sources/AboutFeature/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import SwiftUI
@ViewAction(for: AboutReducer.self)
public struct AboutView: View {
@Bindable public var store: StoreOf<AboutReducer>

var version: String {
Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? ""
}

public init(store: StoreOf<AboutReducer>) {
self.store = store
Expand All @@ -30,6 +34,15 @@ public struct AboutView: View {
.sheet(item: $store.scope(state: \.destination?.privacyPolicy, action: \.presentation.privacyPolicy), content: { _ in
Text("PrivacyPolicy")
})
.sheet(item: $store.scope(state: \.destination?.youtube, action: \.presentation.youtube), content: { _ in
Text("Youtube")
})
.sheet(item: $store.scope(state: \.destination?.xcom, action: \.presentation.xcom), content: { _ in
Text("X.com")
})
.sheet(item: $store.scope(state: \.destination?.medium, action: \.presentation.medium), content: { _ in
Text("Medium")
})
}

@ViewBuilder var content: some View {
Expand Down Expand Up @@ -143,7 +156,48 @@ public struct AboutView: View {
.background(Color(.outlineOutlineVariant))

}

HStack(spacing: 12) {
Button(action: {
send(.youtubeTapped)
}, label: {
Image(systemName: "play.circle")
.resizable()
.aspectRatio(contentMode: .fit)
.foregroundStyle(Color(.surfaceOnSurface))
})
.frame(width: 48, height: 48)

Button(action: {
send(.xcomTapped)
}, label: {
Image(systemName: "x.circle")
.resizable()
.aspectRatio(contentMode: .fit)
.foregroundStyle(Color(.surfaceOnSurface))
})
.frame(width: 48, height: 48)

Button(action: {
send(.mediumTapped)
}, label: {
Image(systemName: "m.circle")
.resizable()
.aspectRatio(contentMode: .fit)
.foregroundStyle(Color(.surfaceOnSurface))
})
.frame(width: 48, height: 48)
}
.padding(.vertical, 24)

Text(String(localized: "AppVersion", bundle: .module))
.font(.body)
.foregroundStyle(Color(.surfaceOnSurface))
.padding(.bottom, 10)

Text(version)
.font(.body)
.foregroundStyle(Color(.surfaceOnSurface))
}
.padding(.horizontal, 16)
}
Expand Down
19 changes: 19 additions & 0 deletions app-ios/Sources/AboutFeature/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
}
}
},
"AppVersion" : {
"localizations" : {
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "アプリバージョン"
}
}
}
},
"CodeOfConduct" : {
"localizations" : {
"ja" : {
Expand Down Expand Up @@ -100,6 +110,9 @@
}
}
}
},
"Medium" : {

},
"Others" : {
"localizations" : {
Expand Down Expand Up @@ -140,6 +153,12 @@
}
}
}
},
"X.com" : {

},
"Youtube" : {

}
},
"version" : "1.0"
Expand Down
31 changes: 31 additions & 0 deletions app-ios/Tests/AboutFeatureTests/AboutFeatureTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,35 @@ final class AboutFeatureTests: XCTestCase {
$0.destination = .privacyPolicy
}
}

@MainActor
func testTappedYoutube() async {
let store = TestStore(initialState: AboutReducer.State()) {
AboutReducer()
}
await store.send(\.view.youtubeTapped) {
$0.destination = .youtube
}
}

@MainActor
func testTappedXcom() async {
let store = TestStore(initialState: AboutReducer.State()) {
AboutReducer()
}
await store.send(\.view.xcomTapped) {
$0.destination = .xcom
}
}

@MainActor
func testTappedMedium() async {
let store = TestStore(initialState: AboutReducer.State()) {
AboutReducer()
}
await store.send(\.view.mediumTapped) {
$0.destination = .medium
}
}

}

0 comments on commit f9cb0d1

Please sign in to comment.