Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
[RN SDK] Updated native dependencies and In person appointments adjus…
Browse files Browse the repository at this point in the history
…tments (#24477)

- Fixes: #24166

## Summary

Updated the native dependencies to the latest version and updated the
navigation for the new appointment detail screen.

### Changelog

- Updated Android to `1.0.0-alpha22`
- Updated iOS to `1.0.0-alpha30`
- Updated the (iOS) navigation for appointment detail screen
- Removed the symlinking of the packages as gradle won't compile anymore

## Test plan

(on iOS and Android)
- Start the playground app and go to native appointment list
- Schedule an in-person appointment
- Go to appointment detail 

## Additional context


https://user-images.githubusercontent.com/1511694/214604028-875ff1bd-39bf-462b-b80d-7db22fe84047.mov



https://user-images.githubusercontent.com/1511694/214805901-0f3e4834-b90e-4519-9d57-7183372e3376.mp4
  • Loading branch information
amseddi authored Jan 26, 2023
1 parent 644c75d commit 9988bd0
Show file tree
Hide file tree
Showing 36 changed files with 413 additions and 103 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@

### Added

- A new `onAppointmentSelected` property is available in `NablaAppointmentListView` component and should be provided to redirect to the appointment detail screen (`NablaSchedulingUI.navigateToAppointmentDetailScreen(appointmentId)`).
(This callback will only be used on iOS and the navigation will work as expected on Android)

### Changed

- `NablaSchedulingClient.openScheduleAppointmentScreen()` has been renamed to `NablaSchedulingUI.navigateToScheduleAppointmentScreen()` in the NablaScheduling package.

### Fixed

### Versions

- Android: [`1.0.0-alpha21`](https://github.com/nabla/nabla-android/releases/tag/1.0.0-alpha21)
- iOS: [`1.0.0-alpha29`](https://github.com/nabla/nabla-ios/releases/tag/1.0.0-alpha29)
- Android: [`1.0.0-alpha22`](https://github.com/nabla/nabla-android/releases/tag/1.0.0-alpha22)
- iOS: [`1.0.0-alpha30`](https://github.com/nabla/nabla-ios/releases/tag/1.0.0-alpha30)

## [1.0.0-alpha12] - 2023-01-02

Expand Down
54 changes: 27 additions & 27 deletions messaging-sample-app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,34 +87,34 @@ PODS:
- WebRTC-SDK (~> 104.5112.07)
- Logging (1.4.0)
- nabla-react-native-core (1.0.0-alpha12):
- NablaCore (= 1.0.0-alpha29)
- NablaCore (= 1.0.0-alpha30)
- React-Core
- nabla-react-native-messaging-core (1.0.0-alpha12):
- nabla-react-native-core
- NablaMessagingCore (= 1.0.0-alpha29)
- NablaMessagingCore (= 1.0.0-alpha30)
- React-Core
- nabla-react-native-messaging-ui (1.0.0-alpha12):
- nabla-react-native-messaging-core
- NablaMessagingUI (= 1.0.0-alpha29)
- NablaMessagingUI (= 1.0.0-alpha30)
- React-Core
- nabla-react-native-video-call (1.0.0-alpha12):
- nabla-react-native-core
- NablaVideoCall (= 1.0.0-alpha29)
- NablaVideoCall (= 1.0.0-alpha30)
- React-Core
- NablaCore (1.0.0-alpha29):
- NablaCore (1.0.0-alpha30):
- Apollo/SQLite (~> 0.50)
- Apollo/WebSocket (~> 0.50)
- Sentry (~> 7.30.1)
- NablaDocumentScanner (1.0.0-alpha29)
- NablaMessagingCore (1.0.0-alpha29):
- NablaCore (= 1.0.0-alpha29)
- NablaMessagingUI (1.0.0-alpha29):
- NablaCore (= 1.0.0-alpha29)
- NablaDocumentScanner (= 1.0.0-alpha29)
- NablaMessagingCore (= 1.0.0-alpha29)
- NablaVideoCall (1.0.0-alpha29):
- NablaDocumentScanner (1.0.0-alpha30)
- NablaMessagingCore (1.0.0-alpha30):
- NablaCore (= 1.0.0-alpha30)
- NablaMessagingUI (1.0.0-alpha30):
- NablaCore (= 1.0.0-alpha30)
- NablaDocumentScanner (= 1.0.0-alpha30)
- NablaMessagingCore (= 1.0.0-alpha30)
- NablaVideoCall (1.0.0-alpha30):
- LiveKitClient (~> 1.0.3)
- NablaCore (= 1.0.0-alpha29)
- NablaCore (= 1.0.0-alpha30)
- OpenSSL-Universal (1.1.1100)
- PromisesObjC (2.1.1)
- PromisesSwift (2.1.1):
Expand Down Expand Up @@ -402,7 +402,7 @@ PODS:
- SQLite.swift/standard (= 0.13.3)
- SQLite.swift/standard (0.13.3)
- SwiftProtobuf (1.20.3)
- WebRTC-SDK (104.5112.07)
- WebRTC-SDK (104.5112.08)
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)
Expand Down Expand Up @@ -579,7 +579,7 @@ SPEC CHECKSUMS:
Apollo: 204819ea82022fbc59ad05056820df867f19bd02
boost: a7c83b31436843459a1961bfd74b96033dc77234
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: 48289402952f4f7a4e235de70a9a590aa0b79ef4
FBReactNativeSpec: dd1186fd05255e3457baa2f4ca65e94c2cd1e3ac
Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0
Expand All @@ -592,19 +592,19 @@ SPEC CHECKSUMS:
Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541
FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 85ecdd10ee8d8ec362ef519a6a45ff9aa27b2e85
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
LiveKitClient: e4c5d63cd7633a5006058f27ccfddd914c5fa592
Logging: beeb016c9c80cf77042d62e83495816847ef108b
nabla-react-native-core: 66f938cc643aeb76126e12d615b3570802ba5a74
nabla-react-native-messaging-core: 1d87dff5c89b9497dc4a6f472b752dc1051aabd3
nabla-react-native-messaging-ui: af5c98f2fae7fb462427e4b1cb9451b565df27fb
nabla-react-native-video-call: 304fdfcba6d39d7b50fde948329d54caa116954a
NablaCore: 219fc1f2b856896d67d10bd312f506ef146d63b2
NablaDocumentScanner: 06ac33fe4c7a6595e44252752de0863a6545ecd6
NablaMessagingCore: 58949d0029ac5c76b4c7224143fb2b2905504abe
NablaMessagingUI: 775ab9c56fe6f2b9a2db239aca838ded457e0679
NablaVideoCall: 5d61e1975e8aaba2d5e5358aec79eedeb6d41769
nabla-react-native-core: 04f461e61fe72203b8770a496343ec0b41055f09
nabla-react-native-messaging-core: 4fe2585594eec2dbbe2179112465140ecdc55593
nabla-react-native-messaging-ui: c8c2378f3bb5c55aba9fd7f484736e81cb105654
nabla-react-native-video-call: 4c387e207ec2f1a074cf15e70e2adfa2b5dfe5aa
NablaCore: cabe7a67184596bcdb87db8c384b4945cfaa4e2b
NablaDocumentScanner: 1c84c7813c2242137ee9442a16e8f7d6e176c810
NablaMessagingCore: 7f77bebb39b2fcdc0eead22128b8cd23a52e50c5
NablaMessagingUI: f8842233b2813726c8229e22c25bfa04f182ea1d
NablaVideoCall: 97564e510993e3cd57d0858120c367dd4d388c0b
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
PromisesSwift: 99fddfe4a0ec88a56486644c0da106694c92a604
Expand Down Expand Up @@ -638,7 +638,7 @@ SPEC CHECKSUMS:
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
SQLite.swift: 903bfa3bc9ab06345fdfbb578e34f47cfcf417da
SwiftProtobuf: b02b5075dcf60c9f5f403000b3b0c202a11b6ae1
WebRTC-SDK: ef83f71e443c135d98de109940343bcf6d313e8f
WebRTC-SDK: d5816d8135a5a947839db0caa8d8ba0e94d2b1fb
Yoga: 99caf8d5ab45e9d637ee6e0174ec16fbbb01bcfc
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-core/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+'

implementation 'com.nabla.nabla-android:core:1.0.0-alpha21'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1'
implementation 'com.nabla.nabla-android:core:1.0.0-alpha22'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
}
23 changes: 12 additions & 11 deletions packages/react-native-core/ios/Sources/LogWatcher/CoreLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,41 @@ public final class CoreLogger {

extension CoreLogger: NablaCore.Logger {

public func debug(message: @autoclosure () -> String, extra: [String: Any]) {
public func debug(message: @autoclosure () -> String, error: Error?, extra: [String: Any]) {
if logLevel.isAtLeast(.debug) {
Self.logsSubject.send(
Log(level: .debug, message: message(), error: extractNablaErrorFromExtra(extra))
Log(level: .debug, message: message(), error: error?.asNablaError())
)
}
}

public func info(message: @autoclosure () -> String, extra: [String: Any]) {
public func info(message: @autoclosure () -> String, error: Error?, extra: [String: Any]) {
if logLevel.isAtLeast(.info) {
Self.logsSubject.send(
Log(level: .info, message: message(), error: extractNablaErrorFromExtra(extra))
Log(level: .info, message: message(), error: error?.asNablaError())
)
}
}

public func warning(message: @autoclosure () -> String, extra: [String: Any]) {
public func warning(message: @autoclosure () -> String, error: Error?, extra: [String: Any]) {
if logLevel.isAtLeast(.warn) {
Self.logsSubject.send(
Log(level: .warn, message: message(), error: extractNablaErrorFromExtra(extra))
Log(level: .warn, message: message(), error: error?.asNablaError())
)
}
}

public func error(message: @autoclosure () -> String, extra: [String: Any]) {
public func error(message: @autoclosure () -> String, error: Error?, extra: [String: Any]) {
if logLevel.isAtLeast(.error) {
Self.logsSubject.send(
Log(level: .error, message: message(), error: extractNablaErrorFromExtra(extra))
Log(level: .error, message: message(), error: error?.asNablaError())
)
}
}
}

private func extractNablaErrorFromExtra(_ extra: [String: Any]) -> NablaError? {
let error = (extra["error"] as? Error) ?? (extra["reason"] as? Error)
return (error as? NablaError) ?? error.map(InternalError.init)
extension Error {
fileprivate func asNablaError() -> NablaError {
(self as? NablaError) ?? InternalError(underlyingError: self)
}
}
2 changes: 1 addition & 1 deletion packages/react-native-core/nabla-react-native-core.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
s.source_files = "ios/Sources/**/*.{h,m,swift}"

s.dependency 'React-Core'
s.dependency 'NablaCore', '1.0.0-alpha29'
s.dependency 'NablaCore', '1.0.0-alpha30'

s.test_spec 'Tests' do |test_spec|
test_spec.source_files= "ios/Tests/**/*.{h,m,swift}"
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-messaging-core/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ dependencies {

implementation project(path: ':nabla_react-native-core')

implementation 'com.nabla.nabla-android:messaging-core:1.0.0-alpha21'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1'
implementation 'com.nabla.nabla-android:messaging-core:1.0.0-alpha22'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
package com.nabla.sdk.reactnative.messaging.core.models

import android.content.Context
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.ReadableArray
import com.facebook.react.bridge.ReadableMap
import com.nabla.sdk.core.annotation.NablaInternal
import com.nabla.sdk.core.domain.entity.evaluate
import com.nabla.sdk.messaging.core.domain.entity.Conversation

@JvmName("toConversationMapArray")
internal fun List<Conversation>.toMapArray(): ReadableArray = Arguments.createArray().apply {
internal fun List<Conversation>.toMapArray(context: Context): ReadableArray = Arguments.createArray().apply {
forEach { conversation ->
pushMap(conversation.toMap())
pushMap(conversation.toMap(context))
}
}

internal fun Conversation.toMap(): ReadableMap {
@OptIn(NablaInternal::class)
internal fun Conversation.toMap(context: Context): ReadableMap {
return Arguments.createMap().apply {
putMap("id", id.toMap())
putString("title", title)
putString("inboxPreviewTitle", inboxPreviewTitle)
putString("inboxPreviewTitle", inboxPreviewTitle.evaluate(context))
putString("lastMessagePreview", lastMessagePreview)
putString("lastModified", lastModified.toString())
putInt("patientUnreadMessageCount", patientUnreadMessageCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal class ConversationListWatcherModule(
.onEach {
loadMoreConversationsCallback = it.loadMore
val params = Arguments.createMap().apply {
putArray("conversations", it.content.toMapArray())
putArray("conversations", it.content.toMapArray(reactApplicationContext))
}
sendEvent(reactApplicationContext,
WATCH_CONVERSATIONS_UPDATED, params)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ internal class ConversationWatcherModule(
val watchConversationJob =
NablaClient.getInstance().messagingClient.watchConversation(conversationId)
.onEach {
sendUpdate(it.toMap())
sendUpdate(it.toMap(reactApplicationContext))
}
.catch { exception: Throwable ->
sendError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import NablaCore
import NablaMessagingCore

extension PaginatedList where T == ConversationItem {
extension PaginatedList where Element == ConversationItem {
var dictionaryRepresentation: [String: Any] {
var result = [String: Any]()
result["hasMore"] = hasMore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import NablaCore
import NablaMessagingCore

extension PaginatedList where T == Conversation {
extension PaginatedList where Element == Conversation {
var dictionaryRepresentation: [String: Any] {
[
"conversations": elements.map(\.dictionaryRepresentation),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Pod::Spec.new do |s|

s.dependency 'React-Core'
s.dependency 'nabla-react-native-core'
s.dependency 'NablaMessagingCore', '1.0.0-alpha29'
s.dependency 'NablaMessagingCore', '1.0.0-alpha30'

s.test_spec 'Tests' do |test_spec|
test_spec.source_files= "ios/Tests/**/*.{h,m,swift}"
Expand Down
10 changes: 5 additions & 5 deletions packages/react-native-messaging-ui/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ dependencies {
implementation project(path: ':nabla_react-native-core')
implementation project(path: ':nabla_react-native-messaging-core')

implementation 'com.nabla.nabla-android:messaging-ui:1.0.0-alpha21'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.fragment:fragment-ktx:1.5.0'
implementation 'androidx.activity:activity-ktx:1.5.0'
implementation 'com.nabla.nabla-android:messaging-ui:1.0.0-alpha22'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.fragment:fragment-ktx:1.5.5'
implementation 'androidx.activity:activity-ktx:1.6.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ Pod::Spec.new do |s|

s.dependency 'React-Core'
s.dependency 'nabla-react-native-messaging-core'
s.dependency 'NablaMessagingUI', '1.0.0-alpha29'
s.dependency 'NablaMessagingUI', '1.0.0-alpha30'
end
4 changes: 2 additions & 2 deletions packages/react-native-scheduling/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies {
implementation 'com.facebook.react:react-native:+'

implementation project(path: ':nabla_react-native-core')
implementation 'androidx.fragment:fragment-ktx:1.5.2'
implementation 'androidx.fragment:fragment-ktx:1.5.5'

implementation 'com.nabla.nabla-android:scheduling:1.0.0-alpha21'
implementation 'com.nabla.nabla-android:scheduling:1.0.0-alpha22'
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.ViewManager
import com.nabla.sdk.reactnative.scheduling.nablaapointmentlistview.NablaAppointmentListViewManager
import com.nabla.sdk.reactnative.scheduling.nablaschedulingclient.NablaSchedulingClientModule
import com.nabla.sdk.reactnative.scheduling.nablaschedulingui.NablaSchedulingUIModule

class NablaSchedulingPackage : ReactPackage {

Expand All @@ -19,7 +20,8 @@ class NablaSchedulingPackage : ReactPackage {
override fun createNativeModules(reactContext: ReactApplicationContext):
MutableList<NativeModule> {
return mutableListOf(
NablaSchedulingClientModule(reactContext)
NablaSchedulingClientModule(reactContext),
NablaSchedulingUIModule(reactContext)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.nabla.sdk.reactnative.scheduling.nablaapointmentlistview
import androidx.fragment.app.FragmentActivity
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReadableArray
import com.facebook.react.common.MapBuilder
import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.ViewGroupManager
import com.nabla.sdk.reactnative.scheduling.utils.NativeViewWrapper
Expand Down Expand Up @@ -35,6 +36,7 @@ internal class NablaAppointmentListViewManager(

private fun createFragment(reactNativeViewId: Int) {
val fragment = AppointmentsFragment.newInstance()

(reactContext.currentActivity as FragmentActivity).supportFragmentManager
.beginTransaction()
.replace(
Expand All @@ -45,6 +47,16 @@ internal class NablaAppointmentListViewManager(
.commit()
}

override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any>? {
return MapBuilder.of(
"onAppointmentClicked",
MapBuilder.of(
"registrationName",
"onAppointmentSelected"
)
)
}

companion object {
private const val REACT_CLASS = "NablaAppointmentListView"
private const val COMMAND_CREATE = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,4 @@ class NablaSchedulingClientModule(
NablaClientModule.addModule(NablaSchedulingModule())
promise.resolve(null)
}

@ReactMethod
fun openScheduleAppointmentScreen() {
if (currentActivity == null) {
CoreLogger.warn("Missing current activity in `NablaSchedulingClientModule`")
return
}
NablaClient.getInstance().schedulingModule.openScheduleAppointmentActivity(currentActivity!!)
}
}
Loading

0 comments on commit 9988bd0

Please sign in to comment.