plotline-engage 5.7.3 → 5.7.5
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/android/build.gradle +14 -5
- package/ios/PlotlineViewContent.m +40 -1
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
buildscript {
|
|
3
3
|
repositories {
|
|
4
|
-
|
|
4
|
+
mavenCentral()
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
dependencies {
|
|
@@ -12,7 +12,7 @@ buildscript {
|
|
|
12
12
|
apply plugin: 'com.android.library'
|
|
13
13
|
|
|
14
14
|
android {
|
|
15
|
-
compileSdkVersion 33
|
|
15
|
+
compileSdkVersion rootProject.ext.has('compileSdkVersion') ? Math.max(33, rootProject.ext.compileSdkVersion as int) : 33
|
|
16
16
|
buildToolsVersion "23.0.1"
|
|
17
17
|
namespace "com.reactnativeplotline"
|
|
18
18
|
compileOptions {
|
|
@@ -33,13 +33,22 @@ android {
|
|
|
33
33
|
|
|
34
34
|
repositories {
|
|
35
35
|
mavenCentral()
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// The host app also resolves this module's native SDK dependency.
|
|
39
|
+
rootProject.allprojects {
|
|
40
|
+
repositories {
|
|
41
|
+
exclusiveContent {
|
|
42
|
+
forRepository {
|
|
43
|
+
maven { url 'https://android-sdk.plotline.so' }
|
|
44
|
+
}
|
|
45
|
+
filter { includeGroup 'com.gitlab.plotline' }
|
|
46
|
+
}
|
|
38
47
|
}
|
|
39
48
|
}
|
|
40
49
|
|
|
41
50
|
dependencies {
|
|
42
51
|
implementation 'com.facebook.react:react-native:+'
|
|
43
|
-
implementation 'com.gitlab.plotline:plotline-android-sdk:5.3.
|
|
52
|
+
implementation 'com.gitlab.plotline:plotline-android-sdk:5.3.1'
|
|
44
53
|
}
|
|
45
54
|
|
|
@@ -9,6 +9,27 @@
|
|
|
9
9
|
#import "PlotlineWidgetEventEmitter.h"
|
|
10
10
|
#import <Plotline/Plotline.h>
|
|
11
11
|
|
|
12
|
+
// Each native widget needs its own listener because size callbacks have no sender.
|
|
13
|
+
@interface PlotlineWidgetSizeListener : NSObject <PlotlineWidgetListener>
|
|
14
|
+
@property (nonatomic, weak) PlotlineViewContent *owner;
|
|
15
|
+
@property (nonatomic) NSUInteger generation;
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@interface PlotlineViewContent ()
|
|
19
|
+
@property (nonatomic, strong) PlotlineWidgetSizeListener *widgetListener;
|
|
20
|
+
@property (nonatomic) NSUInteger widgetGeneration;
|
|
21
|
+
@end
|
|
22
|
+
|
|
23
|
+
@implementation PlotlineWidgetSizeListener
|
|
24
|
+
- (void)onWidgetReadyWithWidth:(CGFloat)width height:(CGFloat)height {
|
|
25
|
+
PlotlineViewContent *owner = self.owner;
|
|
26
|
+
if (!owner || owner.widgetListener != self || owner.widgetGeneration != self.generation) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
[owner onWidgetReadyWithWidth:width height:height];
|
|
30
|
+
}
|
|
31
|
+
@end
|
|
32
|
+
|
|
12
33
|
@implementation PlotlineViewContent
|
|
13
34
|
|
|
14
35
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
@@ -22,12 +43,30 @@
|
|
|
22
43
|
- (void)setParentWidth:(NSString *)parentWidth {
|
|
23
44
|
if (![_parentWidth isEqualToString:parentWidth]) {
|
|
24
45
|
_parentWidth = parentWidth;
|
|
46
|
+
NSUInteger generation = ++self.widgetGeneration;
|
|
47
|
+
// Invalidate immediately, including callbacks before the queued replacement runs.
|
|
48
|
+
self.widgetListener.owner = nil;
|
|
25
49
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
50
|
+
if (generation != self.widgetGeneration) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
26
53
|
[self.plotlineView removeFromSuperview];
|
|
54
|
+
self.plotlineView = nil;
|
|
55
|
+
self.widgetListener = nil;
|
|
27
56
|
if (parentWidth.integerValue != 0) {
|
|
28
|
-
|
|
57
|
+
PlotlineWidgetSizeListener *listener = [PlotlineWidgetSizeListener new];
|
|
58
|
+
listener.owner = self;
|
|
59
|
+
listener.generation = generation;
|
|
60
|
+
self.widgetListener = listener;
|
|
61
|
+
self.plotlineView = [[PlotlineWidget alloc] initWithClientElementId:self.testID frame:CGRectMake(0, 0, parentWidth.integerValue, 0) plotlineWidgetListener:listener];
|
|
29
62
|
self.plotlineView.translatesAutoresizingMaskIntoConstraints = NO;
|
|
30
63
|
[self addSubview:self.plotlineView];
|
|
64
|
+
// Pin the width: with no constraints the host layout pass resizes the widget to this view's stale JS size (0 after an empty callback).
|
|
65
|
+
[NSLayoutConstraint activateConstraints:@[
|
|
66
|
+
[self.plotlineView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
|
|
67
|
+
[self.plotlineView.topAnchor constraintEqualToAnchor:self.topAnchor],
|
|
68
|
+
[self.plotlineView.widthAnchor constraintEqualToConstant:parentWidth.integerValue],
|
|
69
|
+
]];
|
|
31
70
|
}
|
|
32
71
|
});
|
|
33
72
|
}
|