Skip to content

fix analytics warnings in metro logs - #476

Closed
islandbitcoin wants to merge 2 commits into
mainfrom
fix/analytics
Closed

islandbitcoin wants to merge 2 commits into
mainfrom
fix/analytics

Conversation

@islandbitcoin

@islandbitcoin islandbitcoin commented Sep 4, 2025 •

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes analytics warnings in metro logs by migrating from deprecated Firebase SDK default imports to the new v6+ modular SDK functions. The changes update all Firebase-related imports across analytics, crashlytics, messaging, app-check, and remote-config modules to use the new function-based API.

Key Changes

  • Updated Firebase SDK imports to use modular functions instead of default imports
  • Fixed Xcode project file to replace "(null)" placeholders with proper "BuildFile" entries
  • Added new social posting functionality with Nostr integration
  • Created shared Nostr pool instance to prevent connection leaks

Reviewed Changes

Copilot reviewed 48 out of 51 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
package.json Updated @react-native-firebase/messaging to v23.2.0
ios/LNFlash.xcodeproj/project.pbxproj Fixed "(null)" placeholders in BuildFile references
app/utils/notifications.ts Migrated to getMessaging() and getCrashlytics() functions
app/utils/analytics.ts Updated all analytics calls to use getAnalytics()
app/utils/nostr/pool.ts Created shared SimplePool instance
Multiple screen files Updated Firebase imports throughout the codebase
app/screens/social/post.tsx New Nostr social posting functionality
app/i18n/ files Added localization strings for social features
app/components/nostr-quickstart/ New component for Nostr onboarding

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread app/utils/nostr.ts
Comment on lines 243 to 244
export const setPreferredRelay = async (secretKey?: Uint8Array) => {
let pool = new SimplePool()
let secret: Uint8Array | null = null

Copilot AI Sep 4, 2025

Copy link

Choose a reason for hiding this comment

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

The removed SimplePool instantiation could lead to connection leaks. Since a shared pool is now used from './nostr/pool', ensure the pool connections are properly managed elsewhere in the application lifecycle.

Copilot uses AI. Check for mistakes.
Comment on lines 85 to 88
const fetchNostrUser = async (npub: `npub1${string}`) => {
const pool = new SimplePool()
const nostrProfile = await pool.get(relays, {
kinds: [0],
authors: [nip19.decode(npub).data],

Copilot AI Sep 4, 2025

Copy link

Choose a reason for hiding this comment

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

The removed pool.close(relays) call could lead to connection leaks. With the shared pool instance, consider implementing proper connection cleanup at the application level or adding connection management logic.

Copilot uses AI. Check for mistakes.
Comment on lines 138 to 140
const signedKind0Event = finalizeEvent(kind0Event, secret)
let messages = await Promise.any(pool.publish(publicRelays, signedKind0Event))
console.log("PUblished, messages from relays are", messages)

Copilot AI Sep 4, 2025

Copy link

Choose a reason for hiding this comment

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

Another removed pool.close(publicRelays) call that could lead to connection leaks. The shared pool pattern requires careful connection lifecycle management to prevent resource leaks.

Copilot uses AI. Check for mistakes.
Comment thread app/i18n/en/index.ts
@@ -1,5 +1,6 @@
// prettier-ignore

import NostrQuickStart from "@app/components/nostr-quickstart"

Copilot AI Sep 4, 2025

Copy link

Choose a reason for hiding this comment

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

This import statement is unused in the translation file and appears to be incorrectly placed. Translation files should only contain translation data, not component imports.

Suggested change
import NostrQuickStart from "@app/components/nostr-quickstart"

Copilot uses AI. Check for mistakes.
import { PrimaryBtn } from "@app/components/buttons"
import { useI18nContext } from "@app/i18n/i18n-react"

import { nip19, getPublicKey, finalizeEvent, Relay, SimplePool } from "nostr-tools"

Copilot AI Sep 4, 2025

Copy link

Choose a reason for hiding this comment

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

The SimplePool import is unused since the shared pool from '@app/utils/nostr/pool' is being used. Remove the unused import.

Suggested change
import { nip19, getPublicKey, finalizeEvent, Relay, SimplePool } from "nostr-tools"
import { nip19, getPublicKey, finalizeEvent, Relay } from "nostr-tools"

Copilot uses AI. Check for mistakes.

const FIXED_TEXT_LINE_2 = "#introductions"

const MakeNostrPost = ({ privateKey }: { privateKey: string }) => {

Copilot AI Sep 4, 2025

Copy link

Choose a reason for hiding this comment

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

The privateKey prop is defined but never used in the component. The component calls getSecretKey() instead. Either use the prop or remove it from the interface.

Suggested change
const MakeNostrPost = ({ privateKey }: { privateKey: string }) => {
const MakeNostrPost = () => {

Copilot uses AI. Check for mistakes.
Comment thread app/i18n/raw-i18n/source/en.json Resolved
@Nodirbek75

Copy link
Copy Markdown
Contributor

@islandbitcoin this PR includes changes from another PR

@Nodirbek75

Copy link
Copy Markdown
Contributor

Opened another PR including only firebase changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants