Skip to content

Conversation

dporwal-shipit
Copy link
Collaborator

No description provided.

@dporwal-shipit dporwal-shipit self-assigned this Jul 30, 2025
@dporwal-shipit dporwal-shipit changed the title Upgrade react native 0.79.4 dhruv events Upgrade react native 0.79.4 + Removed Mixpanel from Native Android/IOS SDKs Aug 26, 2025
@dporwal-shipit dporwal-shipit marked this pull request as draft August 26, 2025 09:50
@dporwal-shipit
Copy link
Collaborator Author

dporwal-shipit commented Aug 26, 2025

React-Native Bridge for Android successfully propagating events from Native Android SDK(Producer) to Smart Investing Appln (Consumer):

For SCGateway:
image

For SCLoans:
image

React-Native Bridge for IOS successfully propagating events from Native Android IOS(Producer) to Smart Investing Appln (Consumer):

For SCGateway:
image

For SCLoans:
image

…intainability

- Simplified event flow between native and JS layers
- Improved code readability and reduced complexity
- Easier to extend with new analytics events in future
…ved maintainability

- Simplified event flow between native and JS layers
- Improved code readability and reduced complexity
- Easier to extend with new analytics events in future
@dporwal-shipit dporwal-shipit marked this pull request as ready for review August 31, 2025 10:32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install the "prettier" vscode extention for formatting js files. make sure that it matches the older style

(here the diff should only show changes that you've already made)

return SmallcaseGatewayNative.archiveSmallcase(safeIscid);
};

/**
* Returns the native android/ios and react-native sdk version
* (internal-tracking)
* @returns {Promise}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did we remove these return and param types?


/**
* 🔕 Unsubscribe from Gateway Event
* @param {object} subscription - Subscription returned from startGatewayEventListening
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these param and return types can be better. make it closer to the actual types, instead of generic types

this.isInitialized = true;
console.log('[SCLoansEvents] Initialized for', Platform.OS);
} else {
console.warn('[SCLoansEvents] Native module not found for', Platform.OS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this probably should be thrown as an error. shouldn't silently fail

}

try {
const subscription = this.eventEmitter.addListener('scloans_notification', (eventData) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep all these strings ("scloans_notification") as constants. don't use them directly

Comment on lines +55 to +58
type: eventData.eventType || eventData.type || 'unknown_event',
eventType: eventData.eventType || eventData.type || 'unknown_event',
data: eventData.data || eventData,
timestamp: eventData.timestamp || Date.now(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do these fallbacks make sense?

please check with the analytics team on what should be the correct fallback values such that invalid values don't make it into real analysis


this.subscriptions.push(subscription);

console.log('SCLoansEvents Subscribed to gateway events');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all these console logs from the SDK

Comment on lines +81 to +84
const index = this.subscriptions.indexOf(subscription);
if (index > -1) {
this.subscriptions.splice(index, 1);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to use array.filter()

USER_IDENTIFY: 'scgateway_user_identify',
};

export class SCGatewayEvents {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here again, a lot of the event emitter code is duplicated.

structure it in a way where things can be shared as much as possible

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we are treating both the sdks as separate and isolated. So, created separate files to support this. Same is true in android implementation as well for Notification Center.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants