Skip to content

Commit

Permalink
feat: 플로깅 백그라운드에서도 작동하도록 수정 Close #42
Browse files Browse the repository at this point in the history
  • Loading branch information
SH4CK3RS authored and koserim committed Nov 22, 2020
1 parent 3be461a commit 21041ab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions UniPlogger/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<string>Roboto-Thin.ttf</string>
<string>Roboto-ThinItalic.ttf</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand Down
2 changes: 2 additions & 0 deletions UniPlogger/Scene/Plogging/PloggingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,13 @@ extension PloggingViewController: PloggingDisplayLogic{
self.pauseButton.isHidden = false
self.stopButton.isHidden = true
self.resumeButton.isHidden = true
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(UpdateTimer), userInfo: nil, repeats: true)
}

@objc func displayStopPlogging() {
self.startBottomContainerView.isHidden = false
self.doingPauseBottomContainerView.isHidden = true
mapView.removeOverlays(mapView.overlays)
self.trashButton.snp.remakeConstraints{
$0.trailing.equalTo(self.view.snp.trailing).offset(-16)
$0.width.height.equalTo(60)
Expand Down
2 changes: 2 additions & 0 deletions UniPlogger/Scene/Plogging/PloggingWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class PloggingWorker: NSObject {

func resumeRun(){
startUpdateLocation()

}

func stopRun(completion: @escaping (Measurement<UnitLength>) -> Void){
Expand All @@ -68,6 +69,7 @@ class PloggingWorker: NSObject {
locationManager.delegate = self
locationManager.activityType = .fitness
locationManager.distanceFilter = 5
locationManager.allowsBackgroundLocationUpdates = true
locationManager.startUpdatingLocation()
}
}
Expand Down

0 comments on commit 21041ab

Please sign in to comment.