@applicaster/quick-brick-native-apple 5.21.1 → 5.22.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "QuickBrickApple",
3
- "version": "5.21.1",
3
+ "version": "5.22.1",
4
4
  "platforms": {
5
5
  "ios": "14.0",
6
6
  "tvos": "14.0"
@@ -16,7 +16,7 @@
16
16
  "authors": "Applicaster LTD.",
17
17
  "source": {
18
18
  "git": "https://github.com/applicaster/Zapp-Frameworks.git",
19
- "tag": "@@applicaster/quick-brick-native-apple/5.21.1"
19
+ "tag": "@@applicaster/quick-brick-native-apple/5.22.1"
20
20
  },
21
21
  "requires_arc": true,
22
22
  "source_files": "universal/**/*.{m,swift}",
@@ -71,18 +71,35 @@ class QuickBrickViewController: UIViewController, UILayerViewControllerProtocol
71
71
  forceOrientationWithMaskIfNeeded(orientationMask)
72
72
  }
73
73
 
74
+ override func viewDidLayoutSubviews() {
75
+ super.viewDidLayoutSubviews()
76
+
77
+ // viewWillTransition not is not reliable, so we have to use viewDidLayoutSubviews instead
78
+ // In some cases viewWillTransition may not be called
79
+ callManuallyTrackWillTransitionEvent(to: view.bounds.size)
80
+ }
81
+
74
82
  override func viewWillTransition(to size: CGSize,
75
83
  with coordinator: UIViewControllerTransitionCoordinator) {
76
84
  super.viewWillTransition(to: size, with: coordinator)
85
+
86
+ callManuallyTrackWillTransitionEvent(to: size)
87
+ }
88
+
89
+ private func callManuallyTrackWillTransitionEvent(to size: CGSize) {
77
90
  let isLandscape = size.width > size.height
78
91
  let interfaceOrientation = isLandscape ?
79
92
  UIInterfaceOrientation.landscapeLeft :
80
93
  UIInterfaceOrientation.portrait
81
94
 
95
+ guard interfaceOrientation != currentInterfaceOrientation else {
96
+ return
97
+ }
98
+
82
99
  let reactNativeToOrientation = ReactNativeOrientation.fromInterfaceOrientation(orientation: interfaceOrientation)
83
100
  let reactNativefromOrientation = ReactNativeOrientation.fromInterfaceOrientation(orientation: currentInterfaceOrientation)
84
- currentInterfaceOrientation = interfaceOrientation
85
101
 
102
+ currentInterfaceOrientation = interfaceOrientation
86
103
  ReactNativeEventEmitter.orientationChange(toOrientation: reactNativeToOrientation,
87
104
  fromOrientation: reactNativefromOrientation)
88
105
 
@@ -131,7 +148,6 @@ class QuickBrickViewController: UIViewController, UILayerViewControllerProtocol
131
148
  ReactNativeEventEmitter.orientationChange(toOrientation: reactNativeToOrientation,
132
149
  fromOrientation: reactNativeFromOrientation,
133
150
  physicalChange: true)
134
-
135
151
  logger?.debugLog(message: "deviceDidRotate: device oritation changed to: \(deviceOrientation.toString())",
136
152
  category: QuickBrickViewControllerLogs.forceOrientation.category)
137
153
  }
@@ -0,0 +1,52 @@
1
+ //
2
+ // AirPlayButton.swift
3
+ // DefaultPlayer
4
+ //
5
+ // Created by Anna Bauza on 22/06/2020.
6
+ //
7
+
8
+ import AVKit
9
+ import Foundation
10
+
11
+ @objc public class AirPlayButton: UIView {
12
+ override init(frame: CGRect) {
13
+ super.init(frame: frame)
14
+ setupView(frame)
15
+ }
16
+
17
+ required init?(coder aDecoder: NSCoder) {
18
+ super.init(coder: aDecoder)
19
+ setupView(nil)
20
+ }
21
+
22
+ var airplayButton: AVRoutePickerView?
23
+
24
+ // in here you can configure your view
25
+ private func setupView(_ frame: CGRect?) {
26
+ let buttonFrame = frame ?? self.frame
27
+ airplayButton = AVRoutePickerView(frame: buttonFrame)
28
+ airplayButton?.activeTintColor = UIColor.blue
29
+
30
+ if let buttonView = airplayButton {
31
+ addSubview(buttonView)
32
+ buttonView.translatesAutoresizingMaskIntoConstraints = false
33
+ let horizontalConstraint = NSLayoutConstraint(item: buttonView, attribute: .centerX, relatedBy: .equal, toItem: self, attribute: .centerX, multiplier: 1, constant: 0)
34
+ let verticalConstraint = NSLayoutConstraint(item: buttonView, attribute: .centerY, relatedBy: .equal, toItem: self, attribute: .centerY, multiplier: 1, constant: 0)
35
+ let widthConstraint = NSLayoutConstraint(item: buttonView, attribute: .width, relatedBy: .equal, toItem: self, attribute: .width, multiplier: 1, constant: 0)
36
+ let heightConstraint = NSLayoutConstraint(item: buttonView, attribute: .height, relatedBy: .equal, toItem: self, attribute: .height, multiplier: 1, constant: 0)
37
+ addConstraints([horizontalConstraint, verticalConstraint, widthConstraint, heightConstraint])
38
+ }
39
+ }
40
+
41
+ @objc override public var tintColor: UIColor? {
42
+ didSet {
43
+ airplayButton?.tintColor = tintColor
44
+ }
45
+ }
46
+
47
+ @objc public var activeTintColor: UIColor? {
48
+ didSet {
49
+ airplayButton?.activeTintColor = activeTintColor
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,25 @@
1
+ //
2
+ // RCTMyCustomViewManager.swift
3
+ // DefaultPlayer
4
+ //
5
+ // Created by Anna Bauza on 22/06/2020.
6
+ //
7
+
8
+ import AVFoundation
9
+ import Foundation
10
+ import React
11
+
12
+ @objc(AirPlayButtonModule)
13
+ public class AirPlayButtonModule: RCTViewManager {
14
+ override public static func moduleName() -> String? {
15
+ "AirPlayButtonModule"
16
+ }
17
+
18
+ override public static func requiresMainQueueSetup() -> Bool {
19
+ true
20
+ }
21
+
22
+ override public func view() -> UIView! {
23
+ AirPlayButton()
24
+ }
25
+ }
@@ -7,6 +7,8 @@
7
7
  //
8
8
 
9
9
  @import React;
10
+ #import <AVFoundation/AVFoundation.h>
11
+ #import <React/RCTViewManager.h>
10
12
 
11
13
  @interface RCT_EXTERN_MODULE (QuickBrickCommunicationModule, NSObject)
12
14
 
@@ -146,3 +148,9 @@ RCT_EXTERN_METHOD(getCurrentLayoutId:(RCTPromiseResolveBlock)resolve
146
148
  RCT_EXTERN_METHOD(getDefaultLayoutId:(RCTPromiseResolveBlock)resolve
147
149
  rejecter:(RCTPromiseRejectBlock)reject);
148
150
  @end
151
+
152
+ @interface RCT_EXTERN_MODULE(AirPlayButtonModule, RCTViewManager)
153
+ RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor);
154
+ RCT_EXPORT_VIEW_PROPERTY(activeTintColor, UIColor);
155
+
156
+ @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-native-apple",
3
- "version": "5.21.1",
3
+ "version": "5.22.1",
4
4
  "description": "iOS and tvOS native code for QuickBrick applications. This package is used to provide native logic for QuickBrick",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"