@picsa/capacitor-video-player 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CapacitorVideoPlayer.podspec +17 -0
  2. package/LICENSE +21 -0
  3. package/android/build.gradle +71 -0
  4. package/android/src/main/AndroidManifest.xml +3 -0
  5. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/CapacitorVideoPlayer.java +71 -0
  6. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/CapacitorVideoPlayerPlugin.java +1256 -0
  7. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/FullscreenExoPlayerFragment.java +1595 -0
  8. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/Notifications/MyRunnable.java +21 -0
  9. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/Notifications/NotificationCenter.java +61 -0
  10. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/PickerVideo/AdapterVideoList.java +47 -0
  11. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/PickerVideo/ModelVideo.java +49 -0
  12. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/PickerVideo/PickerVideoFragment.java +119 -0
  13. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/PickerVideo/VideoRecyclerViewHolder.java +65 -0
  14. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/Utilities/FilesUtils.java +101 -0
  15. package/android/src/main/java/com/jeep/plugin/capacitor/capacitorvideoplayer/Utilities/FragmentUtils.java +32 -0
  16. package/android/src/main/res/.gitkeep +0 -0
  17. package/android/src/main/res/drawable/bg_round_rect_white_50.xml +9 -0
  18. package/android/src/main/res/drawable/bg_rounded_rectangle_white_corner_rounded.xml +10 -0
  19. package/android/src/main/res/drawable/exo_close_btn.xml +12 -0
  20. package/android/src/main/res/drawable/gradient_transparent_middle.xml +12 -0
  21. package/android/src/main/res/drawable/ic_arrow_left.xml +5 -0
  22. package/android/src/main/res/drawable/ic_baseline_lq.xml +7 -0
  23. package/android/src/main/res/drawable/ic_exo_icon_fastforward.xml +35 -0
  24. package/android/src/main/res/drawable/ic_exo_icon_pause.xml +26 -0
  25. package/android/src/main/res/drawable/ic_exo_icon_play.xml +36 -0
  26. package/android/src/main/res/drawable/ic_exo_icon_rewind.xml +35 -0
  27. package/android/src/main/res/drawable/ic_expand.xml +5 -0
  28. package/android/src/main/res/drawable/ic_fit.xml +5 -0
  29. package/android/src/main/res/drawable/ic_image_background.xml +12 -0
  30. package/android/src/main/res/drawable/ic_img_16_9_background.xml +10 -0
  31. package/android/src/main/res/drawable/ic_img_9_16_background.xml +10 -0
  32. package/android/src/main/res/drawable/ic_outline_lock.xml +5 -0
  33. package/android/src/main/res/drawable/ic_outline_lock_open.xml +5 -0
  34. package/android/src/main/res/drawable/ic_pip_white.xml +5 -0
  35. package/android/src/main/res/drawable/ic_views.xml +18 -0
  36. package/android/src/main/res/drawable/ic_zoom.xml +5 -0
  37. package/android/src/main/res/layout/bridge_layout_main.xml +15 -0
  38. package/android/src/main/res/layout/exo_playback_control_view.xml +289 -0
  39. package/android/src/main/res/layout/exoplayer_layout_youtube.xml +361 -0
  40. package/android/src/main/res/layout/fragment_fs_exoplayer.xml +50 -0
  41. package/android/src/main/res/layout/fragment_picker_video.xml +21 -0
  42. package/android/src/main/res/layout/row_video.xml +76 -0
  43. package/android/src/main/res/values/colors.xml +14 -0
  44. package/android/src/main/res/values/strings.xml +3 -0
  45. package/android/src/main/res/values/styles.xml +3 -0
  46. package/dist/docs.json +831 -0
  47. package/dist/esm/definitions.d.ts +322 -0
  48. package/dist/esm/definitions.js +2 -0
  49. package/dist/esm/definitions.js.map +1 -0
  50. package/dist/esm/index.d.ts +4 -0
  51. package/dist/esm/index.js +7 -0
  52. package/dist/esm/index.js.map +1 -0
  53. package/dist/esm/web-utils/video-types.d.ts +16 -0
  54. package/dist/esm/web-utils/video-types.js +15 -0
  55. package/dist/esm/web-utils/video-types.js.map +1 -0
  56. package/dist/esm/web-utils/videoplayer.d.ts +30 -0
  57. package/dist/esm/web-utils/videoplayer.js +315 -0
  58. package/dist/esm/web-utils/videoplayer.js.map +1 -0
  59. package/dist/esm/web.d.ts +123 -0
  60. package/dist/esm/web.js +675 -0
  61. package/dist/esm/web.js.map +1 -0
  62. package/dist/plugin.cjs.js +1017 -0
  63. package/dist/plugin.cjs.js.map +1 -0
  64. package/dist/plugin.js +1019 -0
  65. package/dist/plugin.js.map +1 -0
  66. package/ios/Plugin/CapacitorVideoPlayer.swift +64 -0
  67. package/ios/Plugin/CapacitorVideoPlayerPlugin.h +10 -0
  68. package/ios/Plugin/CapacitorVideoPlayerPlugin.m +22 -0
  69. package/ios/Plugin/CapacitorVideoPlayerPlugin.swift +632 -0
  70. package/ios/Plugin/Extensions/CapacitorVideoPlayerPlugin.AVPlayerViewController.swift +59 -0
  71. package/ios/Plugin/Extensions/CapacitorVideoPlayerPlugin.File.swift +126 -0
  72. package/ios/Plugin/Extensions/CapacitorVideoPlayerPlugin.Fullscreen.swift +94 -0
  73. package/ios/Plugin/Extensions/CapacitorVideoPlayerPlugin.Notifications.swift +140 -0
  74. package/ios/Plugin/Extensions/CapacitorVideoPlayerPlugin.Observers.swift +180 -0
  75. package/ios/Plugin/Info.plist +24 -0
  76. package/ios/Plugin/VideoPicker/VideoHelper.swift +127 -0
  77. package/ios/Plugin/VideoPicker/VideoPickerViewController.swift +144 -0
  78. package/ios/Plugin/VideoPlayer/Extensions/AVURLAsset.swift +18 -0
  79. package/ios/Plugin/VideoPlayer/Extensions/AllOrientationAVPlayerController.swift +12 -0
  80. package/ios/Plugin/VideoPlayer/Extensions/CMTime.swift +23 -0
  81. package/ios/Plugin/VideoPlayer/Extensions/LandscapeAVPlayerController.swift +12 -0
  82. package/ios/Plugin/VideoPlayer/Extensions/Notification.Name.swift +18 -0
  83. package/ios/Plugin/VideoPlayer/Extensions/PortraitAVPlayerController.swift +12 -0
  84. package/ios/Plugin/VideoPlayer/Extensions/View.swift +54 -0
  85. package/ios/Plugin/VideoPlayer/FullScreenVideoPlayerView.swift +601 -0
  86. package/ios/Plugin/VideoPlayer/Models/Video.swift +28 -0
  87. package/ios/Plugin/VideoPlayer/Models/VideoModel.swift +42 -0
  88. package/package.json +92 -0
  89. package/readme.md +190 -0
