Skip to content

Commit 38d7607

Browse files
feat!: BREAKING update for Capacitor 7 (#60)
Co-authored-by: Carl Poole <[email protected]>
1 parent db089a0 commit 38d7607

File tree

22 files changed

+3736
-3788
lines changed

22 files changed

+3736
-3788
lines changed

Diff for: .github/workflows/ci.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,9 @@ jobs:
139139
**/ios/Pods
140140
key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
141141
restore-keys: |
142-
${{ runner.os }}-cocoapods-
142+
${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
143143
144144
- name: Install cocoapods
145-
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
146145
run: |
147146
cd example/ios
148147
pod install

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ See our docs to [get started with Portals](https://ionic.io/docs/portals/getting
3030

3131
## Registration
3232

33-
The Ionic Portals library for React Native requires a **free** license key to use. Once you have integrated Portals into your project, login to your ionic account to get a key. See our doc on [how to register for free and get your Portals license key](https://ionic.io/docs/portals/how-to/get-a-product-key) and refer to the [React Native](https://ionic.io/docs/portals/getting-started/react-native) getting started guides to see where to add your key.
33+
The Ionic Portals library for React Native requires a license key to use. Once you have integrated Portals into your project, login to your ionic account to get a key. See our doc on [how to register for free and get your Portals license key](https://ionic.io/docs/portals/how-to/get-a-product-key) and refer to the [React Native](https://ionic.io/docs/portals/getting-started/react-native) getting started guides to see where to add your key.
3434

3535
## FAQ
3636

3737
### What is the pricing for Portals use?
3838

39-
Portals is free to use in non-production environments. Businesses with more than USD $1 million in annual revenue are required to purchase a license from Ionic before using Portals in production.
39+
[Contact our sales team](https://ionic.io/portals#sales) for more information about pricing.
4040

4141
### Is Portals Open Source?
4242

Diff for: ReactNativePortals.podspec

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ Pod::Spec.new do |s|
1111
s.license = package["license"]
1212
s.authors = package["author"]
1313

14-
s.platforms = { :ios => min_ios_version_supported }
14+
s.platforms = { :ios => '14.0' }
1515
s.source = { :git => "https://github.com/ionic-team/ionic-portals-react-native.git", :tag => "#{s.version}" }
1616

1717
s.source_files = "ios/**/*.{h,m,mm,swift}"
1818

1919
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
2020
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
2121
if respond_to?(:install_modules_dependencies, true)
22-
s.dependency 'IonicPortals', '~> 0.11.0'
23-
s.dependency 'IonicLiveUpdates', '~> 0.5.2'
22+
s.dependency 'IonicPortals', '~> 0.12.0'
23+
s.dependency 'IonicLiveUpdates', '~> 0.5.6'
2424
install_modules_dependencies(s)
2525

2626
else
2727
s.dependency "React-Core"
28-
s.dependency 'IonicPortals', '~> 0.11.0'
29-
s.dependency 'IonicLiveUpdates', '~> 0.5.2'
28+
s.dependency 'IonicPortals', '~> 0.12.0'
29+
s.dependency 'IonicLiveUpdates', '~> 0.5.6'
3030

3131
# Don't install the dependencies when we run `pod install` in the old architecture.
3232
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then

Diff for: android/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath "com.android.tools.build:gradle:7.2.1"
11+
classpath "com.android.tools.build:gradle:8.7.2"
1212
// noinspection DifferentKotlinGradleVersion
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
}
@@ -95,7 +95,7 @@ dependencies {
9595
//noinspection GradleDynamicVersion
9696
implementation "com.facebook.react:react-native:+"
9797
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
98-
implementation "io.ionic:portals:0.10.+"
98+
implementation "io.ionic:portals:0.12.+"
9999
implementation "io.ionic:liveupdates:0.5.+"
100100
}
101101

Diff for: android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalsPubSub.kt

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.ionic.portals.reactnative
22

3+
import android.util.Log
34
import com.facebook.react.bridge.*
45
import com.facebook.react.modules.core.DeviceEventManagerModule
56
import com.getcapacitor.JSObject
@@ -35,4 +36,12 @@ internal class PortalsPubSubModule(reactContext: ReactApplicationContext) :
3536
}
3637
}
3738

38-
private fun ReadableMap.toJSObject(): JSObject = JSObject.fromJSONObject(JSONObject(toHashMap()))
39+
private fun ReadableMap.toJSObject(): JSObject {
40+
val map = toHashMap() as? Map<*, *> ?: return JSObject()
41+
return try {
42+
JSObject.fromJSONObject(JSONObject(map))
43+
} catch (e: Exception) {
44+
Log.e("PortalsPubSubModule", "Error converting ReadableMap to JSObject", e)
45+
JSObject()
46+
}
47+
}

Diff for: example/Gemfile

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ source 'https://rubygems.org'
33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
44
ruby ">= 2.6.10"
55

6-
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
7-
# bound in the template on Cocoapods with next React Native release.
8-
gem 'cocoapods', '>= 1.13', '< 1.15'
9-
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
6+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
7+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'

Diff for: example/android/app/build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ react {
2525
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
2626
// debuggableVariants = ["liteDebug", "prodDebug"]
2727

28+
/* Autolinking */
29+
autolinkLibrariesWithApp()
30+
2831
/* Bundling */
2932
// A list containing the node command and its flags. Default is just 'node'.
3033
// nodeExecutableAndArgs = ["node"]
@@ -117,8 +120,6 @@ dependencies {
117120
}
118121
}
119122

120-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
121-
122123
task PortalsSync(type: Exec) {
123124
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
124125
commandLine 'cmd', '/c', 'PowerShell -Command portals.exe sync --config ../../.portals.yaml --destination ' + layout.projectDirectory.dir("src/main/assets").toString()

Diff for: example/android/app/src/main/AndroidManifest.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
android:icon="@mipmap/ic_launcher"
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:allowBackup="false"
11-
android:theme="@style/AppTheme">
11+
android:theme="@style/AppTheme"
12+
android:supportsRtl="true">
1213
<activity
1314
android:name=".MainActivity"
1415
android:label="@string/app_name"

Diff for: example/android/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ buildscript {
22
ext {
33
buildToolsVersion = "34.0.0"
44
minSdkVersion = 23
5-
compileSdkVersion = 34
6-
targetSdkVersion = 34
5+
compileSdkVersion = 35
6+
targetSdkVersion = 35
77
ndkVersion = "26.1.10909125"
8-
kotlinVersion = "1.9.22"
8+
kotlinVersion = "1.9.24"
99
}
1010
repositories {
1111
google()

Diff for: example/android/gradle.properties

-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ org.gradle.jvmargs=-Xmx12800m -XX:MaxMetaspaceSize=512m
2121
# Android operating system, and which are packaged with your app's APK
2222
# https://developer.android.com/topic/libraries/support-library/androidx-rn
2323
android.useAndroidX=true
24-
# Automatically convert third-party libraries to use AndroidX
25-
android.enableJetifier=true
2624

2725
# Use this property to specify which architecture you want to build.
2826
# You can also override it from the CLI using

Diff for: example/android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

Diff for: example/android/gradlew

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.

Diff for: example/android/settings.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
2+
plugins { id("com.facebook.react.settings") }
3+
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
14
rootProject.name = 'PortalsReactNativeExample'
2-
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
35
include ':app'
46
includeBuild('../node_modules/@react-native/gradle-plugin')

Diff for: example/ios/Podfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require Pod::Executable.execute_command('node', ['-p',
55
{paths: [process.argv[1]]},
66
)', __dir__]).strip
77

8-
platform :ios, min_ios_version_supported
8+
platform :ios, '14.0'
99
prepare_react_native_project!
1010

1111
linkage = ENV['USE_FRAMEWORKS']

0 commit comments

Comments
 (0)