Skip to content
This repository has been archived by the owner on Nov 17, 2024. It is now read-only.

Commit

Permalink
Repo // Allow Paimon to evaluate the warps.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShikiSuen committed Oct 2, 2023
1 parent 6ae4535 commit 108013f
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Common/UserDefaultKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ extension DefaultsKeys {
.init("checkedUpdateVersions", defaultValue: [])
}

/// Whether using Paimon to evaluate the gacha records.
var useGuestGachaEvaluator: DefaultsKey<Bool> {
.init("useGuestGachaEvaluator", defaultValue: false)
}

// MARK: - For widgets

var widgetTimelineLatestStartAppRefreshTime: DefaultsKey<Date?> {
Expand Down
10 changes: 6 additions & 4 deletions Features/Gacha/View/AccountGachaView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ private struct GachaStatisticSectionView: View {
if gachaType != .regularWarp {
VStack {
HStack {
Text("gacha.account_detail.statistic.pom_pom_review")
let keyPaimon = "gacha.account_detail.statistic.paimon_review"
let keyPomPom = "gacha.account_detail.statistic.pom_pom_review"
Text(Defaults[\.useGuestGachaEvaluator] ? keyPaimon : keyPomPom)
.font(.caption)
.foregroundColor(.secondary)
Spacer()
Expand All @@ -321,10 +323,10 @@ private struct GachaStatisticSectionView: View {
ForEach(Rank.allCases, id: \.rawValue) { rank in
Group {
if judgedRank == rank {
rank.image().resizable()
rank.image(neighborGame: Defaults[\.useGuestGachaEvaluator]).resizable()
.scaledToFit()
} else {
rank.image().resizable()
rank.image(neighborGame: Defaults[\.useGuestGachaEvaluator]).resizable()
.scaledToFit()
.opacity(0.25)
}
Expand All @@ -351,7 +353,7 @@ extension GachaStatisticSectionView.Rank {
case .two:
return neighborGame ? Image("UI_EmotionIcon4") : Image("Pom-Pom_Sticker_32")
case .three:
return neighborGame ? Image("UI_EmotionIcon6") : Image("Pom-Pom_Sticker_18")
return neighborGame ? Image("UI_EmotionIcon3") : Image("Pom-Pom_Sticker_18")
case .four:
return neighborGame ? Image("UI_EmotionIcon2") : Image("Pom-Pom_Sticker_24")
case .five:
Expand Down
12 changes: 12 additions & 0 deletions HSRPizzaHelper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
5BB6BD702ACAC529001D6847 /* DisplayOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BB6BD6F2ACAC529001D6847 /* DisplayOptionsView.swift */; };
BF06C4A52A04D42900EE9120 /* WebViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF06C4A42A04D42900EE9120 /* WebViews.swift */; };
BF06C4A82A04FD1F00EE9120 /* ReviewHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF06C4A72A04FD1F00EE9120 /* ReviewHandler.swift */; };
BF14CFA82A049ADB00E437C6 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = BF14CFAA2A049ADB00E437C6 /* Localizable.strings */; };
Expand Down Expand Up @@ -312,6 +313,7 @@
5B0BAC842A265E5700B0B8F8 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/HSRPizzaHelperWidget.strings"; sourceTree = "<group>"; };
5B0BAC852A265E5700B0B8F8 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
5B0BAC862A265E5700B0B8F8 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
5BB6BD6F2ACAC529001D6847 /* DisplayOptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayOptionsView.swift; sourceTree = "<group>"; };
BF06C4A42A04D42900EE9120 /* WebViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViews.swift; sourceTree = "<group>"; };
BF06C4A72A04FD1F00EE9120 /* ReviewHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewHandler.swift; sourceTree = "<group>"; };
BF14CFA92A049ADB00E437C6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -549,6 +551,14 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
5BB6BD6E2ACAC514001D6847 /* SubViews */ = {
isa = PBXGroup;
children = (
5BB6BD6F2ACAC529001D6847 /* DisplayOptionsView.swift */,
);
path = SubViews;
sourceTree = "<group>";
};
BF14CFA72A049AC100E437C6 /* Internationalization */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1105,6 +1115,7 @@
EAE519CA2A0178D100EF23B7 /* View */ = {
isa = PBXGroup;
children = (
5BB6BD6E2ACAC514001D6847 /* SubViews */,
EADA63762A0201B200BF070F /* HomeView.swift */,
EAE37EBE2A0206AC00154432 /* SettingView.swift */,
EA1D523D2A76521E00FA66A9 /* ToolView.swift */,
Expand Down Expand Up @@ -1545,6 +1556,7 @@
EA5F23322A0BE87000D6D024 /* OnFocused.swift in Sources */,
EA742BF92A020B8700ACB8E4 /* GetCookieWebView.swift in Sources */,
EA2C06522A04AC5A00A328E6 /* TestAccountSectionView.swift in Sources */,
5BB6BD702ACAC529001D6847 /* DisplayOptionsView.swift in Sources */,
EAE519822A01738600EF23B7 /* ContentView.swift in Sources */,
EA1D523E2A76521E00FA66A9 /* ToolView.swift in Sources */,
EADA63752A01FF8B00BF070F /* DailyNoteViewModel.swift in Sources */,
Expand Down
9 changes: 9 additions & 0 deletions HSRPizzaHelper/View/SettingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ struct SettingView: View {
Image(systemSymbol: .bellBadgeFill)
}
}
NavigationLink {
DisplayOptionsView()
} label: {
Label {
Text("setting.uirelated.title")
} icon: {
Image(systemSymbol: .uiwindowSplit2x1)
}
}
}
Section {
Button {
Expand Down
38 changes: 38 additions & 0 deletions HSRPizzaHelper/View/SubViews/DisplayOptionsView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// DisplayOptionsView.swift
// HSRPizzaHelper
//
// Created by ShikiSuen on 2023/10/2.
//

import SwiftUI
import SwiftyUserDefaults

struct DisplayOptionsView: View {
@State var useGuestGachaEvaluator = Binding(
get: {
Defaults[\.useGuestGachaEvaluator]
},
set: {
Defaults[\.useGuestGachaEvaluator] = $0
}
)

var body: some View {
Group {
mainView()
}
.inlineNavigationTitle("setting.uirelated.title")
}

@ViewBuilder
func mainView() -> some View {
List {
Section {
Toggle(isOn: useGuestGachaEvaluator) {
Text("setting.uirelated.useguestgachaevaluator")
}
}
}
}
}

0 comments on commit 108013f

Please sign in to comment.