Skip to content

Commit 8697b0b

Browse files
Merge remote-tracking branch 'origin/development' into upgrade-react-native-0.79.4-dhruv-events
2 parents eff311e + 9c1593c commit 8697b0b

22 files changed

+32692
-14376
lines changed

.github/workflows/sonar-scan.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "SonarQube Scan"
2+
3+
on:
4+
push:
5+
tags:
6+
- "sonar-**"
7+
- "v**"
8+
paths:
9+
- "**"
10+
- "!.github/**"
11+
- "!deployment/**"
12+
pull_request:
13+
branches:
14+
- "development"
15+
- "prod"
16+
paths:
17+
- "**"
18+
- "!.github/**"
19+
- "!deployment/**"
20+
21+
jobs:
22+
sonar_scan:
23+
uses: smallcase/sc-infra-configs/.github/workflows/sonarqube_scan.yaml@master
24+
with:
25+
RUNNER_NAME: arc-runner-set-dind
26+
APPLICATION_NAME: "react-native-smallcase-gateway"
27+
BRANCH_NAME: "${{ github.ref_name }}"
28+
SONAR_SCAN: true
29+
secrets: inherit

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ android.iml
4343
# Cocoapods
4444
#
4545
example/ios/Pods
46+
smart_investing_react_native/Pods
4647

4748
# Ruby
4849
example/vendor/
50+
smart_investing_react_native/vendor/
4951

5052
# node.js
5153
#

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
smart_investing_react_native/
2+
node_modules/

