-
Notifications
You must be signed in to change notification settings - Fork 0
[Work 36] 위치 권한 조회를 Data 계층으로 이동했습니다. #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
586e307
FEAT: 위치 권한 상태 Domain 엔티티(LocationPermissionStatus) 추가
snughnu b2108af
FEAT: 위치 권한 조회를 위한 Domain 프로토콜(LocationPermissionRepository) 추가
snughnu 0c0fde8
FEAT: CoreLocationRepository가 LocationPermissionRepository를 구현하도록 추가
snughnu 79868d1
FEAT: 위치 권한 조회/구독/요청 UseCase(ObserveLocationPermissionUseCase) 추가
snughnu a71fc86
REFACTOR: MyPageViewModel의 위치 권한 조회를 CLLocationManager 직접 사용에서 Observ…
snughnu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
22 changes: 22 additions & 0 deletions
22
WhereAreYou/WhereAreYou/Domain/Entity/LocationPermissionStatus.swift
This file contains hidden or 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,22 @@ | ||
| // | ||
| // LocationPermissionStatus.swift | ||
| // WhereAreYou | ||
| // | ||
| // Created by 김성훈 on 8/13/26. | ||
| // | ||
|
|
||
| /// 위치 권한 상태 | ||
| enum LocationPermissionStatus { | ||
|
|
||
| /// 사용자가 아직 위치 권한을 허용/거부하지 않은 상태 (최초 상태) | ||
| case notDetermined | ||
| /// 사용자가 위치 권한을 명시적으로 거부한 상태 (설정 앱에서 직접 허용 필요) | ||
| case denied | ||
| /// 자녀 보호 기능 등 기기 정책으로 인해 위치 권한 자체를 사용할 수 없는 상태 (앱에서 변경 불가) | ||
| case restricted | ||
| /// 앱을 사용하지 않을 때도 항상 위치 접근이 허용된 상태 | ||
| case authorizedAlways | ||
| /// 앱을 사용하는 동안에만 위치 접근이 허용된 상태 | ||
| case authorizedWhenInUse | ||
|
|
||
| } |
20 changes: 20 additions & 0 deletions
20
WhereAreYou/WhereAreYou/Domain/Repository/LocationPermissionRepository.swift
This file contains hidden or 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,20 @@ | ||
| // | ||
| // LocationPermissionRepository.swift | ||
| // WhereAreYou | ||
| // | ||
| // Created by 김성훈 on 8/14/26. | ||
| // | ||
|
|
||
| import Combine | ||
|
|
||
| /// 위치 권한 상태의 조회 및 구독을 담당 | ||
| protocol LocationPermissionRepository { | ||
|
|
||
| /// 현재 위치 권한 상태 | ||
| var authorizationStatus: LocationPermissionStatus { get } | ||
| /// 위치 권한 상태가 변경될 때마다 발행되는 스트림 | ||
| var authorizationStatusPublisher: AnyPublisher<LocationPermissionStatus, Never> { get } | ||
| /// 위치 권한을 요청 | ||
| func requestAuthorization() | ||
|
|
||
| } |
34 changes: 34 additions & 0 deletions
34
WhereAreYou/WhereAreYou/Domain/UseCase/ObserveLocationPermissionUseCase.swift
This file contains hidden or 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,34 @@ | ||
| // | ||
| // ObserveLocationPermissionUseCase.swift | ||
| // WhereAreYou | ||
| // | ||
| // Created by 김성훈 on 8/14/26. | ||
| // | ||
|
|
||
| import Combine | ||
|
|
||
| /// 위치 권한 상태의 조회, 구독, 요청을 담당 | ||
| final class ObserveLocationPermissionUseCase { | ||
|
snughnu marked this conversation as resolved.
|
||
|
|
||
| private let repository: LocationPermissionRepository | ||
|
|
||
| init(repository: LocationPermissionRepository) { | ||
| self.repository = repository | ||
| } | ||
|
|
||
| /// 현재 위치 권한 상태 | ||
| var currentStatus: LocationPermissionStatus { | ||
| repository.authorizationStatus | ||
| } | ||
|
|
||
| /// 위치 권한 상태가 변경될 때마다 발행되는 스트림 | ||
| var statusPublisher: AnyPublisher<LocationPermissionStatus, Never> { | ||
| repository.authorizationStatusPublisher | ||
| } | ||
|
|
||
| /// 위치 권한을 요청 | ||
| func requestAuthorization() { | ||
| repository.requestAuthorization() | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.