mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Removing Dead Code part 1 (#2234)
This commit is contained in:
@@ -31,9 +31,6 @@ protocol AnalyticsClientProtocol {
|
||||
/// Stop the analytics client reporting data.
|
||||
func stop()
|
||||
|
||||
/// Send any queued events immediately.
|
||||
func flush()
|
||||
|
||||
/// Capture the supplied analytics event.
|
||||
/// - Parameter event: The event to capture.
|
||||
func capture(_ event: AnalyticsEventProtocol)
|
||||
@@ -41,14 +38,6 @@ protocol AnalyticsClientProtocol {
|
||||
/// Capture the supplied analytics screen event.
|
||||
/// - Parameter event: The screen event to capture.
|
||||
func screen(_ event: AnalyticsScreenProtocol)
|
||||
|
||||
/// Updates any user properties to help with creating cohorts.
|
||||
/// - Parameter userProperties: The user properties to be updated.
|
||||
///
|
||||
/// Only non-nil properties will be updated when calling this method. There might
|
||||
/// be a delay when updating user properties as these are cached to be included
|
||||
/// as part of the next event that gets captured.
|
||||
func updateUserProperties(_ userProperties: AnalyticsEvent.UserProperties)
|
||||
}
|
||||
|
||||
// sourcery: AutoMockable
|
||||
|
||||
@@ -105,13 +105,6 @@ class AnalyticsService {
|
||||
appSettings.analyticsConsentState = .unknown
|
||||
}
|
||||
|
||||
/// Flushes the event queue in the analytics client, uploading all pending events.
|
||||
/// Normally events are sent in batches. Call this method when you need an event
|
||||
/// to be sent immediately.
|
||||
func forceUpload() {
|
||||
client.flush()
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
/// Capture an event in the `client`.
|
||||
|
||||
@@ -24,10 +24,6 @@ protocol AudioSessionProtocol: AnyObject {
|
||||
}
|
||||
|
||||
extension AudioSessionProtocol {
|
||||
func setCategory(_ category: AVAudioSession.Category, mode: AVAudioSession.Mode) throws {
|
||||
try setCategory(category, mode: mode, options: [])
|
||||
}
|
||||
|
||||
func setActive(_ active: Bool) throws {
|
||||
try setActive(active, options: [])
|
||||
}
|
||||
|
||||
@@ -46,12 +46,13 @@ class AudioPlayer: NSObject, AudioPlayerProtocol {
|
||||
|
||||
private var statusObserver: NSKeyValueObservation?
|
||||
private var rateObserver: NSKeyValueObservation?
|
||||
private var playToEndObserver: NSObjectProtocol?
|
||||
private var appBackgroundObserver: NSObjectProtocol?
|
||||
private var autoplay = false
|
||||
|
||||
private let audioSession = AVAudioSession.sharedInstance()
|
||||
|
||||
// periphery:ignore - when set to nil is automatically cancelled
|
||||
@CancellableTask private var releaseAudioSessionTask: Task<Void, Never>?
|
||||
|
||||
private let releaseAudioSessionTimeoutInterval = 5.0
|
||||
|
||||
private(set) var url: URL?
|
||||
|
||||
@@ -19,7 +19,6 @@ import Foundation
|
||||
|
||||
enum AudioPlayerError: Error {
|
||||
case genericError
|
||||
case loadFileError
|
||||
}
|
||||
|
||||
enum AudioPlayerAction {
|
||||
|
||||
@@ -110,7 +110,7 @@ class AudioPlayerState: ObservableObject, Identifiable {
|
||||
playbackState = .stopped
|
||||
}
|
||||
|
||||
func reportError(_ error: Error) {
|
||||
func reportError() {
|
||||
playbackState = .error
|
||||
}
|
||||
|
||||
@@ -167,6 +167,7 @@ class AudioPlayerState: ObservableObject, Identifiable {
|
||||
displayLink?.add(to: .current, forMode: .common)
|
||||
}
|
||||
|
||||
// periphery:ignore:parameters displayLink - required for objc selector
|
||||
@objc private func updateProgress(displayLink: CADisplayLink) {
|
||||
if let currentTime = audioPlayer?.currentTime, duration > 0 {
|
||||
progress = currentTime / duration
|
||||
|
||||
@@ -343,9 +343,9 @@ class AudioRecorder: AudioRecorderProtocol {
|
||||
.store(in: &cancellables)
|
||||
|
||||
NotificationCenter.default.publisher(for: Notification.Name.AVAudioEngineConfigurationChange)
|
||||
.sink { [weak self] notification in
|
||||
.sink { [weak self] _ in
|
||||
guard let self else { return }
|
||||
self.handleConfigurationChange(notification: notification)
|
||||
self.handleConfigurationChange()
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
@@ -396,7 +396,7 @@ class AudioRecorder: AudioRecorderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func handleConfigurationChange(notification: Notification) {
|
||||
func handleConfigurationChange() {
|
||||
guard let audioEngine else { return }
|
||||
MXLog.warning("Configuration changed: \(audioEngine.inputNode.inputFormat(forBus: 0))")
|
||||
if internalState != .suspended {
|
||||
|
||||
@@ -24,7 +24,6 @@ enum AudioRecorderError: Error, Equatable {
|
||||
case audioFileCreationFailure
|
||||
case interrupted
|
||||
case recordingCancelled
|
||||
case recordingFailed
|
||||
case recordPermissionNotGranted
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class AudioRecorderState: ObservableObject, Identifiable {
|
||||
recordingState = .stopped
|
||||
}
|
||||
|
||||
func reportError(_ error: Error) {
|
||||
func reportError() {
|
||||
recordingState = .error
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ class AudioRecorderState: ObservableObject, Identifiable {
|
||||
displayLink?.add(to: .current, forMode: .common)
|
||||
}
|
||||
|
||||
// periphery:ignore:parameters displayLink - required for objc selector
|
||||
@objc private func publishUpdate(displayLink: CADisplayLink) {
|
||||
if let currentTime = audioRecorder?.currentTime {
|
||||
duration = currentTime
|
||||
|
||||
@@ -19,8 +19,6 @@ import UIKit
|
||||
|
||||
// sourcery: AutoMockable
|
||||
protocol ApplicationProtocol {
|
||||
func beginBackgroundTask(expirationHandler handler: (() -> Void)?) -> UIBackgroundTaskIdentifier
|
||||
|
||||
func beginBackgroundTask(withName taskName: String?, expirationHandler handler: (() -> Void)?) -> UIBackgroundTaskIdentifier
|
||||
|
||||
func endBackgroundTask(_ identifier: UIBackgroundTaskIdentifier)
|
||||
|
||||
@@ -29,12 +29,6 @@ protocol BackgroundTaskProtocol: AnyObject {
|
||||
/// Flag indicating the background task is reusable. If reusable, `name` is the key to distinguish background tasks.
|
||||
var isReusable: Bool { get }
|
||||
|
||||
/// Elapsed time after the task started. In milliseconds.
|
||||
var elapsedTime: TimeInterval { get }
|
||||
|
||||
/// Expiration handler for the background task
|
||||
var expirationHandler: BackgroundTaskExpirationHandler? { get }
|
||||
|
||||
/// Method to be called when a task reused one more time. Should only be valid for reusable tasks.
|
||||
func reuse()
|
||||
|
||||
|
||||
@@ -115,10 +115,6 @@ class BugReportService: NSObject, BugReportServiceProtocol {
|
||||
lastCrashEventId = nil
|
||||
MXLog.info("Reset.")
|
||||
}
|
||||
|
||||
func crash() {
|
||||
SentrySDK.crash()
|
||||
}
|
||||
|
||||
func submitBugReport(_ bugReport: BugReport,
|
||||
progressListener: CurrentValueSubject<Double, Never>) async -> Result<SubmitBugReportResponse, BugReportServiceError> {
|
||||
|
||||
@@ -52,6 +52,7 @@ enum BugReportServiceError: LocalizedError {
|
||||
|
||||
// sourcery: AutoMockable
|
||||
protocol BugReportServiceProtocol {
|
||||
// periphery: ignore
|
||||
var isRunning: Bool { get }
|
||||
|
||||
var crashedLastRun: Bool { get }
|
||||
@@ -61,8 +62,6 @@ protocol BugReportServiceProtocol {
|
||||
func stop()
|
||||
|
||||
func reset()
|
||||
|
||||
func crash()
|
||||
|
||||
func submitBugReport(_ bugReport: BugReport,
|
||||
progressListener: CurrentValueSubject<Double, Never>) async -> Result<SubmitBugReportResponse, BugReportServiceError>
|
||||
|
||||
@@ -25,15 +25,17 @@ class ClientProxy: ClientProxyProtocol {
|
||||
private let appSettings: AppSettings
|
||||
private let networkMonitor: NetworkMonitorProtocol
|
||||
|
||||
private var sessionVerificationControllerProxy: SessionVerificationControllerProxy?
|
||||
private let mediaLoader: MediaLoaderProtocol
|
||||
private let clientQueue: DispatchQueue
|
||||
|
||||
private var roomListService: RoomListService?
|
||||
// periphery: ignore - only for retain
|
||||
private var roomListStateUpdateTaskHandle: TaskHandle?
|
||||
// periphery: ignore - only for retain
|
||||
private var roomListStateLoadingStateUpdateTaskHandle: TaskHandle?
|
||||
|
||||
private var syncService: SyncService?
|
||||
// periphery: ignore - only for retain
|
||||
private var syncServiceStateUpdateTaskHandle: TaskHandle?
|
||||
|
||||
private var delegateHandle: TaskHandle?
|
||||
@@ -48,8 +50,6 @@ class ClientProxy: ClientProxyProtocol {
|
||||
let notificationSettings: NotificationSettingsProxyProtocol
|
||||
|
||||
let secureBackupController: SecureBackupControllerProtocol
|
||||
|
||||
private let roomListRecencyOrderingAllowedEventTypes = ["m.room.message", "m.room.encrypted", "m.sticker"]
|
||||
|
||||
private static var roomCreationPowerLevelOverrides: PowerLevels {
|
||||
.init(usersDefault: nil,
|
||||
@@ -79,7 +79,6 @@ class ClientProxy: ClientProxyProtocol {
|
||||
}
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
private var visibleRoomsListProxyStateObservationToken: AnyCancellable?
|
||||
|
||||
/// Will be `true` whilst the app cleans up and forces a logout. Prevents the sync service from restarting
|
||||
/// before the client is released which ends up running in a loop. This is a workaround until the sync service
|
||||
@@ -413,18 +412,6 @@ class ClientProxy: ClientProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func accountDataEvent<Content>(type: String) async -> Result<Content?, ClientProxyError> where Content: Decodable {
|
||||
await Task.dispatch(on: clientQueue) {
|
||||
.failure(.failedRetrievingAccountData)
|
||||
}
|
||||
}
|
||||
|
||||
func setAccountData<Content: Encodable>(content: Content, type: String) async -> Result<Void, ClientProxyError> {
|
||||
await Task.dispatch(on: clientQueue) {
|
||||
.failure(.failedSettingAccountData)
|
||||
}
|
||||
}
|
||||
|
||||
func sessionVerificationControllerProxy() async -> Result<SessionVerificationControllerProxyProtocol, ClientProxyError> {
|
||||
await Task.dispatch(on: clientQueue) {
|
||||
do {
|
||||
|
||||
@@ -42,8 +42,6 @@ enum ClientProxyError: Error {
|
||||
case failedRetrievingUserDisplayName
|
||||
case failedRetrievingUserAvatarURL
|
||||
case failedSettingUserDisplayName
|
||||
case failedRetrievingAccountData
|
||||
case failedSettingAccountData
|
||||
case failedRetrievingSessionVerificationController
|
||||
case failedLoadingMedia
|
||||
case mediaFileError
|
||||
@@ -122,11 +120,7 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {
|
||||
func setUserAvatar(media: MediaInfo) async -> Result<Void, ClientProxyError>
|
||||
|
||||
func removeUserAvatar() async -> Result<Void, ClientProxyError>
|
||||
|
||||
func accountDataEvent<Content: Decodable>(type: String) async -> Result<Content?, ClientProxyError>
|
||||
|
||||
func setAccountData<Content: Encodable>(content: Content, type: String) async -> Result<Void, ClientProxyError>
|
||||
|
||||
|
||||
func sessionVerificationControllerProxy() async -> Result<SessionVerificationControllerProxyProtocol, ClientProxyError>
|
||||
|
||||
func logout() async -> URL?
|
||||
|
||||
@@ -117,14 +117,6 @@ class MockClientProxy: ClientProxyProtocol {
|
||||
.failure(.failedSettingUserAvatar)
|
||||
}
|
||||
|
||||
func accountDataEvent<Content>(type: String) async -> Result<Content?, ClientProxyError> where Content: Decodable {
|
||||
.failure(.failedRetrievingAccountData)
|
||||
}
|
||||
|
||||
func setAccountData<Content>(content: Content, type: String) async -> Result<Void, ClientProxyError> where Content: Encodable {
|
||||
.failure(.failedSettingAccountData)
|
||||
}
|
||||
|
||||
func loadMediaContentForSource(_ source: MediaSourceProxy) async throws -> Data {
|
||||
throw ClientProxyError.failedLoadingMedia
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ enum ElementCallWidgetDriverError: Error {
|
||||
|
||||
enum ElementCallWidgetDriverAction {
|
||||
case callEnded
|
||||
case errorReceived(ElementCallWidgetDriverError)
|
||||
}
|
||||
|
||||
// sourcery: AutoMockable
|
||||
|
||||
@@ -25,5 +25,4 @@ struct EmojiItem: Equatable, Identifiable {
|
||||
let unicode: String
|
||||
let keywords: [String]
|
||||
let shortcodes: [String]
|
||||
let skins: [String]
|
||||
}
|
||||
|
||||
@@ -97,6 +97,5 @@ extension EmojiItem {
|
||||
label = emojibase.label
|
||||
shortcodes = emojibase.shortcodes
|
||||
keywords = emojibase.tags ?? []
|
||||
skins = emojibase.skins?.map(\.unicode) ?? []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ extension NotificationManager: UNUserNotificationCenterDelegate {
|
||||
return [.badge, .sound, .list, .banner]
|
||||
}
|
||||
|
||||
guard delegate.shouldDisplayInAppNotification(self, content: notification.request.content) else {
|
||||
guard delegate.shouldDisplayInAppNotification(content: notification.request.content) else {
|
||||
return []
|
||||
}
|
||||
|
||||
@@ -245,8 +245,7 @@ extension NotificationManager: UNUserNotificationCenterDelegate {
|
||||
content: response.notification.request.content,
|
||||
replyText: response.userText)
|
||||
case UNNotificationDefaultActionIdentifier:
|
||||
await delegate?.notificationTapped(self,
|
||||
content: response.notification.request.content)
|
||||
await delegate?.notificationTapped(content: response.notification.request.content)
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -18,10 +18,8 @@ import Foundation
|
||||
import UserNotifications
|
||||
|
||||
protocol NotificationManagerDelegate: AnyObject {
|
||||
func shouldDisplayInAppNotification(_ service: NotificationManagerProtocol,
|
||||
content: UNNotificationContent) -> Bool
|
||||
func notificationTapped(_ service: NotificationManagerProtocol,
|
||||
content: UNNotificationContent) async
|
||||
func shouldDisplayInAppNotification(content: UNNotificationContent) -> Bool
|
||||
func notificationTapped(content: UNNotificationContent) async
|
||||
func handleInlineReply(_ service: NotificationManagerProtocol,
|
||||
content: UNNotificationContent,
|
||||
replyText: String) async
|
||||
|
||||
@@ -16,4 +16,5 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
// periphery: ignore - markdown protocol
|
||||
protocol DecorationTimelineItemProtocol: RoomTimelineItemProtocol { }
|
||||
|
||||
Reference in New Issue
Block a user