@iternio/react-native-auto-play 0.3.0 → 0.3.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.
- package/ios/ReactHelpers/NitroConvert.h +19 -0
- package/ios/ReactHelpers/NitroConvert.m +21 -0
- package/ios/ReactHelpers/NitroSurface.h +10 -0
- package/ios/ReactHelpers/NitroSurface.m +37 -0
- package/ios/scenes/AutoPlayScene.swift +1 -5
- package/ios/templates/Parser.swift +2 -7
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NitroConvert.h
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Manuel Auer on 04.11.25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// this is required for old architecture support since the React pod can not be imported
|
|
9
|
+
|
|
10
|
+
#import <UIKit/UIKit.h>
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
+
|
|
14
|
+
@interface NitroConvert : NSObject
|
|
15
|
+
+ (UIColor *)uiColor:(id)json;
|
|
16
|
+
+ (UIImage *)uiImage:(id)json;
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NitroConvert.m
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Manuel Auer on 04.11.25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// this is required for old architecture support since the React pod can not be imported
|
|
9
|
+
|
|
10
|
+
#import "NitroConvert.h"
|
|
11
|
+
#import <React/RCTConvert.h>
|
|
12
|
+
|
|
13
|
+
@implementation NitroConvert
|
|
14
|
+
+ (UIColor *)uiColor:(id)json {
|
|
15
|
+
return [RCTConvert UIColor:json];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
+ (nonnull UIImage *)uiImage:(nonnull id)json {
|
|
19
|
+
return [RCTConvert UIImage:json];
|
|
20
|
+
}
|
|
21
|
+
@end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NitroSurface.m
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Manuel Auer on 28.11.25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "NitroSurface.h"
|
|
9
|
+
#import <React/RCTInvalidating.h>
|
|
10
|
+
#import <React/RCTRootView.h>
|
|
11
|
+
#import <React/RCTSurface.h>
|
|
12
|
+
#import <React/RCTSurfaceHostingProxyRootView.h>
|
|
13
|
+
|
|
14
|
+
@implementation NitroSurface
|
|
15
|
+
|
|
16
|
+
+ (void)stop:(nullable UIView *)view {
|
|
17
|
+
if (view == nil) {
|
|
18
|
+
NSLog(@"[AutoPlay] View is nil, ignoring");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if ([view isKindOfClass:[RCTSurfaceHostingView class]]) {
|
|
23
|
+
RCTSurfaceHostingProxyRootView *rootView =
|
|
24
|
+
(RCTSurfaceHostingProxyRootView *)view;
|
|
25
|
+
|
|
26
|
+
if (rootView == nil) {
|
|
27
|
+
NSLog(@"[AutoPlay] rootView == nil, cannot stop");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[rootView.surface stop];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
NSLog(@"[AutoPlay] View is not recognized type, ignoring");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@end
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import CarPlay
|
|
9
|
-
import React
|
|
10
9
|
|
|
11
10
|
class AutoPlayScene: UIResponder {
|
|
12
11
|
var initialProperties: [String: Any] = [:]
|
|
@@ -54,10 +53,7 @@ class AutoPlayScene: UIResponder {
|
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
func disconnect() {
|
|
57
|
-
|
|
58
|
-
rootView.surface.stop()
|
|
59
|
-
}
|
|
60
|
-
|
|
56
|
+
NitroSurface.stop(self.window?.rootViewController?.view)
|
|
61
57
|
self.window = nil
|
|
62
58
|
isConnected = false
|
|
63
59
|
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
import CarPlay
|
|
9
9
|
import UIKit
|
|
10
|
-
import React
|
|
11
10
|
|
|
12
11
|
struct HeaderActions {
|
|
13
12
|
let leadingNavigationBarButtons: [CPBarButton]
|
|
@@ -740,7 +739,7 @@ class Parser {
|
|
|
740
739
|
}
|
|
741
740
|
|
|
742
741
|
static func doubleToColor(value: Double) -> UIColor {
|
|
743
|
-
return
|
|
742
|
+
return NitroConvert.uiColor(value)
|
|
744
743
|
}
|
|
745
744
|
|
|
746
745
|
static func parseNitroImage(
|
|
@@ -768,7 +767,7 @@ class Parser {
|
|
|
768
767
|
assetImage: AssetImage,
|
|
769
768
|
traitCollection: UITraitCollection
|
|
770
769
|
) -> UIImage? {
|
|
771
|
-
let uiImage =
|
|
770
|
+
let uiImage = NitroConvert.uiImage([
|
|
772
771
|
"height": assetImage.height, "width": assetImage.width,
|
|
773
772
|
"uri": assetImage.uri, "scale": assetImage.scale,
|
|
774
773
|
"__packager_asset": assetImage.packager_asset,
|
|
@@ -777,10 +776,6 @@ class Parser {
|
|
|
777
776
|
guard let color = assetImage.color else {
|
|
778
777
|
return uiImage
|
|
779
778
|
}
|
|
780
|
-
|
|
781
|
-
guard let uiImage = uiImage else {
|
|
782
|
-
return nil
|
|
783
|
-
}
|
|
784
779
|
|
|
785
780
|
return getTintedImageAsset(
|
|
786
781
|
color: color,
|