From 41517b34518057b445a3e92b16c96c88d263a50f Mon Sep 17 00:00:00 2001 From: Ivan Sekovanikj Date: Thu, 12 Dec 2024 12:14:43 +0100 Subject: [PATCH 01/13] fix: add V5 branch configuration --- .github/workflows/check-pr.yml | 1 + .github/workflows/next-release.yml | 1 + .github/workflows/sample-distribution.yml | 10 +++++----- .github/workflows/sdk-size-metrics.yml | 1 + release/next.js | 1 + 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 3d5dd6dcc4..2cdd5fcfda 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -5,6 +5,7 @@ on: branches: - develop - main + - V5 - 'v[0-9]+.[0-9]+.[0-9]+*beta*' types: [opened, synchronize] diff --git a/.github/workflows/next-release.yml b/.github/workflows/next-release.yml index 935f2fcd7c..f2ccc23ace 100644 --- a/.github/workflows/next-release.yml +++ b/.github/workflows/next-release.yml @@ -4,6 +4,7 @@ on: push: branches: - develop + - V5 jobs: publish-next: diff --git a/.github/workflows/sample-distribution.yml b/.github/workflows/sample-distribution.yml index 366b4f25af..51bf53ca1c 100644 --- a/.github/workflows/sample-distribution.yml +++ b/.github/workflows/sample-distribution.yml @@ -13,7 +13,7 @@ on: jobs: build_and_deploy_ios_testflight_qa: - name: Build SampleApp iOS and Deploy-${{ github.ref == 'refs/heads/develop' }} + name: Build SampleApp iOS and Deploy-${{ github.ref == 'refs/heads/V5' }} runs-on: [macos-14] steps: - name: Connect Bot @@ -36,14 +36,14 @@ jobs: run: bundle exec pod install - name: Build and release Testflight QA working-directory: examples/SampleApp - run: bundle exec fastlane deploy_to_testflight_qa deploy:${{ github.ref == 'refs/heads/develop' }}; + run: bundle exec fastlane deploy_to_testflight_qa deploy:${{ github.ref == 'refs/heads/V5' }}; env: MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }} APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }} build_and_deploy_android_s3: - name: Build SampleApp Android and Deploy-${{ github.ref == 'refs/heads/develop' }} + name: Build SampleApp Android and Deploy-${{ github.ref == 'refs/heads/V5' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -64,13 +64,13 @@ jobs: rm -rf $HOME/.gradle/caches/ && ./gradlew assembleRelease - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 - if: ${{ github.ref == 'refs/heads/develop' }} + if: ${{ github.ref == 'refs/heads/V5' }} with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: Upload APK - if: ${{ github.ref == 'refs/heads/develop' }} + if: ${{ github.ref == 'refs/heads/V5' }} # https://getstream.io/downloads/rn-sample-app.apk run: | cp examples/SampleApp/android/app/build/outputs/apk/release/app-release.apk rn-sample-app.apk diff --git a/.github/workflows/sdk-size-metrics.yml b/.github/workflows/sdk-size-metrics.yml index 0e799c5c07..e0838e9e8a 100644 --- a/.github/workflows/sdk-size-metrics.yml +++ b/.github/workflows/sdk-size-metrics.yml @@ -9,6 +9,7 @@ on: branches: - develop - main + - V5 env: HOMEBREW_NO_INSTALL_CLEANUP: 1 # Disable cleanup for homebrew, we don't need it on CI diff --git a/release/next.js b/release/next.js index 55f91550e9..fb52927f00 100644 --- a/release/next.js +++ b/release/next.js @@ -8,6 +8,7 @@ configPromise.then((config) => { ...config, branches: [ 'main', + 'V5', { name: 'develop', channel: 'beta', From 168053bdc2f4ee98ddbec5b1d6ecf7ee3308a3dd Mon Sep 17 00:00:00 2001 From: Ivan Sekovanikj Date: Thu, 12 Dec 2024 16:35:08 +0100 Subject: [PATCH 02/13] chore: test dry run --- release/release.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/release/release.config.js b/release/release.config.js index c950d9a7e8..52f961df79 100644 --- a/release/release.config.js +++ b/release/release.config.js @@ -53,6 +53,7 @@ module.exports = Promise.resolve().then(() => { const lernaPackage = require('../lerna.json'); return { + dryRun: true, extends: [`${__dirname}/monorepo-setup.js`], workspaces: lernaPackage.packages, filterPath: process.env.FILTER_PATH, From 89c0a4027dde55abdee99d623e2499ad9c0c1d24 Mon Sep 17 00:00:00 2001 From: Khushal Agarwal Date: Wed, 8 Jan 2025 12:10:12 +0530 Subject: [PATCH 03/13] chore: remove docusaurus related actions and vale setup in favor of new docs system --- .github/workflows/check-pr.yml | 5 +- .github/workflows/docusaurus.yml | 28 ---- .github/workflows/next-release.yml | 4 +- .github/workflows/release.yml | 3 +- .github/workflows/vale-doc-lint.yml | 26 ---- .styles/Google/AMPM.yml | 9 -- .styles/Google/Acronyms.yml | 64 --------- .styles/Google/Colons.yml | 8 -- .styles/Google/Contractions.yml | 30 ----- .styles/Google/DateFormat.yml | 9 -- .styles/Google/Ellipses.yml | 9 -- .styles/Google/EmDash.yml | 12 -- .styles/Google/EnDash.yml | 13 -- .styles/Google/Exclamation.yml | 7 - .styles/Google/FirstPerson.yml | 13 -- .styles/Google/Gender.yml | 9 -- .styles/Google/GenderBias.yml | 45 ------- .styles/Google/HeadingPunctuation.yml | 13 -- .styles/Google/Headings.yml | 29 ---- .styles/Google/Latin.yml | 11 -- .styles/Google/LyHyphens.yml | 14 -- .styles/Google/OptionalPlurals.yml | 12 -- .styles/Google/Ordinal.yml | 7 - .styles/Google/OxfordComma.yml | 7 - .styles/Google/Parens.yml | 7 - .styles/Google/Passive.yml | 184 -------------------------- .styles/Google/Periods.yml | 7 - .styles/Google/Quotes.yml | 7 - .styles/Google/Ranges.yml | 7 - .styles/Google/Semicolons.yml | 8 -- .styles/Google/Slang.yml | 11 -- .styles/Google/Spacing.yml | 8 -- .styles/Google/Spelling.yml | 8 -- .styles/Google/Units.yml | 8 -- .styles/Google/We.yml | 11 -- .styles/Google/Will.yml | 7 - .styles/Google/WordList.yml | 80 ----------- .styles/Google/meta.json | 4 - .styles/Google/vocab.txt | 0 .styles/Vocab/Base/accept.txt | 57 -------- .styles/Vocab/Base/reject.txt | 0 .vale.ini | 17 --- package.json | 4 +- package/.eslintignore | 1 - 44 files changed, 6 insertions(+), 817 deletions(-) delete mode 100644 .github/workflows/docusaurus.yml delete mode 100644 .github/workflows/vale-doc-lint.yml delete mode 100644 .styles/Google/AMPM.yml delete mode 100644 .styles/Google/Acronyms.yml delete mode 100644 .styles/Google/Colons.yml delete mode 100644 .styles/Google/Contractions.yml delete mode 100644 .styles/Google/DateFormat.yml delete mode 100644 .styles/Google/Ellipses.yml delete mode 100644 .styles/Google/EmDash.yml delete mode 100644 .styles/Google/EnDash.yml delete mode 100644 .styles/Google/Exclamation.yml delete mode 100644 .styles/Google/FirstPerson.yml delete mode 100644 .styles/Google/Gender.yml delete mode 100644 .styles/Google/GenderBias.yml delete mode 100644 .styles/Google/HeadingPunctuation.yml delete mode 100644 .styles/Google/Headings.yml delete mode 100644 .styles/Google/Latin.yml delete mode 100644 .styles/Google/LyHyphens.yml delete mode 100644 .styles/Google/OptionalPlurals.yml delete mode 100644 .styles/Google/Ordinal.yml delete mode 100644 .styles/Google/OxfordComma.yml delete mode 100644 .styles/Google/Parens.yml delete mode 100644 .styles/Google/Passive.yml delete mode 100644 .styles/Google/Periods.yml delete mode 100644 .styles/Google/Quotes.yml delete mode 100644 .styles/Google/Ranges.yml delete mode 100644 .styles/Google/Semicolons.yml delete mode 100644 .styles/Google/Slang.yml delete mode 100644 .styles/Google/Spacing.yml delete mode 100644 .styles/Google/Spelling.yml delete mode 100644 .styles/Google/Units.yml delete mode 100644 .styles/Google/We.yml delete mode 100644 .styles/Google/Will.yml delete mode 100644 .styles/Google/WordList.yml delete mode 100644 .styles/Google/meta.json delete mode 100644 .styles/Google/vocab.txt delete mode 100644 .styles/Vocab/Base/accept.txt delete mode 100644 .styles/Vocab/Base/reject.txt delete mode 100644 .vale.ini diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 2cdd5fcfda..d0ffe5375b 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -27,8 +27,7 @@ jobs: - name: Install && Build - SDK and Sample App uses: ./.github/actions/install-and-build-sdk - name: Lint - run: yarn lerna-workspaces run lint && cd docusaurus && npx prettier --check '**/*.mdx' + run: yarn lerna-workspaces run lint - name: Test run: yarn test:coverage - env: - GITHUB_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }} + diff --git a/.github/workflows/docusaurus.yml b/.github/workflows/docusaurus.yml deleted file mode 100644 index b951cad79f..0000000000 --- a/.github/workflows/docusaurus.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: docusaurus - -on: - push: - branches: - - main # default branch name for each repo that docs should be push from - - develop -env: - branch_map: '{"refs/heads/main": "production", "refs/heads/develop": "staging"}' -jobs: - push_docusaurus: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.x] - steps: - - uses: actions/checkout@v2 - - name: Node ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'yarn' - - name: Push to stream-chat-docusaurus - uses: GetStream/push-stream-chat-docusaurus-action@main - with: - target-branch: ${{ fromJSON(env.branch_map)[github.ref] }} - env: - DOCUSAURUS_GH_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }} diff --git a/.github/workflows/next-release.yml b/.github/workflows/next-release.yml index f2ccc23ace..532f2b6ce7 100644 --- a/.github/workflows/next-release.yml +++ b/.github/workflows/next-release.yml @@ -31,11 +31,9 @@ jobs: - name: Install && Build - SDK and Sample App uses: ./.github/actions/install-and-build-sdk - name: Lint - run: yarn lerna-workspaces run lint && (cd docusaurus; npx prettier --check '**/*.mdx') + run: yarn lerna-workspaces run lint - name: Test run: yarn test:coverage - env: - GITHUB_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }} - name: Publish Next Release run: GITHUB_SHORT_SHA="$(git rev-parse --short $GITHUB_SHA)" yarn release-next env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d82f3129f..50f2d2e9e8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,12 +31,11 @@ jobs: - name: Install && Build - SDK and Sample App uses: ./.github/actions/install-and-build-sdk - name: Lint - run: yarn lerna-workspaces run lint && cd docusaurus && npx prettier --check '**/*.mdx' + run: yarn lerna-workspaces run lint - name: Publish Release run: yarn release env: NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} - GH_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }} - name: Merge back changes run: | git stash diff --git a/.github/workflows/vale-doc-lint.yml b/.github/workflows/vale-doc-lint.yml deleted file mode 100644 index 734fb3d172..0000000000 --- a/.github/workflows/vale-doc-lint.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Check Docusaurus docs with Vale linter - -on: [pull_request] - -jobs: - vale: - name: Vale doc linter - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: errata-ai/vale-action@reviewdog - with: - version: 2.30.0 - # added, diff_context, file, nofilter - # Default is added: results are filtered for added/modified files. Set to no filter when all files need to be checked. - # More info: https://github.com/errata-ai/vale-action and https://github.com/reviewdog/reviewdog#filter-mode - filter_mode: nofilter - # github-pr-check, github-pr-review, github-check - reporter: github-pr-check - # Set fail_on_error to true to make sure builds fail. - fail_on_error: true - files: docusaurus - env: - # Required, set by GitHub actions automatically: - # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret - GITHUB_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }} diff --git a/.styles/Google/AMPM.yml b/.styles/Google/AMPM.yml deleted file mode 100644 index fbdc6e4f84..0000000000 --- a/.styles/Google/AMPM.yml +++ /dev/null @@ -1,9 +0,0 @@ -extends: existence -message: "Use 'AM' or 'PM' (preceded by a space)." -link: 'https://developers.google.com/style/word-list' -level: error -nonword: true -tokens: - - '\d{1,2}[AP]M' - - '\d{1,2} ?[ap]m' - - '\d{1,2} ?[aApP]\.[mM]\.' diff --git a/.styles/Google/Acronyms.yml b/.styles/Google/Acronyms.yml deleted file mode 100644 index f41af0189b..0000000000 --- a/.styles/Google/Acronyms.yml +++ /dev/null @@ -1,64 +0,0 @@ -extends: conditional -message: "Spell out '%s', if it's unfamiliar to the audience." -link: 'https://developers.google.com/style/abbreviations' -level: suggestion -ignorecase: false -# Ensures that the existence of 'first' implies the existence of 'second'. -first: '\b([A-Z]{3,5})\b' -second: '(?:\b[A-Z][a-z]+ )+\(([A-Z]{3,5})\)' -# ... with the exception of these: -exceptions: - - API - - ASP - - CLI - - CPU - - CSS - - CSV - - DEBUG - - DOM - - DPI - - FAQ - - GCC - - GDB - - GET - - GPU - - GTK - - GUI - - HTML - - HTTP - - HTTPS - - IDE - - JAR - - JSON - - JSX - - LESS - - LLDB - - NET - - NOTE - - NVDA - - OSS - - PATH - - PDF - - PHP - - POST - - RAM - - REPL - - RSA - - SCM - - SCSS - - SDK - - SQL - - SSH - - SSL - - SVG - - TBD - - TCP - - TODO - - URI - - URL - - USB - - UTF - - XML - - XSS - - YAML - - ZIP diff --git a/.styles/Google/Colons.yml b/.styles/Google/Colons.yml deleted file mode 100644 index 99363fbd46..0000000000 --- a/.styles/Google/Colons.yml +++ /dev/null @@ -1,8 +0,0 @@ -extends: existence -message: "'%s' should be in lowercase." -link: 'https://developers.google.com/style/colons' -nonword: true -level: warning -scope: sentence -tokens: - - ':\s[A-Z]' diff --git a/.styles/Google/Contractions.yml b/.styles/Google/Contractions.yml deleted file mode 100644 index 95234987be..0000000000 --- a/.styles/Google/Contractions.yml +++ /dev/null @@ -1,30 +0,0 @@ -extends: substitution -message: "Feel free to use '%s' instead of '%s'." -link: 'https://developers.google.com/style/contractions' -level: suggestion -ignorecase: true -action: - name: replace -swap: - are not: aren't - cannot: can't - could not: couldn't - did not: didn't - do not: don't - does not: doesn't - has not: hasn't - have not: haven't - how is: how's - is not: isn't - it is: it's - should not: shouldn't - that is: that's - they are: they're - was not: wasn't - we are: we're - we have: we've - were not: weren't - what is: what's - when is: when's - where is: where's - will not: won't diff --git a/.styles/Google/DateFormat.yml b/.styles/Google/DateFormat.yml deleted file mode 100644 index e9d227fa13..0000000000 --- a/.styles/Google/DateFormat.yml +++ /dev/null @@ -1,9 +0,0 @@ -extends: existence -message: "Use 'July 31, 2016' format, not '%s'." -link: 'https://developers.google.com/style/dates-times' -ignorecase: true -level: error -nonword: true -tokens: - - '\d{1,2}(?:\.|/)\d{1,2}(?:\.|/)\d{4}' - - '\d{1,2} (?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)|May|Jun(?:e)|Jul(?:y)|Aug(?:ust)|Sep(?:tember)?|Oct(?:ober)|Nov(?:ember)?|Dec(?:ember)?) \d{4}' diff --git a/.styles/Google/Ellipses.yml b/.styles/Google/Ellipses.yml deleted file mode 100644 index 1e070517bf..0000000000 --- a/.styles/Google/Ellipses.yml +++ /dev/null @@ -1,9 +0,0 @@ -extends: existence -message: "In general, don't use an ellipsis." -link: 'https://developers.google.com/style/ellipses' -nonword: true -level: warning -action: - name: remove -tokens: - - '\.\.\.' diff --git a/.styles/Google/EmDash.yml b/.styles/Google/EmDash.yml deleted file mode 100644 index 1befe72aa8..0000000000 --- a/.styles/Google/EmDash.yml +++ /dev/null @@ -1,12 +0,0 @@ -extends: existence -message: "Don't put a space before or after a dash." -link: 'https://developers.google.com/style/dashes' -nonword: true -level: error -action: - name: edit - params: - - remove - - ' ' -tokens: - - '\s[—–]\s' diff --git a/.styles/Google/EnDash.yml b/.styles/Google/EnDash.yml deleted file mode 100644 index b314dc4e98..0000000000 --- a/.styles/Google/EnDash.yml +++ /dev/null @@ -1,13 +0,0 @@ -extends: existence -message: "Use an em dash ('—') instead of '–'." -link: 'https://developers.google.com/style/dashes' -nonword: true -level: error -action: - name: edit - params: - - replace - - '-' - - '—' -tokens: - - '–' diff --git a/.styles/Google/Exclamation.yml b/.styles/Google/Exclamation.yml deleted file mode 100644 index 3e15181b2f..0000000000 --- a/.styles/Google/Exclamation.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Don't use exclamation points in text." -link: 'https://developers.google.com/style/exclamation-points' -nonword: true -level: error -tokens: - - '\w!(?:\s|$)' diff --git a/.styles/Google/FirstPerson.yml b/.styles/Google/FirstPerson.yml deleted file mode 100644 index 0b7b8828ca..0000000000 --- a/.styles/Google/FirstPerson.yml +++ /dev/null @@ -1,13 +0,0 @@ -extends: existence -message: "Avoid first-person pronouns such as '%s'." -link: 'https://developers.google.com/style/pronouns#personal-pronouns' -ignorecase: true -level: warning -nonword: true -tokens: - - (?:^|\s)I\s - - (?:^|\s)I,\s - - \bI'm\b - - \bme\b - - \bmy\b - - \bmine\b diff --git a/.styles/Google/Gender.yml b/.styles/Google/Gender.yml deleted file mode 100644 index c8486181d6..0000000000 --- a/.styles/Google/Gender.yml +++ /dev/null @@ -1,9 +0,0 @@ -extends: existence -message: "Don't use '%s' as a gender-neutral pronoun." -link: 'https://developers.google.com/style/pronouns#gender-neutral-pronouns' -level: error -ignorecase: true -tokens: - - he/she - - s/he - - \(s\)he diff --git a/.styles/Google/GenderBias.yml b/.styles/Google/GenderBias.yml deleted file mode 100644 index 261cfb666f..0000000000 --- a/.styles/Google/GenderBias.yml +++ /dev/null @@ -1,45 +0,0 @@ -extends: substitution -message: "Consider using '%s' instead of '%s'." -link: 'https://developers.google.com/style/inclusive-documentation' -ignorecase: true -level: error -swap: - (?:alumna|alumnus): graduate - (?:alumnae|alumni): graduates - air(?:m[ae]n|wom[ae]n): pilot(s) - anchor(?:m[ae]n|wom[ae]n): anchor(s) - authoress: author - camera(?:m[ae]n|wom[ae]n): camera operator(s) - chair(?:m[ae]n|wom[ae]n): chair(s) - congress(?:m[ae]n|wom[ae]n): member(s) of congress - door(?:m[ae]|wom[ae]n): concierge(s) - draft(?:m[ae]n|wom[ae]n): drafter(s) - fire(?:m[ae]n|wom[ae]n): firefighter(s) - fisher(?:m[ae]n|wom[ae]n): fisher(s) - fresh(?:m[ae]n|wom[ae]n): first-year student(s) - garbage(?:m[ae]n|wom[ae]n): waste collector(s) - lady lawyer: lawyer - ladylike: courteous - landlord: building manager - mail(?:m[ae]n|wom[ae]n): mail carriers - man and wife: husband and wife - man enough: strong enough - mankind: human kind - manmade: manufactured - manpower: personnel - men and girls: men and women - middle(?:m[ae]n|wom[ae]n): intermediary - news(?:m[ae]n|wom[ae]n): journalist(s) - ombuds(?:man|woman): ombuds - oneupmanship: upstaging - poetess: poet - police(?:m[ae]n|wom[ae]n): police officer(s) - repair(?:m[ae]n|wom[ae]n): technician(s) - sales(?:m[ae]n|wom[ae]n): salesperson or sales people - service(?:m[ae]n|wom[ae]n): soldier(s) - steward(?:ess)?: flight attendant - tribes(?:m[ae]n|wom[ae]n): tribe member(s) - waitress: waiter - woman doctor: doctor - woman scientist[s]?: scientist(s) - work(?:m[ae]n|wom[ae]n): worker(s) diff --git a/.styles/Google/HeadingPunctuation.yml b/.styles/Google/HeadingPunctuation.yml deleted file mode 100644 index b538be5b42..0000000000 --- a/.styles/Google/HeadingPunctuation.yml +++ /dev/null @@ -1,13 +0,0 @@ -extends: existence -message: "Don't put a period at the end of a heading." -link: 'https://developers.google.com/style/capitalization#capitalization-in-titles-and-headings' -nonword: true -level: warning -scope: heading -action: - name: edit - params: - - remove - - '.' -tokens: - - '[a-z0-9][.]\s*$' diff --git a/.styles/Google/Headings.yml b/.styles/Google/Headings.yml deleted file mode 100644 index a53301338a..0000000000 --- a/.styles/Google/Headings.yml +++ /dev/null @@ -1,29 +0,0 @@ -extends: capitalization -message: "'%s' should use sentence-style capitalization." -link: 'https://developers.google.com/style/capitalization#capitalization-in-titles-and-headings' -level: warning -scope: heading -match: $sentence -indicators: - - ':' -exceptions: - - Azure - - CLI - - Code - - Cosmos - - Docker - - Emmet - - gRPC - - I - - Kubernetes - - Linux - - macOS - - Marketplace - - MongoDB - - REPL - - Studio - - TypeScript - - URLs - - Visual - - VS - - Windows diff --git a/.styles/Google/Latin.yml b/.styles/Google/Latin.yml deleted file mode 100644 index d91700de3f..0000000000 --- a/.styles/Google/Latin.yml +++ /dev/null @@ -1,11 +0,0 @@ -extends: substitution -message: "Use '%s' instead of '%s'." -link: 'https://developers.google.com/style/abbreviations' -ignorecase: true -level: error -nonword: true -action: - name: replace -swap: - '\b(?:eg|e\.g\.)[\s,]': for example - '\b(?:ie|i\.e\.)[\s,]': that is diff --git a/.styles/Google/LyHyphens.yml b/.styles/Google/LyHyphens.yml deleted file mode 100644 index ac8f557a4a..0000000000 --- a/.styles/Google/LyHyphens.yml +++ /dev/null @@ -1,14 +0,0 @@ -extends: existence -message: "'%s' doesn't need a hyphen." -link: 'https://developers.google.com/style/hyphens' -level: error -ignorecase: false -nonword: true -action: - name: edit - params: - - replace - - '-' - - ' ' -tokens: - - '\s[^\s-]+ly-' diff --git a/.styles/Google/OptionalPlurals.yml b/.styles/Google/OptionalPlurals.yml deleted file mode 100644 index f858ea6fee..0000000000 --- a/.styles/Google/OptionalPlurals.yml +++ /dev/null @@ -1,12 +0,0 @@ -extends: existence -message: "Don't use plurals in parentheses such as in '%s'." -link: 'https://developers.google.com/style/plurals-parentheses' -level: error -nonword: true -action: - name: edit - params: - - remove - - '(s)' -tokens: - - '\b\w+\(s\)' diff --git a/.styles/Google/Ordinal.yml b/.styles/Google/Ordinal.yml deleted file mode 100644 index d1ac7d27e8..0000000000 --- a/.styles/Google/Ordinal.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Spell out all ordinal numbers ('%s') in text." -link: 'https://developers.google.com/style/numbers' -level: error -nonword: true -tokens: - - \d+(?:st|nd|rd|th) diff --git a/.styles/Google/OxfordComma.yml b/.styles/Google/OxfordComma.yml deleted file mode 100644 index b9ba21ebb2..0000000000 --- a/.styles/Google/OxfordComma.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Use the Oxford comma in '%s'." -link: 'https://developers.google.com/style/commas' -scope: sentence -level: warning -tokens: - - '(?:[^,]+,){1,}\s\w+\s(?:and|or)' diff --git a/.styles/Google/Parens.yml b/.styles/Google/Parens.yml deleted file mode 100644 index 3b8711d0c8..0000000000 --- a/.styles/Google/Parens.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Use parentheses judiciously." -link: 'https://developers.google.com/style/parentheses' -nonword: true -level: suggestion -tokens: - - '\(.+\)' diff --git a/.styles/Google/Passive.yml b/.styles/Google/Passive.yml deleted file mode 100644 index 3265890e52..0000000000 --- a/.styles/Google/Passive.yml +++ /dev/null @@ -1,184 +0,0 @@ -extends: existence -link: 'https://developers.google.com/style/voice' -message: "In general, use active voice instead of passive voice ('%s')." -ignorecase: true -level: suggestion -raw: - - \b(am|are|were|being|is|been|was|be)\b\s* -tokens: - - '[\w]+ed' - - awoken - - beat - - become - - been - - begun - - bent - - beset - - bet - - bid - - bidden - - bitten - - bled - - blown - - born - - bought - - bound - - bred - - broadcast - - broken - - brought - - built - - burnt - - burst - - cast - - caught - - chosen - - clung - - come - - cost - - crept - - cut - - dealt - - dived - - done - - drawn - - dreamt - - driven - - drunk - - dug - - eaten - - fallen - - fed - - felt - - fit - - fled - - flown - - flung - - forbidden - - foregone - - forgiven - - forgotten - - forsaken - - fought - - found - - frozen - - given - - gone - - gotten - - ground - - grown - - heard - - held - - hidden - - hit - - hung - - hurt - - kept - - knelt - - knit - - known - - laid - - lain - - leapt - - learnt - - led - - left - - lent - - let - - lighted - - lost - - made - - meant - - met - - misspelt - - mistaken - - mown - - overcome - - overdone - - overtaken - - overthrown - - paid - - pled - - proven - - put - - quit - - read - - rid - - ridden - - risen - - run - - rung - - said - - sat - - sawn - - seen - - sent - - set - - sewn - - shaken - - shaven - - shed - - shod - - shone - - shorn - - shot - - shown - - shrunk - - shut - - slain - - slept - - slid - - slit - - slung - - smitten - - sold - - sought - - sown - - sped - - spent - - spilt - - spit - - split - - spoken - - spread - - sprung - - spun - - stolen - - stood - - stridden - - striven - - struck - - strung - - stuck - - stung - - stunk - - sung - - sunk - - swept - - swollen - - sworn - - swum - - swung - - taken - - taught - - thought - - thrived - - thrown - - thrust - - told - - torn - - trodden - - understood - - upheld - - upset - - wed - - wept - - withheld - - withstood - - woken - - won - - worn - - wound - - woven - - written - - wrung diff --git a/.styles/Google/Periods.yml b/.styles/Google/Periods.yml deleted file mode 100644 index d24a6a6c03..0000000000 --- a/.styles/Google/Periods.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Don't use periods with acronyms or initialisms such as '%s'." -link: 'https://developers.google.com/style/abbreviations' -level: error -nonword: true -tokens: - - '\b(?:[A-Z]\.){3,}' diff --git a/.styles/Google/Quotes.yml b/.styles/Google/Quotes.yml deleted file mode 100644 index 3cb6f1abd1..0000000000 --- a/.styles/Google/Quotes.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Commas and periods go inside quotation marks." -link: 'https://developers.google.com/style/quotation-marks' -level: error -nonword: true -tokens: - - '"[^"]+"[.,?]' diff --git a/.styles/Google/Ranges.yml b/.styles/Google/Ranges.yml deleted file mode 100644 index 3ec045e777..0000000000 --- a/.styles/Google/Ranges.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Don't add words such as 'from' or 'between' to describe a range of numbers." -link: 'https://developers.google.com/style/hyphens' -nonword: true -level: warning -tokens: - - '(?:from|between)\s\d+\s?-\s?\d+' diff --git a/.styles/Google/Semicolons.yml b/.styles/Google/Semicolons.yml deleted file mode 100644 index bb8b85b420..0000000000 --- a/.styles/Google/Semicolons.yml +++ /dev/null @@ -1,8 +0,0 @@ -extends: existence -message: "Use semicolons judiciously." -link: 'https://developers.google.com/style/semicolons' -nonword: true -scope: sentence -level: suggestion -tokens: - - ';' diff --git a/.styles/Google/Slang.yml b/.styles/Google/Slang.yml deleted file mode 100644 index 63f4c248a8..0000000000 --- a/.styles/Google/Slang.yml +++ /dev/null @@ -1,11 +0,0 @@ -extends: existence -message: "Don't use internet slang abbreviations such as '%s'." -link: 'https://developers.google.com/style/abbreviations' -ignorecase: true -level: error -tokens: - - 'tl;dr' - - ymmv - - rtfm - - imo - - fwiw diff --git a/.styles/Google/Spacing.yml b/.styles/Google/Spacing.yml deleted file mode 100644 index 27f7ca2bdc..0000000000 --- a/.styles/Google/Spacing.yml +++ /dev/null @@ -1,8 +0,0 @@ -extends: existence -message: "'%s' should have one space." -link: 'https://developers.google.com/style/sentence-spacing' -level: error -nonword: true -tokens: - - '[a-z][.?!] {2,}[A-Z]' - - '[a-z][.?!][A-Z]' diff --git a/.styles/Google/Spelling.yml b/.styles/Google/Spelling.yml deleted file mode 100644 index 57acb88414..0000000000 --- a/.styles/Google/Spelling.yml +++ /dev/null @@ -1,8 +0,0 @@ -extends: existence -message: "In general, use American spelling instead of '%s'." -link: 'https://developers.google.com/style/spelling' -ignorecase: true -level: warning -tokens: - - '(?:\w+)nised?' - - '(?:\w+)logue' diff --git a/.styles/Google/Units.yml b/.styles/Google/Units.yml deleted file mode 100644 index 379fad6b8e..0000000000 --- a/.styles/Google/Units.yml +++ /dev/null @@ -1,8 +0,0 @@ -extends: existence -message: "Put a nonbreaking space between the number and the unit in '%s'." -link: 'https://developers.google.com/style/units-of-measure' -nonword: true -level: error -tokens: - - \d+(?:B|kB|MB|GB|TB) - - \d+(?:ns|ms|s|min|h|d) diff --git a/.styles/Google/We.yml b/.styles/Google/We.yml deleted file mode 100644 index c7ac7d3622..0000000000 --- a/.styles/Google/We.yml +++ /dev/null @@ -1,11 +0,0 @@ -extends: existence -message: "Try to avoid using first-person plural like '%s'." -link: 'https://developers.google.com/style/pronouns#personal-pronouns' -level: warning -ignorecase: true -tokens: - - we - - we'(?:ve|re) - - ours? - - us - - let's diff --git a/.styles/Google/Will.yml b/.styles/Google/Will.yml deleted file mode 100644 index 128a918362..0000000000 --- a/.styles/Google/Will.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Avoid using '%s'." -link: 'https://developers.google.com/style/tense' -ignorecase: true -level: warning -tokens: - - will diff --git a/.styles/Google/WordList.yml b/.styles/Google/WordList.yml deleted file mode 100644 index bb711517e6..0000000000 --- a/.styles/Google/WordList.yml +++ /dev/null @@ -1,80 +0,0 @@ -extends: substitution -message: "Use '%s' instead of '%s'." -link: 'https://developers.google.com/style/word-list' -level: warning -ignorecase: false -action: - name: replace -swap: - '(?:API Console|dev|developer) key': API key - '(?:cell ?phone|smart ?phone)': phone|mobile phone - '(?:dev|developer|APIs) console': API console - '(?:e-mail|Email|E-mail)': email - '(?:file ?path|path ?name)': path - '(?:kill|terminate|abort)': stop|exit|cancel|end - '(?:OAuth ?2|Oauth)': OAuth 2.0 - '(?:ok|Okay)': OK|okay - '(?:WiFi|wifi)': Wi-Fi - '[\.]+apk': APK - '3\-D': 3D - 'Google (?:I\-O|IO)': Google I/O - 'tap (?:&|and) hold': touch & hold - 'un(?:check|select)': clear - above: preceding - account name: username - action bar: app bar - admin: administrator - Ajax: AJAX - Android device: Android-powered device - android: Android - API explorer: APIs Explorer - application: app - approx\.: approximately - authN: authentication - authZ: authorization - autoupdate: automatically update - cellular data: mobile data - cellular network: mobile network - chapter: documents|pages|sections - check box: checkbox - check: select - CLI: command-line tool - click on: click|click in - Cloud: Google Cloud Platform|GCP - Container Engine: Kubernetes Engine - content type: media type - curated roles: predefined roles - data are: data is - Developers Console: Google API Console|API Console - disabled?: turn off|off - ephemeral IP address: ephemeral external IP address - fewer data: less data - file name: filename - firewalls: firewall rules - functionality: capability|feature - Google account: Google Account - Google accounts: Google Accounts - Googling: search with Google - grayed-out: unavailable - HTTPs: HTTPS - in order to: to - ingest: import|load - k8s: Kubernetes - long press: touch & hold - network IP address: internal IP address - omnibox: address bar - open-source: open source - overview screen: recents screen - regex: regular expression - SHA1: SHA-1|HAS-SHA1 - sign into: sign in to - sign-?on: single sign-on - static IP address: static external IP address - stylesheet: style sheet - synch: sync - tablename: table name - tablet: device - touch: tap - url: URL - vs\.: versus - World Wide Web: web diff --git a/.styles/Google/meta.json b/.styles/Google/meta.json deleted file mode 100644 index a5da2a8480..0000000000 --- a/.styles/Google/meta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "feed": "https://github.com/errata-ai/Google/releases.atom", - "vale_version": ">=1.0.0" -} diff --git a/.styles/Google/vocab.txt b/.styles/Google/vocab.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.styles/Vocab/Base/accept.txt b/.styles/Vocab/Base/accept.txt deleted file mode 100644 index be8a7c04e1..0000000000 --- a/.styles/Vocab/Base/accept.txt +++ /dev/null @@ -1,57 +0,0 @@ -viewport -[Tt]ooltip -SDKs -100ms -Giphy -Angular -React -API -timeframe -APNs -Telehealth -Xcode -UI -memoize -memoization -bundler -config -iMessage -react -typings -serializable -Upserts -Unsets -SDK's -SDKs -Worklet -aiba -(nl) -(ru) -(ko) -namespace -falsy -iCloud -jetifier -npm -Notifee -colorScheme -performant -virtualized -rncli -RNCLI -CDNs -haptics -async -Podfile -boolean -Async -subscribable -memoizing -Boolean -draggable -sendMessage -overridable -loadMore -pollAnswers -enum -SendMessage diff --git a/.styles/Vocab/Base/reject.txt b/.styles/Vocab/Base/reject.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.vale.ini b/.vale.ini deleted file mode 100644 index 115f33b4a0..0000000000 --- a/.vale.ini +++ /dev/null @@ -1,17 +0,0 @@ -StylesPath = .styles - -MinAlertLevel = error -Vocab = Base - -Packages = Google - -# The "formats" section allows you to associate an "unknown" format -# with one of Vale's supported formats. -[formats] -mdx = md - -# Since we mapped `mdx` to `md` in the `formats`section we have to declare our format to be `md` -[*.md] -BasedOnStyles = Vale, Google -TokenIgnores = (^###.*),(^import .*;),(import .*;), (\{#[a-zA-Z].*?\}), (\*\*.*?\*\*), (src='.*?'), -BlockIgnores = (\n(.*\n)+
),(\| .* \|), (), () \ No newline at end of file diff --git a/package.json b/package.json index 00549f7c1d..2af9e55a5e 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "release-next": "yarn lerna-workspaces run release-next", "extract-changelog": "rm -rf NEXT_RELEASE_CHANGELOG.md && yarn lerna-workspaces run extract-changelog", "bootstrap": "yarn lerna-workspaces run bootstrap", - "lint": "yarn lerna-workspaces run lint && (cd docusaurus && npx prettier --check '**/*.mdx')", - "lint-fix": "yarn lerna-workspaces run lint-fix && (cd docusaurus && npx prettier --write '**/*.mdx')", + "lint": "yarn lerna-workspaces run lint", + "lint-fix": "yarn lerna-workspaces run lint-fix", "build": "yarn lerna-workspaces run build", "test:coverage": "yarn lerna-workspaces run test:coverage", "test:unit": "yarn lerna-workspaces run test:unit", diff --git a/package/.eslintignore b/package/.eslintignore index 4835dc2cf7..792b2f2404 100644 --- a/package/.eslintignore +++ b/package/.eslintignore @@ -6,4 +6,3 @@ vendor/ *.md src/components/docs/ lib/ -docusaurus/ \ No newline at end of file From 5fbd50a5a79f0eca63c3a540e2ea4c6bc9d1a8e3 Mon Sep 17 00:00:00 2001 From: Khushal Agarwal Date: Wed, 8 Jan 2025 12:45:16 +0530 Subject: [PATCH 04/13] fix: add size theme and prop for the ChannelAvatar component (#2881) * fix: add size theme and prop for the ChannelAvatar component * fix: make size prop optional --- examples/SampleApp/ios/Podfile.lock | 4 ++-- .../ChannelPreview/ChannelAvatar.tsx | 22 +++++++++++++++---- .../src/contexts/themeContext/utils/theme.ts | 6 +++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/examples/SampleApp/ios/Podfile.lock b/examples/SampleApp/ios/Podfile.lock index 742904914a..46b8030d78 100644 --- a/examples/SampleApp/ios/Podfile.lock +++ b/examples/SampleApp/ios/Podfile.lock @@ -1541,7 +1541,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost: d3f49c53809116a5d38da093a8aa78bf551aed09 - DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5 + DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953 FBLazyVector: 56e0e498dbb513b96c40bac6284729ba4e62672d FBReactNativeSpec: 146c741a3f40361f6bc13a4ba284678cbedb5881 Firebase: 91fefd38712feb9186ea8996af6cbdef41473442 @@ -1556,7 +1556,7 @@ SPEC CHECKSUMS: FirebaseRemoteConfigInterop: 6efda51fb5e2f15b16585197e26eaa09574e8a4d FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - glog: 69ef571f3de08433d766d614c73a9838a06bf7eb + glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2 GoogleAppMeasurement: f3abf08495ef2cba7829f15318c373b8d9226491 GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 diff --git a/package/src/components/ChannelPreview/ChannelAvatar.tsx b/package/src/components/ChannelPreview/ChannelAvatar.tsx index 3183136591..51298324aa 100644 --- a/package/src/components/ChannelPreview/ChannelAvatar.tsx +++ b/package/src/components/ChannelPreview/ChannelAvatar.tsx @@ -5,13 +5,19 @@ import { useChannelPreviewDisplayAvatar } from './hooks/useChannelPreviewDisplay import { useChannelPreviewDisplayPresence } from './hooks/useChannelPreviewDisplayPresence'; import { ChatContextValue, useChatContext } from '../../contexts/chatContext/ChatContext'; +import { useTheme } from '../../contexts/themeContext/ThemeContext'; import type { DefaultStreamChatGenerics } from '../../types/types'; import { Avatar } from '../Avatar/Avatar'; import { GroupAvatar } from '../Avatar/GroupAvatar'; export type ChannelAvatarProps< StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, -> = Pick, 'channel'>; +> = Pick, 'channel'> & { + /** + * The size of the avatar + */ + size?: number; +}; /** * This UI component displays an avatar for a particular channel. @@ -21,7 +27,15 @@ export const ChannelAvatarWithContext = < >( props: ChannelAvatarProps & Pick, ) => { - const { channel, ImageComponent } = props; + const { channel, ImageComponent, size: propSize } = props; + const { + theme: { + channelPreview: { + avatar: { size: themeSize }, + }, + }, + } = useTheme(); + const size = propSize || themeSize; const displayAvatar = useChannelPreviewDisplayAvatar(channel); const displayPresence = useChannelPreviewDisplayPresence(channel); @@ -32,7 +46,7 @@ export const ChannelAvatarWithContext = < ImageComponent={ImageComponent} images={displayAvatar.images} names={displayAvatar.names} - size={40} + size={size} /> ); } @@ -43,7 +57,7 @@ export const ChannelAvatarWithContext = < ImageComponent={ImageComponent} name={displayAvatar.name} online={displayPresence} - size={40} + size={size} /> ); }; diff --git a/package/src/contexts/themeContext/utils/theme.ts b/package/src/contexts/themeContext/utils/theme.ts index d69b93fc29..2ff2462db2 100644 --- a/package/src/contexts/themeContext/utils/theme.ts +++ b/package/src/contexts/themeContext/utils/theme.ts @@ -152,6 +152,9 @@ export type Theme = { maskFillColor?: ColorValue; }; channelPreview: { + avatar: { + size: number; + }; checkAllIcon: IconProps; checkIcon: IconProps; container: ViewStyle; @@ -875,6 +878,9 @@ export const defaultTheme: Theme = { height: 64, }, channelPreview: { + avatar: { + size: 40, + }, checkAllIcon: { height: DEFAULT_STATUS_ICON_SIZE, width: DEFAULT_STATUS_ICON_SIZE, From efe1074b219d4f7b6f0fef6da756fc51009a81f4 Mon Sep 17 00:00:00 2001 From: Khushal Agarwal Date: Wed, 8 Jan 2025 13:11:02 +0530 Subject: [PATCH 05/13] chore: change next release config for V5 branch (#2882) * chore: change next release config for V5 branch * chore: change dry run to false --- release/next.js | 5 ++++- release/release.config.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/release/next.js b/release/next.js index fb52927f00..1344b88b86 100644 --- a/release/next.js +++ b/release/next.js @@ -8,7 +8,10 @@ configPromise.then((config) => { ...config, branches: [ 'main', - 'V5', + { + name:"V5", + range: "5.x", + }, { name: 'develop', channel: 'beta', diff --git a/release/release.config.js b/release/release.config.js index 52f961df79..1986024f53 100644 --- a/release/release.config.js +++ b/release/release.config.js @@ -53,7 +53,7 @@ module.exports = Promise.resolve().then(() => { const lernaPackage = require('../lerna.json'); return { - dryRun: true, + dryRun: false, extends: [`${__dirname}/monorepo-setup.js`], workspaces: lernaPackage.packages, filterPath: process.env.FILTER_PATH, From 34ddec9cfe888c6febc82673635e201062ac44da Mon Sep 17 00:00:00 2001 From: Khushal Agarwal Date: Fri, 10 Jan 2025 22:24:29 +0530 Subject: [PATCH 06/13] fix: read state for messages (#2890) --- .../MessageList/hooks/useLastReadData.ts | 37 +++++++++++++++++++ .../MessageList/hooks/useMessageList.ts | 9 ++++- .../MessageList/utils/getReadStates.ts | 16 ++++---- 3 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 package/src/components/MessageList/hooks/useLastReadData.ts diff --git a/package/src/components/MessageList/hooks/useLastReadData.ts b/package/src/components/MessageList/hooks/useLastReadData.ts new file mode 100644 index 0000000000..f0922a08f8 --- /dev/null +++ b/package/src/components/MessageList/hooks/useLastReadData.ts @@ -0,0 +1,37 @@ +import { useMemo } from 'react'; + +import type { ChannelState } from 'stream-chat'; + +import { PaginatedMessageListContextValue } from '../../../contexts/paginatedMessageListContext/PaginatedMessageListContext'; +import { ThreadContextValue } from '../../../contexts/threadContext/ThreadContext'; +import type { DefaultStreamChatGenerics } from '../../../types/types'; +import { getReadStates } from '../utils/getReadStates'; + +type UseLastReadDataParams< + StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, +> = { + messages: + | PaginatedMessageListContextValue['messages'] + | ThreadContextValue['threadMessages']; + userID: string | undefined; + read?: ChannelState['read']; + returnAllReadData?: boolean; +}; + +export const useLastReadData = < + StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, +>( + props: UseLastReadDataParams, +) => { + const { messages, read, returnAllReadData = true, userID } = props; + + return useMemo( + () => + getReadStates( + messages.filter(({ user }) => user?.id === userID), + read, + returnAllReadData, + ), + [messages, read, returnAllReadData, userID], + ); +}; diff --git a/package/src/components/MessageList/hooks/useMessageList.ts b/package/src/components/MessageList/hooks/useMessageList.ts index 159a9c158f..627ea575ee 100644 --- a/package/src/components/MessageList/hooks/useMessageList.ts +++ b/package/src/components/MessageList/hooks/useMessageList.ts @@ -1,5 +1,7 @@ import type { ChannelState, MessageResponse } from 'stream-chat'; +import { useLastReadData } from './useLastReadData'; + import { ChannelContextValue, useChannelContext, @@ -14,7 +16,6 @@ import { useThreadContext } from '../../../contexts/threadContext/ThreadContext' import type { DefaultStreamChatGenerics } from '../../../types/types'; import { getDateSeparators } from '../utils/getDateSeparators'; import { getGroupStyles } from '../utils/getGroupStyles'; -import { getReadStates } from '../utils/getReadStates'; export type UseMessageListParams = { deletedMessagesVisibilityType?: DeletedMessagesVisibilityType; @@ -81,7 +82,11 @@ export const useMessageList = < userId: client.userID, }); - const readData = getReadStates(client.userID, messageList, readList); + const readData = useLastReadData({ + messages: messageList, + read: readList, + userID: client.userID, + }); const messagesWithStylesReadByAndDateSeparator = messageList .filter((msg) => { diff --git a/package/src/components/MessageList/utils/getReadStates.ts b/package/src/components/MessageList/utils/getReadStates.ts index 0d8541478b..8f86dfdb48 100644 --- a/package/src/components/MessageList/utils/getReadStates.ts +++ b/package/src/components/MessageList/utils/getReadStates.ts @@ -6,11 +6,11 @@ import type { DefaultStreamChatGenerics } from '../../../types/types'; export const getReadStates = < StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, >( - clientUserId: string | undefined, messages: | PaginatedMessageListContextValue['messages'] | ThreadContextValue['threadMessages'], read?: ChannelContextValue['read'], + returnAllReadData?: boolean, ) => { const readData: Record = {}; @@ -32,20 +32,20 @@ export const getReadStates = < if (msg.created_at && msg.created_at < readState.last_read) { userLastReadMsgId = msg.id; - // if true, save other user's read data for all messages they've read - if (!readData[userLastReadMsgId]) { - readData[userLastReadMsgId] = 0; - } + if (returnAllReadData) { + // if true, save other user's read data for all messages they've read + if (!readData[userLastReadMsgId]) { + readData[userLastReadMsgId] = 0; + } - // Only increment read count if the message is not sent by the current user - if (msg.user?.id !== clientUserId) { + // Only increment read count if the message is not sent by the current user readData[userLastReadMsgId] = readData[userLastReadMsgId] + 1; } } }); // if true, only save read data for other user's last read message - if (userLastReadMsgId) { + if (userLastReadMsgId && !returnAllReadData) { if (!readData[userLastReadMsgId]) { readData[userLastReadMsgId] = 0; } From ba07bf91557cf7a62b13465d4f9949f98196b2a8 Mon Sep 17 00:00:00 2001 From: Khushal Agarwal Date: Wed, 15 Jan 2025 13:19:12 +0530 Subject: [PATCH 07/13] fix: inverted unread indicator due to applied inverted styles (#2889) * fix: inverted unread indicator due to applied inverted styles * fix: tests snapshots * fix: unread indicator inverted issue on android * fix: tests --- package/src/components/MessageList/MessageList.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/package/src/components/MessageList/MessageList.tsx b/package/src/components/MessageList/MessageList.tsx index c86afef956..7625b59135 100644 --- a/package/src/components/MessageList/MessageList.tsx +++ b/package/src/components/MessageList/MessageList.tsx @@ -670,6 +670,7 @@ const MessageListWithContext = < threadList={threadList} /> ); + return wrapMessageInTheme ? ( <> @@ -677,13 +678,15 @@ const MessageListWithContext = < style={[shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined]} testID={`message-list-item-${index}`} > + {shouldApplyAndroidWorkaround && insertInlineUnreadIndicator && ( + + )} {shouldApplyAndroidWorkaround && renderDateSeperator} {renderMessage} {!shouldApplyAndroidWorkaround && renderDateSeperator} - {/* Adding indicator below the messages, since the list is inverted */} - {insertInlineUnreadIndicator && } + {!shouldApplyAndroidWorkaround && insertInlineUnreadIndicator && } ) : ( <> @@ -691,12 +694,12 @@ const MessageListWithContext = < style={[shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined]} testID={`message-list-item-${index}`} > + {shouldApplyAndroidWorkaround && insertInlineUnreadIndicator && } {shouldApplyAndroidWorkaround && renderDateSeperator} {renderMessage} {!shouldApplyAndroidWorkaround && renderDateSeperator} - {/* Adding indicator below the messages, since the list is inverted */} - {insertInlineUnreadIndicator && } + {!shouldApplyAndroidWorkaround && insertInlineUnreadIndicator && } ); }; From dc870d7026f48723ee89c3f96b31a1701315955b Mon Sep 17 00:00:00 2001 From: Ivan Sekovanikj <31964049+isekovanic@users.noreply.github.com> Date: Thu, 23 Jan 2025 12:01:35 +0100 Subject: [PATCH 08/13] fix: properly sync own reads while offline mode is enabled (#2902) * fix: properly sync own reads while offline mode is enabled * fix: use proper unreadCount * fix: use countUnread() api for brevity --- .../hooks/useCreateChannelsContext.ts | 4 ++- .../hooks/useChannelPreviewData.ts | 3 +- .../Chat/hooks/handleEventToSyncDB.ts | 32 ++++++++++++++++--- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/package/src/components/ChannelList/hooks/useCreateChannelsContext.ts b/package/src/components/ChannelList/hooks/useCreateChannelsContext.ts index c2190b2e13..3dc8d5de73 100644 --- a/package/src/components/ChannelList/hooks/useCreateChannelsContext.ts +++ b/package/src/components/ChannelList/hooks/useCreateChannelsContext.ts @@ -41,7 +41,9 @@ export const useCreateChannelsContext = < const channelValueString = channels ?.map( (channel) => - `${channel.data?.name ?? ''}${channel.id ?? ''}${Object.values(channel.state.members) + `${channel.data?.name ?? ''}${channel.id ?? ''}${ + channel?.state?.unreadCount ?? '' + }${Object.values(channel.state.members) .map((member) => member.user?.online) .join()}`, ) diff --git a/package/src/components/ChannelPreview/hooks/useChannelPreviewData.ts b/package/src/components/ChannelPreview/hooks/useChannelPreviewData.ts index a678e7042a..1c627e4305 100644 --- a/package/src/components/ChannelPreview/hooks/useChannelPreviewData.ts +++ b/package/src/components/ChannelPreview/hooks/useChannelPreviewData.ts @@ -47,8 +47,7 @@ export const useChannelPreviewData = < } const newUnreadCount = channel.countUnread(); setUnread(newUnreadCount); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [channel, channelLastMessageString, channelListForceUpdate]); + }, [channel, channelLastMessage, channelLastMessageString, channelListForceUpdate, lastMessage]); /** * This effect listens for the `notification.mark_read` event and sets the unread count to 0 diff --git a/package/src/components/Chat/hooks/handleEventToSyncDB.ts b/package/src/components/Chat/hooks/handleEventToSyncDB.ts index b8a6b25d25..d58dcc9798 100644 --- a/package/src/components/Chat/hooks/handleEventToSyncDB.ts +++ b/package/src/components/Chat/hooks/handleEventToSyncDB.ts @@ -97,14 +97,36 @@ export const handleEventToSyncDB = < } if (type === 'message.new') { - const message = event.message; + const { cid, message, user } = event; + if (message && (!message.parent_id || message.show_in_channel)) { - return queriesWithChannelGuard((flushOverride) => - upsertMessages({ + return queriesWithChannelGuard((flushOverride) => { + let queries = upsertMessages({ flush: flushOverride, messages: [message], - }), - ); + }); + if (cid && client.user && client.user.id !== user?.id) { + const userId = client.user.id; + const channel = client.activeChannels[cid]; + if (channel) { + const ownReads = channel.state.read[userId]; + const unreadCount = channel.countUnread(); + const upsertReadsQueries = upsertReads({ + cid, + flush: flushOverride, + reads: [ + { + last_read: ownReads.last_read.toString() as string, + unread_messages: unreadCount, + user: client.user, + }, + ], + }); + queries = [...queries, ...upsertReadsQueries]; + } + } + return queries; + }); } } From d78954eb7742192eadb9e284a68a84f94f433ac4 Mon Sep 17 00:00:00 2001 From: Ivan Sekovanikj <31964049+isekovanic@users.noreply.github.com> Date: Wed, 29 Jan 2025 09:20:20 +0100 Subject: [PATCH 09/13] fix: add thumbnail info on gallery press handlers (#2911) * fix: add thumbnail info on gallery press handlers * fix: pr review comments --- package/src/components/Attachment/Gallery.tsx | 3 ++ package/src/components/Message/Message.tsx | 30 ++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/package/src/components/Attachment/Gallery.tsx b/package/src/components/Attachment/Gallery.tsx index 5836ffb478..ff5685e76c 100644 --- a/package/src/components/Attachment/Gallery.tsx +++ b/package/src/components/Attachment/Gallery.tsx @@ -330,6 +330,7 @@ const GalleryThumbnail = < onLongPress={(event) => { if (onLongPress) { onLongPress({ + additionalInfo: { thumbnail }, emitter: 'gallery', event, }); @@ -338,6 +339,7 @@ const GalleryThumbnail = < onPress={(event) => { if (onPress) { onPress({ + additionalInfo: { thumbnail }, defaultHandler: defaultOnPress, emitter: 'gallery', event, @@ -347,6 +349,7 @@ const GalleryThumbnail = < onPressIn={(event) => { if (onPressIn) { onPressIn({ + additionalInfo: { thumbnail }, defaultHandler: defaultOnPress, emitter: 'gallery', event, diff --git a/package/src/components/Message/Message.tsx b/package/src/components/Message/Message.tsx index 891c123415..e7758c6128 100644 --- a/package/src/components/Message/Message.tsx +++ b/package/src/components/Message/Message.tsx @@ -48,6 +48,7 @@ import { isEditedMessage, MessageStatusTypes, } from '../../utils/utils'; +import type { Thumbnail } from '../Attachment/utils/buildGallery/types'; import { isMessageWithStylesReadByAndDateSeparator, @@ -65,23 +66,40 @@ export type TouchableEmitter = | 'messageReplies' | 'reactionList'; +export type TextMentionTouchableHandlerAdditionalInfo< + StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, +> = { user?: UserResponse }; + export type TextMentionTouchableHandlerPayload< StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, > = { emitter: 'textMention'; - additionalInfo?: { user?: UserResponse }; + additionalInfo?: TextMentionTouchableHandlerAdditionalInfo; }; +export type UrlTouchableHandlerAdditionalInfo = { url?: string }; + export type UrlTouchableHandlerPayload = { emitter: 'textLink' | 'card'; - additionalInfo?: { url?: string }; + additionalInfo?: UrlTouchableHandlerAdditionalInfo; }; +export type FileAttachmentTouchableHandlerAdditionalInfo< + StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, +> = { attachment?: Attachment }; + export type FileAttachmentTouchableHandlerPayload< StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, > = { emitter: 'fileAttachment'; - additionalInfo?: { attachment?: Attachment }; + additionalInfo?: FileAttachmentTouchableHandlerAdditionalInfo; +}; + +export type GalleryThumbnailTouchableHandlerAdditionalInfo = { thumbnail?: Thumbnail }; + +export type GalleryThumbnailTouchableHandlerPayload = { + emitter: 'gallery'; + additionalInfo?: GalleryThumbnailTouchableHandlerAdditionalInfo; }; export type TouchableHandlerPayload = { @@ -89,11 +107,15 @@ export type TouchableHandlerPayload = { event?: GestureResponderEvent; } & ( | { - emitter?: Exclude; + emitter?: Exclude< + TouchableEmitter, + 'textMention' | 'textLink' | 'card' | 'fileAttachment' | 'gallery' + >; } | TextMentionTouchableHandlerPayload | UrlTouchableHandlerPayload | FileAttachmentTouchableHandlerPayload + | GalleryThumbnailTouchableHandlerPayload ); export type MessageTouchableHandlerPayload< From e20e728b672112cb6c09f8815486ad8c0352ce6e Mon Sep 17 00:00:00 2001 From: Khushal Agarwal Date: Wed, 5 Feb 2025 22:38:18 +0530 Subject: [PATCH 10/13] feat: blockquote support on v5 branch --- .../utils/generateMarkdownText.test.ts | 2 +- .../utils/generateMarkdownText.ts | 2 +- .../MessageSimple/utils/renderText.tsx | 29 ++++++++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/package/src/components/Message/MessageSimple/utils/generateMarkdownText.test.ts b/package/src/components/Message/MessageSimple/utils/generateMarkdownText.test.ts index f7eb12d8c6..56a02249c5 100644 --- a/package/src/components/Message/MessageSimple/utils/generateMarkdownText.test.ts +++ b/package/src/components/Message/MessageSimple/utils/generateMarkdownText.test.ts @@ -15,7 +15,7 @@ describe('generateMarkdownText', () => { 'Hi [test@gmail.com](mailto:test@gmail.com) @test@gmail.com', ], ['Hi @getstream.io getstream.io', 'Hi @getstream.io [getstream.io](http://getstream.io)'], - ['Hi ', 'Hi \\'], + ['Hi ', 'Hi \\'], ])('Returns the generated markdown text for %p and %p', (text, expected) => { const result = generateMarkdownText(text); expect(result).toBe(expected); diff --git a/package/src/components/Message/MessageSimple/utils/generateMarkdownText.ts b/package/src/components/Message/MessageSimple/utils/generateMarkdownText.ts index dd654facb1..8e196ac6cd 100644 --- a/package/src/components/Message/MessageSimple/utils/generateMarkdownText.ts +++ b/package/src/components/Message/MessageSimple/utils/generateMarkdownText.ts @@ -34,7 +34,7 @@ export const generateMarkdownText = (text?: string) => { } // Escape the " and ' characters, except in code blocks where we deem this allowed. - resultText = resultText.replace(/(```[\s\S]*?```|`.*?`)|[<"'>]/g, (match, code) => { + resultText = resultText.replace(/(```[\s\S]*?```|`.*?`)|[<"']/g, (match, code) => { if (code) return code; return `\\${match}`; }); diff --git a/package/src/components/Message/MessageSimple/utils/renderText.tsx b/package/src/components/Message/MessageSimple/utils/renderText.tsx index ab42170908..d649fd5b5b 100644 --- a/package/src/components/Message/MessageSimple/utils/renderText.tsx +++ b/package/src/components/Message/MessageSimple/utils/renderText.tsx @@ -200,6 +200,23 @@ export const renderText = < color: colors.accent_blue, ...markdownStyles?.autolink, }, + blockQuoteSection: { + ...defaultMarkdownStyles.blockQuoteSection, + flexDirection: 'row', + padding: 8, + ...markdownStyles?.blockQuoteSection, + }, + blockQuoteSectionBar: { + ...defaultMarkdownStyles.blockQuoteSectionBar, + backgroundColor: colors.grey_gainsboro, + marginRight: 8, + width: 2, + ...markdownStyles?.blockQuoteSectionBar, + }, + blockQuoteText: { + ...defaultMarkdownStyles.blockQuoteText, + ...markdownStyles?.blockQuoteText, + }, codeBlock: { ...defaultMarkdownStyles.codeBlock, backgroundColor: colors.code_block, @@ -398,7 +415,18 @@ export const renderText = < ); + const blockQuoteReact: ReactNodeOutput = (node, output, state) => ( + + + {output(node.content, state)} + + ); + const customRules = { + blockQuote: { + react: blockQuoteReact, + }, + codeBlock: { react: codeBlockReact }, // do not render images, we will scrape them out of the message and show on attachment card component image: { match: () => null }, link: { react: linkReact }, @@ -418,7 +446,6 @@ export const renderText = < }, } : {}), - codeBlock: { react: codeBlockReact }, table: { react: tableReact }, }; From f37276927bfeb245a8932938e3501e7d8b3f6251 Mon Sep 17 00:00:00 2001 From: Ivan Sekovanikj <31964049+isekovanic@users.noreply.github.com> Date: Thu, 13 Mar 2025 09:43:25 +0100 Subject: [PATCH 11/13] fix: initial scroll to first unread v5 (#3016) * fix: initial scrolling to first unread message on v5 * fix: ios sample app build on v5 * fix: actions/cache ersion bump --- .github/workflows/sample-distribution.yml | 8 +++++--- package/src/components/Channel/Channel.tsx | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sample-distribution.yml b/.github/workflows/sample-distribution.yml index 51bf53ca1c..9885602055 100644 --- a/.github/workflows/sample-distribution.yml +++ b/.github/workflows/sample-distribution.yml @@ -14,7 +14,7 @@ on: jobs: build_and_deploy_ios_testflight_qa: name: Build SampleApp iOS and Deploy-${{ github.ref == 'refs/heads/V5' }} - runs-on: [macos-14] + runs-on: [macos-15] steps: - name: Connect Bot uses: webfactory/ssh-agent@v0.7.0 @@ -25,7 +25,7 @@ jobs: - name: Install && Build - SDK and Sample App uses: ./.github/actions/install-and-build-sdk - name: Cache iOS pods - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: examples/SampleApp/ios/Pods key: ${{ runner.os }}-pods-${{ hashFiles('examples/SampleApp/ios/Podfile.lock') }} @@ -33,7 +33,9 @@ jobs: ${{ runner.os }}-pods- - name: iOS Pods setup working-directory: examples/SampleApp/ios - run: bundle exec pod install + run: | + pod update hermes-engine --no-repo-update + bundle exec pod install - name: Build and release Testflight QA working-directory: examples/SampleApp run: bundle exec fastlane deploy_to_testflight_qa deploy:${{ github.ref == 'refs/heads/V5' }}; diff --git a/package/src/components/Channel/Channel.tsx b/package/src/components/Channel/Channel.tsx index a2fecbec66..cdb2030f9b 100644 --- a/package/src/components/Channel/Channel.tsx +++ b/package/src/components/Channel/Channel.tsx @@ -203,7 +203,7 @@ export const reactionData: ReactionData[] = [ * If count of unread messages is less than 4, then no need to scroll to first unread message, * since first unread message will be in visible frame anyways. */ -const scrollToFirstUnreadThreshold = 4; +const scrollToFirstUnreadThreshold = 0; const defaultThrottleInterval = 500; const defaultDebounceInterval = 500; @@ -1042,6 +1042,7 @@ const ChannelWithContext = < }, () => { if (unreadMessageIdToScrollTo) { + setTargetedMessage(unreadMessageIdToScrollTo); restartSetsMergeFuncRef.current(); } }, From c4d1a2b1987d3deb27a1a1a7bbf55c2feae7512b Mon Sep 17 00:00:00 2001 From: Ivan Sekovanikj Date: Tue, 23 Dec 2025 13:52:27 +0100 Subject: [PATCH 12/13] fix: reaction memoization crash --- package/src/components/Message/MessageSimple/ReactionList.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/src/components/Message/MessageSimple/ReactionList.tsx b/package/src/components/Message/MessageSimple/ReactionList.tsx index 50d5dd92f9..6693e32c11 100644 --- a/package/src/components/Message/MessageSimple/ReactionList.tsx +++ b/package/src/components/Message/MessageSimple/ReactionList.tsx @@ -313,8 +313,8 @@ const areEqual = - type === nextMessage.latest_reactions?.[index].type && - count === nextMessage.latest_reactions?.[index].count, + type === nextMessage.latest_reactions?.[index]?.type && + count === nextMessage.latest_reactions?.[index]?.count, ) : prevReactions === nextReactions; From 2bfa7dbdc45f8bc47fc3d4677fe17e28206f2d58 Mon Sep 17 00:00:00 2001 From: Ivan Sekovanikj Date: Tue, 23 Dec 2025 14:32:41 +0100 Subject: [PATCH 13/13] fix: trigger release --- package/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/package/CHANGELOG.md b/package/CHANGELOG.md index a74f8e8236..681cfcc5d7 100644 --- a/package/CHANGELOG.md +++ b/package/CHANGELOG.md @@ -1,5 +1,6 @@ # Change Log + ### [5.44.2](https://github.com/GetStream/stream-chat-react-native/compare/v5.44.1...v5.44.2) (2024-12-10)