mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

configure the bitdrift Capture SDK (#6979)

* configure bitdrift Capture SDK

* remove console log

* use the new url

* add patch to fix devtool interaction

* update patches

* fix patch

* add BITDRIFT_API_KEY to .env.example

authored by

Snow Pettersen and committed by
GitHub
20ac42a5 c8745a9a

+64
+1
.env.example
··· 1 1 # Copy this to `.env` and `.env.test` files 2 2 3 + BITDRIFT_API_KEY= 3 4 SENTRY_AUTH_TOKEN= 4 5 EXPO_PUBLIC_ENV=development 5 6 EXPO_PUBLIC_LOG_LEVEL=debug
+1
app.config.js
··· 222 222 }, 223 223 ], 224 224 'react-native-compressor', 225 + '@bitdrift/react-native', 225 226 './plugins/starterPackAppClipExtension/withStarterPackAppClip.js', 226 227 './plugins/withAndroidManifestPlugin.js', 227 228 './plugins/withAndroidManifestFCMIconPlugin.js',
+6
docs/build.md
··· 87 87 88 88 If you change `SENTRY_AUTH_TOKEN`, you need to do `yarn prebuild` before running `yarn ios` or `yarn android` again. 89 89 90 + ### Adding bitdrift 91 + 92 + Adding bitdirft is NOT required. You can keep `BITDRIFT_API_KEY=` in `.env` which will avoid initializing bitdrift during startup. 93 + 94 + However, if you're a part of the Bluesky team and want to enable bitdrift, fill in `BITDRIFT_API_KEY` in your `.env` to enable bitdrift. 95 + 90 96 ### Adding and Updating Locales 91 97 92 98 - `yarn intl:build` -> you will also need to run this anytime `./src/locale/{locale}/messages.po` change
+1
package.json
··· 55 55 }, 56 56 "dependencies": { 57 57 "@atproto/api": "^0.13.18", 58 + "@bitdrift/react-native": "0.4.0", 58 59 "@braintree/sanitize-url": "^6.0.2", 59 60 "@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet", 60 61 "@emoji-mart/react": "^1.1.1",
+3
patches/expo-modules-core+2.1.1.md
··· 1 + ## expo-modules-core Patch 2 + 3 + This patch fixes an issue where bitdrift's API stream gets blocked by the Expo interceptor used to power the devtools
+15
patches/expo-modules-core+2.1.1.patch
··· 1 + diff --git a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt 2 + index 47c4d15..afe138d 100644 3 + --- a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt 4 + +++ b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt 5 + @@ -125,6 +125,10 @@ internal fun peekResponseBody( 6 + } 7 + 8 + internal fun shouldParseBody(response: Response): Boolean { 9 + + if (response.request.url.encodedPath == "/bitdrift_public.protobuf.client.v1.ApiService/Mux") { 10 + + return false 11 + + } 12 + + 13 + // Check for Content-Type 14 + val skipContentTypes = listOf( 15 + "text/event-stream", // Server Sent Events
+1
src/App.native.tsx
··· 1 1 import 'react-native-url-polyfill/auto' 2 2 import '#/lib/sentry' // must be near top 3 + import '#/lib/bitdrift' // must be near top 3 4 import '#/view/icons' 4 5 5 6 import React, {useEffect, useState} from 'react'
+7
src/lib/bitdrift.ts
··· 1 + import {init} from '@bitdrift/react-native' 2 + 3 + const BITDRIFT_API_KEY = process.env.BITDRIFT_API_KEY 4 + 5 + if (BITDRIFT_API_KEY) { 6 + init(BITDRIFT_API_KEY, {url: 'https://api-bsky.bitdrift.io'}) 7 + }
+24
src/logger/index.ts
··· 1 + import { 2 + debug as bdDebug, 3 + error as bdError, 4 + info as bdInfo, 5 + warn as bdWarn, 6 + } from '@bitdrift/react-native' 1 7 import format from 'date-fns/format' 2 8 import {nanoid} from 'nanoid/non-secure' 3 9 ··· 129 135 } else { 130 136 log(`${format(timestamp, 'HH:mm:ss')} ${message.toString()}${extra}`) 131 137 } 138 + } 139 + 140 + export const bitdriftTransport: Transport = (level, message) => { 141 + const log = ( 142 + { 143 + [LogLevel.Debug]: bdDebug, 144 + [LogLevel.Info]: bdInfo, 145 + [LogLevel.Log]: bdInfo, 146 + [LogLevel.Warn]: bdWarn, 147 + [LogLevel.Error]: bdError, 148 + } as const 149 + )[level] 150 + 151 + log(message.toString()) 132 152 } 133 153 134 154 export const sentryTransport: Transport = ( ··· 327 347 * `logger.enable()` 328 348 */ 329 349 export const logger = new Logger() 350 + 351 + if (!env.IS_TEST) { 352 + logger.addTransport(bitdriftTransport) 353 + } 330 354 331 355 if (env.IS_DEV && !env.IS_TEST) { 332 356 logger.addTransport(consoleTransport)
+5
yarn.lock
··· 3377 3377 resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" 3378 3378 integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== 3379 3379 3380 + "@bitdrift/react-native@0.4.0": 3381 + version "0.4.0" 3382 + resolved "https://registry.yarnpkg.com/@bitdrift/react-native/-/react-native-0.4.0.tgz#e6484343ef04824aa924df2a757bd9620b2106c1" 3383 + integrity sha512-KuYzWEkoGwjjP0ZurjHwV+zfRZjQXxbXa3zhijWv0iqzMI/7kbrBd9lm+wNQo8OrkqFVDlebCb8AGPc0jMZw7A== 3384 + 3380 3385 "@braintree/sanitize-url@^6.0.2": 3381 3386 version "6.0.4" 3382 3387 resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-6.0.4.tgz#923ca57e173c6b232bbbb07347b1be982f03e783"