@imgly/editor-react-native 1.82.1 → 1.83.0-rc.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.
@@ -22,8 +22,27 @@ def isNewArchitectureEnabled() {
22
22
  return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
23
23
  }
24
24
 
25
+ // React Native modules are built with the host application's AGP. AGP 9 can
26
+ // supply Kotlin itself, while older AGP versions require the Kotlin Gradle
27
+ // Plugin.
28
+ def isBuiltInKotlinEnabled() {
29
+ def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
30
+ if (agpMajor < 9) {
31
+ return false
32
+ }
33
+
34
+ def propertyValue = providers.gradleProperty('android.builtInKotlin').orNull
35
+ return propertyValue == null || propertyValue.toBoolean()
36
+ }
37
+
25
38
  def getKotlinVersion() {
26
- return project.plugins.findPlugin("kotlin-android")?.class?.package?.implementationVersion
39
+ def kotlinAndroidPlugin = project.plugins.findPlugin("kotlin-android")
40
+ if (kotlinAndroidPlugin) {
41
+ return kotlinAndroidPlugin.class.package.implementationVersion
42
+ }
43
+
44
+ // AGP 9 supplies Kotlin 2+ when built-in Kotlin is enabled.
45
+ return isBuiltInKotlinEnabled() ? "2.0.0" : null
27
46
  }
28
47
 
29
48
  def isKotlin2OrHigher() {
@@ -94,7 +113,9 @@ def getKotlinCompilerExtensionVersion() {
94
113
 
95
114
  apply plugin: 'com.android.library'
96
115
  apply plugin: 'com.facebook.react'
97
- apply plugin: 'org.jetbrains.kotlin.android'
116
+ if (!isBuiltInKotlinEnabled()) {
117
+ apply plugin: 'org.jetbrains.kotlin.android'
118
+ }
98
119
 
99
120
  // This module builds only the presets EditorBuilder exposes.
100
121
  ext.starterKitsInclude = ["apparel", "design", "photo", "postcard", "video"]
@@ -109,21 +130,25 @@ if (isKotlin2OrHigher()) {
109
130
  }
110
131
 
111
132
  android {
112
- compileSdkVersion safeExtGet('compileSdkVersion', 34)
133
+ compileSdkVersion safeExtGet('compileSdkVersion', 37)
113
134
 
114
135
  namespace "ly.img.editor.reactnative.module"
115
136
 
116
137
  defaultConfig {
117
138
  minSdk = 24
139
+ aarMetadata {
140
+ // AGP 9 defaults this to compileSdk; declare the consumer requirement separately.
141
+ minCompileSdk = 34
142
+ }
118
143
  buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
119
144
  }
120
145
 
121
146
  sourceSets {
122
147
  main {
123
148
  if (isNewArchitectureEnabled()) {
124
- java.srcDirs += ['src/newarch']
149
+ kotlin.srcDirs += ['src/newarch']
125
150
  } else {
126
- java.srcDirs += ['src/oldarch']
151
+ kotlin.srcDirs += ['src/oldarch']
127
152
  }
128
153
  }
129
154
  }
@@ -132,7 +157,7 @@ android {
132
157
  compose true
133
158
  }
134
159
 
135
- if (!isKotlin2OrHigher()) {
160
+ if (!isKotlin2OrHigher() && !isBuiltInKotlinEnabled()) {
136
161
  def composeVersion = getKotlinCompilerExtensionVersion()
137
162
  composeOptions {
138
163
  kotlinCompilerExtensionVersion = composeVersion
@@ -146,7 +171,7 @@ repositories {
146
171
  }
147
172
 
148
173
  dependencies {
149
- api "ly.img:editor:1.82.1"
174
+ api "ly.img:editor:1.83.0-rc.1"
150
175
 
151
176
  implementation "androidx.activity:activity-ktx:1.9.0"
152
177
  implementation "androidx.appcompat:appcompat:1.7.1"
@@ -1,8 +1,8 @@
1
1
  package ly.img.editor.configuration.video.component
2
2
 
3
3
  import androidx.compose.runtime.Composable
4
+ import ly.img.editor.configuration.video.VideoConfigurationBuilder
4
5
  import ly.img.editor.core.component.Timeline
5
- import ly.img.editor.core.component.remember
6
6
 
7
7
  /**
8
8
  * The configuration of the component that is displayed over the editor. It is useful if you want to display a popup dialog or anything in the
@@ -10,4 +10,4 @@ import ly.img.editor.core.component.remember
10
10
  * Implementation shows [Timeline] in the bottom panel.
11
11
  */
12
12
  @Composable
13
- fun rememberBottomPanel() = Timeline.remember()
13
+ fun VideoConfigurationBuilder.rememberBottomPanel() = rememberTimeline()
@@ -0,0 +1,44 @@
1
+ package ly.img.editor.configuration.video.component
2
+
3
+ import androidx.compose.runtime.Composable
4
+ import androidx.compose.ui.Alignment
5
+ import ly.img.editor.configuration.video.VideoConfigurationBuilder
6
+ import ly.img.editor.core.component.Timeline
7
+ import ly.img.editor.core.component.remember
8
+ import ly.img.editor.core.component.rememberAddAudio
9
+ import ly.img.editor.core.component.rememberAddClip
10
+ import ly.img.editor.core.component.rememberLoop
11
+ import ly.img.editor.core.component.rememberPlayPause
12
+ import ly.img.editor.core.component.rememberTimecode
13
+ import ly.img.editor.core.component.rememberToggleExpanded
14
+
15
+ /**
16
+ * The configuration of the timeline of the video editor.
17
+ *
18
+ * The [Timeline] component renders tracks alone, so this starter kit declares the header and the
19
+ * two lane buttons.
20
+ */
21
+ @Composable
22
+ fun VideoConfigurationBuilder.rememberTimeline() = Timeline.remember {
23
+ // highlight-starter-kit-timeline-header
24
+ headerListBuilder = {
25
+ Timeline.HeaderListBuilder.remember {
26
+ aligned(alignment = Alignment.Start) {
27
+ add { Timeline.Label.rememberTimecode() }
28
+ }
29
+ aligned(alignment = Alignment.CenterHorizontally) {
30
+ add { Timeline.Button.rememberPlayPause() }
31
+ }
32
+ aligned(alignment = Alignment.End) {
33
+ add { Timeline.Button.rememberLoop() }
34
+ add { Timeline.Button.rememberToggleExpanded() }
35
+ }
36
+ }
37
+ }
38
+ // highlight-starter-kit-timeline-header
39
+
40
+ // highlight-starter-kit-timeline-lane-buttons
41
+ addClipButton = { Timeline.Button.rememberAddClip() }
42
+ addAudioButton = { Timeline.Button.rememberAddAudio() }
43
+ // highlight-starter-kit-timeline-lane-buttons
44
+ }
@@ -69,7 +69,10 @@ import UIKit
69
69
  }
70
70
  // Remove the handler to prevent multiple invokations.
71
71
  self?.currentResultHandler = nil
72
- self?.presentationController?.presentingViewController?.dismiss(animated: true)
72
+ // Release the editor, otherwise it stays alive and keeps playing until the next openEditor.
73
+ let controller = self?.presentationController
74
+ self?.presentationController = nil
75
+ controller?.presentingViewController?.dismiss(animated: true)
73
76
  }
74
77
 
75
78
  presentationController = builder(settings, preset, metadata) { [weak self] result in
@@ -8,9 +8,43 @@ extension VideoEditorConfiguration {
8
8
  BottomPanel.Configuration { builder in
9
9
  // highlight-starter-kit-bottom-panel
10
10
  builder.content { context in
11
- DefaultTimelineComponent(context: context)
11
+ Timeline(context: context, configuration: .videoStarterKit)
12
12
  }
13
13
  // highlight-starter-kit-bottom-panel
14
14
  }
15
15
  }
16
16
  }
17
+
18
+ // MARK: - Timeline
19
+
20
+ private extension Timeline.Configuration {
21
+ /// The `Timeline` renders its tracks alone, so this starter kit declares the header and the two
22
+ /// lane buttons.
23
+ static var videoStarterKit: Timeline.Configuration {
24
+ Timeline.Configuration { builder in
25
+ // highlight-starter-kit-timeline-header
26
+ // The spacers are explicit, so inserting an item is predictable: put it before or after a
27
+ // `Timeline.Spacer` to choose which edge it hugs.
28
+ builder.header { _ in
29
+ Timeline.ItemGroup(placement: .leading) {
30
+ Timeline.Labels.timecode()
31
+ Timeline.Spacer()
32
+ }
33
+ Timeline.ItemGroup(placement: .center) {
34
+ Timeline.Buttons.playPause()
35
+ }
36
+ Timeline.ItemGroup(placement: .trailing) {
37
+ Timeline.Buttons.loop()
38
+ Timeline.Spacer()
39
+ Timeline.Buttons.toggleExpanded()
40
+ }
41
+ }
42
+ // highlight-starter-kit-timeline-header
43
+
44
+ // highlight-starter-kit-timeline-lane-buttons
45
+ builder.addClip = Timeline.Buttons.addClip()
46
+ builder.addAudio = Timeline.Buttons.addAudio()
47
+ // highlight-starter-kit-timeline-lane-buttons
48
+ }
49
+ }
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imgly/editor-react-native",
3
- "version": "1.82.1",
3
+ "version": "1.83.0-rc.1",
4
4
  "description": "CreativeEditor SDK for React Native - enable photo, video and design editing for your users on iOS and Android.",
5
5
  "react-native": "index.js",
6
6
  "source": "index.js",
@@ -96,7 +96,7 @@ export class EditorSettingsModel implements EditorSettings {
96
96
  * sources (stickers, filters, and more).
97
97
  */
98
98
  baseUri: string =
99
- 'https://cdn.img.ly/packages/imgly/cesdk-react-native/1.82.1/assets';
99
+ 'https://cdn.img.ly/packages/imgly/cesdk-react-native/1.83.0-rc.1/assets';
100
100
 
101
101
  /**
102
102
  * Unique ID tied to your application's user.