Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

[PAY-803] [PAY-766] Initial DMs client integration#2521

Merged
rickyrombo merged 53 commits into
mainfrom
mjp-dms
Jan 10, 2023
Merged

[PAY-803] [PAY-766] Initial DMs client integration#2521
rickyrombo merged 53 commits into
mainfrom
mjp-dms

Conversation

@rickyrombo

@rickyrombo rickyrombo commented Jan 5, 2023

Copy link
Copy Markdown
Contributor

Description

  • Updates SDK to v1.0.37 to get ChatsApi
  • Removes BigInt polyfill on RN to get SDK working
  • Patches @noble and micro-aes-gcm to be able to polyfill crypto
  • Adds new feature flag for CHAT_ENABLED
  • Moves SDK saga usage to use useContext() instead, also changes SDK initialization logic to be similar to libs singleton pattern
  • Adds prototype-level UI on web for sending/receiving messages under /chats (route to change, no UI for creating new chats)
  • Adds even more basic prototype-level UI on mobile for confirming the SDK works correctly reading messages (hardcoded a chat ID for now)

Dragons

Is there anything the reviewer should be on the lookout for? Are there any dangerous changes?

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide repro instructions & any configuration.

  • Tested locally against stage

How will this change be monitored?

For features that are critical or could fail silently please describe the monitoring/alerting being added.

  • N/A, all behind feature flag

Feature Flags

Are all new features properly feature flagged? Describe added feature flags.

CHAT_ENABLED

@gitguardian

gitguardian Bot commented Jan 5, 2023

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 12 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
2111319 Generic High Entropy Secret dcc2335 packages/mobile/.env.prod View secret
2111320 Generic High Entropy Secret dcc2335 packages/mobile/.env.stage View secret
2111319 Generic High Entropy Secret 8170f40 packages/mobile/.env.prod View secret
2111320 Generic High Entropy Secret 8170f40 packages/mobile/.env.stage View secret
2111319 Generic High Entropy Secret 8170f40 packages/web/.env/.env.prod View secret
2111320 Generic High Entropy Secret 8170f40 packages/web/.env/.env.stage View secret
2111319 Generic High Entropy Secret 883684c packages/mobile/.env.prod View secret
2111320 Generic High Entropy Secret 883684c packages/mobile/.env.stage View secret
2111319 Generic High Entropy Secret 883684c packages/web/.env/.env.prod View secret
2111320 Generic High Entropy Secret 883684c packages/web/.env/.env.stage View secret
2111319 Generic High Entropy Secret a77a76a packages/web/.env/.env.prod View secret
2111320 Generic High Entropy Secret a77a76a packages/web/.env/.env.stage View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@dylanjeffers dylanjeffers 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.

such clean code! love this

import * as chatSelectors from './selectors'
import { actions as chatActions } from './slice'

const {

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.

love that this file was added to common off the rip


import { Status } from 'models'

type ChatState = {

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.

i typically export this state, and use it for the types, rather than the ReturnType<typeof reducer> pattern

Comment thread packages/mobile/index.js
require('react-native-get-random-values')
require('react-native-url-polyfill/auto')

// Polyfill BigInt

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.

sweet

to='Profile'
params={{ handle: 'accountUser' }}
/>
{isChatEnabled ? (

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.

sweeeeeet

export const ChatsScreen = () => {
const dispatch = useDispatch()
const chats = useSelector(chatSelectors.getChats)
const id = 'clbyghuy800003bat0th2ivy5'

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.

this cool just merging? like its not an important key or something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nah just a hardcoded chat id for testing

return (
<Screen>
<View>
<Text>You have {chats?.length} chats:</Text>

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.

?? 0 maybe? since it could be undefined chats?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah this will change for sure

View
} from 'react-native'
import RadialGradient from 'react-native-radial-gradient'
import { RadialGradient } from 'react-native-radial-gradient'

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.

presh

@@ -0,0 +1,116 @@
import { EventEmitter } from 'events'

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.

this is great!

share: (url: string, message?: string) => share({ url, message }),
openSeaClient: new OpenSeaClient(Config.OPENSEA_API_URL)
openSeaClient: new OpenSeaClient(Config.OPENSEA_API_URL),
audiusSdk

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.

so clutch

@piazzatron piazzatron 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.

Rad!!! Just nits - great job figuring out all these dependency issues. Can't wait to test this on stage

Comment on lines +35 to +40
yield* put(
cacheUsersActions.fetchUsers({
userIds: Array.from(userIds.values())
})
)
yield* put(fetchMoreChatsSucceeded(response))

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.

nit: could yield all

yield takeEvery(userActions.FETCH_USER_SOCIALS, fetchUserSocials)
}

function* watchFetchUsers() {

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.

nice

Comment on lines +27 to +34
const member = chat.chat_members.find(
(u) => decodeHashId(u.user_id) !== currentUserId
)
const user = useSelector((state) =>
cacheUsersSelectors.getUser(state, {
id: member ? decodeHashId(member.user_id) ?? -1 : -1
})
)

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.

Could this whole bit be memo'd?

export const ChatList = (props: ComponentPropsWithoutRef<'div'>) => {
const dispatch = useDispatch()
const chats = useSelector(chatSelectors.getChats)
console.log({ chats })

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.

console

Comment on lines +28 to +30
const senderUserId = decodeHashId(message.sender_user_id)
const userId = useSelector(accountSelectors.getUserId)
const isAuthor = userId === senderUserId

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.

same comment about memo

@audius-infra

Copy link
Copy Markdown
Collaborator

Preview this change https://demo.audius.co/mjp-dms

:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
rive-react-native:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure why this got added cc: @dylanjeffers ?

@rickyrombo

Copy link
Copy Markdown
Contributor Author

Will address PR comments in a follow up

@rickyrombo rickyrombo merged commit 7287c4c into main Jan 10, 2023
@rickyrombo rickyrombo deleted the mjp-dms branch January 10, 2023 18:43
@rickyrombo rickyrombo mentioned this pull request Jan 10, 2023
audius-infra pushed a commit that referenced this pull request Jan 14, 2023
[646a2ee] [C-1772] Fix share-drawer for tracks with missing images (#2594) Dylan Jeffers
[ea615c6] [C-1829] Fix android build due to gradle dep (#2592) Dylan Jeffers
[708563a] [C-1778] Fix update banner styles (#2591) Dylan Jeffers
[aa51116] update playlist_page route to accept permalink optionally (#2569) sabrina-kiam
[8ed8846] Move stream mp3 feature flag check later so optimizely is ready (#2590) Andrew Mendelsohn
[8c19e15] [PAY-778] Update track page for premium tracks (#2565) Saliou Diallo
[9bc901e] [C-1643] Update track player to work with the queue in the redux store (#2580) Kyle Shanks
[6e9c2d1] Make rc-staging fast-app variant (#2585) Dylan Jeffers
[c75163a] Fix notification userInteraction (#2583) Dylan Jeffers
[2d9a92f] [PAY-817] Add premium content to track upload flow on desktop - Part 2 (#2546) Saliou Diallo
[e9b0673] [C-1821] Fix android manual sign up overflow (#2582) Sebastian Klingler
[c26a6c4] Add null check for notification navigation hook (#2581) Kyle Shanks
[b62a866] Entity manager notification writes (#2556) Joseph Lee
[b685c89] [C-1819] Fix customCheck in waitForValue (#2578) Sebastian Klingler
[4ddbd37] Bump ios to 1.1.52 (#2577) Sebastian Klingler
[70a9fd5] [C-1816] Fix divider color (#2574) Sebastian Klingler
[0796f47] Hotfix: Fix mobile build after selector was changed (#2575) Marcus Pasell
[0d513a7] DMs UI Part 1 (#2563) Marcus Pasell
[0e24bbc] [C-1726] useLocalImage (#2564) Sebastian Klingler
[6329be8] [C-1815] Fix legacy image loading (#2573) Sebastian Klingler
[57d72ab] [C-1814] Prevent infinite rerender of UserList (#2572) Sebastian Klingler
[b3b00e8] [C-1706] Fix sidebar track statistic (#2570) Dylan Jeffers
[abb17ef] Fix setup states (#2567) Raymond Jacobson
[c9f158e] Remove EntityManager gating for users and tracks (#2549) Isaac Solo
[adea3ff] [C-1760] Fix lineup-tile animation lag (#2548) Dylan Jeffers
[3c3426d] [C-1791] Add fast-cache, safe-fast-cache (#2554) Dylan Jeffers
[15b26fd] [C-1764] Fix offline app initialization for offline mode (#2560) Andrew Mendelsohn
[bd9ab4d] [C-1790] Improve lottie colorize perf (#2552) Dylan Jeffers
[120cce4] [C-1397] Add appVersion to optimizely audience attributes (#2561) Sebastian Klingler
[32962ec] Bump ios to 1.1.51 (#2558) Sebastian Klingler
[bd40d44] [QA-282] Fix app crash on edit playlist screen when missing collection image source (#2559) Kyle Shanks
[ee0e3cd] Update the feature flag for rate cta drawer (#2557) Kyle Shanks
[c0c12d7] Add back arm64 exclusion (#2531) Marcus Pasell
[7287c4c] [PAY-803] [PAY-766] Initial DMs client integration (#2521) Marcus Pasell
[effd347] [PAY-367] [C-1786 C-1661] Refactor FeedTipTile/Lineup interdependency (#2547) Dylan Jeffers
[6eb31a8] [PAY-808] [PAY-810] Float new playlists to top of library (#2526) Michael Piazza
[9c133b5] [C-1789] Fix lottie colorize crash (#2551) Sebastian Klingler
[a27b24d] [C-1418] Add new android bundles (#2523) Sebastian Klingler
[12dd5e8] [C-1788][C-1784][C-1785] Fix offline queue loops and duplicates (#2550) Andrew Mendelsohn
[fc4c8d2] [C-1779 Improve makeStyles performance (#2541) Dylan Jeffers
[08b79bc] [C-1766][C-1781] Fix loading states on DownloadToggle (#2545) Andrew Mendelsohn
[470a44f] [C-1756][C-1767] Fix job cancellation for track download queue (#2543) Andrew Mendelsohn
[bd15357] [C-1703] fix button padding for remove download playlist (#2544) Andrew Mendelsohn
[6eb6b74] [PAY-776] Add premium content to track upload flow on desktop - Part 1 (#2469) Saliou Diallo
@AudiusProject AudiusProject deleted a comment from linear Bot Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants