Skip to content

Commit

Permalink
feat: add resume action
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed Dec 23, 2023
1 parent e619d85 commit 80c72a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Sources/hyper-focus/schedule_manager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ class ScheduleManager {
endPause = end
}

func resumeBlocking() {
log("resume blocking")
endPause = nil
}

func schedules() -> [Configuration.ScheduleItem] {
return configuration.schedule
}
Expand Down
8 changes: 7 additions & 1 deletion Sources/hyper-focus/server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,15 @@ class ApiServer {
return ["status": "ok"]
}

router["/resume"] = JSONResponse { _ -> Any in
log("/resume")
self.scheduleManager.resumeBlocking()
return ["status": "ok"]
}

// http -vvv POST http://localhost:8080/pause until=1667510271
router["/pause"] = JSONResponse { environ -> Any in
log("pause route")
log("/pause")

var pauseUtil: Int?

Expand Down

0 comments on commit 80c72a8

Please sign in to comment.