Skip to content

Commit bd69439

Browse files
authored
Merge pull request #288 from TaskarCenterAtUW/task-2348-Create-Debug-App
Task 2348 create debug app
2 parents e038d77 + fb68f02 commit bd69439

File tree

3 files changed

+65
-27
lines changed

3 files changed

+65
-27
lines changed

GoInfoGame/GoInfoGame.xcodeproj/project.pbxproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,9 +1809,9 @@
18091809
isa = PBXNativeTarget;
18101810
buildConfigurationList = FAD5C5192AFCBE720040C61A /* Build configuration list for PBXNativeTarget "GoInfoGame" */;
18111811
buildPhases = (
1812+
3A8B389D639C310AE1E29BEB /* [CP] Check Pods Manifest.lock */,
18121813
C7927B562E42364100A7A34E /* SwiftGen */,
18131814
C77AACA72E44738A006713B2 /* Copy GoogleService-Info.plist */,
1814-
3A8B389D639C310AE1E29BEB /* [CP] Check Pods Manifest.lock */,
18151815
FAD5C4EB2AFCBE700040C61A /* Sources */,
18161816
FAD5C4EC2AFCBE700040C61A /* Frameworks */,
18171817
FAD5C4ED2AFCBE700040C61A /* Resources */,
@@ -2895,7 +2895,7 @@
28952895
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
28962896
CODE_SIGN_IDENTITY = "Apple Development";
28972897
CODE_SIGN_STYLE = Automatic;
2898-
CURRENT_PROJECT_VERSION = 4;
2898+
CURRENT_PROJECT_VERSION = 1;
28992899
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
29002900
DEVELOPMENT_TEAM = G8MQVE5WWW;
29012901
ENABLE_USER_SCRIPT_SANDBOXING = NO;
@@ -2918,7 +2918,7 @@
29182918
"$(inherited)",
29192919
"@executable_path/Frameworks",
29202920
);
2921-
MARKETING_VERSION = 1.0;
2921+
MARKETING_VERSION = 1.0.1;
29222922
OTHER_LDFLAGS = (
29232923
"$(inherited)",
29242924
"-l\"c++\"",
@@ -2960,7 +2960,7 @@
29602960
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
29612961
CODE_SIGN_IDENTITY = "Apple Development";
29622962
CODE_SIGN_STYLE = Automatic;
2963-
CURRENT_PROJECT_VERSION = 4;
2963+
CURRENT_PROJECT_VERSION = 1;
29642964
DEVELOPMENT_TEAM = G8MQVE5WWW;
29652965
ENABLE_USER_SCRIPT_SANDBOXING = NO;
29662966
GENERATE_INFOPLIST_FILE = YES;
@@ -2982,7 +2982,7 @@
29822982
"$(inherited)",
29832983
"@executable_path/Frameworks",
29842984
);
2985-
MARKETING_VERSION = 1.0;
2985+
MARKETING_VERSION = 1.0.1;
29862986
OTHER_LDFLAGS = (
29872987
"$(inherited)",
29882988
"-l\"c++\"",

GoInfoGame/GoInfoGame/Login/View/PosmLogin.swift

Lines changed: 60 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ struct PosmLoginView: View {
1717

1818
@State private var selectedEnvironment: APIEnvironment = .production
1919
@State private var showAlert = false
20+
@State private var debugMode: Bool = false
21+
@State private var showEnableDebugModeAlert: Bool = false
22+
@State private var showDisableDebugModeAlert: Bool = false
2023

2124
var body: some View {
2225
NavigationStack {
@@ -59,29 +62,29 @@ struct PosmLoginView: View {
5962
.padding(10)
6063
.cornerRadius(10)
6164
.padding(.horizontal, 40)
62-
#if DEBUG
63-
Menu {
64-
ForEach(APIEnvironment.allCases, id: \.self) { environment in
65-
Button(action: {
66-
selectedEnvironment = environment
67-
APIConfiguration.shared.environment = environment
68-
}) {
69-
Text(environment.rawValue)
65+
if debugMode {
66+
Menu {
67+
ForEach(APIEnvironment.allCases, id: \.self) { environment in
68+
Button(action: {
69+
selectedEnvironment = environment
70+
APIConfiguration.shared.environment = environment
71+
}) {
72+
Text(environment.rawValue)
73+
}
7074
}
75+
} label: {
76+
HStack {
77+
Text("Environment: \(selectedEnvironment.rawValue)")
78+
.foregroundColor(.black)
79+
Image(systemName: "chevron.down")
80+
}
81+
.padding()
82+
.background(Color(.systemGray6))
83+
.cornerRadius(10)
7184
}
72-
} label: {
73-
HStack {
74-
Text("Environment: \(selectedEnvironment.rawValue)")
75-
.foregroundColor(.black)
76-
Image(systemName: "chevron.down")
77-
}
78-
.padding()
79-
.background(Color(.systemGray6))
80-
.cornerRadius(10)
85+
.padding(.horizontal, 40)
8186
}
82-
.padding(.horizontal, 40)
8387

84-
#endif
8588
Button(action: {
8689
APIConfiguration.shared.environment = selectedEnvironment
8790
viewModel.performLogin(for: selectedEnvironment)
@@ -138,7 +141,23 @@ struct PosmLoginView: View {
138141
}
139142

140143
Spacer()
144+
if debugMode {
145+
Button {
146+
showDisableDebugModeAlert = true
147+
} label: {
148+
Text("Exit debug mode")
149+
.font(FontFamily.Lato.bold.swiftUIFont(size: 16))
150+
.foregroundColor(Asset.Colors.d74BA827Pink.swiftUIColor)
151+
}
152+
.padding(.bottom, 5)
153+
}
141154
appVersionText
155+
.accessibilityRespondsToUserInteraction()
156+
.onTapGesture(count: 7, perform: {
157+
if !debugMode {
158+
showEnableDebugModeAlert = true
159+
}
160+
})
142161
}
143162
.padding([.top], 0)
144163

@@ -166,6 +185,27 @@ struct PosmLoginView: View {
166185
} message: {
167186
Text("Would you like to use Face ID or Touch ID for faster logins?")
168187
}
188+
.alert("Debug mode", isPresented: $showEnableDebugModeAlert) {
189+
Button("Enable") {
190+
debugMode = true
191+
}
192+
Button("Not Now", role: .cancel) {
193+
194+
}
195+
} message: {
196+
Text("Do you want to enable debug mode?")
197+
}
198+
.alert("Debug mode", isPresented: $showDisableDebugModeAlert) {
199+
Button("Disable") {
200+
selectedEnvironment = .production
201+
debugMode = false
202+
}
203+
Button("Not Now", role: .cancel) {
204+
205+
}
206+
} message: {
207+
Text("Do you want to disable debug mode?")
208+
}
169209
.onReceive(NotificationCenter.default.publisher(for: Notification.Name("SessionExpired"))) { notification in
170210
showAlert = true
171211
}
@@ -178,8 +218,7 @@ struct PosmLoginView: View {
178218

179219
var appVersionText: Text {
180220
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "N/A"
181-
let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "N/A"
182-
return Text("Version \(version) (\(build))")
221+
return Text("Version \(version)")
183222
.font(FontFamily.Lato.medium.swiftUIFont(size: 16))
184223
.foregroundColor(Asset.Colors._83879BTextFiledTitle.swiftUIColor)
185224
}

GoInfoGame/GoInfoGame/SceneDelegate.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
4141
window.makeKeyAndVisible()
4242
}
4343
}
44-
4544
}
4645

4746
func sceneDidDisconnect(_ scene: UIScene) {

0 commit comments

Comments
 (0)