Skip to content

Commit

Permalink
Merge pull request #1008 from 0x1-company/refactor-school
Browse files Browse the repository at this point in the history
refactor: 💡 school setting feature
  • Loading branch information
tomokisun authored Nov 21, 2023
2 parents e7564e9 + 22d5da9 commit df46180
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 35 deletions.
15 changes: 11 additions & 4 deletions Packages/GodPackage/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ let package = Package(
.library(name: "ProfileShareFeature", targets: ["ProfileShareFeature"]),
.library(name: "ProfileStoryFeature", targets: ["ProfileStoryFeature"]),
.library(name: "RevealFeature", targets: ["RevealFeature"]),
.library(name: "SchoolSettingFeature", targets: ["SchoolSettingFeature"]),
.library(name: "ShareScreenshotFeature", targets: ["ShareScreenshotFeature"]),
.library(name: "ShopFeature", targets: ["ShopFeature"]),
.library(name: "TutorialFeature", targets: ["TutorialFeature"]),
Expand Down Expand Up @@ -223,17 +224,15 @@ let package = Package(
"HowItWorksFeature",
"ProfileStoryFeature",
"InviteFriendFeature",
"SchoolSettingFeature",
"CupertinoMessageFeature",
.product(name: "Constants", package: "DependencyPackage"),
.product(name: "AsyncValue", package: "DependencyPackage"),
.product(name: "PhotosClient", package: "CupertinoPackage"),
.product(name: "SocialShare", package: "UIComponentPackage"),
.product(name: "ProfileImage", package: "UIComponentPackage"),
.product(name: "ActivityView", package: "UIComponentPackage"),
.product(name: "StringHelpers", package: "DependencyPackage"),
.product(name: "ContactsClient", package: "CupertinoPackage"),
.product(name: "RoundedCorner", package: "UIComponentPackage"),
.product(name: "AnalyticsClient", package: "DependencyPackage"),
.product(name: "ShareLinkBuilder", package: "DependencyPackage"),
.product(name: "UIPasteboardClient", package: "CupertinoPackage"),
.product(name: "UserDefaultsClient", package: "CupertinoPackage"),
Expand All @@ -242,7 +241,6 @@ let package = Package(
.product(name: "UserNotificationClient", package: "CupertinoPackage"),
.product(name: "FirebaseStorageClient", package: "DependencyPackage"),
.product(name: "PhoneNumberDependencies", package: "DependencyPackage"),
.product(name: "CachedAsyncImage", package: "swiftui-cached-async-image"),
.product(name: "FirebaseDynamicLinkClient", package: "DependencyPackage"),
], resources: [.copy("onboarding.json")]),
.target(name: "PlayAgainFeature", dependencies: [
Expand Down Expand Up @@ -305,6 +303,15 @@ let package = Package(
.product(name: "AnalyticsClient", package: "DependencyPackage"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
]),
.target(name: "SchoolSettingFeature", dependencies: [
.product(name: "Constants", package: "DependencyPackage"),
.product(name: "GodClient", package: "DependencyPackage"),
.product(name: "Styleguide", package: "UIComponentPackage"),
.product(name: "RoundedCorner", package: "UIComponentPackage"),
.product(name: "AnalyticsClient", package: "DependencyPackage"),
.product(name: "CachedAsyncImage", package: "swiftui-cached-async-image"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
]),
.target(name: "ShareScreenshotFeature", dependencies: [
.product(name: "AsyncValue", package: "DependencyPackage"),
.product(name: "PhotosClient", package: "CupertinoPackage"),
Expand Down
30 changes: 0 additions & 30 deletions Packages/GodPackage/Sources/OnboardFeature/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,6 @@
}
}
},
"If your school is not found, add it here" : {
"localizations" : {
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "学校が見つからない場合はここから追加する"
}
}
}
},
"Imported from Contacts" : {
"localizations" : {
"ja" : {
Expand Down Expand Up @@ -389,16 +379,6 @@
}
}
},
"MEMBERS" : {
"localizations" : {
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "人"
}
}
}
},
"Next" : {
"localizations" : {
"ja" : {
Expand Down Expand Up @@ -459,16 +439,6 @@
}
}
},
"Pick your school" : {
"localizations" : {
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "あなたの高校を選択"
}
}
}
},
"Please allow access" : {

},
Expand Down
1 change: 1 addition & 0 deletions Packages/GodPackage/Sources/OnboardFeature/Onboard.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ComposableArchitecture
import SchoolSettingFeature
import Contacts
import ContactsClient
import FirebaseAuth
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"sourceLanguage" : "en",
"strings" : {
"If your school is not found, add it here" : {
"localizations" : {
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "学校が見つからない場合はここから追加する"
}
}
}
},
"MEMBERS" : {
"localizations" : {
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "人"
}
}
}
},
"Pick your school" : {
"localizations" : {
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "あなたの高校を選択"
}
}
}
}
},
"version" : "1.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public struct SchoolSettingLogic {
@Dependency(\.openURL) var openURL
@Dependency(\.godClient) var godClient
@Dependency(\.analytics) var analytics

enum Cancel {
case school
}

public var body: some Reducer<State, Action> {
Reduce<State, Action> { state, action in
Expand All @@ -45,6 +49,7 @@ public struct SchoolSettingLogic {
} catch: { error, send in
await send(.schoolsResponse(.failure(error)))
}
.cancellable(id: Cancel.school, cancelInFlight: true)

case .onAppear:
analytics.logScreen(screenName: "SchoolSetting", of: self)
Expand All @@ -56,7 +61,10 @@ public struct SchoolSettingLogic {
}

case let .schoolButtonTapped(id):
return .send(.delegate(.nextScreen(id: id)))
return .run { send in
analytics.setUserProperty(key: .schoolId, value: id)
await send(.delegate(.nextScreen(id: id)))
}

case let .schoolsResponse(.success(data)):
state.schools = data.schools.edges.map(\.node)
Expand Down

0 comments on commit df46180

Please sign in to comment.