CHANGELOG.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,109 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [5.2.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.0.2-rc.2...v5.2.0) (2025-08-14)
6+
7+
8+
### Features
9+
10+
* add smart investing app w/ react-native-0.79.4 ([#102](https://github.com/smallcase/react-native-smallcase-gateway/issues/102)) ([180018e](https://github.com/smallcase/react-native-smallcase-gateway/commit/180018ef04183128fc6e78011ae34755eb5f9323))
11+
12+
13+
### Bug Fixes
14+
15+
* update iOS bundle identifier and clean up build config ([363f457](https://github.com/smallcase/react-native-smallcase-gateway/commit/363f4576103bd57a301ad84fe773296288969e8c))
16+
17+
## [6.0.0-rc.7](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.6...v6.0.0-rc.7) (2025-07-09)
18+
19+
## [6.0.0-rc.6](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.5...v6.0.0-rc.6) (2025-07-09)
20+
21+
## [6.0.0-rc.5](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.4...v6.0.0-rc.5) (2025-07-09)
22+
23+
## [6.0.0-rc.4](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.3...v6.0.0-rc.4) (2025-07-09)
24+
25+
## [6.0.0-rc.3](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.2...v6.0.0-rc.3) (2025-07-09)
26+
27+
## [6.0.0-rc.2](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.0...v6.0.0-rc.2) (2025-07-09)
28+
29+
## [6.0.0-rc.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.1.0-rc.3...v6.0.0-rc.0) (2025-07-09)
30+
31+
32+
### Features
33+
34+
* **release:** add 'release:major:rc' script for prerelease management ([5602fa6](https://github.com/smallcase/react-native-smallcase-gateway/commit/5602fa62bf7f0e24d27353b2b93ebdfaea11466d))
35+
36+
## [5.1.0-rc.3](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.1.0-rc.2...v5.1.0-rc.3) (2025-07-01)
37+
38+
## [5.1.0-rc.2](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.1.0-rc.1...v5.1.0-rc.2) (2025-07-01)
39+
40+
## [5.1.0-rc.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.0.1-native-SCGateway-webview-4.1.3-389-release...v5.1.0-rc.1) (2025-06-20)
41+
42+
### [5.0.1-native-SCGateway-webview-4.1.3-389-release](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.0.1-native-SCGateway-webview-4.1.3-388-release...v5.0.1-native-SCGateway-webview-4.1.3-389-release) (2025-06-18)
43+
44+
### [5.0.1-native-SCGateway-webview-4.1.3-388-release](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.0.1...v5.0.1-native-SCGateway-webview-4.1.3-388-release) (2025-06-16)
45+
46+
## [5.1.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.0.2-rc.2...v5.1.0) (2025-08-14)
47+
48+
49+
### Features
50+
51+
* add smart investing app w/ react-native-0.79.4 ([#102](https://github.com/smallcase/react-native-smallcase-gateway/issues/102)) ([180018e](https://github.com/smallcase/react-native-smallcase-gateway/commit/180018ef04183128fc6e78011ae34755eb5f9323))
52+
53+
54+
### Bug Fixes
55+
56+
* update iOS bundle identifier and clean up build config ([363f457](https://github.com/smallcase/react-native-smallcase-gateway/commit/363f4576103bd57a301ad84fe773296288969e8c))
57+
58+
## [6.0.0-rc.7](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.6...v6.0.0-rc.7) (2025-07-09)
59+
60+
## [6.0.0-rc.6](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.5...v6.0.0-rc.6) (2025-07-09)
61+
62+
## [6.0.0-rc.5](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.4...v6.0.0-rc.5) (2025-07-09)
63+
64+
## [6.0.0-rc.4](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.3...v6.0.0-rc.4) (2025-07-09)
65+
66+
## [6.0.0-rc.3](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.2...v6.0.0-rc.3) (2025-07-09)
67+
68+
## [6.0.0-rc.2](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.0...v6.0.0-rc.2) (2025-07-09)
69+
70+
## [6.0.0-rc.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.1.0-rc.3...v6.0.0-rc.0) (2025-07-09)
71+
72+
73+
### Features
74+
75+
* **release:** add 'release:major:rc' script for prerelease management ([5602fa6](https://github.com/smallcase/react-native-smallcase-gateway/commit/5602fa62bf7f0e24d27353b2b93ebdfaea11466d))
76+
77+
## [5.1.0-rc.3](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.1.0-rc.2...v5.1.0-rc.3) (2025-07-01)
78+
79+
## [5.1.0-rc.2](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.1.0-rc.1...v5.1.0-rc.2) (2025-07-01)
80+
81+
## [5.1.0-rc.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.0.1-native-SCGateway-webview-4.1.3-389-release...v5.1.0-rc.1) (2025-06-20)
82+
83+
### [5.0.1-native-SCGateway-webview-4.1.3-389-release](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.0.1-native-SCGateway-webview-4.1.3-388-release...v5.0.1-native-SCGateway-webview-4.1.3-389-release) (2025-06-18)
84+
85+
### [5.0.1-native-SCGateway-webview-4.1.3-388-release](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.0.1...v5.0.1-native-SCGateway-webview-4.1.3-388-release) (2025-06-16)
86+
87+
## [6.0.0-rc.7](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.6...v6.0.0-rc.7) (2025-07-09)
88+
89+
## [6.0.0-rc.6](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.5...v6.0.0-rc.6) (2025-07-09)
90+
91+
## [6.0.0-rc.5](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.4...v6.0.0-rc.5) (2025-07-09)
92+
93+
## [6.0.0-rc.3](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.2...v6.0.0-rc.3) (2025-07-09)
94+
95+
## [6.0.0-rc.2](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.0...v6.0.0-rc.2) (2025-07-09)
96+
97+
## [6.0.0-rc.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v6.0.0-rc.0...v6.0.0-rc.1) (2025-07-09)
98+
99+
## [6.0.0-rc.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.1.0-rc.3...v6.0.0-rc.0) (2025-07-09)
100+
101+
102+
### Features
103+
104+
* **release:** add 'release:major:rc' script for prerelease management ([5602fa6](https://github.com/smallcase/react-native-smallcase-gateway/commit/5602fa62bf7f0e24d27353b2b93ebdfaea11466d))
105+
106+
## [5.1.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.1.0-rc.3...v5.1.0) (2025-07-07)
107+
5108
### [5.0.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v5.0.0...v5.0.1) (2025-05-05)
6109

7110
## [5.0.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v4.3.3...v5.0.0) (2025-01-21)

android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
149149
dependencies {
150150
//noinspection GradleDynamicVersion
151151
implementation 'com.facebook.react:react-native:+' // From node_modules
152-
implementation "com.smallcase.gateway:sdk-dhruv-android-extract-mixpanel-from-sdk-11bad28:4.3.0-3182-release"
153-
implementation "com.smallcase.loans:sdk-dhruv-android-extract-mixpanel-from-sdk-11bad28:3.1.1-80-release"
152+
implementation "com.smallcase.gateway:sdk-release-scg-v5-0-0-loans-v4-0-0-1df0c05:4.3.0-3183-release"
153+
implementation "com.smallcase.loans:sdk-release-scg-v5-0-0-loans-v4-0-0-1df0c05:3.1.1-81-release"
154154
implementation "androidx.core:core-ktx:1.3.1"
155155
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
156156
}
@@ -161,4 +161,4 @@ if (isNewArchitectureEnabled()) {
161161
libraryName = "SmallcaseGateway"
162162
codegenJavaPackageName = "com.reactnativesmallcasegateway"
163163
}
164-
}
164+
}

ios/SCGatewayEmitter.swift

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ import SCGateway
55
@objc(SCGatewayEmitter)
66
class SCGatewayEmitter: RCTEventEmitter {
77

8-
private struct Constants {
9-
static let payloadKey = "payload"
10-
static let stringifiedPayloadKey = "payload_str"
11-
static let scgNotificationName = "scg_notification"
12-
}
13-
148
private static var shared: SCGatewayEmitter?
159

1610
private var notificationObserver: NSObjectProtocol?
@@ -31,7 +25,7 @@ class SCGatewayEmitter: RCTEventEmitter {
3125
}
3226

3327
override func supportedEvents() -> [String]! {
34-
return [Constants.scgNotificationName]
28+
return [SCGateway.scgNotificationName.rawValue]
3529
}
3630

3731
override func startObserving() {
@@ -71,15 +65,15 @@ class SCGatewayEmitter: RCTEventEmitter {
7165
self.stopListening()
7266

7367
self.notificationObserver = NotificationCenter.default.addObserver(
74-
forName: Notification.Name(Constants.scgNotificationName),
68+
forName: SCGateway.scgNotificationName,
7569
object: nil,
7670
queue: .main
7771
) { [weak self] notification in
7872
self?.processScgNotification(notification)
7973
}
8074

8175
print(
82-
"SCGatewayEmitter: Started listening to notifications with name: \(Constants.scgNotificationName)."
76+
"SCGatewayEmitter: Started listening to notifications with name: \(SCGateway.scgNotificationName.rawValue)."
8377
)
8478
resolve?("Started listening to SCGateway events")
8579
}
@@ -109,15 +103,15 @@ class SCGatewayEmitter: RCTEventEmitter {
109103

110104
print("SCGatewayEmitter: Received notification with userInfo keys: \(userInfo.keys)")
111105

112-
guard let jsonString = userInfo[Constants.stringifiedPayloadKey] as? String else {
106+
guard let jsonString = userInfo[SCGNotification.strigifiedPayloadKey] as? String else {
113107
print(
114-
"SCGatewayEmitter: No stringified payload found with key '\(Constants.stringifiedPayloadKey)'"
108+
"SCGatewayEmitter: No stringified payload found with key '\(SCGNotification.strigifiedPayloadKey)'"
115109
)
116110
return
117111
}
118112

119113
print("SCGatewayEmitter: Received JSON string: \(jsonString).")
120-
sendEvent(withName: Constants.scgNotificationName, body: jsonString)
121-
print("SCGatewayEmitter: Emitted event '\(Constants.scgNotificationName)' with JSON string.")
114+
sendEvent(withName: SCGateway.scgNotificationName.rawValue, body: jsonString)
115+
print("SCGatewayEmitter: Emitted event '\(SCGateway.scgNotificationName.rawValue)' with JSON string.")
122116
}
123-
}
117+
}

ios/SCGatewayEmitter~.swift

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import Foundation
2+
import React
3+
import SCGateway
4+
5+
@objc(SCGatewayEmitter)
6+
class SCGatewayEmitter: RCTEventEmitter {
7+
8+
private struct Constants {
9+
static let stringifiedPayloadKey = "payload_str"
10+
}
11+
12+
private static var shared: SCGatewayEmitter?
13+
14+
private var notificationObserver: NSObjectProtocol?
15+
16+
private var isListening: Bool {
17+
return notificationObserver != nil
18+
}
19+
20+
override init() {
21+
super.init()
22+
SCGatewayEmitter.shared = self
23+
print("SCGatewayEmitter: Initialized.")
24+
}
25+
26+
deinit {
27+
print("SCGatewayEmitter: Deinitializing.")
28+
stopListening()
29+
}
30+
31+
override func supportedEvents() -> [String]! {
32+
return [SCGateway.scgNotificationName]
33+
}
34+
35+
override func startObserving() {
36+
super.startObserving()
37+
print("SCGatewayEmitter: React Native bridge startObserving called.")
38+
startListening()
39+
}
40+
41+
override func stopObserving() {
42+
super.stopObserving()
43+
print("SCGatewayEmitter: React Native bridge stopObserving called.")
44+
stopListening()
45+
}
46+
47+
override static func requiresMainQueueSetup() -> Bool {
48+
return true
49+
}
50+
51+
@objc func startListening(
52+
_ resolve: RCTPromiseResolveBlock? = nil,
53+
rejecter reject: RCTPromiseRejectBlock? = nil
54+
) {
55+
print("SCGatewayEmitter: Starting to listen for notifications.")
56+
57+
guard !isListening else {
58+
print("SCGatewayEmitter: Already listening, no action needed.")
59+
resolve?("Already listening")
60+
return
61+
}
62+
63+
DispatchQueue.main.async { [weak self] in
64+
guard let self = self else {
65+
reject?("START_LISTENING_FAILED", "Self deallocated", nil)
66+
return
67+
}
68+
69+
self.stopListening()
70+
71+
self.notificationObserver = NotificationCenter.default.addObserver(
72+
forName: Notification.Name(SCGateway.scgNotificationName),
73+
object: nil,
74+
queue: .main
75+
) { [weak self] notification in
76+
self?.processScgNotification(notification)
77+
}
78+
79+
print(
80+
"SCGatewayEmitter: Started listening to notifications with name: \(SCGateway.scgNotificationName)."
81+
)
82+
resolve?("Started listening to SCGateway events")
83+
}
84+
}
85+
86+
@objc func stopListening(
87+
_ resolve: RCTPromiseResolveBlock? = nil,
88+
rejecter reject: RCTPromiseRejectBlock? = nil
89+
) {
90+
print("SCGatewayEmitter: Stopping listening for notifications.")
91+
92+
guard isListening, let observer = notificationObserver else {
93+
print("SCGatewayEmitter: Not listening or no observer, no action needed.")
94+
resolve?("Not listening")
95+
return
96+
}
97+
98+
NotificationCenter.default.removeObserver(observer)
99+
notificationObserver = nil
100+
101+
print("SCGatewayEmitter: Stopped listening to notifications.")
102+
resolve?("Stopped listening to SCGateway events")
103+
}
104+
105+
private func processScgNotification(_ notification: Notification) {
106+
let userInfo = notification.userInfo ?? [:]
107+
108+
print("SCGatewayEmitter: Received notification with userInfo keys: \(userInfo.keys)")
109+
110+
guard let jsonString = userInfo[SCGNotification.SCGNotification] as? String else {
111+
print(
112+
"SCGatewayEmitter: No stringified payload found with key '\(SCGNotification.SCGNotification)'"
113+
)
114+
return
115+
}
116+
117+
print("SCGatewayEmitter: Received JSON string: \(jsonString).")
118+
sendEvent(withName: SCGateway.scgNotificationName, body: jsonString)
119+
print("SCGatewayEmitter: Emitted event '\(SCGateway.scgNotificationName)' with JSON string.")
120+
}
121+
}

0 commit comments

Comments
 (0)