From 8d59ef825e8462834f7f452ccb0b047b425be1ce Mon Sep 17 00:00:00 2001 From: "emerge-tools-ai[bot]" <166171007+emerge-tools-ai[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 17:28:23 +0000 Subject: [PATCH 1/3] Delete file `ios/HackerNews/Network/NetworkDebugger.swift` containing `NetworkDebugger`. --- ios/HackerNews/Network/NetworkDebugger.swift | 35 -------------------- 1 file changed, 35 deletions(-) delete mode 100644 ios/HackerNews/Network/NetworkDebugger.swift diff --git a/ios/HackerNews/Network/NetworkDebugger.swift b/ios/HackerNews/Network/NetworkDebugger.swift deleted file mode 100644 index 69efe7c9..00000000 --- a/ios/HackerNews/Network/NetworkDebugger.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// NetworkDebugger.swift -// Hacker News -// -// Created by Trevor Elkins on 3/21/24. -// - -import Foundation - -// Prints out interesting stats for a URLResponse! -class NetworkDebugger { - static func printStats(for response: URLResponse) { - guard let httpResponse = response as? HTTPURLResponse else { - print("The response is not an HTTP URL response.") - return - } - - if let url = httpResponse.url { - print("URL: \(url.absoluteString)") - } - - print("Status Code: \(httpResponse.statusCode)") - - if let mimeType = httpResponse.mimeType { - print("MIME Type: \(mimeType)") - } - - print("Expected Content Length: \(httpResponse.expectedContentLength)") - - print("Header Fields:") - for (key, value) in httpResponse.allHeaderFields { - print("\(key): \(value)") - } - } -} From 2f7df0991a78f70bcb63dd1c75a2686fd22a81eb Mon Sep 17 00:00:00 2001 From: "emerge-tools-ai[bot]" <166171007+emerge-tools-ai[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 17:28:24 +0000 Subject: [PATCH 2/3] Update project file to remove NetworkDebugger --- ios/HackerNews.xcodeproj/project.pbxproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ios/HackerNews.xcodeproj/project.pbxproj b/ios/HackerNews.xcodeproj/project.pbxproj index 72771900..98c9ceca 100644 --- a/ios/HackerNews.xcodeproj/project.pbxproj +++ b/ios/HackerNews.xcodeproj/project.pbxproj @@ -13,7 +13,6 @@ A40DC1FA2C20D8B60055B920 /* Previews.swift in Sources */ = {isa = PBXBuildFile; fileRef = A40DC1F92C20D8B60055B920 /* Previews.swift */; }; A413E8572A8C40E800C0F867 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A413E8562A8C40E800C0F867 /* Extensions.swift */; }; A413E8592A8D868500C0F867 /* ThemedButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = A413E8582A8D868500C0F867 /* ThemedButtonStyle.swift */; }; - A423B0682BAE05FB00267DDB /* NetworkDebugger.swift in Sources */ = {isa = PBXBuildFile; fileRef = A423B0672BAE05FB00267DDB /* NetworkDebugger.swift */; }; A423B06A2BAE061600267DDB /* Flags.swift in Sources */ = {isa = PBXBuildFile; fileRef = A423B0692BAE061600267DDB /* Flags.swift */; }; A427057D2A4293B10057E439 /* HNApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A427057C2A4293B10057E439 /* HNApp.swift */; }; A427057F2A4293B10057E439 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A427057E2A4293B10057E439 /* ContentView.swift */; }; @@ -77,7 +76,6 @@ A40DC1F92C20D8B60055B920 /* Previews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Previews.swift; sourceTree = ""; }; A413E8562A8C40E800C0F867 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; A413E8582A8D868500C0F867 /* ThemedButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemedButtonStyle.swift; sourceTree = ""; }; - A423B0672BAE05FB00267DDB /* NetworkDebugger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkDebugger.swift; sourceTree = ""; }; A423B0692BAE061600267DDB /* Flags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Flags.swift; sourceTree = ""; }; A42705792A4293B10057E439 /* HackerNews.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HackerNews.app; sourceTree = BUILT_PRODUCTS_DIR; }; A427057C2A4293B10057E439 /* HNApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HNApp.swift; sourceTree = ""; }; @@ -190,7 +188,6 @@ isa = PBXGroup; children = ( A42705AC2A429D2E0057E439 /* HNApi.swift */, - A423B0672BAE05FB00267DDB /* NetworkDebugger.swift */, ); path = Network; sourceTree = ""; @@ -559,7 +556,6 @@ A49933952AA28B6500DED8B1 /* StoryScreen.swift in Sources */, A42705A72A42949D0057E439 /* AppViewModel.swift in Sources */, A42705AD2A429D2E0057E439 /* HNApi.swift in Sources */, - A423B0682BAE05FB00267DDB /* NetworkDebugger.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; From c01199893b6737761908541e30b362e2194b0d3d Mon Sep 17 00:00:00 2001 From: "emerge-tools-ai[bot]" <166171007+emerge-tools-ai[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 17:28:40 +0000 Subject: [PATCH 3/3] Delete NetworkDebugger in ios/HackerNews/Network/HNApi.swift --- ios/HackerNews/Network/HNApi.swift | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ios/HackerNews/Network/HNApi.swift b/ios/HackerNews/Network/HNApi.swift index e1082b3a..0a618b5e 100644 --- a/ios/HackerNews/Network/HNApi.swift +++ b/ios/HackerNews/Network/HNApi.swift @@ -19,9 +19,6 @@ class HNApi { do { let (data, response) = try await URLSession.shared.data(from: url) - if Flags.isEnabled(.networkDebugger) { - NetworkDebugger.printStats(for: response) - } let decoder = JSONDecoder() let storyIds = try decoder.decode([Int64].self, from: data) let items = await fetchItems(ids: Array(storyIds.prefix(20))) @@ -43,9 +40,6 @@ class HNApi { taskGroup.addTask { let url = URL(string: "https://hacker-news.firebaseio.com/v0/item/\(id).json")! let (data, response) = try await URLSession.shared.data(from: url) - if Flags.isEnabled(.networkDebugger) { - NetworkDebugger.printStats(for: response) - } let decoder = JSONDecoder() // print("Received response: \(response)") // if let str = String(data: data, encoding: .utf8) {