-
Notifications
You must be signed in to change notification settings - Fork 1
Upgrade react native 0.79.4 + Removed Mixpanel from Native Android/IOS SDKs #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dporwal-shipit
wants to merge
45
commits into
development
Choose a base branch
from
upgrade-react-native-0.79.4-dhruv-events
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+8,661
−102
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
9c53b71
fix: setup sdk function working now
aaditya-smallcase b30f6fa
feat: remove old example app and add new smart investing app
indrajit-roy-sc f4d0333
chore: android working state with 0.79.4
indrajit-roy-sc 6acd2e4
chore: ios working state with 0.79.4
indrajit-roy-sc 2f9c755
feat: implement core functionality for smart investing app
indrajit-roy-sc 129e071
chore: revert back iOS min version and SCGateway dependency to match
indrajit-roy-sc 24b1ca8
chore: update Podfile.lock
indrajit-roy-sc 94a5d70
feat(analytics): Adding events capturing through new RCTBridgeModule
dporwal-shipit 75bd9c3
feat(analytics): Adding events capturing through new RCTBridgeModule
dporwal-shipit 0fc855d
feature(analytics): working state
dporwal-shipit 145a91d
chore: update SCGateway dependency to version 4.1.5 in Podfile.lock
indrajit-roy-sc c70b0b1
chore: update iOS run script to list available devices
indrajit-roy-sc 63378d4
revert: change impl. back to stable version
indrajit-roy-sc 4eb3933
feature(analytics): updated code to capture events.
dporwal-shipit 0e0091a
feature(analytics): updated code to capture events.
dporwal-shipit 44ad07b
feat(analytics):- remove Mixpanel from SCLoans and substitute with ne…
dporwal-shipit 2a2b64d
app building
dporwal-shipit f82d8c1
developing android event flow
dporwal-shipit 2a319f7
feature(analytics): working state android and ios scgateway emitters
dporwal-shipit 08de62a
feature(analytics): Working state android scloans events incoming
dporwal-shipit 42eb202
feature(analytics): working state ios events emission-capturing
dporwal-shipit ca7ed39
feature(analytics): working state android events emission-capturing
dporwal-shipit 8008365
refactor(analytics): restructure event bridging logic for improved ma…
dporwal-shipit 767a0c2
refactor(analytics): restructure loans event bridging logic for impro…
dporwal-shipit 46d9821
feature(analytics): making changes as requested in PR reviews
dporwal-shipit 3691d60
feature(analytics): making changes as per PR request reviews
dporwal-shipit 9ee02e7
feature(analytics): making changes as per PR request reviews
dporwal-shipit 2b62d03
refactor(SCGatewayEvents): streamline initialization and subscription…
indrajit-roy-sc b55d7e3
refactor(analytics): refactoring the native files in bridge to forwar…
dporwal-shipit d29aba7
refactor(analytics): refactoring the code, shifted App.tsx from class…
dporwal-shipit 9d19442
refactor(analytics): working state of android scgateway & scloans
dporwal-shipit 2832b51
refactor(analytics): working state of ios scgateway & scloans
dporwal-shipit 27eb4fb
refactor(analytics): making use of native sdk exposed properties dire…
dporwal-shipit 1e7f2a0
refactor(analytics): standardize class structure with formatting and …
dporwal-shipit a17eac1
chore(analytics): Merge upgrade/react-native-0.79.4 into branch upgra…
dporwal-shipit 8292030
refactor: improve event emitters and clean up codebase
dporwal-shipit 4f1a28e
refactor: we no longer need try-catch in onCatalystInstanceDestroy
dporwal-shipit 4fe94b8
refactor: we no longer need try-catch in onCatalystInstanceDestroy
dporwal-shipit 4949c3e
refactor: renaming to ensure consistency across ios/android
dporwal-shipit 3891eee
changed the PRODUCT_BUNDLE_IDENTIFIER and updated build.gradle with n…
dporwal-shipit b26c64b
making changes as per PR reviews
dporwal-shipit eff311e
making changes as per PR
dporwal-shipit 8697b0b
Merge remote-tracking branch 'origin/development' into upgrade-react-…
dporwal-shipit 09f4c52
2nd emitter got added while testing in XCode-VSCode, removed
dporwal-shipit 25e9221
making changes as per PR reviews
dporwal-shipit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
android/src/main/java/com/reactnativesmallcasegateway/SCGatewayBridgeEmitter.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
|
||
// SCGatewayBridgeEmitter.kt | ||
package com.reactnativesmallcasegateway | ||
|
||
import android.util.Log | ||
import com.facebook.react.bridge.* | ||
import com.facebook.react.bridge.UiThreadUtil | ||
import com.facebook.react.modules.core.DeviceEventManagerModule | ||
import com.smallcase.gateway.data.listeners.Notification | ||
import com.smallcase.gateway.data.listeners.NotificationCenter | ||
import com.smallcase.gateway.portal.ScgNotification | ||
import com.smallcase.gateway.portal.SmallcaseGatewaySdk | ||
|
||
class SCGatewayBridgeEmitter(private val reactContext: ReactApplicationContext) : | ||
ReactContextBaseJavaModule(reactContext) { | ||
|
||
companion object { | ||
const val TAG = "SCGatewayBridgeEmitter" | ||
} | ||
|
||
private var notificationObserver: ((Notification) -> Unit)? = null | ||
|
||
private val isListening: Boolean | ||
get() = notificationObserver != null | ||
|
||
init { | ||
UiThreadUtil.runOnUiThread { startListening() } | ||
} | ||
|
||
override fun getName(): String = "SCGatewayBridgeEmitter" | ||
|
||
override fun onCatalystInstanceDestroy() { | ||
super.onCatalystInstanceDestroy() | ||
if (isListening) { | ||
notificationObserver?.let { observer -> | ||
NotificationCenter.removeObserver(observer) | ||
} | ||
notificationObserver = null | ||
Log.d(TAG, "Successfully cleaned up notification observer") | ||
} | ||
} | ||
|
||
@ReactMethod | ||
fun startListening(promise: Promise? = null) { | ||
Log.d(TAG, "startListening called") | ||
|
||
if (isListening) { | ||
Log.d(TAG, "Already listening to events") | ||
promise?.resolve("Already listening") | ||
return | ||
} | ||
|
||
UiThreadUtil.runOnUiThread { | ||
Log.d(TAG, "Starting listener on thread: ${Thread.currentThread().name}") | ||
|
||
notificationObserver = { notification -> | ||
Log.d(TAG, "Received notification: ${notification.name}") | ||
processScgNotification(notification) | ||
} | ||
|
||
notificationObserver?.let { observer -> | ||
NotificationCenter.addObserver(observer) | ||
Log.d(TAG, "Successfully started listening for notifications") | ||
promise?.resolve("Started listening successfully") | ||
} ?: run { | ||
promise?.reject("START_LISTENING_ERROR", "Failed to create observer") | ||
} | ||
} | ||
} | ||
|
||
@ReactMethod | ||
fun stopListening(promise: Promise) { | ||
if (!isListening) { | ||
promise.resolve("Not listening") | ||
return | ||
} | ||
|
||
UiThreadUtil.runOnUiThread { | ||
notificationObserver?.let { observer -> | ||
NotificationCenter.removeObserver(observer) | ||
notificationObserver = null | ||
promise.resolve("Stopped listening successfully") | ||
} ?: run { | ||
promise.resolve("No observer to remove") | ||
} | ||
} | ||
} | ||
|
||
private fun processScgNotification(notification: Notification) { | ||
val jsonString = notification.userInfo?.get(ScgNotification.STRINGIFIED_PAYLOAD_KEY) as? String | ||
if (jsonString == null) { | ||
Log.e(TAG, "SCGatewayBridgeEmitter: Invalid notification object - expected JSON string") | ||
return | ||
} | ||
|
||
sendEvent(SmallcaseGatewaySdk.SCG_NOTIFICATION_NAME, jsonString) | ||
} | ||
|
||
private fun sendEvent(eventName: String, jsonString: String) { | ||
try { | ||
if (reactContext.hasActiveCatalystInstance()) { | ||
reactContext | ||
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java) | ||
.emit(eventName, jsonString) | ||
} else { | ||
Log.w(TAG, "React context not active, cannot send event: $eventName") | ||
} | ||
} catch (e: Exception) { | ||
Log.e(TAG, "Failed to send event: $eventName", e) | ||
} | ||
} | ||
} |
117 changes: 117 additions & 0 deletions
117
android/src/main/java/com/reactnativesmallcasegateway/SCLoansBridgeEmitter.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
// SCLoansBridgeEmitter.kt | ||
package com.reactnativesmallcasegateway | ||
|
||
import android.util.Log | ||
import com.facebook.react.bridge.* | ||
import com.facebook.react.bridge.UiThreadUtil | ||
import com.facebook.react.modules.core.DeviceEventManagerModule | ||
import com.smallcase.loans.core.external.ScLoan | ||
import com.smallcase.loans.core.external.ScLoanNotification | ||
import com.smallcase.loans.data.listeners.Notification | ||
import com.smallcase.loans.data.listeners.NotificationCenter | ||
|
||
class SCLoansBridgeEmitter(private val reactContext: ReactApplicationContext): | ||
ReactContextBaseJavaModule(reactContext) { | ||
|
||
companion object { | ||
const val TAG = "SCLoansBridgeEmitter" | ||
} | ||
|
||
private var notificationObserver: ((Notification) -> Unit)? = null | ||
|
||
private val isListening: Boolean | ||
get() = notificationObserver != null | ||
|
||
init { | ||
UiThreadUtil.runOnUiThread { | ||
startListening() | ||
} | ||
} | ||
|
||
override fun getName(): String = "SCLoansBridgeEmitter" | ||
|
||
override fun onCatalystInstanceDestroy() { | ||
super.onCatalystInstanceDestroy() | ||
if (isListening) { | ||
notificationObserver?.let { observer -> | ||
NotificationCenter.removeObserver(observer) | ||
} | ||
notificationObserver = null | ||
Log.d(TAG, "Successfully cleaned up notification observer") | ||
} | ||
} | ||
|
||
@ReactMethod | ||
fun startListening(promise: Promise ? = null) { | ||
Log.d(TAG, "startListening called") | ||
|
||
if (isListening) { | ||
Log.d(TAG, "Already listening to events") | ||
promise?.resolve("Already listening") | ||
return | ||
} | ||
|
||
UiThreadUtil.runOnUiThread { | ||
Log.d(TAG, "Starting listener on thread: ${Thread.currentThread().name}") | ||
|
||
notificationObserver = { notification -> | ||
Log.d(TAG, "Received notification: ${notification.name}") | ||
processScLoansNotification(notification) | ||
} | ||
|
||
notificationObserver?.let { observer -> | ||
NotificationCenter.addObserver(observer) | ||
Log.d(TAG, "Successfully started listening for notifications") | ||
promise?.resolve("Started listening successfully") | ||
} ?: run { | ||
promise?.reject("START_LISTENING_ERROR", "Failed to create observer") | ||
} | ||
} | ||
} | ||
|
||
@ReactMethod | ||
fun stopListening(promise: Promise) { | ||
if (!isListening) { | ||
promise.resolve("Not listening") | ||
return | ||
} | ||
|
||
UiThreadUtil.runOnUiThread { | ||
notificationObserver?.let { observer -> | ||
NotificationCenter.removeObserver(observer) | ||
notificationObserver = null | ||
promise.resolve("Stopped listening successfully") | ||
} ?: run { | ||
promise.resolve("No observer to remove") | ||
} | ||
} | ||
} | ||
|
||
private fun processScLoansNotification(notification: Notification) { | ||
val jsonString = | ||
notification.userInfo?.get(ScLoanNotification.STRINGIFIED_PAYLOAD_KEY) as? String | ||
if (jsonString == null) { | ||
Log.e( | ||
TAG, | ||
"SCLoansBridgeEmitter: Invalid notification object - expected JSON string" | ||
) | ||
return | ||
} | ||
|
||
sendEvent(ScLoan.SCLOANS_NOTIFICATION_NAME, jsonString) | ||
} | ||
|
||
private fun sendEvent(eventName: String, jsonString: String) { | ||
try { | ||
if (reactContext.hasActiveCatalystInstance()) { | ||
reactContext | ||
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java) | ||
.emit(eventName, jsonString) | ||
} else { | ||
Log.w(TAG, "React context not active, cannot send event: $eventName") | ||
} | ||
} catch (e: Exception) { | ||
Log.e(TAG, "Failed to send event: $eventName", e) | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// SCGatewayBridgeEmitter.m | ||
// SCGateway | ||
// | ||
// Created by Dhruv Porwal | ||
// Copyright © 2025 smallcase. All rights reserved. | ||
// | ||
|
||
#import <React/RCTBridgeModule.h> | ||
#import "SmallcaseGateway-Bridging-Header.h" | ||
|
||
@interface RCT_EXTERN_REMAP_MODULE(SCGatewayBridgeEmitter, SCGatewayEmitter, NSObject) | ||
|
||
RCT_EXTERN_METHOD(startListening:(RCTPromiseResolveBlock)resolve | ||
rejecter:(RCTPromiseRejectBlock)reject) | ||
|
||
RCT_EXTERN_METHOD(stopListening:(RCTPromiseResolveBlock)resolve | ||
rejecter:(RCTPromiseRejectBlock)reject) | ||
|
||
@end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.