-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from AsyncSwift/development
Check app clip
- Loading branch information
Showing
6 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Sources/AsyncLocationKit/Settings/LocationPermission.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Pavel Grechikhin on 29.10.2022. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum LocationPermission { | ||
case always | ||
case whenInUsage | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
import XCTest | ||
import CoreLocation | ||
@testable import AsyncLocationKit | ||
|
||
final class AsyncLocationKitTests: XCTestCase { | ||
let locationManager = AsyncLocationManager(locationManager: MockLocationManager(), desiredAccuracy: .bestAccuracy) | ||
|
||
func testRequestLocation() async { | ||
do { | ||
let location = try await locationManager.requestLocation() | ||
|
||
switch location { | ||
case .didUpdateLocations(let locations): | ||
print(locations) | ||
XCTAssert(true) | ||
default: | ||
XCTAssert(false, "Something went wrong") | ||
} | ||
|
||
} catch { | ||
XCTAssert(false, error.localizedDescription) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Pavel Grechikhin on 29.10.2022. | ||
// | ||
|
||
import Foundation | ||
import CoreLocation | ||
|
||
class MockLocationManager: CLLocationManager { | ||
override var location: CLLocation? { | ||
return CLLocation(latitude: 100, longitude: 200) | ||
} | ||
|
||
override func requestLocation() { | ||
delegate?.locationManager?(self, didUpdateLocations: [location!]) | ||
} | ||
} |