Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions android/app/src/main/java/com/bitpay/wallet/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.WindowManager
import com.braze.reactbridge.BrazeReactUtils
import com.braze.ui.inappmessage.BrazeInAppMessageManager
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
Expand Down Expand Up @@ -40,6 +41,7 @@ class MainActivity : ReactActivity() {
return
}

BrazeReactUtils.populateInitialPushPayloadFromIntent(intent)
RNBootSplash.init(this, R.style.BootTheme)
supportFragmentManager.fragmentFactory = RNScreensFragmentFactory()
super.onCreate(savedInstanceState)
Expand Down
3 changes: 1 addition & 2 deletions android/app/src/main/res/values/braze.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="com_braze_api_key">BRAZE_API_KEY_REPLACE_ME</string>
<string translatable="false" name="com_braze_custom_endpoint">sdk.iad-05.braze.com</string>
<bool name="com_braze_enable_delayed_initialization">true</bool>
<bool translatable="false" name="com_braze_firebase_cloud_messaging_registration_enabled">true</bool>
<string translatable="false" name="com_braze_firebase_cloud_messaging_sender_id">BRAZE_SENDER_ID_REPLACE_ME</string>
<bool name="com_braze_handle_push_deep_links_automatically">false</bool>
Expand Down
2 changes: 2 additions & 0 deletions declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ declare module '*.svg' {
declare module '@env' {
export const PAYPRO_TRUSTED_KEYS: string;
export const BASE_FIATRATES_MARKETSTATS_URL_DEVELOPMENT: string;
export const BRAZE_API_KEY_ANDROID: string;
export const BRAZE_API_KEY_IOS: string;
export const BRAZE_EXPORT_API_KEY: string;
export const BRAZE_MERGE_AND_DELETE_API_KEY: string;
export const BRAZE_REST_API_ENDPOINT: string;
Expand Down
17 changes: 8 additions & 9 deletions ios/BitPayApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import AppsFlyerLib
import RNBootSplash
import BrazeKit
import BrazeUI
import braze_react_native_sdk
import UserNotifications
import CryptoKit

Expand Down Expand Up @@ -172,17 +173,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, BrazeInAppMessageUIDelega
window?.makeKeyAndVisible()

// MARK: Braze SDK setup
let config = Braze.Configuration(apiKey: "BRAZE_API_KEY_REPLACE_ME", endpoint: "sdk.iad-05.braze.com")
config.logger.level = .info
config.triggerMinimumTimeInterval = 1

// `BrazeReactBridge.initBraze(_:)` is an Objective-C selector; we call it dynamically
if let brazeObj = BrazeReactBridge.perform(#selector(BrazeReactBridge.initBraze(_:)), with: config)?.takeUnretainedValue() as? Braze {
self.braze = brazeObj
BrazeReactInitializer.configure({ config in
config.logger.level = .info
config.triggerMinimumTimeInterval = 1
}, postInitialization: { [weak self] braze in
self?.braze = braze
let inAppUI = BrazeInAppMessageUI()
inAppUI.delegate = self
brazeObj.inAppMessagePresenter = inAppUI
}
braze.inAppMessagePresenter = inAppUI
})

// Disable URL caching globally to prevent sensitive data disclosure
URLCache.shared.removeAllCachedResponses()
Expand Down
28 changes: 14 additions & 14 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ PODS:
- AppsFlyerFramework/Main (= 6.17.9)
- AppsFlyerFramework/Main (6.17.9)
- boost (1.84.0)
- braze-react-native-sdk (16.1.0):
- braze-react-native-sdk (20.0.0):
- boost
- BrazeKit (~> 13.2.0)
- BrazeLocation (~> 13.2.0)
- BrazeUI (~> 13.2.0)
- BrazeKit (~> 14.0.4)
- BrazeLocation (~> 14.0.4)
- BrazeUI (~> 14.0.4)
- DoubleConversion
- fast_float
- fmt
Expand All @@ -34,11 +34,11 @@ PODS:
- ReactCommon/turbomodule/core
- SocketRocket
- Yoga
- BrazeKit (13.2.1)
- BrazeLocation (13.2.1):
- BrazeKit (= 13.2.1)
- BrazeUI (13.2.1):
- BrazeKit (= 13.2.1)
- BrazeKit (14.0.4)
- BrazeLocation (14.0.4):
- BrazeKit (= 14.0.4)
- BrazeUI (14.0.4):
- BrazeKit (= 14.0.4)
- BVLinearGradient (2.6.2):
- React-Core
- CookieManager (6.3.0):
Expand Down Expand Up @@ -3955,10 +3955,10 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AppsFlyerFramework: 4f9a8237d40e9093941aef760cd77d606238aedd
boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90
braze-react-native-sdk: b3bd4594310a390c12beb06b02bf0fbbfcbca7e0
BrazeKit: dc74d3969d42e3f890461fe842e9422480269774
BrazeLocation: 1919682502f70d3f215215b9ef2b56836dde4a9e
BrazeUI: b49f51ff3eb88657d6a97e6b3688e03a7255cbe1
braze-react-native-sdk: 4ecf9641a4a748531fc7e074e22da9ee6f4de8be
BrazeKit: ba951d2299c1d16b541cf35cdd7250d03e28a0fb
BrazeLocation: d6938a737f123bb9e6632246d1abea40eeb12768
BrazeUI: 1d733e1dea4d81f95f261b52cc6e4b91a0eccca8
BVLinearGradient: 34a999fda29036898a09c6a6b728b0b4189e1a44
CookieManager: ae06e97a79ea66832add0c8aa501a7986bdbb72d
DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb
Expand Down Expand Up @@ -4099,6 +4099,6 @@ SPEC CHECKSUMS:
VisionCamera: 05e4bc4783174689a5878a0797015ab32afae9e4
Yoga: 93bc00d78638987f9ffd928f4a9f895d3e601bc3

PODFILE CHECKSUM: 91e915b372fe50cffa909299965ad28bb54bc3f7
PODFILE CHECKSUM: a1c95fa7251801b3773e737bac8e5be40dfa3c65

COCOAPODS: 1.16.2
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"translation:download": "crowdin download --identity crowdin-credentials.yml"
},
"dependencies": {
"@braze/react-native-sdk": "16.1.0",
"@braze/react-native-sdk": "20.0.0",
"@ethersproject/shims": "5.7.0",
"@freakycoder/react-native-bounceable": "0.2.5",
"@gorhom/bottom-sheet": "5.2.6",
Expand Down
18 changes: 0 additions & 18 deletions scripts/braze-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,10 @@ const dotenv = require('dotenv');
throw result.error;
}

// Configure Braze for iOS
if (process.env.BRAZE_API_KEY_IOS) {
const brazeConfigFileIOS = `${__dirname}/../ios/BitPayApp/AppDelegate.swift`;
let contentiOS = fs.readFileSync(brazeConfigFileIOS, 'utf8');
contentiOS = contentiOS.replace(
'BRAZE_API_KEY_REPLACE_ME',
process.env.BRAZE_API_KEY_IOS,
);
fs.writeFileSync(brazeConfigFileIOS, contentiOS);
}

// Configure Braze for Android
const brazeConfigFileAndroid = `${__dirname}/../android/app/src/main/res/values/braze.xml`;
let contentAndroid = fs.readFileSync(brazeConfigFileAndroid, 'utf8');

if (process.env.BRAZE_API_KEY_ANDROID) {
contentAndroid = contentAndroid.replace(
'BRAZE_API_KEY_REPLACE_ME',
process.env.BRAZE_API_KEY_ANDROID,
);
}

if (process.env.BRAZE_SENDER_ID) {
contentAndroid = contentAndroid.replace(
'BRAZE_SENDER_ID_REPLACE_ME',
Expand Down
12 changes: 10 additions & 2 deletions src/lib/Braze/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import Braze from '@braze/react-native-sdk';
import axios from 'axios';
import {BRAZE_MERGE_AND_DELETE_API_KEY, BRAZE_REST_API_ENDPOINT} from '@env';
import {
BRAZE_API_ENDPOINT,
BRAZE_API_KEY_ANDROID,
BRAZE_API_KEY_IOS,
BRAZE_MERGE_AND_DELETE_API_KEY,
BRAZE_REST_API_ENDPOINT,
} from '@env';
import {checkNotifications, RESULTS} from 'react-native-permissions';
import {NativeModules, Platform} from 'react-native';
import {logManager} from '../../managers/LogManager';
Expand Down Expand Up @@ -296,7 +302,9 @@ class BrazeClientWrapper {
}

private async initializeSdk(): Promise<void> {
return Promise.resolve();
const apiKey =
Platform.OS === 'ios' ? BRAZE_API_KEY_IOS : BRAZE_API_KEY_ANDROID;
Braze.initialize(apiKey, BRAZE_API_ENDPOINT);
}
}

Expand Down
7 changes: 0 additions & 7 deletions src/utils/braze.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
BannerNewsFeedCard,
CaptionedContentCard,
ClassicContentCard,
ContentCard,
Expand Down Expand Up @@ -27,12 +26,6 @@ export const DEFAULT_CLASSIC_CONTENT_CARD: ClassicContentCard = {
cardDescription: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
};

export const isBannerContentCard = (
contentCard: BannerNewsFeedCard,
): contentCard is BannerNewsFeedCard => {
return contentCard.type === 'Banner';
};

export const isCaptionedContentCard = (
contentCard: ContentCard,
): contentCard is CaptionedContentCard => {
Expand Down
39 changes: 32 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1490,10 +1490,10 @@
web3 "4.16.0"
xrpl "2.13.0"

"@braze/react-native-sdk@16.1.0":
version "16.1.0"
resolved "https://registry.yarnpkg.com/@braze/react-native-sdk/-/react-native-sdk-16.1.0.tgz#d66c838a4eb38d2c5390d3dc4168767d7808a55a"
integrity sha512-IUoL+36KELKk4w6tlNdYjJ2fi0QBs2HT+yhYsupwfntvbbKPdSqlKrXU0e/xAyDv34qACcIxl2AYxeeD7Vhptg==
"@braze/react-native-sdk@20.0.0":
version "20.0.0"
resolved "https://registry.yarnpkg.com/@braze/react-native-sdk/-/react-native-sdk-20.0.0.tgz#91d1150e087d0011ff5bda4db54157cdd2110984"
integrity sha512-qpDZ6X/KxrvZeNcTcK9K6XOZc51M/SlqdkqMd+ry2C+EyzkYTCvT4LBI25gn5o6lu7DtRNa5oJanISVEPZufQw==

"@cbor-extract/cbor-extract-darwin-arm64@2.2.0":
version "2.2.0"
Expand Down Expand Up @@ -16338,7 +16338,16 @@ string-range@~1.2, string-range@~1.2.1:
resolved "https://registry.yarnpkg.com/string-range/-/string-range-1.2.2.tgz#a893ed347e72299bc83befbbf2a692a8d239d5dd"
integrity sha512-tYft6IFi8SjplJpxCUxyqisD3b+R2CSkomrtJYCkvuf1KuCAWgz7YXt4O0jip7efpfCemwHEzTEAO8EuOYgh3w==

"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -16443,7 +16452,7 @@ stringify-entities@^3.1.0:
character-entities-legacy "^1.0.0"
xtend "^4.0.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand All @@ -16457,6 +16466,13 @@ strip-ansi@^5.0.0:
dependencies:
ansi-regex "^4.1.0"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1:
version "7.1.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
Expand Down Expand Up @@ -17849,7 +17865,7 @@ word-wrap@^1.2.5:
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -17867,6 +17883,15 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down
Loading