Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
20dea6b
[IMP-3] Create AsyncPinger
shineRR May 18, 2025
655deb6
[IMP-3] Add sequenceNumber
shineRR May 24, 2025
f6d5b5d
Update structure
shineRR May 25, 2025
d08e3ad
Update README.md
shineRR May 25, 2025
ff08c46
Update example
shineRR May 25, 2025
a0ef2a2
Merge branch 'feature/refactoring' of https://github.com/shineRR/ping…
shineRR May 25, 2025
f281239
Update README.md
shineRR Jun 7, 2025
75a13a2
[IMP-3] Update showroom
shineRR Jun 22, 2025
00bbd3d
[IMP-3] Update request
shineRR Jun 22, 2025
5e57496
[IMP-3] Add configuration
shineRR Jun 22, 2025
9ba6879
[IMP-3] Update tests
shineRR Jun 28, 2025
a2f729b
[IMP-3] Update default configuration
shineRR Jun 28, 2025
a9b0c9c
[IMP-3] Update tests and add request identifier
shineRR Jun 28, 2025
88fb017
[IMP-3] Minor fix
shineRR Jun 29, 2025
71f414f
[IMP-3] Minor fix
shineRR Jun 29, 2025
49e771b
[IMP-3] Minor fix
shineRR Jun 29, 2025
333e2fb
Update README.md
shineRR Jun 29, 2025
46e1276
Merge branch 'feature/refactoring' of https://github.com/shineRR/ping…
shineRR Jun 29, 2025
fcaaf3f
Update README.md
shineRR Jun 29, 2025
e955d5f
[IMP-3] Update payload
shineRR Jul 5, 2025
0637a94
[IMP-3] Update pinger tests
shineRR Jul 6, 2025
f893e2b
[IMP-3] Fix misuse issue
shineRR Jul 13, 2025
5187338
[IMP-3] Minor fix
shineRR Jul 13, 2025
f4b7f0b
[IMP-3] Fix lint issues
shineRR Jul 13, 2025
122b5b2
Update swift.yml
shineRR Jul 13, 2025
0629fdb
Update swift.yml
shineRR Jul 13, 2025
92bc0a2
[IMP-3] Increase timeout
shineRR Jul 13, 2025
c7487ec
Merge branch 'feature/refactoring' of https://github.com/shineRR/ping…
shineRR Jul 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: macos-latest
steps:
- name: 🔨 Select Xcode
run: xcodes select 16.1
run: xcodes select 16.2
- name: Checkout Code
uses: actions/checkout@v4
- name: 🛠️ Build
Expand All @@ -24,11 +24,11 @@ jobs:
runs-on: macos-latest
steps:
- name: 🔨 Select Xcode
run: xcodes select 16.1
run: xcodes select 16.2
- name: Checkout Code
uses: actions/checkout@v4
- name: 🧪 Run tests
run: xcodebuild test -scheme "pingx" -testPlan "pingx" -destination "OS=18.1,name=iPhone 16 Pro"
run: xcodebuild test -scheme "pingx" -testPlan "pingx" -destination "OS=18.2,name=iPhone 16 Pro"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
Expand Down
2 changes: 1 addition & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use_frameworks!

platform :ios, '10.0'
platform :ios, '16.0'

target 'pingx_Example' do
pod 'pingx', :path => '../'
Expand Down
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- pingx (1.0.9)
- pingx (1.1.0)

DEPENDENCIES:
- pingx (from `../`)
Expand All @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
pingx: 2f1582e813a34ebcc3915fdaefb09e3dc93f3473
pingx: dbb0887216ff095cfb8ffad2f7f10f07f71c4053

PODFILE CHECKSUM: 4c5247958d334b884adb4a4531fca1e4770e66c2
PODFILE CHECKSUM: ddeffc2916e764f9db59b21e77dbf1eac5714944

