227 lines
15 KiB
Kotlin
227 lines
15 KiB
Kotlin
// RootReducer.kt —— 根 reducer 骨架(对应 module_10032 的根状态 z6 / TOState 与根 reducer k6)
|
||
//
|
||
// 原包 k6 对 89 个切片逐个调用各自的 reducer,再 `return n.cti(...)`(copy 出新状态)。
|
||
// 这里采用同一形状。已迁移的 66 个切片里,65 个真正调用 reducer,launchParams 只做类型收口:
|
||
//
|
||
// inviteState → ReduceInvite(aD / pD.er5)
|
||
// loginByPassword → ReduceLoginByPassword(gD / MD.cr6)
|
||
// twitchState → ReduceTwitch(g9 / y9.gta)
|
||
// home → ReduceHome(s1 / 根 reducer 的 `(inline@home)` 分支)
|
||
// localBattleUserState → ReduceLocalBattleUser(lE / `(inline@localBattleUserState)` 分支)
|
||
// shop → ReduceShop(j4 / `(inline@shop)` 分支)
|
||
// screen → ReduceScreen(WK / dY().ks5)
|
||
// lootBoxes → ReduceLootBoxes(aH / EH.wrv)
|
||
// garage → ReduceGarage(UB / hF,根委派 `i = hF(t, n)`)
|
||
// garagePreview → ReduceGaragePreview(IG / fs.eru,根委派 `fs.eru(t, n.epv_1)`)
|
||
// entrance → ReduceEntrance(hD / Bv.pth,根委派 `Bv.pth(t, n.jpx_1)`)
|
||
// user → ReduceUser(t8 / M8().qtd,根委派 `M8().qtd(t, n.ypu_1)`)
|
||
// settings → ReduceSettings(Uut / xw.ltg,根委派 `xw.ltg(t, n.upv_1)`)
|
||
// accountSettings → ReduceAccountSettings(oet / Lp.mtg,根委派 `Lp.mtg(t, n.vpv_1)`)
|
||
// proBattle → ReduceProBattle(Wtt / uv.wth,根委派 `uv.wth(t, n.bpy_1)`)
|
||
// language → ReduceLanguage(枚举值 / m6().jtg,根委派 `m6().jtg(t, n.gpx_1)`)
|
||
// announcement → ReduceAnnouncement(lC / PC().rq5,根委派 `PC().rq5(t, n.opx_1)`)
|
||
// news → ReduceNews(ZX / E_.asd,根委派 `E_.asd(t, n.tpv_1)`)
|
||
// notifications → ReduceNotifications(jJ / B_.ise,根委派 `B_.ise(t, n.xpv_1)`)
|
||
// quests → ReduceQuests(Frt / Yrt.otg,根委派 `(null == zp && new Yrt(), zp).otg(t, n.npv_1)`)
|
||
// lobbyLoader → ReduceLobbyLoader(KW / VW.es1,根委派 `Bs.es1(t, n.fpw_1)`)
|
||
// purchaseDialogState → ReducePurchaseDialog(CO / DO.ur2,根委派 `je.ur2(t, n.bpx_1)`)
|
||
// promoCode → ReducePromoCode(cZ / wZ.ysg,根委派 `Q_.ysg(t, n.gpy_1)`)
|
||
// supportUrl → ReduceSupportUrl(I4 / P4.ct7,根委派 `Yl.ct7(t, n.ipy_1)`)
|
||
// rulesUpdated → ReduceRulesUpdated(i1 / u1.dsm,根委派 `Ch.dsm(t, n.npx_1)`)
|
||
// notificationByCountry → ReduceNotificationByCountry(gJ / $J.ssd,根委派 `R_.ssd(t, n.ppx_1)`)
|
||
// availabilityByRank → ReduceAvailabilityByRank(tet / set.xth,根委派 `$p.xth(t, n.cpy_1)`)
|
||
// icons → ReduceIcons(oH / vs.kru,根委派 `vs.kru(t, n.wpx_1)`)
|
||
// questCategories → ReduceQuestCategories(zZ / th.lsh,根委派 `th.lsh(t, n.apy_1)`)
|
||
// mainQuest → ReduceMainQuest(WZ / ih.bsk,根委派 `(null == ih && new nQ(), ih).bsk(t, n.fpx_1)`)
|
||
// securitySettings → ReduceSecuritySettings(V2 / pc.qsv,根委派 `pc.qsv(t, n.apx_1)`)
|
||
// referralEvent → ReduceReferralEvent(pQ / lh.osk,根委派 `lh.osk(t, n.hpy_1)`)
|
||
// tipsState → ReduceTips(dst / Hw.vth,根委派 `Hw.vth(t, n.spv_1)`)
|
||
// rankUpDialogState → ReduceRankUpDialog(LO / Se.br3,根委派 `Se.br3(t, n.npw_1)`)
|
||
// battleResult → ReduceBattleResult(sR / Fi.aqp,根委派 `Fi.aqp(t, n.gpw_1)`)
|
||
// captchaState → ReduceCaptcha(jP / ar.iqt,根委派 `ar.iqt(t, n.kpv_1)`)
|
||
// modalScreen → ReduceModalScreen(nV / Fs.js1,根委派 `Fs.js1(t, n.apv_1)`)
|
||
// droppableGold → ReduceDroppableGold(Vet / Wp.kth,根委派 `Wp.kth(t, n.spw_1)`)
|
||
// eventGoods → ReduceEventGoods(W7 / Wc.esx,根委派 `Wc.esx(t, n.rpx_1)`)
|
||
// creatorTagState → ReduceCreatorTag(qO / ze.er2,根委派 `ze.er2(t, n.spx_1)`)
|
||
// rewardedVideosState → ReduceRewardedVideos(JQ / xh.zsl,根委派 `xh.zsl(t, n.upx_1)`)
|
||
// passwordChangeState → ReducePasswordChange(VD / uu.pr6,根委派 `uu.pr6(t, n.lpv_1)`)
|
||
// system → ReduceSystem(_9 / w9().xt9,根委派 `w9().xt9(t, n.mpv_1)`)
|
||
// contextTutorial → ReduceContextTutorial(Mst / Jst().tth,根委派 `Jst().tth(t, n.ypx_1)`)
|
||
// battleTutorial → ReduceBattleTutorial(rE / Q.sq8,根委派 `Q.sq8(t, n.cpv_1)`)
|
||
// spectator → ReduceSpectator(HA / Li.jqm,根委派 `Li.jqm(t, n.lpx_1)`)
|
||
// twoStepVerificationState → ReduceTwoStepVerification(x9 / _f.atb,根委派 `_f.atb(t, n.tpx_1)`)
|
||
// antiAddiction → ReduceAntiAddiction(UC / W.iq8,根委派 `W.iq8(t, n.kpx_1)`)
|
||
// moderation → ReduceModeration(NI / Ei.oqh,根委派 `Ei.oqh(t, n.mpx_1)`)
|
||
// migrationState → ReduceMigrationState($it / Uv.rtg,根委派 `Uv.rtg(t, n.ipv_1)`)
|
||
// register → ReduceRegister(Cit / cp.stg,根委派 `cp.stg(t, n.hpv_1)`)
|
||
// userReportsState → ReduceUserReports(Zst / qot.zth,根委派 `(null == sd && new qot(), sd).zth(t, n.dpy_1)`)
|
||
// friends → ReduceFriends(KD / NL().cr9,根委派 `NL().cr9(t, n.ypv_1)`)
|
||
// suppliesState → ReduceSupplies(wE / $t.fq9,根委派 `$t.fq9(t, n.ipw_1)`)
|
||
// clanUserInfo → ReduceClanUserInfo(hO / de.gr1,根委派 `de.gr1(t, n.opw_1)`)
|
||
// battleInviteState → ReduceBattleInvite(att / Ttt().nth,根委派 `Ttt().nth(t, n.cpx_1)`)
|
||
// partner → ReducePartner(UJ / `(inline@partner)`,根委派内联 IIFE)
|
||
// userRenameState → ReduceUserRename(O8 / Rf.pte,根委派 `Rf.pte(t, n.qpx_1)`)
|
||
// battlePauseState → ReduceBattlePause(dT / NT().mqc,根委派 `NT().mqc(t, n.lpw_1)`)
|
||
// battleViewState → ReduceBattleView(DT / sI.jqd,根委派 `(null == $n && new sI(), $n).jqd(t, n.mpw_1)`)
|
||
// tankActionsLogState → ReduceTankActionsLog(vI / wi.gqe,根委派 `wi.gqe(t, n.ppw_1)`)
|
||
// suppliesTutorial → ReduceSuppliesTutorial(ust / Uw.uth,根委派 `Uw.uth(t, n.zpx_1)`)
|
||
// clanChatState → ReduceClanChat(qnt / yv.qtg,根委派 `yv.qtg(t, n.ppv_1)`)
|
||
// battleSearchState → ReduceBattleSearch(Itt / Htt().vtg,根委派 `Htt().vtg(t, n.epw_1)`)
|
||
// battleStatistics → ReduceBattleStatistics(jR / rr.fqr,根委派 `rr.fqr(t, n.bpv_1)`)
|
||
// launchParams → 无 reducer(原根 reducer 原样透传;默认 `ag()` = emptyMap())
|
||
//
|
||
// 其余 23 个字段按原样透传(defaultValue 取原构造)。每个切片 reducer 对无关动作都返回原状态,
|
||
// 所以一次 copy 里串起全部已迁移 reducer,与按动作路由再归约的结果一致。
|
||
// 迁移进度与每个字段的证据见生成物 RootWiring.kt(不要手改)。
|
||
package App.State
|
||
|
||
import App.State.Reducers.ReduceAccountSettings
|
||
import App.State.Reducers.ReduceAnnouncement
|
||
import App.State.Reducers.ReduceAntiAddiction
|
||
import App.State.Reducers.ReduceBattleResult
|
||
import App.State.Reducers.ReduceBattlePause
|
||
import App.State.Reducers.ReduceBattleSearch
|
||
import App.State.Reducers.ReduceBattleStatistics
|
||
import App.State.Reducers.ReduceBattleTutorial
|
||
import App.State.Reducers.ReduceBattleView
|
||
import App.State.Reducers.ReduceBattleInvite
|
||
import App.State.Reducers.ReduceCaptcha
|
||
import App.State.Reducers.ReduceClanUserInfo
|
||
import App.State.Reducers.ReduceClanChat
|
||
import App.State.Reducers.ReduceContextTutorial
|
||
import App.State.Reducers.ReduceCreatorTag
|
||
import App.State.Reducers.ReduceDroppableGold
|
||
import App.State.Reducers.ReduceEntrance
|
||
import App.State.Reducers.ReduceEventGoods
|
||
import App.State.Reducers.ReduceGarage
|
||
import App.State.Reducers.ReduceGaragePreview
|
||
import App.State.Reducers.ReduceFriends
|
||
import App.State.Reducers.ReduceHome
|
||
import App.State.Reducers.ReduceIcons
|
||
import App.State.Reducers.ReduceInvite
|
||
import App.State.Reducers.ReduceLanguage
|
||
import App.State.Reducers.ReduceLocalBattleUser
|
||
import App.State.Reducers.ReduceLoginByPassword
|
||
import App.State.Reducers.ReduceLootBoxes
|
||
import App.State.Reducers.ReduceMainQuest
|
||
import App.State.Reducers.ReduceAvailabilityByRank
|
||
import App.State.Reducers.ReduceLobbyLoader
|
||
import App.State.Reducers.ReduceMigrationState
|
||
import App.State.Reducers.ReduceModalScreen
|
||
import App.State.Reducers.ReduceModeration
|
||
import App.State.Reducers.ReduceNews
|
||
import App.State.Reducers.ReduceNotificationByCountry
|
||
import App.State.Reducers.ReduceNotifications
|
||
import App.State.Reducers.ReducePasswordChange
|
||
import App.State.Reducers.ReducePartner
|
||
import App.State.Reducers.ReduceProBattle
|
||
import App.State.Reducers.ReducePromoCode
|
||
import App.State.Reducers.ReducePurchaseDialog
|
||
import App.State.Reducers.ReduceQuestCategories
|
||
import App.State.Reducers.ReduceQuests
|
||
import App.State.Reducers.ReduceRankUpDialog
|
||
import App.State.Reducers.ReduceReferralEvent
|
||
import App.State.Reducers.ReduceRegister
|
||
import App.State.Reducers.ReduceRewardedVideos
|
||
import App.State.Reducers.ReduceRulesUpdated
|
||
import App.State.Reducers.ReduceScreen
|
||
import App.State.Reducers.ReduceSecuritySettings
|
||
import App.State.Reducers.ReduceSpectator
|
||
import App.State.Reducers.ReduceSupportUrl
|
||
import App.State.Reducers.ReduceSettings
|
||
import App.State.Reducers.ReduceShop
|
||
import App.State.Reducers.ReduceSupplies
|
||
import App.State.Reducers.ReduceSuppliesTutorial
|
||
import App.State.Reducers.ReduceSystem
|
||
import App.State.Reducers.ReduceTankActionsLog
|
||
import App.State.Reducers.ReduceTips
|
||
import App.State.Reducers.ReduceTwitch
|
||
import App.State.Reducers.ReduceTwoStepVerification
|
||
import App.State.Reducers.ReduceUser
|
||
import App.State.Reducers.ReduceUserRename
|
||
import App.State.Reducers.ReduceUserReports
|
||
|
||
/** 根 reducer:`k6`。 */
|
||
object RootReducer {
|
||
|
||
/** 已迁移(强类型;launchParams 为透传)的字段名,来自生成物 RootWiring.Migrated。 */
|
||
val Migrated: Set<String> get() = RootWiring.Migrated
|
||
|
||
/** 形如「已迁移 3/89」,给日志与自检用。 */
|
||
val Coverage: String get() = "已迁移 ${Migrated.size}/${RootWiring.All.size}"
|
||
|
||
/**
|
||
* 归约一次。未迁移字段原样带过去(`copy` 只改已迁移的字段)。
|
||
*/
|
||
fun Reduce(State0: RootState, Action: Any): RootState = State0.copy(
|
||
InviteState = ReduceInvite(State0.InviteState, Action),
|
||
LoginByPassword = ReduceLoginByPassword(State0.LoginByPassword, Action),
|
||
TwitchState = ReduceTwitch(State0.TwitchState, Action),
|
||
Home = ReduceHome(State0.Home, Action),
|
||
LocalBattleUserState = ReduceLocalBattleUser(State0.LocalBattleUserState, Action),
|
||
Shop = ReduceShop(State0.Shop, Action),
|
||
Screen = ReduceScreen(State0.Screen, Action),
|
||
LootBoxes = ReduceLootBoxes(State0.LootBoxes, Action),
|
||
Garage = ReduceGarage(State0.Garage, Action),
|
||
GaragePreview = ReduceGaragePreview(State0.GaragePreview, Action),
|
||
Entrance = ReduceEntrance(State0.Entrance, Action),
|
||
User = ReduceUser(State0.User, Action),
|
||
Settings = ReduceSettings(State0.Settings, Action),
|
||
AccountSettings = ReduceAccountSettings(State0.AccountSettings, Action),
|
||
ProBattle = ReduceProBattle(State0.ProBattle, Action),
|
||
Language = ReduceLanguage(State0.Language, Action),
|
||
Announcement = ReduceAnnouncement(State0.Announcement, Action),
|
||
News = ReduceNews(State0.News, Action),
|
||
Notifications = ReduceNotifications(State0.Notifications, Action),
|
||
Quests = ReduceQuests(State0.Quests, Action),
|
||
LobbyLoader = ReduceLobbyLoader(State0.LobbyLoader, Action),
|
||
PurchaseDialogState = ReducePurchaseDialog(State0.PurchaseDialogState, Action),
|
||
PromoCode = ReducePromoCode(State0.PromoCode, Action),
|
||
SupportUrl = ReduceSupportUrl(State0.SupportUrl, Action),
|
||
RulesUpdated = ReduceRulesUpdated(State0.RulesUpdated, Action),
|
||
NotificationByCountry = ReduceNotificationByCountry(State0.NotificationByCountry, Action),
|
||
AvailabilityByRank = ReduceAvailabilityByRank(State0.AvailabilityByRank, Action),
|
||
Icons = ReduceIcons(State0.Icons, Action),
|
||
QuestCategories = ReduceQuestCategories(State0.QuestCategories, Action),
|
||
MainQuest = ReduceMainQuest(State0.MainQuest, Action),
|
||
SecuritySettings = ReduceSecuritySettings(State0.SecuritySettings, Action),
|
||
ReferralEvent = ReduceReferralEvent(State0.ReferralEvent, Action),
|
||
TipsState = ReduceTips(State0.TipsState, Action),
|
||
RankUpDialogState = ReduceRankUpDialog(State0.RankUpDialogState, Action),
|
||
BattleResult = ReduceBattleResult(State0.BattleResult, Action),
|
||
CaptchaState = ReduceCaptcha(State0.CaptchaState, Action),
|
||
ModalScreen = ReduceModalScreen(State0.ModalScreen, Action),
|
||
DroppableGold = ReduceDroppableGold(State0.DroppableGold, Action),
|
||
EventGoods = ReduceEventGoods(State0.EventGoods, Action),
|
||
CreatorTagState = ReduceCreatorTag(State0.CreatorTagState, Action),
|
||
RewardedVideosState = ReduceRewardedVideos(State0.RewardedVideosState, Action),
|
||
PasswordChangeState = ReducePasswordChange(State0.PasswordChangeState, Action),
|
||
System = ReduceSystem(State0.System, Action),
|
||
ContextTutorial = ReduceContextTutorial(State0.ContextTutorial, Action),
|
||
BattleTutorial = ReduceBattleTutorial(State0.BattleTutorial, Action),
|
||
Spectator = ReduceSpectator(State0.Spectator, Action),
|
||
TwoStepVerificationState = ReduceTwoStepVerification(State0.TwoStepVerificationState, Action),
|
||
AntiAddiction = ReduceAntiAddiction(State0.AntiAddiction, Action),
|
||
Moderation = ReduceModeration(State0.Moderation, Action),
|
||
MigrationState = ReduceMigrationState(State0.MigrationState, Action),
|
||
Register = ReduceRegister(State0.Register, Action),
|
||
UserReportsState = ReduceUserReports(State0.UserReportsState, Action),
|
||
Friends = ReduceFriends(State0.Friends, Action),
|
||
SuppliesState = ReduceSupplies(State0.SuppliesState, Action),
|
||
ClanUserInfo = ReduceClanUserInfo(State0.ClanUserInfo, Action),
|
||
BattleInviteState = ReduceBattleInvite(State0.BattleInviteState, Action),
|
||
Partner = ReducePartner(State0.Partner, Action),
|
||
UserRenameState = ReduceUserRename(State0.UserRenameState, Action),
|
||
BattlePauseState = ReduceBattlePause(State0.BattlePauseState, Action),
|
||
BattleViewState = ReduceBattleView(State0.BattleViewState, Action),
|
||
TankActionsLogState = ReduceTankActionsLog(State0.TankActionsLogState, Action),
|
||
SuppliesTutorial = ReduceSuppliesTutorial(State0.SuppliesTutorial, Action),
|
||
ClanChatState = ReduceClanChat(State0.ClanChatState, Action),
|
||
BattleSearchState = ReduceBattleSearch(State0.BattleSearchState, Action),
|
||
BattleStatistics = ReduceBattleStatistics(State0.BattleStatistics, Action),
|
||
)
|
||
}
|
||
|
||
/** 顶层入口,与切片 reducer 的 `ReduceXxx(State0, Action)` 命名保持一致。 */
|
||
fun ReduceRoot(State0: RootState, Action: Any): RootState = RootReducer.Reduce(State0, Action)
|