Logo
Explore Help
Sign In
rock-n-code/deep-linking-sample
rock-n-code/deep-linking-sample
1
0
Fork 0
You've already forked deep-linking-sample
Code Pull Requests Releases 2 Wiki Activity
deep-linking-sample/Apps/Wikipedia/WMF Framework/Remote Notifications/RemoteNotificationsRefreshDeadlineController.swift

24 lines
540 B
Swift
Raw Normal View History

[Setup] Basic project structure (#1) This PR contains all the work related to setting up this project as required to implement the [Assignment](https://repo.rock-n-code.com/rock-n-code/deep-linking-assignment/wiki/Assignment) on top, as intended. To summarise this work: - [x] created a new **Xcode** project; - [x] cloned the `Wikipedia` app and inserted it into the **Xcode** project; - [x] created the `Locations` app and also, its `Libraries` package; - [x] created the `Shared` package to share dependencies between the apps; - [x] added a `Makefile` file and implemented some **environment** and **help** commands. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: https://repo.rock-n-code.com/rock-n-code/deep-linking-assignment/pulls/1
2023-04-08 18:37:13 +00:00
import Foundation
final class RemoteNotificationsRefreshDeadlineController {
private let deadline: TimeInterval = 30 // 30 seconds
private var now: CFAbsoluteTime {
return CFAbsoluteTimeGetCurrent()
}
public var shouldRefresh: Bool {
guard let lastRefreshTime = lastRefreshTime else {
return true
}
return now - lastRefreshTime > deadline
}
private var lastRefreshTime: CFAbsoluteTime?
public func reset() {
lastRefreshTime = now
}
}
Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 125ms Template: 4ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API