Signal-iOS/SignalUI/Environment/Dependencies+SignalUI.swift
2021-11-02 14:26:03 -03:00

129 lines
2.9 KiB
Swift

//
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
//
import Foundation
// MARK: - NSObject
@objc
public extension NSObject {
final var audioSession: OWSAudioSession {
SUIEnvironment.shared.audioSessionRef
}
static var audioSession: OWSAudioSession {
SUIEnvironment.shared.audioSessionRef
}
final var contactsViewHelper: ContactsViewHelper {
SUIEnvironment.shared.contactsViewHelperRef
}
static var contactsViewHelper: ContactsViewHelper {
SUIEnvironment.shared.contactsViewHelperRef
}
final var fullTextSearcher: FullTextSearcher { .shared }
static var fullTextSearcher: FullTextSearcher { .shared }
var chatColors: ChatColors {
SUIEnvironment.shared.chatColorsRef
}
static var chatColors: ChatColors {
SUIEnvironment.shared.chatColorsRef
}
var payments: Payments {
SUIEnvironment.shared.paymentsRef
}
static var payments: Payments {
SUIEnvironment.shared.paymentsRef
}
}
// MARK: - Obj-C Dependencies
public extension Dependencies {
var audioSession: OWSAudioSession {
SUIEnvironment.shared.audioSessionRef
}
static var audioSession: OWSAudioSession {
SUIEnvironment.shared.audioSessionRef
}
var contactsViewHelper: ContactsViewHelper {
SUIEnvironment.shared.contactsViewHelperRef
}
static var contactsViewHelper: ContactsViewHelper {
SUIEnvironment.shared.contactsViewHelperRef
}
var fullTextSearcher: FullTextSearcher { .shared }
static var fullTextSearcher: FullTextSearcher { .shared }
var chatColors: ChatColors {
SUIEnvironment.shared.chatColorsRef
}
static var chatColors: ChatColors {
SUIEnvironment.shared.chatColorsRef
}
var payments: Payments {
SUIEnvironment.shared.paymentsRef
}
static var payments: Payments {
SUIEnvironment.shared.paymentsRef
}
}
// MARK: - Swift-only Dependencies
public extension NSObject {
final var paymentsSwift: PaymentsSwift {
SUIEnvironment.shared.paymentsRef as! PaymentsSwift
}
static var paymentsSwift: PaymentsSwift {
SUIEnvironment.shared.paymentsRef as! PaymentsSwift
}
final var paymentsImpl: PaymentsImpl {
SUIEnvironment.shared.paymentsRef as! PaymentsImpl
}
static var paymentsImpl: PaymentsImpl {
SUIEnvironment.shared.paymentsRef as! PaymentsImpl
}
}
// MARK: - Swift-only Dependencies
public extension Dependencies {
var paymentsSwift: PaymentsSwift {
SUIEnvironment.shared.paymentsRef as! PaymentsSwift
}
static var paymentsSwift: PaymentsSwift {
SUIEnvironment.shared.paymentsRef as! PaymentsSwift
}
var paymentsImpl: PaymentsImpl {
SUIEnvironment.shared.paymentsRef as! PaymentsImpl
}
static var paymentsImpl: PaymentsImpl {
SUIEnvironment.shared.paymentsRef as! PaymentsImpl
}
}