Skip to content

Commit e792b4b

Browse files
authored
Release 0.7.0 (#56)
* feat!: remove deprecated APIs
1 parent dc56064 commit e792b4b

File tree

17 files changed

+64
-376
lines changed

17 files changed

+64
-376
lines changed

android/src/main/java/io/ionic/portals/reactnative/PortalView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ internal class PortalViewManager(private val context: ReactApplicationContext) :
3333
when (fragmentMap[viewGroup.id]) {
3434
null -> fragmentMap[viewGroup.id] = PortalViewState(
3535
fragment = null,
36-
portal = RNPortalManager.getPortal(name) ?: RNPortalManager.createPortal(portal),
36+
portal = RNPortalManager.createPortal(portal),
3737
initialContext = portal.getMap("initialContext")?.toHashMap()
3838
)
3939
}

android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalManager.kt

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,11 @@ internal data class PortalPlugin(val androidClassPath: String, val iosClassName:
4141

4242
internal object RNPortalManager {
4343
private val manager = PortalManager
44-
@Deprecated("Will be removed in the next release.")
45-
private val portals: ConcurrentHashMap<String, RNPortal> = ConcurrentHashMap()
4644
private lateinit var reactApplicationContext: ReactApplicationContext
4745
private var usesSecureLiveUpdates = false
4846

4947
fun register(key: String) = manager.register(key)
5048

51-
@Deprecated("Will be removed in the next release.")
52-
fun addPortal(map: ReadableMap): RNPortal? {
53-
val portal = createPortal(map) ?: return null
54-
portals[portal.builder.name] = portal
55-
return portal
56-
}
57-
5849
fun createPortal(map: ReadableMap): RNPortal? {
5950
val name = map.getString("name") ?: return null
6051
val portalBuilder = PortalBuilder(name)
@@ -147,11 +138,6 @@ internal object RNPortalManager {
147138
)
148139
}
149140

150-
@Deprecated("Will be removed in the next release.")
151-
fun getPortal(name: String): RNPortal? {
152-
return portals[name]
153-
}
154-
155141
fun enableSecureLiveUpdates(keyPath: String) {
156142
LiveUpdateManager.secureLiveUpdatePEM = keyPath
157143
usesSecureLiveUpdates = true
@@ -183,13 +169,6 @@ internal object RNPortalManager {
183169
LiveUpdateManager.secureLiveUpdatePEM = it
184170
usesSecureLiveUpdates = true
185171
}
186-
187-
val portalJsonArray = configJson.getJSONArray("portals")
188-
189-
for (index in 0 until portalJsonArray.length()) {
190-
val portalJson = portalJsonArray.getJSONObject(index)
191-
addPortal(portalJson.toReactMap())
192-
}
193172
}
194173
}
195174

android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalsModule.kt

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,6 @@ internal class PortalManagerModule(reactContext: ReactApplicationContext) :
1616
promise.resolve(null)
1717
}
1818

19-
@ReactMethod
20-
fun addPortal(map: ReadableMap, promise: Promise) {
21-
val portal = RNPortalManager.addPortal(map)
22-
if (portal == null) {
23-
promise.reject(null, "Invalid Portal configuration.")
24-
} else {
25-
promise.resolve(portal.toReadableMap())
26-
}
27-
}
28-
29-
@ReactMethod
30-
fun addPortals(array: ReadableArray, promise: Promise) {
31-
val portals = WritableNativeArray()
32-
33-
for (i in 0 until array.size()) {
34-
val map = array.getMap(i)
35-
val portal = RNPortalManager.addPortal(map) ?: continue
36-
portals.pushMap(portal.toReadableMap())
37-
}
38-
39-
promise.resolve(portals)
40-
}
41-
42-
@ReactMethod
43-
fun getPortal(name: String, promise: Promise) {
44-
try {
45-
val portal = RNPortalManager.getPortal(name)
46-
promise.resolve(portal?.toReadableMap())
47-
} catch (e: IllegalStateException) {
48-
promise.reject(null, "Portal named $name not registered.")
49-
}
50-
}
51-
5219
@ReactMethod
5320
fun enableSecureLiveUpdates(keyPath: String, promise: Promise) {
5421
RNPortalManager.enableSecureLiveUpdates(keyPath)

android/src/main/java/io/ionic/portals/reactnative/ReactNativeWebVitalsModule.kt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,6 @@ import com.facebook.react.bridge.ReactMethod
88
internal class PortalWebVitalsModule(reactContext: ReactApplicationContext): ReactContextBaseJavaModule(reactContext) {
99
override fun getName() = "IONPortalsWebVitals"
1010

11-
private fun registerVital(portalName: String, vitalName: String) {
12-
val portal = RNPortalManager.getPortal(portalName) ?: return
13-
if (portal.vitals == null) {
14-
portal.vitals = mutableListOf()
15-
}
16-
portal.vitals?.add(vitalName)
17-
}
18-
19-
@ReactMethod
20-
fun registerOnFirstContentfulPaint(portalName: String, promise: Promise) {
21-
registerVital(portalName,"fcp")
22-
promise.resolve(null)
23-
}
24-
25-
@ReactMethod
26-
fun registerOnFirstInputDelay(portalName: String, promise: Promise) {
27-
registerVital(portalName,"fid")
28-
promise.resolve(null)
29-
}
30-
31-
@ReactMethod
32-
fun registerOnTimeToFirstByte(portalName: String, promise: Promise) {
33-
registerVital(portalName,"ttfb")
34-
promise.resolve(null)
35-
}
36-
3711
@ReactMethod
3812
fun addListener(eventName: String) {
3913
}

example/ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ PODS:
11711171
- React-logger (= 0.74.2)
11721172
- React-perflogger (= 0.74.2)
11731173
- React-utils (= 0.74.2)
1174-
- ReactNativePortals (0.5.2):
1174+
- ReactNativePortals (0.6.0):
11751175
- DoubleConversion
11761176
- glog
11771177
- hermes-engine
@@ -1435,10 +1435,10 @@ SPEC CHECKSUMS:
14351435
React-runtimescheduler: 56b642bf605ba5afa500d35790928fc1d51565ad
14361436
React-utils: 4476b7fcbbd95cfd002f3e778616155241d86e31
14371437
ReactCommon: ecad995f26e0d1e24061f60f4e5d74782f003f12
1438-
ReactNativePortals: 9bfdb3928c55e58ba22b21d99775aa3bb33c4df8
1438+
ReactNativePortals: 42f59afa6ed4119897d2dd7c9e5f66599c022684
14391439
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
14401440
Yoga: ae3c32c514802d30f687a04a6a35b348506d411f
14411441

14421442
PODFILE CHECKSUM: ce82c2dd878c18eaa5b59018ea58e2e1c0876c21
14431443

1444-
COCOAPODS: 1.14.3
1444+
COCOAPODS: 1.15.2

example/ios/PortalsReactNativeExample.xcodeproj/project.pbxproj

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -608,11 +608,7 @@
608608
"-DFOLLY_CFG_NO_COROUTINES=1",
609609
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
610610
);
611-
OTHER_LDFLAGS = (
612-
"$(inherited)",
613-
"-Wl",
614-
"-ld_classic",
615-
);
611+
OTHER_LDFLAGS = "$(inherited)";
616612
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
617613
SDKROOT = iphoneos;
618614
USE_HERMES = true;
@@ -684,11 +680,7 @@
684680
"-DFOLLY_CFG_NO_COROUTINES=1",
685681
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
686682
);
687-
OTHER_LDFLAGS = (
688-
"$(inherited)",
689-
"-Wl",
690-
"-ld_classic",
691-
);
683+
OTHER_LDFLAGS = "$(inherited)";
692684
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
693685
SDKROOT = iphoneos;
694686
USE_HERMES = true;

example/src/App.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ export default function App() {
4848
<View style={styles.container}>
4949
<PubSubLabel initialNumber={initialNumber} />
5050
{/* {ready ? ( */}
51-
<PortalView
52-
portal={portal}
53-
style={styles.portalView}
54-
// webVitals={{
55-
// firstContentfulPaint: (duration: number) =>
56-
// console.log('firstContentfulPaint', duration),
57-
// firstInputDelay: (duration: number) =>
58-
// console.log('firstInputDelay', duration),
59-
// timeToFirstByte: (duration: number) => {
60-
// console.log('timeToFirstByte', duration);
61-
// },
62-
// }}
63-
/>
51+
<PortalView
52+
portal={portal}
53+
style={styles.portalView}
54+
webVitals={{
55+
firstContentfulPaint: (duration: number) =>
56+
console.log('firstContentfulPaint', duration),
57+
firstInputDelay: (duration: number) =>
58+
console.log('firstInputDelay', duration),
59+
timeToFirstByte: (duration: number) => {
60+
console.log('timeToFirstByte', duration);
61+
},
62+
}}
63+
/>
6464
{/* ) : (
6565
<></>
6666
)} */}

ios/AssetMap+Codable.swift

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// IonicPortals+Codable.swift
3+
// ReactNativePortals
4+
//
5+
// Created by Trevor Lambert on 6/5/24.
6+
// Copyright © 2024 Facebook. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import IonicPortals
11+
12+
extension AssetMap: Encodable {
13+
enum CodingKeys: String, CodingKey {
14+
case startDir, virtualPath, name
15+
}
16+
17+
public func encode(to encoder: Encoder) throws {
18+
var container = encoder.container(keyedBy: CodingKeys.self)
19+
try container.encode(startDir, forKey: .startDir)
20+
try container.encode(virtualPath, forKey: .virtualPath)
21+
try container.encode(name, forKey: .name)
22+
}
23+
}
24+
25+
extension AssetMap: Decodable {
26+
public init(from decoder: Decoder) throws {
27+
let container = try decoder.container(keyedBy: CodingKeys.self)
28+
let name = try container.decode(String.self, forKey: .name)
29+
let startDir = try container.decodeIfPresent(String.self, forKey: .startDir) ?? ""
30+
let virtualPath = try container.decodeIfPresent(String.self, forKey: .virtualPath)
31+
self.init(name: name, virtualPath: virtualPath, startDir: startDir)
32+
}
33+
}

ios/AssetMap+Dict.swift

Lines changed: 0 additions & 28 deletions
This file was deleted.

ios/IonicPortals+Codable.swift

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)