@@ -0,0 +1,127 @@
1
+ //
2
+ // VideoHelper.swift
3
+ // Plugin
4
+ //
5
+ // Created by Quéau Jean Pierre on 28/05/2021.
6
+ // Copyright © 2021 Max Lynch. All rights reserved.
7
+ //
8
+ // Copyright (c) 2021 Razeware LLC
9
+ //
10
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ // of this software and associated documentation files (the "Software"), to deal
12
+ // in the Software without restriction, including without limitation the rights
13
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ // copies of the Software, and to permit persons to whom the Software is
15
+ // furnished to do so, subject to the following conditions:
16
+ //
17
+ // The above copyright notice and this permission notice shall be included in
18
+ // all copies or substantial portions of the Software.
19
+ //
20
+ // Notwithstanding the foregoing, you may not use, copy, modify, merge, publish,
21
+ // distribute, sublicense, create a derivative work, and/or sell copies of the
22
+ // Software in any work that is designed, intended, or marketed for pedagogical or
23
+ // instructional purposes related to programming, coding, application development,
24
+ // or information technology. Permission for such use, copying, modification,
25
+ // merger, publication, distribution, sublicensing, creation of derivative works,
26
+ // or sale is expressly withheld.
27
+ //
28
+ // This project and source code may use libraries or frameworks that are
29
+ // released under various Open-Source licenses. Use of those libraries and
30
+ // frameworks are governed by their own individual licenses.
31
+ //
32
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
38
+ // THE SOFTWARE.
39
+
40
+ import AVFoundation
41
+ import MobileCoreServices
42
+ import UIKit
43
+
44
+ enum VideoHelper {
45
+ static func orientationFromTransform(
46
+ _ transform: CGAffineTransform
47
+ ) -> (orientation: UIImage.Orientation, isPortrait: Bool) {
48
+ var assetOrientation = UIImage.Orientation.up
49
+ var isPortrait = false
50
+ let tfA = transform.a
51
+ let tfB = transform.b
52
+ let tfC = transform.c
53
+ let tfD = transform.d
54
+
55
+ if tfA == 0 && tfB == 1.0 && tfC == -1.0 && tfD == 0 {
56
+ assetOrientation = .right
57
+ isPortrait = true
58
+ } else if tfA == 0 && tfB == -1.0 && tfC == 1.0 && tfD == 0 {
59
+ assetOrientation = .left
60
+ isPortrait = true
61
+ } else if tfA == 1.0 && tfB == 0 && tfC == 0 && tfD == 1.0 {
62
+ assetOrientation = .up
63
+ } else if tfA == -1.0 && tfB == 0 && tfC == 0 && tfD == -1.0 {
64
+ assetOrientation = .down
65
+ }
66
+ return (assetOrientation, isPortrait)
67
+ }
68
+
69
+ static func startMediaBrowser(
70
+ delegate: UIViewController & UINavigationControllerDelegate & UIImagePickerControllerDelegate,
71
+ sourceType: UIImagePickerController.SourceType
72
+ ) {
73
+ guard UIImagePickerController.isSourceTypeAvailable(sourceType)
74
+ else { return }
75
+
76
+ let mediaUI = UIImagePickerController()
77
+ mediaUI.sourceType = sourceType
78
+ mediaUI.mediaTypes = [kUTTypeMovie as String]
79
+ mediaUI.allowsEditing = false
80
+ mediaUI.delegate = delegate
81
+ delegate.present(mediaUI, animated: true, completion: nil)
82
+ }
83
+
84
+ static func videoCompositionInstruction(
85
+ _ track: AVCompositionTrack,
86
+ asset: AVAsset
87
+ ) -> AVMutableVideoCompositionLayerInstruction {
88
+ let instruction = AVMutableVideoCompositionLayerInstruction(assetTrack: track)
89
+ let assetTrack = asset.tracks(withMediaType: AVMediaType.video)[0]
90
+
91
+ let transform = assetTrack.preferredTransform
92
+ let assetInfo = orientationFromTransform(transform)
93
+
94
+ var scaleToFitRatio = UIScreen.main.bounds.width / assetTrack.naturalSize.width
95
+ if assetInfo.isPortrait {
96
+ scaleToFitRatio = UIScreen.main.bounds.width / assetTrack.naturalSize.height
97
+ let scaleFactor = CGAffineTransform(
98
+ scaleX: scaleToFitRatio,
99
+ y: scaleToFitRatio)
100
+ instruction.setTransform(
101
+ assetTrack.preferredTransform.concatenating(scaleFactor),
102
+ at: .zero)
103
+ } else {
104
+ let scaleFactor = CGAffineTransform(
105
+ scaleX: scaleToFitRatio,
106
+ y: scaleToFitRatio)
107
+ var concat = assetTrack.preferredTransform.concatenating(scaleFactor)
108
+ .concatenating(CGAffineTransform(
109
+ translationX: 0,
110
+ y: UIScreen.main.bounds.width / 2))
111
+ if assetInfo.orientation == .down {
112
+ let fixUpsideDown = CGAffineTransform(rotationAngle: CGFloat(Double.pi))
113
+ let windowBounds = UIScreen.main.bounds
114
+ let yFix = assetTrack.naturalSize.height + windowBounds.height
115
+ let centerFix = CGAffineTransform(
116
+ translationX: assetTrack.naturalSize.width,
117
+ y: yFix)
118
+ concat = fixUpsideDown.concatenating(centerFix).concatenating(scaleFactor)
119
+ }
120
+ instruction.setTransform(concat, at: .zero)
121
+ }
122
+
123
+ return instruction
124
+ }
125
+ }
126
+
127
+ import Foundation
@@ -0,0 +1,144 @@
1
+ //
2
+ // VideoPickerViewController.swift
3
+ // Plugin
4
+ //
5
+ // Created by Quéau Jean Pierre on 11/08/2020.
6
+ // Copyright © 2021 Max Lynch. All rights reserved.
7
+ //
8
+
9
+ import AVKit
10
+ import MobileCoreServices
11
+ import UIKit
12
+
13
+ open class VideoPickerViewController: UIViewController {
14
+ private var _videoRate: Float = 1.0
15
+ private var _exitOnEnd: Bool = true
16
+ private var _loopOnEnd: Bool = false
17
+ private var _pipEnabled: Bool = true
18
+ private var _backModeEnabled: Bool = true
19
+ private var _showControls: Bool = true
20
+ private var _displayMode: String = "all"
21
+
22
+ // MARK: - Set-up rate
23
+
24
+ var rate: Float {
25
+ get {
26
+ return self._videoRate
27
+ }
28
+ set {
29
+ self._videoRate = newValue
30
+ }
31
+ }
32
+
33
+ // MARK: - Set-up exitOnEnd
34
+
35
+ var exitOnEnd: Bool {
36
+ get {
37
+ return self._exitOnEnd
38
+ }
39
+ set {
40
+ self._exitOnEnd = newValue
41
+ }
42
+ }
43
+
44
+ // MARK: - Set-up loopOnEnd
45
+
46
+ var loopOnEnd: Bool {
47
+ get {
48
+ return self._loopOnEnd
49
+ }
50
+ set {
51
+ self._loopOnEnd = newValue
52
+ }
53
+ }
54
+
55
+ // MARK: - Set-up pipEnabled
56
+
57
+ var pipEnabled: Bool {
58
+ get {
59
+ return self._pipEnabled
60
+ }
61
+ set {
62
+ self._pipEnabled = newValue
63
+ }
64
+ }
65
+
66
+ // MARK: - Set-up backModeEnabled
67
+
68
+ var backModeEnabled: Bool {
69
+ get {
70
+ return self._backModeEnabled
71
+ }
72
+ set {
73
+ self._backModeEnabled = newValue
74
+ }
75
+ }
76
+ // MARK: - Set-up showControls
77
+
78
+ var showControls: Bool {
79
+ get {
80
+ return self._showControls
81
+ }
82
+ set {
83
+ self._showControls = newValue
84
+ }
85
+ }
86
+
87
+ // MARK: - Set-up displayMode
88
+
89
+ var displayMode: String {
90
+ get {
91
+ return self._displayMode
92
+ }
93
+ set {
94
+ self._displayMode = newValue
95
+ }
96
+ }
97
+
98
+ override open func viewDidLoad() {
99
+ super.viewDidLoad()
100
+ VideoHelper.startMediaBrowser(delegate: self,
101
+ sourceType: .savedPhotosAlbum)
102
+ }
103
+
104
+ }
105
+
106
+ // MARK: - UIImagePickerControllerDelegate
107
+ extension VideoPickerViewController: UIImagePickerControllerDelegate {
108
+ public func imagePickerController(
109
+ _ picker: UIImagePickerController,
110
+ didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]
111
+ ) {
112
+ guard
113
+ let mediaType = info[UIImagePickerController.InfoKey.mediaType] as? String,
114
+ mediaType == (kUTTypeMovie as String),
115
+ let url = info[UIImagePickerController.InfoKey.mediaURL] as? URL
116
+ else {
117
+ return
118
+ }
119
+ let vId: [String: Any] = [
120
+ "videoUrl": url, "videoRate": rate,
121
+ "exitOnEnd": exitOnEnd, "loopOnEnd": loopOnEnd,
122
+ "pipEnabled": pipEnabled,
123
+ "backModeEnabled": backModeEnabled,
124
+ "showControls": showControls,
125
+ "displayMode": displayMode]
126
+ NotificationCenter.default.post(name: .videoPathInternalReady, object: nil, userInfo: vId)
127
+ }
128
+ public func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
129
+ let vId: [String: Any] = [
130
+ "videoUrl": "", "videoRate": rate,
131
+ "exitOnEnd": exitOnEnd, "loopOnEnd": loopOnEnd,
132
+ "pipEnabled": pipEnabled,
133
+ "backModeEnabled": backModeEnabled,
134
+ "showControls": showControls,
135
+ "displayMode": displayMode
136
+ ]
137
+ NotificationCenter.default.post(name: .videoPathInternalReady,
138
+ object: nil, userInfo: vId)
139
+ }
140
+ }
141
+
142
+ // MARK: - UINavigationControllerDelegate
143
+ extension VideoPickerViewController: UINavigationControllerDelegate {
144
+ }
@@ -0,0 +1,18 @@
1
+ //
2
+ // AVURLAsset.swift
3
+ // Plugin
4
+ //
5
+ // Created by Quéau Jean Pierre on 02/04/2021.
6
+ // Copyright © 2021 Max Lynch. All rights reserved.
7
+ //
8
+
9
+ import AVKit
10
+
11
+ extension AVURLAsset {
12
+
13
+ var videoSize: CGSize? {
14
+ tracks(withMediaType: .video).first.flatMap {
15
+ tracks.count > 0 ? $0.naturalSize.applying($0.preferredTransform) : nil
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,12 @@
1
+ //
2
+ // AllOrientationAVPlayerController.swift
3
+ // CapacitorVideoPlayer
4
+ //
5
+ // Created by Manuel Garcia Marin on 24-05-23.
6
+ //
7
+
8
+ import AVKit
9
+ class AllOrientationAVPlayerController: AVPlayerViewController {
10
+ override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
11
+ return .all }
12
+ }
@@ -0,0 +1,23 @@
1
+ //
2
+ // CMTime.swift
3
+ // Plugin
4
+ //
5
+ // Created by Quéau Jean Pierre on 13/01/2020.
6
+ // Copyright © 2021 Max Lynch. All rights reserved.
7
+ //
8
+
9
+ import CoreMedia
10
+
11
+ extension CMTime {
12
+ public var stringValue: String {
13
+ let totalSeconds = Int(self.seconds)
14
+ let hours = totalSeconds / 3600
15
+ let minutes = totalSeconds % 3600 / 60
16
+ let seconds = totalSeconds % 3600 % 60
17
+ if hours > 0 {
18
+ return String(format: "%i:%02i:%02i", hours, minutes, seconds)
19
+ } else {
20
+ return String(format: "%02i:%02i", minutes, seconds)
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,12 @@
1
+ //
2
+ // LandscapeAVPlayerController.swift
3
+ // CapacitorVideoPlayer
4
+ //
5
+ // Created by Quéau Jean Pierre on 23/05/2023.
6
+ //
7
+
8
+ import AVKit
9
+ class LandscapeAVPlayerController: AVPlayerViewController {
10
+ override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
11
+ return .landscapeRight }
12
+ }
@@ -0,0 +1,18 @@
1
+ //
2
+ // Notification.Name.swift
3
+ // Plugin
4
+ //
5
+ // Created by Quéau Jean Pierre on 13/01/2020.
6
+ // Copyright © 2021 Max Lynch. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+ extension NSNotification.Name {
11
+ static var playerItemPlay: Notification.Name {return .init(rawValue: "playerItemPlay")}
12
+ static var playerItemPause: Notification.Name {return .init(rawValue: "playerItemPause")}
13
+ static var playerItemEnd: Notification.Name {return .init(rawValue: "playerItemEnd")}
14
+ static var playerItemReady: Notification.Name {return .init(rawValue: "playerItemReady")}
15
+ static var playerInTableDismiss: Notification.Name {return .init(rawValue: "playerInTableDismiss")}
16
+ static var playerFullscreenDismiss: Notification.Name {return .init(rawValue: "playerFullscreenDismiss")}
17
+ static var videoPathInternalReady: Notification.Name {return .init(rawValue: "videoPathInternalReady")}
18
+ }
@@ -0,0 +1,12 @@
1
+ //
2
+ // PortraitAVPlayerController.swift
3
+ // CapacitorVideoPlayer
4
+ //
5
+ // Created by Quéau Jean Pierre on 23/05/2023.
6
+ //
7
+
8
+ import AVKit
9
+ class PortraitAVPlayerController: AVPlayerViewController {
10
+ override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
11
+ return .portrait }
12
+ }
@@ -0,0 +1,54 @@
1
+ //
2
+ // View.swift
3
+ // Plugin
4
+ //
5
+ // Sample_TableView
6
+ //
7
+ // Created by Esat Kemal Ekren on 5.04.2018.
8
+ // Copyright © 2021 Esat Kemal Ekren. All rights reserved.
9
+ // Copyright © 2021 Max Lynch. All rights reserved.
10
+ //
11
+
12
+ import UIKit
13
+
14
+ extension UIView {
15
+ // swiftlint:disable function_parameter_count
16
+ func anchor (paddingTop: CGFloat, paddingLeft: CGFloat, paddingBottom: CGFloat,
17
+ paddingRight: CGFloat, width: CGFloat, height: CGFloat, enableInsets: Bool,
18
+ top: NSLayoutYAxisAnchor? = nil, left: NSLayoutXAxisAnchor? = nil,
19
+ bottom: NSLayoutYAxisAnchor? = nil, right: NSLayoutXAxisAnchor? = nil) {
20
+
21
+ var topInset = CGFloat(0)
22
+ var bottomInset = CGFloat(0)
23
+
24
+ if #available(iOS 11, *), enableInsets {
25
+ let insets = self.safeAreaInsets
26
+ topInset = insets.top
27
+ bottomInset = insets.bottom
28
+ print("Top: \(topInset)")
29
+ print("bottom: \(bottomInset)")
30
+ }
31
+
32
+ translatesAutoresizingMaskIntoConstraints = false
33
+
34
+ if let mTop = top {
35
+ self.topAnchor.constraint(equalTo: mTop, constant: paddingTop+topInset).isActive = true
36
+ }
37
+ if let mLeft = left {
38
+ self.leftAnchor.constraint(equalTo: mLeft, constant: paddingLeft).isActive = true
39
+ }
40
+ if let mRight = right {
41
+ self.rightAnchor.constraint(equalTo: mRight, constant: -paddingRight).isActive = true
42
+ }
43
+ if let mBottom = bottom {
44
+ self.bottomAnchor.constraint(equalTo: mBottom, constant: -paddingBottom-bottomInset).isActive = true
45
+ }
46
+ if height != 0 {
47
+ self.heightAnchor.constraint(equalToConstant: height).isActive = true
48
+ }
49
+ if width != 0 {
50
+ self.widthAnchor.constraint(equalToConstant: width).isActive = true
51
+ }
52
+ }
53
+ // swiftlint:enable function_parameter_count
54
+ }