Images.swift 6.22 KB
Newer Older
1
// swiftlint:disable all
2
// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen
3

4
#if os(OSX)
5
  import AppKit.NSImage
6
  internal typealias AssetColorTypeAlias = NSColor
7
  internal typealias AssetImageTypeAlias = NSImage
8 9
#elseif os(iOS) || os(tvOS) || os(watchOS)
  import UIKit.UIImage
10
  internal typealias AssetColorTypeAlias = UIColor
11
  internal typealias AssetImageTypeAlias = UIImage
12 13
#endif

14
// swiftlint:disable superfluous_disable_command
15
// swiftlint:disable file_length
16

17
// MARK: - Asset Catalogs
18 19

// swiftlint:disable identifier_name line_length nesting type_body_length type_name
20 21
internal enum Asset {
  internal static let accountIcon = ImageAsset(name: "account_icon")
22
  internal static let addAvatar = ImageAsset(name: "add_avatar")
23 24 25 26 27 28 29 30 31 32 33 34 35
  internal static let addPerson = ImageAsset(name: "add_person")
  internal static let attachmentIcon = ImageAsset(name: "attachment_icon")
  internal static let audioMuted = ImageAsset(name: "audio_muted")
  internal static let audioRunning = ImageAsset(name: "audio_running")
  internal static let backButton = ImageAsset(name: "back_button")
  internal static let backgroundRing = ImageAsset(name: "background_ring")
  internal static let blockIcon = ImageAsset(name: "block_icon")
  internal static let callButton = ImageAsset(name: "call_button")
  internal static let camera = ImageAsset(name: "camera")
  internal static let clearConversation = ImageAsset(name: "clear_conversation")
  internal static let closeIcon = ImageAsset(name: "close_icon")
  internal static let contactRequestIcon = ImageAsset(name: "contact_request_icon")
  internal static let conversationIcon = ImageAsset(name: "conversation_icon")
Quentin Muret's avatar
Quentin Muret committed
36
  internal static let cross = ImageAsset(name: "cross")
37
  internal static let device = ImageAsset(name: "device")
Kateryna Kostiuk's avatar
Kateryna Kostiuk committed
38
  internal static let dialpad = ImageAsset(name: "dialpad")
39 40 41 42 43 44
  internal static let disableSpeakerphone = ImageAsset(name: "disable_speakerphone")
  internal static let doneIcon = ImageAsset(name: "done_icon")
  internal static let downloadIcon = ImageAsset(name: "download_icon")
  internal static let enableSpeakerphone = ImageAsset(name: "enable_speakerphone")
  internal static let fallbackAvatar = ImageAsset(name: "fallback_avatar")
  internal static let icContactPicture = ImageAsset(name: "ic_contact_picture")
45
  internal static let icConversationRemove = ImageAsset(name: "ic_conversation_remove")
Kateryna Kostiuk's avatar
Kateryna Kostiuk committed
46 47
  internal static let icHideInput = ImageAsset(name: "ic_hide_input")
  internal static let icShowInput = ImageAsset(name: "ic_show_input")
48
  internal static let infoArrow = ImageAsset(name: "info_arrow")
49
  internal static let jamiIcon = ImageAsset(name: "jamiIcon")
50
  internal static let jamiLogo = ImageAsset(name: "jamiLogo")
51
  internal static let leftArrow = ImageAsset(name: "left_arrow")
52 53
  internal static let moreSettings = ImageAsset(name: "more_settings")
  internal static let pauseCall = ImageAsset(name: "pause_call")
Kateryna Kostiuk's avatar
Kateryna Kostiuk committed
54
  internal static let phoneBook = ImageAsset(name: "phone_book")
Quentin Muret's avatar
Quentin Muret committed
55 56
  internal static let qrCode = ImageAsset(name: "qr_code")
  internal static let qrCodeScan = ImageAsset(name: "qr_code_scan")
57
  internal static let revokeDevice = ImageAsset(name: "revoke_device")
58
  internal static let ringLogo = ImageAsset(name: "ring_logo")
Quentin Muret's avatar
Quentin Muret committed
59
  internal static let scan = ImageAsset(name: "scan")
60
  internal static let sendButton = ImageAsset(name: "send_button")
61
  internal static let settings = ImageAsset(name: "settings")
62 63 64 65 66 67 68
  internal static let settingsIcon = ImageAsset(name: "settings_icon")
  internal static let shareButton = ImageAsset(name: "share_button")
  internal static let stopCall = ImageAsset(name: "stop_call")
  internal static let switchCamera = ImageAsset(name: "switch_camera")
  internal static let unpauseCall = ImageAsset(name: "unpause_call")
  internal static let videoMuted = ImageAsset(name: "video_muted")
  internal static let videoRunning = ImageAsset(name: "video_running")
69 70 71
}
// swiftlint:enable identifier_name line_length nesting type_body_length type_name

72 73 74 75 76 77 78 79 80
// MARK: - Implementation Details

internal struct ColorAsset {
  internal fileprivate(set) var name: String

  #if swift(>=3.2)
  @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *)
  internal var color: AssetColorTypeAlias {
    return AssetColorTypeAlias(asset: self)
81
  }
82
  #endif
83 84
}

85
internal extension AssetColorTypeAlias {
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
  #if swift(>=3.2)
  @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *)
  convenience init!(asset: ColorAsset) {
    let bundle = Bundle(for: BundleToken.self)
    #if os(iOS) || os(tvOS)
    self.init(named: asset.name, in: bundle, compatibleWith: nil)
    #elseif os(OSX)
    self.init(named: asset.name, bundle: bundle)
    #elseif os(watchOS)
    self.init(named: asset.name)
    #endif
  }
  #endif
}

101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
internal struct DataAsset {
  internal fileprivate(set) var name: String

  #if (os(iOS) || os(tvOS) || os(OSX)) && swift(>=3.2)
  @available(iOS 9.0, tvOS 9.0, OSX 10.11, *)
  internal var data: NSDataAsset {
    return NSDataAsset(asset: self)
  }
  #endif
}

#if (os(iOS) || os(tvOS) || os(OSX)) && swift(>=3.2)
@available(iOS 9.0, tvOS 9.0, OSX 10.11, *)
internal extension NSDataAsset {
  convenience init!(asset: DataAsset) {
    let bundle = Bundle(for: BundleToken.self)
    self.init(name: asset.name, bundle: bundle)
  }
}
#endif

internal struct ImageAsset {
  internal fileprivate(set) var name: String

  internal var image: AssetImageTypeAlias {
    let bundle = Bundle(for: BundleToken.self)
    #if os(iOS) || os(tvOS)
    let image = AssetImageTypeAlias(named: name, in: bundle, compatibleWith: nil)
    #elseif os(OSX)
    let image = bundle.image(forResource: name)
    #elseif os(watchOS)
    let image = AssetImageTypeAlias(named: name)
    #endif
    guard let result = image else { fatalError("Unable to load image named \(name).") }
    return result
  }
}

internal extension AssetImageTypeAlias {
  @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *)
  @available(OSX, deprecated,
    message: "This initializer is unsafe on macOS, please use the ImageAsset.image property")
  convenience init!(asset: ImageAsset) {
    #if os(iOS) || os(tvOS)
    let bundle = Bundle(for: BundleToken.self)
    self.init(named: asset.name, in: bundle, compatibleWith: nil)
    #elseif os(OSX) || os(watchOS)
    self.init(named: asset.name)
    #endif
  }
}

153
private final class BundleToken {}