-
Notifications
You must be signed in to change notification settings - Fork 4
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 #106 from boostcamp3-iOS/develop
0.1.2
- Loading branch information
Showing
71 changed files
with
1,732 additions
and
1,272 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// | ||
// LocationObserver.swift | ||
// FineDust | ||
// | ||
// Created by Presto on 06/02/2019. | ||
// Copyright © 2019 boostcamp3rd. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
/// 위치 정보 관련 옵저버 프로토콜. | ||
/// | ||
/// `registerLocationObserver()` 메소드를 `viewDidLoad()`에서 호출하여 옵저버 등록. | ||
/// `unregisterLocationObserver()` 메소드를 `deinit`에서 호출하여 옵저버 해제. | ||
protocol LocationObserver: class { | ||
|
||
/// 위치 정보 갱신 작업이 성공했을 때의 핸들러. | ||
func handleIfSuccess(_ notification: Notification) | ||
|
||
/// 위치 정보 갱신 작업이 실패했을 때의 핸들러. | ||
func handleIfFail(_ notification: Notification) | ||
|
||
/// 위치 정보 권한이 허용되지 않았을 때의 핸들러. | ||
func handleIfAuthorizationDenied(_ notification: Notification) | ||
|
||
/// 위치 정보 옵저버 등록. | ||
func registerLocationObserver() | ||
|
||
/// 위치 정보 옵저버 해제. | ||
func unregisterLocationObserver() | ||
} | ||
|
||
// MARK: - LocationObserver 프로토콜 초기 구현 | ||
|
||
extension LocationObserver where Self: UIViewController { | ||
|
||
/// 위의 세 경우에 대한 옵저버 등록. | ||
func registerLocationObserver() { | ||
NotificationCenter.default.addObserver( | ||
forName: .didSuccessUpdatingAllLocationTasks, | ||
object: nil, | ||
queue: nil) { [weak self] notification in | ||
self?.handleIfSuccess(notification) | ||
} | ||
NotificationCenter.default.addObserver( | ||
forName: .didFailUpdatingAllLocationTasks, | ||
object: nil, | ||
queue: nil) { [weak self] notification in | ||
self?.handleIfFail(notification) | ||
} | ||
NotificationCenter.default.addObserver( | ||
forName: .locationPermissionDenied, | ||
object: nil, | ||
queue: nil) { [weak self] notification in | ||
self?.handleIfAuthorizationDenied(notification) | ||
} | ||
} | ||
|
||
/// 위의 세 경우에 대한 옵저버 해제. | ||
func unregisterLocationObserver() { | ||
NotificationCenter.default.removeObserver( | ||
self, | ||
name: .didSuccessUpdatingAllLocationTasks, | ||
object: nil | ||
) | ||
NotificationCenter.default.removeObserver( | ||
self, | ||
name: .didFailUpdatingAllLocationTasks, | ||
object: nil | ||
) | ||
NotificationCenter.default.removeObserver( | ||
self, | ||
name: .locationPermissionDenied, | ||
object: nil | ||
) | ||
} | ||
} |
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
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,16 @@ | ||
// | ||
// CoreDataIntakeManager.swift | ||
// FineDust | ||
// | ||
// Created by Presto on 11/02/2019. | ||
// Copyright © 2019 boostcamp3rd. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
final class CoreDataIntakeManager: CoreDataIntakeManagerType { | ||
|
||
static let shared = CoreDataIntakeManager() | ||
|
||
private init() { } | ||
} |
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
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,16 @@ | ||
// | ||
// CoreDataUserManager.swift | ||
// FineDust | ||
// | ||
// Created by Presto on 11/02/2019. | ||
// Copyright © 2019 boostcamp3rd. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
final class CoreDataUserManager: CoreDataUserManagerType { | ||
|
||
static let shared = CoreDataUserManager() | ||
|
||
private init() { } | ||
} |
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
6 changes: 3 additions & 3 deletions
6
FineDust/Core Data/FineDust.xcdatamodeld/FineDust.xcdatamodel/contents
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,16 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="14460.32" systemVersion="18C54" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier=""> | ||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="14460.32" systemVersion="18D109" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier=""> | ||
<entity name="Intake" representedClassName="Intake" syncable="YES" codeGenerationType="class"> | ||
<attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/> | ||
<attribute name="value" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/> | ||
<relationship name="intake" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="User" inverseName="intake" inverseEntity="User" syncable="YES"/> | ||
</entity> | ||
<entity name="User" representedClassName="User" syncable="YES" codeGenerationType="class"> | ||
<attribute name="installedDate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/> | ||
<attribute name="lastAccessedDate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/> | ||
<relationship name="intake" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Intake" inverseName="intake" inverseEntity="Intake" syncable="YES"/> | ||
</entity> | ||
<elements> | ||
<element name="User" positionX="-238.1171875" positionY="-28.01171875" width="128" height="73"/> | ||
<element name="Intake" positionX="-18" positionY="27" width="128" height="88"/> | ||
<element name="User" positionX="-238.1171875" positionY="-28.01171875" width="128" height="73"/> | ||
</elements> | ||
</model> |
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
Oops, something went wrong.