COCOAPODS: 1.16.2
96 changes: 74 additions & 22 deletions Example/pingx.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,30 @@
objects = {

/* Begin PBXBuildFile section */
146872512D23313B00373862 /* Presenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1468724D2D23313B00373862 /* Presenter.swift */; };
145E71772E0FFF6100F92C01 /* PingResultDisplayModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 145E71762E0FFF5D00F92C01 /* PingResultDisplayModel.swift */; };
1467664E2DE31BFD00B89B10 /* CallbackPingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1467664D2DE31BFD00B89B10 /* CallbackPingView.swift */; };
146766502DE31C0E00B89B10 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1467664F2DE31C0E00B89B10 /* HomeView.swift */; };
146766522DE31D1000B89B10 /* CallbackPingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146766512DE31D0A00B89B10 /* CallbackPingViewModel.swift */; };
146766552DE322BC00B89B10 /* AsyncPingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146766542DE322BC00B89B10 /* AsyncPingView.swift */; };
146766572DE322C200B89B10 /* AsyncPingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146766562DE322BF00B89B10 /* AsyncPingViewModel.swift */; };
146872522D23313B00373862 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 146872472D23313B00373862 /* AppDelegate.swift */; };
146872532D23313B00373862 /* PresenterImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1468724E2D23313B00373862 /* PresenterImpl.swift */; };
146872542D23313B00373862 /* PingxView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1468724C2D23313B00373862 /* PingxView.swift */; };
146872552D23313B00373862 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1468724F2D23313B00373862 /* ViewController.swift */; };
146872572D23313B00373862 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1468724B2D23313B00373862 /* LaunchScreen.xib */; };
146872582D23313B00373862 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 146872482D23313B00373862 /* Images.xcassets */; };
FE343DB94858EB002C0DA943 /* Pods_pingx_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7978D2CD5145265FA076CCB8 /* Pods_pingx_Example.framework */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
145E71762E0FFF5D00F92C01 /* PingResultDisplayModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PingResultDisplayModel.swift; sourceTree = "<group>"; };
1467664D2DE31BFD00B89B10 /* CallbackPingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallbackPingView.swift; sourceTree = "<group>"; };
1467664F2DE31C0E00B89B10 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = "<group>"; };
146766512DE31D0A00B89B10 /* CallbackPingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallbackPingViewModel.swift; sourceTree = "<group>"; };
146766542DE322BC00B89B10 /* AsyncPingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsyncPingView.swift; sourceTree = "<group>"; };
146766562DE322BF00B89B10 /* AsyncPingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsyncPingViewModel.swift; sourceTree = "<group>"; };
1468721D2D2330C500373862 /* pingx_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = pingx_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
146872472D23313B00373862 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
146872482D23313B00373862 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
146872492D23313B00373862 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1468724A2D23313B00373862 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
1468724C2D23313B00373862 /* PingxView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PingxView.swift; sourceTree = "<group>"; };
1468724D2D23313B00373862 /* Presenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Presenter.swift; sourceTree = "<group>"; };
1468724E2D23313B00373862 /* PresenterImpl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PresenterImpl.swift; sourceTree = "<group>"; };
1468724F2D23313B00373862 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
16ECE250B3B64C6E99822325 /* Pods-pingx_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-pingx_Example.release.xcconfig"; path = "Target Support Files/Pods-pingx_Example/Pods-pingx_Example.release.xcconfig"; sourceTree = "<group>"; };
27E15695FB38592072BFDC43 /* Pods-pingx.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-pingx.release.xcconfig"; path = "Target Support Files/Pods-pingx/Pods-pingx.release.xcconfig"; sourceTree = "<group>"; };
7978D2CD5145265FA076CCB8 /* Pods_pingx_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_pingx_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -46,6 +50,50 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
145E71752E0FFF5400F92C01 /* DisplayModels */ = {
isa = PBXGroup;
children = (
145E71762E0FFF5D00F92C01 /* PingResultDisplayModel.swift */,
);
path = DisplayModels;
sourceTree = "<group>";
};
146766482DE31BC200B89B10 /* Views */ = {
isa = PBXGroup;
children = (
146766532DE322AE00B89B10 /* AsyncPingView */,
1467664A2DE31BD400B89B10 /* HomeView */,
146766492DE31BCD00B89B10 /* CallbackPingView */,
);
path = Views;
sourceTree = "<group>";
};
146766492DE31BCD00B89B10 /* CallbackPingView */ = {
isa = PBXGroup;
children = (
146766512DE31D0A00B89B10 /* CallbackPingViewModel.swift */,
1467664D2DE31BFD00B89B10 /* CallbackPingView.swift */,
);
path = CallbackPingView;
sourceTree = "<group>";
};
1467664A2DE31BD400B89B10 /* HomeView */ = {
isa = PBXGroup;
children = (
1467664F2DE31C0E00B89B10 /* HomeView.swift */,
);
path = HomeView;
sourceTree = "<group>";
};
146766532DE322AE00B89B10 /* AsyncPingView */ = {
isa = PBXGroup;
children = (
146766562DE322BF00B89B10 /* AsyncPingViewModel.swift */,
146766542DE322BC00B89B10 /* AsyncPingView.swift */,
);
path = AsyncPingView;
sourceTree = "<group>";
};
146872142D2330C500373862 = {
isa = PBXGroup;
children = (
Expand All @@ -67,14 +115,12 @@
146872502D23313B00373862 /* pingx */ = {
isa = PBXGroup;
children = (
145E71752E0FFF5400F92C01 /* DisplayModels */,
146766482DE31BC200B89B10 /* Views */,
146872472D23313B00373862 /* AppDelegate.swift */,
146872482D23313B00373862 /* Images.xcassets */,
146872492D23313B00373862 /* Info.plist */,
1468724B2D23313B00373862 /* LaunchScreen.xib */,
1468724C2D23313B00373862 /* PingxView.swift */,
1468724D2D23313B00373862 /* Presenter.swift */,
1468724E2D23313B00373862 /* PresenterImpl.swift */,
1468724F2D23313B00373862 /* ViewController.swift */,
);
path = pingx;
sourceTree = "<group>";
Expand Down Expand Up @@ -214,11 +260,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
146872512D23313B00373862 /* Presenter.swift in Sources */,
1467664E2DE31BFD00B89B10 /* CallbackPingView.swift in Sources */,
146766572DE322C200B89B10 /* AsyncPingViewModel.swift in Sources */,
146872522D23313B00373862 /* AppDelegate.swift in Sources */,
146872532D23313B00373862 /* PresenterImpl.swift in Sources */,
146872542D23313B00373862 /* PingxView.swift in Sources */,
146872552D23313B00373862 /* ViewController.swift in Sources */,
145E71772E0FFF6100F92C01 /* PingResultDisplayModel.swift in Sources */,
146766522DE31D1000B89B10 /* CallbackPingViewModel.swift in Sources */,
146766502DE31C0E00B89B10 /* HomeView.swift in Sources */,
146766552DE322BC00B89B10 /* AsyncPingView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -244,9 +292,9 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = GX6R5HS8S3;
DEVELOPMENT_TEAM = "";
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = pingx/Info.plist;
Expand All @@ -256,7 +304,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -267,6 +315,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -280,9 +329,9 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = GX6R5HS8S3;
DEVELOPMENT_TEAM = "";
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = pingx/Info.plist;
Expand All @@ -292,7 +341,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -302,6 +351,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down Expand Up @@ -367,6 +417,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_STRICT_CONCURRENCY = complete;
};
name = Debug;
};
Expand Down Expand Up @@ -422,6 +473,7 @@
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_STRICT_CONCURRENCY = complete;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down
7 changes: 2 additions & 5 deletions Example/pingx/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import UIKit
import SwiftUI

// MARK: - AppDelegate

Expand All @@ -11,11 +11,8 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
let presenter = PresenterImpl()
let viewController = ViewController(presenter: presenter)

window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = viewController
window?.rootViewController = UIHostingController(rootView: HomeView())
window?.makeKeyAndVisible()

return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,22 @@
// SOFTWARE.
//

import Foundation
import pingx

// sourcery: AutoMockable
protocol TimerFactory {
func createDispatchSourceTimer(
timeInterval: TimeInterval,
eventQueue: DispatchQueue,
eventHandler: @escaping () -> Void
) -> PingxTimer
struct PingResultDisplayModel {
let pingResult: PingResult

func makeUserFriendlyMessage() -> String {
switch pingResult {
case .success(let response):
return """
Success
Destination: \(response.destination.address),
Response time: \(String(format: "%.05f", response.duration.milliseconds)) ms,
Sequence number: \(response.sequenceNumber)
"""
case .failure(let error):
return "Error: \(error.errorDescription ?? "")"
}
}
}
3 changes: 0 additions & 3 deletions Example/pingx/PingxView.swift

This file was deleted.

5 changes: 0 additions & 5 deletions Example/pingx/Presenter.swift

This file was deleted.

54 changes: 0 additions & 54 deletions Example/pingx/PresenterImpl.swift

This file was deleted.

Loading
Loading