* #99 Implement background tasks * #99 Add changelog * #99 Fix some code smells * #99 Use background tasks in room timeline controller * #99 Move background task service into room proxy and media provider
41 lines
1.3 KiB
Swift
41 lines
1.3 KiB
Swift
//
|
|
// BackgroundTaskServiceProtocol.swift
|
|
// ElementX
|
|
//
|
|
// Created by Ismail on 28.06.2022.
|
|
// Copyright © 2022 Element. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
protocol BackgroundTaskServiceProtocol {
|
|
|
|
func startBackgroundTask(withName name: String,
|
|
isReusable: Bool,
|
|
expirationHandler: (() -> Void)?) -> BackgroundTaskProtocol?
|
|
|
|
}
|
|
|
|
extension BackgroundTaskServiceProtocol {
|
|
|
|
func startBackgroundTask(withName name: String) -> BackgroundTaskProtocol? {
|
|
return startBackgroundTask(withName: name,
|
|
expirationHandler: nil)
|
|
}
|
|
|
|
func startBackgroundTask(withName name: String,
|
|
isReusable: Bool) -> BackgroundTaskProtocol? {
|
|
return startBackgroundTask(withName: name,
|
|
isReusable: isReusable,
|
|
expirationHandler: nil)
|
|
}
|
|
|
|
func startBackgroundTask(withName name: String,
|
|
expirationHandler: (() -> Void)?) -> BackgroundTaskProtocol? {
|
|
return startBackgroundTask(withName: name,
|
|
isReusable: false,
|
|
expirationHandler: expirationHandler)
|
|
}
|
|
|
|
}
|