diff --git a/.github/workflows/dart_code_metrics.yaml b/.github/workflows/dart_code_metrics.yaml index 9162b1a7..a5ffc54d 100644 --- a/.github/workflows/dart_code_metrics.yaml +++ b/.github/workflows/dart_code_metrics.yaml @@ -1,73 +1,73 @@ name: Dart Code Metrics env: - flutter_version: "3.3.3" + flutter_version: "3.7.0" folders: "lib, test" - melos_version: "2.7.1" on: pull_request: + paths: + - 'packages/**' push: branches: - master - develop +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: check: name: dart-code-metrics runs-on: ubuntu-latest steps: - name: "Git Checkout" - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - - name: "Cache Flutter dependencies" - uses: actions/cache@v2 - with: - path: /opt/hostedtoolcache/flutter - key: ${{ env.flutter_version }}-flutter - - name: "Install Flutter" - uses: subosito/flutter-action@v1 + uses: subosito/flutter-action@v2 with: + cache: true flutter-version: ${{ env.flutter_version }} - name: "Install Tools" - run: flutter pub global activate melos ${{ env.melos_version }} + run: flutter pub global activate melos - name: "Bootstrap Workspace" run: melos bootstrap - name: "Stream Chat Metrics" - uses: dart-code-checker/dart-code-metrics-action@v2.0.0 + uses: dart-code-checker/dart-code-metrics-action@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} relative_path: 'packages/stream_chat' folders: ${{ env.folders }} - name: "Stream Chat Flutter Core Metrics" - uses: dart-code-checker/dart-code-metrics-action@v2.0.0 + uses: dart-code-checker/dart-code-metrics-action@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} relative_path: 'packages/stream_chat_flutter_core' folders: ${{ env.folders }} - name: "Stream Chat Flutter Metrics" - uses: dart-code-checker/dart-code-metrics-action@v2.0.0 + uses: dart-code-checker/dart-code-metrics-action@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} relative_path: 'packages/stream_chat_flutter' folders: ${{ env.folders }} - name: "Stream Chat Localizations Metrics" - uses: dart-code-checker/dart-code-metrics-action@v2.0.0 + uses: dart-code-checker/dart-code-metrics-action@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} relative_path: 'packages/stream_chat_localizations' folders: ${{ env.folders }} - name: "Stream Chat Persistence Metrics" - uses: dart-code-checker/dart-code-metrics-action@v2.0.0 + uses: dart-code-checker/dart-code-metrics-action@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} relative_path: 'packages/stream_chat_persistence' diff --git a/.github/workflows/docusaurus.yml b/.github/workflows/docusaurus.yml index f46fa893..5a234e8f 100644 --- a/.github/workflows/docusaurus.yml +++ b/.github/workflows/docusaurus.yml @@ -9,12 +9,17 @@ on: - docusaurus/** jobs: push_docusaurus: + name: Publish docusaurus docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - name: Setup Node 16 + uses: actions/setup-node@v3 + with: + node-version: 16 - name: push uses: GetStream/push-stream-chat-docusaurus-action@main with: target-branch: ${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }} env: - DOCUSAURUS_GH_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }} \ No newline at end of file + DOCUSAURUS_GH_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }} diff --git a/.github/workflows/pana.yml b/.github/workflows/pana.yml index a6a7e822..aa72f61a 100644 --- a/.github/workflows/pana.yml +++ b/.github/workflows/pana.yml @@ -14,12 +14,16 @@ on: - master paths-ignore: - 'docs/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: stream_chat: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: axel-op/dart-package-analyzer@v3 id: analysis with: @@ -39,7 +43,7 @@ jobs: stream_chat_persistence: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: axel-op/dart-package-analyzer@v3 id: analysis with: @@ -60,7 +64,7 @@ jobs: stream_chat_flutter_core: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: axel-op/dart-package-analyzer@v3 id: analysis with: @@ -80,7 +84,7 @@ jobs: stream_chat_flutter: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: axel-op/dart-package-analyzer@v3 id: analysis with: diff --git a/.github/workflows/pr_title.yml b/.github/workflows/pr_title.yml index b7d1ad9b..bd4e36cb 100644 --- a/.github/workflows/pr_title.yml +++ b/.github/workflows/pr_title.yml @@ -7,6 +7,10 @@ on: - synchronize branches: - develop + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: conventional_pr_title: diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index 9de7ca4d..af57f49f 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -2,16 +2,20 @@ name: stream_flutter_workflow env: ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' - flutter_version: "3.3.3" - melos_version: "2.7.1" + flutter_version: "3.7.0" on: pull_request: - types: [opened, synchronize, reopened, ready_for_review, converted_to_draft] + paths: + - 'packages/**' push: branches: - master - develop + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: analyze: @@ -20,21 +24,17 @@ jobs: runs-on: ubuntu-latest steps: - name: "Git Checkout" - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Cache Flutter dependencies - uses: actions/cache@v2 - with: - path: /opt/hostedtoolcache/flutter - key: ${{ env.flutter_version }}-flutter - name: "Install Flutter" - uses: subosito/flutter-action@v1 + uses: subosito/flutter-action@v2 with: + cache: true flutter-version: ${{ env.flutter_version }} - name: "Install Tools" run: | - flutter pub global activate melos ${{ env.melos_version }} + flutter pub global activate melos - name: "Bootstrap Workspace" run: melos bootstrap --verbose - name: "Dart Analyze" @@ -51,21 +51,17 @@ jobs: timeout-minutes: 15 steps: - name: "Git Checkout" - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Cache Flutter dependencies - uses: actions/cache@v2 - with: - path: /opt/hostedtoolcache/flutter - key: ${{ env.flutter_version }}-flutter - name: "Install Flutter" - uses: subosito/flutter-action@v1 + uses: subosito/flutter-action@v2 with: + cache: true flutter-version: ${{ env.flutter_version }} - name: "Install Tools" run: | - flutter pub global activate melos ${{ env.melos_version }} + flutter pub global activate melos - name: "Bootstrap Workspace" run: melos bootstrap - name: "Melos Format" @@ -75,26 +71,22 @@ jobs: ./.github/workflows/scripts/validate-formatting.sh test: - runs-on: macos-latest + runs-on: ubuntu-latest if: github.event.pull_request.draft == false timeout-minutes: 30 steps: - name: "Git Checkout" - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Cache Flutter dependencies - uses: actions/cache@v2 - with: - path: /Users/runner/hostedtoolcache/flutter - key: ${{ env.flutter_version }}-flutter - name: "Install Flutter" - uses: subosito/flutter-action@v1 + uses: subosito/flutter-action@v2 with: + cache: true flutter-version: ${{ env.flutter_version }} - name: "Install Tools" run: | - flutter pub global activate melos ${{ env.melos_version }} + flutter pub global activate melos flutter pub global activate remove_from_coverage - name: "Bootstrap Workspace" run: melos bootstrap diff --git a/.github/workflows/vale-doc-lint.yml b/.github/workflows/vale-doc-lint.yml new file mode 100644 index 00000000..d0253fb4 --- /dev/null +++ b/.github/workflows/vale-doc-lint.yml @@ -0,0 +1,25 @@ +name: Check Docusaurus docs with vale linter + +on: [pull_request] + +jobs: + vale: + name: Vale doc linter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: errata-ai/vale-action@reviewdog + with: + # 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", "README.md"]' + 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.GITHUB_TOKEN}} diff --git a/.styles/Google/AMPM.yml b/.styles/Google/AMPM.yml new file mode 100644 index 00000000..fbdc6e4f --- /dev/null +++ b/.styles/Google/AMPM.yml @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..f41af018 --- /dev/null +++ b/.styles/Google/Acronyms.yml @@ -0,0 +1,64 @@ +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 new file mode 100644 index 00000000..99363fbd --- /dev/null +++ b/.styles/Google/Colons.yml @@ -0,0 +1,8 @@ +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 new file mode 100644 index 00000000..95234987 --- /dev/null +++ b/.styles/Google/Contractions.yml @@ -0,0 +1,30 @@ +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 new file mode 100644 index 00000000..e9d227fa --- /dev/null +++ b/.styles/Google/DateFormat.yml @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..1e070517 --- /dev/null +++ b/.styles/Google/Ellipses.yml @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..1befe72a --- /dev/null +++ b/.styles/Google/EmDash.yml @@ -0,0 +1,12 @@ +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 new file mode 100644 index 00000000..b314dc4e --- /dev/null +++ b/.styles/Google/EnDash.yml @@ -0,0 +1,13 @@ +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 new file mode 100644 index 00000000..3e15181b --- /dev/null +++ b/.styles/Google/Exclamation.yml @@ -0,0 +1,7 @@ +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 new file mode 100644 index 00000000..0b7b8828 --- /dev/null +++ b/.styles/Google/FirstPerson.yml @@ -0,0 +1,13 @@ +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 new file mode 100644 index 00000000..c8486181 --- /dev/null +++ b/.styles/Google/Gender.yml @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..261cfb66 --- /dev/null +++ b/.styles/Google/GenderBias.yml @@ -0,0 +1,45 @@ +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 new file mode 100644 index 00000000..b538be5b --- /dev/null +++ b/.styles/Google/HeadingPunctuation.yml @@ -0,0 +1,13 @@ +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 new file mode 100644 index 00000000..a5330133 --- /dev/null +++ b/.styles/Google/Headings.yml @@ -0,0 +1,29 @@ +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 new file mode 100644 index 00000000..d91700de --- /dev/null +++ b/.styles/Google/Latin.yml @@ -0,0 +1,11 @@ +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 new file mode 100644 index 00000000..ac8f557a --- /dev/null +++ b/.styles/Google/LyHyphens.yml @@ -0,0 +1,14 @@ +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 new file mode 100644 index 00000000..f858ea6f --- /dev/null +++ b/.styles/Google/OptionalPlurals.yml @@ -0,0 +1,12 @@ +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 new file mode 100644 index 00000000..d1ac7d27 --- /dev/null +++ b/.styles/Google/Ordinal.yml @@ -0,0 +1,7 @@ +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 new file mode 100644 index 00000000..b9ba21eb --- /dev/null +++ b/.styles/Google/OxfordComma.yml @@ -0,0 +1,7 @@ +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 new file mode 100644 index 00000000..3b8711d0 --- /dev/null +++ b/.styles/Google/Parens.yml @@ -0,0 +1,7 @@ +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 new file mode 100644 index 00000000..3265890e --- /dev/null +++ b/.styles/Google/Passive.yml @@ -0,0 +1,184 @@ +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 new file mode 100644 index 00000000..d24a6a6c --- /dev/null +++ b/.styles/Google/Periods.yml @@ -0,0 +1,7 @@ +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 new file mode 100644 index 00000000..3cb6f1ab --- /dev/null +++ b/.styles/Google/Quotes.yml @@ -0,0 +1,7 @@ +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 new file mode 100644 index 00000000..3ec045e7 --- /dev/null +++ b/.styles/Google/Ranges.yml @@ -0,0 +1,7 @@ +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 new file mode 100644 index 00000000..bb8b85b4 --- /dev/null +++ b/.styles/Google/Semicolons.yml @@ -0,0 +1,8 @@ +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 new file mode 100644 index 00000000..63f4c248 --- /dev/null +++ b/.styles/Google/Slang.yml @@ -0,0 +1,11 @@ +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 new file mode 100644 index 00000000..27f7ca2b --- /dev/null +++ b/.styles/Google/Spacing.yml @@ -0,0 +1,8 @@ +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 new file mode 100644 index 00000000..57acb884 --- /dev/null +++ b/.styles/Google/Spelling.yml @@ -0,0 +1,8 @@ +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 new file mode 100644 index 00000000..379fad6b --- /dev/null +++ b/.styles/Google/Units.yml @@ -0,0 +1,8 @@ +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/Will.yml b/.styles/Google/Will.yml new file mode 100644 index 00000000..128a9183 --- /dev/null +++ b/.styles/Google/Will.yml @@ -0,0 +1,7 @@ +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 new file mode 100644 index 00000000..bb711517 --- /dev/null +++ b/.styles/Google/WordList.yml @@ -0,0 +1,80 @@ +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 new file mode 100644 index 00000000..a5da2a84 --- /dev/null +++ b/.styles/Google/meta.json @@ -0,0 +1,4 @@ +{ + "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 new file mode 100644 index 00000000..e69de29b diff --git a/.styles/Vocab/Base/accept.txt b/.styles/Vocab/Base/accept.txt new file mode 100644 index 00000000..bc7aba92 --- /dev/null +++ b/.styles/Vocab/Base/accept.txt @@ -0,0 +1,15 @@ +API +SDK +Crashlytics +Rollbar +APIs +boolean +Giphy +DM +UI +[Ss]lidable +discoverability +[Ll]ivestream +monorepo +Melos +uploader \ No newline at end of file diff --git a/.styles/Vocab/Base/reject.txt b/.styles/Vocab/Base/reject.txt new file mode 100644 index 00000000..e69de29b diff --git a/.vale.ini b/.vale.ini new file mode 100644 index 00000000..f295edca --- /dev/null +++ b/.vale.ini @@ -0,0 +1,17 @@ +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 +BlockIgnores = (^import .*;), (import .*;), (\n(.*\n)+
), (\| .* \|) +TokenIgnores = (^import .*;),(import .*;) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 385b6085..279e3bc4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -Welcome to Stream’s Flutter repository! Thank you for taking the time to contribute to our codebase. 🎉. +Welcome to Stream’s Flutter repository. Thank you for taking the time to contribute to our codebase. 🎉. This document outlines a set of guidelines for contributing to Stream and our packages. These are mostly guidelines, not necessarily a fixed set of rules. Please use your best judgment and feel free to propose changes to this document in a pull request. @@ -26,7 +26,7 @@ Stream's Flutter code is kept in a single mono-repository consisting of multiple ### Project Structure 🧱 -`.github` - GitHub files including issue templates, pull request templates, and Github Action scripts. +`.github` - GitHub files including issue templates, pull request templates, and GitHub Action scripts. `images` - Static images used in our README and elsewhere. @@ -56,11 +56,11 @@ Stream's Flutter code is kept in a single mono-repository consisting of multiple ### Local Setup -Congratulations! 🎉. You've successfully cloned our repo, and you are ready to make your first contribution. Before you can start making code changes, there are a few things to configure. +Congratulations. 🎉. You've successfully cloned our repository, and you are ready to make your first contribution. Before you can start making code changes, there are a few things to configure. **Melos Setup** -Stream uses `melos` to manage our mono-repository. For those unfamiliar, Melos is used to split up large code bases into separate independently versioned packages. To install melos, developers can run the following command: +Stream uses `Melos` to manage our mono-repository. For those unfamiliar, Melos is used to split up large code bases into separate independently versioned packages. To install Melos, developers can run the following command: ```bash pub global activate melos @@ -72,7 +72,7 @@ Once activated, users can now "bootstrap" their local clone by running the follo melos bootstrap ``` -Bootstrap will automatically fetch and link dependencies for all packages in the repo. It is the melos equivalent of running `flutter pub get`. +Bootstrap will automatically fetch and link dependencies for all packages in the repository. It is the Melos equivalent of running `flutter pub get`. Bonus Tip: Did you know it is possible to define and run custom scripts using Melos? Our team uses custom scripts for all sorts of actions like testing, lints, and more. @@ -88,7 +88,7 @@ Are you ready to dive into code? It's pretty easy to get up and running with you Before filing bugs, take a look at our existing backlog. For common bugs, there might be an existing ticket on GitHub. -To quickly narrow down the amount of tickets on Github, try filtering based on the label that best suites the bug. +To quickly narrow down the amount of tickets on GitHub, try filtering based on the label that best suites the bug. ![image](https://user-images.githubusercontent.com/20601437/124240983-9d9f6100-db1b-11eb-952f-3c0cc60a910e.png) @@ -98,17 +98,17 @@ Didn't find an existing issue? Go ahead and file a new bug using one of our pre- Be sure to provide as much information as possible when filing bug reports. A good issue should have steps to reproduce and information on your development environment and expected behavior. -Screenshots and gifs are always welcomed :) +Screenshots and GIFs are always welcomed :) ## Feature Request 💡 -Have an idea for a new feature? We would love to hear about it! +Have an idea for a new feature? We would love to hear about it. Our team uses GitHub discussions to triage and discuss feature requests. Before opening a new topic, please check our existing issues and pull requests to ensure the feature you are suggesting is not already in progress. -To file a feature request, select the "Discussions" tab on our GitHub repo or [visit this link](https://github.com/GetStream/stream-chat-flutter/discussions/new). Once there, change the default category to "**💡 Ideas**", then write a brief description of your feature/change. +To file a feature request, select the "Discussions" tab on our GitHub repository or [visit this link](https://github.com/GetStream/stream-chat-flutter/discussions/new). Once there, change the default category to "**💡 Ideas**", then write a brief description of your feature/change. -Screenshots, sketches, and sample code are all welcomed! +Screenshots, sketches, and sample code are all welcomed. ![image](https://user-images.githubusercontent.com/20601437/124241092-bc055c80-db1b-11eb-9205-7e3d7c157af1.png) @@ -134,13 +134,13 @@ Add any other context or screenshots about the feature request here. ![image](https://user-images.githubusercontent.com/20601437/124241146-c7f11e80-db1b-11eb-9588-d9f578ec004a.png) -Thank you for taking the time to submit a patch and contribute to our codebase. You rock! +Thank you for taking the time to submit a patch and contribute to our codebase. You rock. Before we can land your pull request, please don't forget to [sign Stream's CLA (Contributor License Agreement](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform). 📝 ### PR Semantics 🦄 -Our team uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) when coding and creating PRs. This standard makes it easy for our team to review and identify commits in our repo quickly. +Our team uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) when coding and creating PRs. This standard makes it easy for our team to review and identify commits in our repository quickly. While we don't expect developers to follow the specification down to every commit message, we enforce semantics on PR titles. @@ -162,7 +162,7 @@ PR titles should follow the format below: ### Testing -At Stream, we value testing. Every PR should include passing tests for existing and new features. To run our test suite locally, you can use the following *melos* command: +At Stream, we value testing. Every PR should include passing tests for existing and new features. To run our test suite locally, you can use the following *Melos* command: ```bash > melos run test:dart @@ -173,13 +173,13 @@ At Stream, we value testing. Every PR should include passing tests for existing By default, our development branch is `develop`. Contributors should create new PRs based on `develop` when working on new features. -Develop is merged into master after the team performs various automated and QA tests on the branch. Master can be considered our stable branch — it represents the latest published release on pub.dev. +Develop is merged into master after the team performs various automated and QA tests on the branch. Master can be considered our stable branch, it represents the latest published release on pub.dev. --- # Versioning Policy -All of the Stream Chat packages follow [semantic versioning (semver)](https://semver.org/). +All of the Stream Chat packages follow [semantic versioning](https://semver.org/). See our [versioning policy documentation](https://getstream.io/chat/docs/sdk/flutter/basics/versioning_policy/) for more information. diff --git a/README.md b/README.md index 5d78e7bf..051b8a4e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/images/sdk_hero_v4.png) ![CI](https://github.com/GetStream/stream-chat-flutter/workflows/stream_flutter_workflow/badge.svg?branch=master) -[![melos](https://img.shields.io/badge/maintained%20with-melos-f700ff.svg?style=flat-square)](https://github.com/invertase/melos) +[![Melos](https://img.shields.io/badge/maintained%20with-melos-f700ff.svg?style=flat-square)](https://github.com/invertase/melos) **Quick Links** @@ -21,7 +21,7 @@ Stream allows developers to rapidly deploy scalable feeds and chat messaging wit For upgrading from V3 to V4, please refer to the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migration_guide_4_0/) ## Sample apps and demos -Our team maintains a dedicated repository for fully-fledged sample applications and demos. Consider checking out [GetStream/flutter-samples](https://github.com/GetStream/flutter-samples) to learn more or get started by looking at our latest [Stream Chat demo](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1). +Our team maintains a dedicated repository for full fledged sample applications and demos. Consider checking out [GetStream/flutter-samples](https://github.com/GetStream/flutter-samples) to learn more or get started by looking at our latest [Stream Chat demo](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1). ## Free for Makers @@ -40,19 +40,19 @@ melos bootstrap ## Packages We provide a variety of packages depending on the level of customization you want to achieve. -### [stream_chat](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat) +### [`stream_chat`](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat) A pure Dart package that can be used on any Dart project. It provides a low-level client to access the Stream Chat service. -### [stream_chat_persistence](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_persistence) +### [`stream_chat_persistence`](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_persistence) This package provides a persistence client for fetching and saving chat data locally. Stream Chat Persistence uses Moor as a disk cache. -### [stream_chat_flutter_core](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_flutter_core) +### [`stream_chat_flutter_core`](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_flutter_core) This package provides business logic to fetch common things required for integrating Stream Chat into your application. The `core` package allows more customisation and hence provides business logic but no UI components. -### [stream_chat_flutter](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_flutter) +### [`stream_chat_flutter`](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_flutter) This library includes both a low-level chat SDK and a set of reusable and customizable UI components. -### [stream_chat_localizations](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_localizations) +### [`stream_chat_localizations`](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_localizations) This library includes a set of localization files for the Flutter UI components. ## Flutter Chat Tutorial @@ -68,7 +68,7 @@ We also provide a set of sample apps created using the Stream Flutter SDK at [th ## Versioning Policy -All of the Stream Chat packages follow [semantic versioning (semver)](https://semver.org/). +All of the Stream Chat packages follow [semantic versioning](https://semver.org/). See our [versioning policy documentation](https://getstream.io/chat/docs/sdk/flutter/basics/versioning_policy/) for more information. diff --git a/docusaurus/docs/Flutter/01-basics/_category_.json b/docusaurus/docs/Flutter/01-basics/_category_.json new file mode 100644 index 00000000..69a9460d --- /dev/null +++ b/docusaurus/docs/Flutter/01-basics/_category_.json @@ -0,0 +1,3 @@ +{ + "label": "Basics" +} \ No newline at end of file diff --git a/docusaurus/docs/Flutter/basics/choose_package.mdx b/docusaurus/docs/Flutter/01-basics/choose_package.mdx similarity index 78% rename from docusaurus/docs/Flutter/basics/choose_package.mdx rename to docusaurus/docs/Flutter/01-basics/choose_package.mdx index 8be73f01..104b9381 100644 --- a/docusaurus/docs/Flutter/basics/choose_package.mdx +++ b/docusaurus/docs/Flutter/01-basics/choose_package.mdx @@ -1,9 +1,11 @@ --- id: choose_package sidebar_position: 2 -title: Choosing The Right Flutter Package +title: Choosing The Right SDK --- +Choosing The Right Flutter Package + ### Why the SDK is split into different packages Different applications need different levels of customization and integration with the Stream Chat SDK. @@ -14,7 +16,7 @@ which allows you persist data locally which works with all packages. ### How do I choose? -#### The case for stream_chat_flutter +#### The case for `stream_chat_flutter` For the quickest way to integrate Stream Chat with your app, the UI SDK (`stream_chat_flutter`) is the way to go. `stream_chat_flutter` contains prebuilt components that manage most operations like data @@ -30,26 +32,26 @@ to request this through our support channels. Summary: -For the quickest and easiest way to add Chat to your app with prebuilt UI components, use stream_chat_flutter +For the quickest and easiest way to add Chat to your app with prebuilt UI components, use `stream_chat_flutter` -#### The case for stream_chat_flutter_core +#### The case for `stream_chat_flutter_core` -If your application involves UI that does not fit in with the stream_chat_flutter components, stream_chat_flutter_core +If your application involves UI that does not fit in with the `stream_chat_flutter` components, `stream_chat_flutter_core` strips away the UI associated with the components and provides the data fetching and manipulation capabilities while supplying builders for UI. This allows you to implement your own UI and themes completely independently while not worrying about writing functions for data and pagination. Summary: -For implementing your own custom UI while not having to worry about lower level API calls, use stream_chat_flutter_core. +For implementing your own custom UI while not having to worry about lower level API calls, use `stream_chat_flutter_core`. -#### The case for stream_chat +#### The case for `stream_chat` -The stream_chat package is the Low-level Client (LLC) of Stream Chat in Flutter. This package wraps +The `stream_chat` package is the Low-level Client (LLC) of Stream Chat in Flutter. This package wraps the underlying functionality of Stream Chat and allows the most customization in terms of UI, data, and architecture. Summary: -For the most control over the SDK and dealing with low level calls to the API, use stream_chat. +For the most control over the SDK and dealing with low level calls to the API, use `stream_chat`. diff --git a/docusaurus/docs/Flutter/basics/introduction.mdx b/docusaurus/docs/Flutter/01-basics/introduction.mdx similarity index 78% rename from docusaurus/docs/Flutter/basics/introduction.mdx rename to docusaurus/docs/Flutter/01-basics/introduction.mdx index 99170774..02487dab 100644 --- a/docusaurus/docs/Flutter/basics/introduction.mdx +++ b/docusaurus/docs/Flutter/01-basics/introduction.mdx @@ -2,9 +2,9 @@ slug: / id: introduction sidebar_position: 1 -title: About The Flutter SDK +title: Overview --- -Exploring The Basics Of Stream Chat +About The Flutter SDK ![](../assets/sdk_title.png) @@ -20,18 +20,18 @@ giving you complete control to ones that give you a rich out-of-the-box chat exp The packages that make up the Stream Chat SDK are: -1. Low Level Client (stream_chat): a pure Dart package that can be used on any Dart project. +1. Low Level Client (`stream_chat`): a pure Dart package that can be used on any Dart project. It provides a low-level client to access the Stream Chat service. -2. Core (stream_chat_flutter_core): provides business logic to fetch common things required +2. Core (`stream_chat_flutter_core`): provides business logic to fetch common things required for integrating Stream Chat into your application. The core package allows more customisation and hence provides business logic but no UI components. -3. UI (stream_chat_flutter): this library includes both a low-level chat SDK and a set of -reusable and customisable UI components. -4. Persistence (stream_chat_persistence): provides a persistence client for fetching and +3. UI (`stream_chat_flutter`): this library includes both a low-level chat SDK and a set of +reusable and customizable UI components. +4. Persistence (`stream_chat_persistence`): provides a persistence client for fetching and saving chat data locally. -5. Localizations (stream_chat_localizations): provides a set of localizations for the SDK. +5. Localizations (`stream_chat_localizations`): provides a set of localizations for the SDK. -We recommend building prototypes using the full UI package, [stream_chat_flutter](https://pub.dev/packages/stream_chat_flutter), +We recommend building prototypes using the full UI package, [`stream_chat_flutter`](https://pub.dev/packages/stream_chat_flutter), since it contains UI widgets already integrated with Stream's API. It is the fastest way to get up and running using Stream chat in your app. @@ -39,7 +39,7 @@ The Flutter SDK enables you to build any type of chat or messaging experience fo and Desktop. If you're building a very custom UI and would prefer a more lean package, -[stream_chat_flutter_core](https://pub.dev/packages/stream_chat_flutter_core) will be suited to this +[`stream_chat_flutter_core`](https://pub.dev/packages/stream_chat_flutter_core) will be suited to this use case. Core allows you to build custom, expressive UIs while retaining the benefits of our full Flutter SDK. APIs for accessing and controlling users, sending messages, and so forth are seamlessly integrated into this package and accessible via providers and builders. @@ -69,7 +69,7 @@ While this is a simplistic overview of the service, the Flutter SDK handles the Before reading the docs, consider trying our [online API tour](https://getstream.io/chat/get_started/), it is a nice way to learn how the API works. -It's in-browser so you'll need to use Javascript but the core conceps are pretty much the same as Dart. +It's in-browser so you'll need to use JavaScript but the core concepts are pretty much the same as Dart. You may also like to look at the [Flutter tutorial](https://getstream.io/chat/flutter/tutorial/) which focuses on using the UI package to get Stream Chat integrated into a Flutter app. diff --git a/docusaurus/docs/Flutter/basics/versioning_policy.mdx b/docusaurus/docs/Flutter/01-basics/versioning_policy.mdx similarity index 92% rename from docusaurus/docs/Flutter/basics/versioning_policy.mdx rename to docusaurus/docs/Flutter/01-basics/versioning_policy.mdx index 48f25d66..99ec8111 100644 --- a/docusaurus/docs/Flutter/basics/versioning_policy.mdx +++ b/docusaurus/docs/Flutter/01-basics/versioning_policy.mdx @@ -4,7 +4,7 @@ sidebar_position: 3 title: Versioning Policy --- -All of the Stream Chat packages follow [semantic versioning (semver)](https://semver.org/). +All of the Stream Chat packages follow [semantic versioning](https://semver.org/). That means that with a version number x.y.z (major.minor.patch): - When releasing bug fixes (backwards compatible), we make a patch release by changing the z number (ex: 3.6.2 to 3.6.3). A bug fix is defined as an internal change that fixes incorrect behavior. diff --git a/docusaurus/docs/Flutter/guides/customize_message_widget.mdx b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/01-customize_message_widget.mdx similarity index 94% rename from docusaurus/docs/Flutter/guides/customize_message_widget.mdx rename to docusaurus/docs/Flutter/02-customization/01-custom-widgets/01-customize_message_widget.mdx index c4878188..93611740 100644 --- a/docusaurus/docs/Flutter/guides/customize_message_widget.mdx +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/01-customize_message_widget.mdx @@ -1,10 +1,9 @@ --- id: customize_message_widget -sidebar_position: 11 -title: Customizing The StreamMessageWidget +title: Message --- -Customizing Text Messages +Customizing Text Messages with the StreamMessageWidget ### Introduction @@ -63,7 +62,7 @@ StreamChatThemeData( ) ``` -![](../assets/message_theming.png) +![](../../assets/message_theming.png) #### Change message text style @@ -79,7 +78,7 @@ StreamMessageThemeData( ) ``` -![](../assets/message_styles.png) +![](../../assets/message_styles.png) #### Change avatar theme @@ -93,7 +92,7 @@ StreamMessageThemeData( ) ``` -![](../assets/message_rounded_avatar.png) +![](../../assets/message_rounded_avatar.png) #### Changing Reaction theme @@ -107,7 +106,7 @@ StreamMessageThemeData( ), ``` -![](../assets/message_reaction_theming.png) +![](../../assets/message_reaction_theming.png) ### Changing Message Actions @@ -133,7 +132,7 @@ StreamMessageWidget( ), ``` -![](../assets/message_widget_actions.png) +![](../../assets/message_widget_actions.png) ### Building attachments diff --git a/docusaurus/docs/Flutter/guides/customize_text_messages.mdx b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/02-customize_text_messages.mdx similarity index 98% rename from docusaurus/docs/Flutter/guides/customize_text_messages.mdx rename to docusaurus/docs/Flutter/02-customization/01-custom-widgets/02-customize_text_messages.mdx index 57b3301d..429fc5e2 100644 --- a/docusaurus/docs/Flutter/guides/customize_text_messages.mdx +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/02-customize_text_messages.mdx @@ -1,7 +1,6 @@ --- id: customize_text_messages -sidebar_position: 6 -title: Customize Text Messages +title: Message List View --- Customizing Text Messages @@ -155,4 +154,4 @@ We can replace the hashtags using RegEx and add links for the MarkdownBody which `_replaceHashtags()` function. Inside the textBuilder, we use the `flutter_markdown` package to build our hashtags as links. -![](../assets/hashtag_example.jpg) +![](../../assets/hashtag_example.jpg) diff --git a/docusaurus/docs/Flutter/guides/customize_message_actions.mdx b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/03-customize_message_actions.mdx similarity index 94% rename from docusaurus/docs/Flutter/guides/customize_message_actions.mdx rename to docusaurus/docs/Flutter/02-customization/01-custom-widgets/03-customize_message_actions.mdx index 12cc7715..966a996d 100644 --- a/docusaurus/docs/Flutter/guides/customize_message_actions.mdx +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/03-customize_message_actions.mdx @@ -1,7 +1,6 @@ --- id: customize_message_actions -sidebar_position: 8 -title: Customize Message Actions +title: Message Actions --- Customizing Message Actions @@ -10,7 +9,7 @@ Customizing Message Actions Message actions pop up in message overlay, when you long-press a message. -![](../assets/message_actions.jpg) +![](../../assets/message_actions.jpg) We have provided granular control over these actions. @@ -37,7 +36,7 @@ Additionally, pinning a message requires you to add the roles which are allowed ### Partially remove some message actions -For example, if you only want to keep "copy message" and "delete message", +For example, if you only want to keep "copy message" and "delete message": here is how to do it using the `messageBuilder` with our `StreamMessageWidget`. ```dart diff --git a/docusaurus/docs/Flutter/guides/adding_custom_attachments.mdx b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/04-adding_custom_attachments.mdx similarity index 93% rename from docusaurus/docs/Flutter/guides/adding_custom_attachments.mdx rename to docusaurus/docs/Flutter/02-customization/01-custom-widgets/04-adding_custom_attachments.mdx index 559464f7..03f9f129 100644 --- a/docusaurus/docs/Flutter/guides/adding_custom_attachments.mdx +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/04-adding_custom_attachments.mdx @@ -1,7 +1,6 @@ --- id: adding_custom_attachments -sidebar_position: 3 -title: Adding Custom Attachments +title: Attachments --- Adding Your Own Types Of Attachments To A Message @@ -25,9 +24,9 @@ To do this, let's check out an example to add location sharing to Stream Chat. Let's build an example of location sharing option in the app: -![](../assets/location_sharing_example.jpg) +![](../../assets/location_sharing_example.jpg) -* Show a "Share Location" button next to StreamMessageInput Textfield. +* Show a "Share Location" button next to StreamMessageInput `Textfield`. * When the user presses this button, it should fetch the current location coordinates of the user, and send a message on the channel as follows: @@ -47,7 +46,7 @@ Message( ) ``` -For our example, we are going to use [geolocator](https://pub.dev/packages/geolocator) library. +For our example, we are going to use [`geolocator`](https://pub.dev/packages/geolocator) library. Please check their [setup instructions](https://pub.dev/packages/geolocator) on their docs. NOTE: If you are testing on iOS simulator, you will need to set some dummy coordinates, as mentioned [here](https://stackoverflow.com/a/31238119/7489541). @@ -55,7 +54,7 @@ Also don't forget to enable "location update" capability in background mode, fro On the receiver end, `location` type attachment should be rendered in map view, in the `StreamMessageListView`. We are going to use [Google Static Maps API](https://developers.google.com/maps/documentation/maps-static/overview) to render the map in the message. -You can use other libraries as well such as [google_maps_flutter](https://pub.dev/packages/google_maps_flutter). +You can use other libraries as well such as [`google_maps_flutter`](https://pub.dev/packages/google_maps_flutter). First, we add a button which when clicked fetches and shares location into the `MessageInput`: @@ -174,7 +173,7 @@ StreamMessageListView( This gives us the final location attachment: -![](../assets/location_sharing_example_message.jpg) +![](../../assets/location_sharing_example_message.jpg) Additionally, you can also add a thumbnail if a message has a location attachment (unlike in this case, where we sent the message directly). @@ -264,4 +263,4 @@ StreamMessageInput( And we can see the thumbnails in the StreamMessageInput: -![](../assets/location_sharing_example_message_thumbnail.jpg) +![](../../assets/location_sharing_example_message_thumbnail.jpg) diff --git a/docusaurus/docs/Flutter/guides/customize_attachment_picker_modal.mdx b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/05-customize_attachment_picker_modal.mdx similarity index 97% rename from docusaurus/docs/Flutter/guides/customize_attachment_picker_modal.mdx rename to docusaurus/docs/Flutter/02-customization/01-custom-widgets/05-customize_attachment_picker_modal.mdx index 194e785b..77f727c9 100644 --- a/docusaurus/docs/Flutter/guides/customize_attachment_picker_modal.mdx +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/05-customize_attachment_picker_modal.mdx @@ -1,6 +1,6 @@ --- id: customize_attachment_picker_modal -title: Customizing the Attachment Picker Modal +title: Attachment Picker Modal --- Customizing the Attachment Picker Modal @@ -8,7 +8,7 @@ Customizing the Attachment Picker Modal ### Introduction The Attachment Picker is a modal that allows users to select attachments from their device. -It is generally used when a user taps the attachment button in the [StreamMessageInput](../stream_chat_flutter/message_input.mdx). +It is generally used when a user taps the attachment button in the [StreamMessageInput](../../03-stream_chat_flutter/stream_message_input.mdx). By default, the Attachment Picker provides multiple picker options as per the platform. - For example, on Mobile, the default options are Camera, Gallery, File, and Video. diff --git a/docusaurus/docs/Flutter/guides/autocomplete_triggers.mdx b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/06-autocomplete_triggers.mdx similarity index 91% rename from docusaurus/docs/Flutter/guides/autocomplete_triggers.mdx rename to docusaurus/docs/Flutter/02-customization/01-custom-widgets/06-autocomplete_triggers.mdx index 413d147a..ac38087b 100644 --- a/docusaurus/docs/Flutter/guides/autocomplete_triggers.mdx +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/06-autocomplete_triggers.mdx @@ -1,13 +1,13 @@ --- id: autocomplete_triggers -title: Adding Custom Autocomplete Triggers +title: Autocomplete Triggers --- Adding Custom Autocomplete Triggers ### Introduction -The [StreamMessageInput](../stream_chat_flutter/message_input.mdx) widget provides a way to add custom autocomplete triggers using the `StreamMessageInput.customAutocompleteTriggers` property. +The [StreamMessageInput](../../03-stream_chat_flutter/stream_message_input.mdx) widget provides a way to add custom autocomplete triggers using the `StreamMessageInput.customAutocompleteTriggers` property. By default we provide autocomplete triggers for mentions and commands, but it's very easy to add your custom ones. @@ -19,7 +19,7 @@ This widget will be used to show the autocomplete options. For this example we're using two external dependencies: - [emojis](https://pub.dev/packages/emojis) -- [substring_highlight](https://pub.dev/packages/substring_highlight) +- [`substring_highlight`](https://pub.dev/packages/substring_highlight) ```dart import 'package:emojis/emoji.dart'; diff --git a/docusaurus/docs/Flutter/guides/slidable_channel_list_preview.mdx b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/07-slidable_channel_list_preview.mdx similarity index 92% rename from docusaurus/docs/Flutter/guides/slidable_channel_list_preview.mdx rename to docusaurus/docs/Flutter/02-customization/01-custom-widgets/07-slidable_channel_list_preview.mdx index 5a060fd7..30ba952f 100644 --- a/docusaurus/docs/Flutter/guides/slidable_channel_list_preview.mdx +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/07-slidable_channel_list_preview.mdx @@ -1,7 +1,6 @@ --- id: slidable_channel_list_preview -sidebar_position: 14 -title: Slidable Channel List Preview +title: Channel List Preview --- Slidable Channel List Preview @@ -11,9 +10,9 @@ Slidable Channel List Preview The default slidable behavior within the channel list has been removed in v4 of the Stream Chat Flutter SDK. This guide will show you how you can easily add this functionality yourself. -Please see our [full v4 migration guide](migration_guide_4_0.mdx) if you're migrating from an earlier version of the Stream Chat Flutter SDK. +Please see our [full v4 migration guide](../../05-guides/08-migrations/migration_guide_4_0.mdx) if you're migrating from an earlier version of the Stream Chat Flutter SDK. -![Slidable demo](../assets/slidable_demo.jpg) +![Slidable demo](../../assets/slidable_demo.jpg) ### Prerequisites @@ -39,7 +38,7 @@ In this example, you are doing a few important things in the ChannelListPage wid - Using the **flutter_slidable** package to easily add slide functionality. - Passing in the `itemBuilder` argument for the **StreamChannelListView** widget. This gives access to the current **BuildContext**, **Channel**, and **StreamChannelListTile**, and allows you to create, or customize, the stream channel list tiles. - Returning a Slidable widget with two CustomSlidableAction widgets - to delete a channel and show more options. These widgets come from the flutter_slidable package. -- Adding `onPressed` behaviour to call `showConfirmationBottomSheet` and `showChannelInfoModalBottomSheet`. These methods come from the **stream_chat_flutter** package. They have a few different on-tap callbacks you can supply, for example, `onViewInfoTap`. Alternatively, you can create custom dialogs from scratch. +- Adding `onPressed` behaviour to call `showConfirmationBottomSheet` and `showChannelInfoModalBottomSheet`. These methods come from the **`stream_chat_flutter`** package. They have a few different on-tap callbacks you can supply, for example, `onViewInfoTap`. Alternatively, you can create custom dialog screens from scratch. - Using the **StreamChannelListController** to perform actions, such as, `deleteChannel`. ```dart @@ -105,7 +104,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - sort: const [SortOption('last_message_at')], + channelStateSort: const [SortOption('last_message_at')], ); @override diff --git a/docusaurus/docs/Flutter/02-customization/01-custom-widgets/_category_.json b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/_category_.json new file mode 100644 index 00000000..7dfd26e6 --- /dev/null +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/_category_.json @@ -0,0 +1,3 @@ +{ + "label": "Custom Widgets" +} \ No newline at end of file diff --git a/docusaurus/docs/Flutter/02-customization/_category_.json b/docusaurus/docs/Flutter/02-customization/_category_.json new file mode 100644 index 00000000..b0b9ad39 --- /dev/null +++ b/docusaurus/docs/Flutter/02-customization/_category_.json @@ -0,0 +1,3 @@ +{ + "label": "Customization" +} \ No newline at end of file diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_chat_and_theming.mdx b/docusaurus/docs/Flutter/02-customization/stream_chat_and_theming.mdx similarity index 98% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_chat_and_theming.mdx rename to docusaurus/docs/Flutter/02-customization/stream_chat_and_theming.mdx index d527b738..ff38e1c4 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/stream_chat_and_theming.mdx +++ b/docusaurus/docs/Flutter/02-customization/stream_chat_and_theming.mdx @@ -1,7 +1,7 @@ --- id: stream_chat_and_theming -sidebar_position: 3 -title: StreamChat And Theming +sidebar_position: 1 +title: Theming --- Understanding How To Customize Widgets Using `StreamChatTheme` diff --git a/docusaurus/docs/Flutter/03-stream_chat_flutter/_category_.json b/docusaurus/docs/Flutter/03-stream_chat_flutter/_category_.json new file mode 100644 index 00000000..b323499b --- /dev/null +++ b/docusaurus/docs/Flutter/03-stream_chat_flutter/_category_.json @@ -0,0 +1,3 @@ +{ + "label": "UI Widgets" +} \ No newline at end of file diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/introduction.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/introduction.mdx similarity index 100% rename from docusaurus/docs/Flutter/stream_chat_flutter/introduction.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/introduction.mdx diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/setup.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/setup.mdx similarity index 75% rename from docusaurus/docs/Flutter/stream_chat_flutter/setup.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/setup.mdx index dc20a604..e07e1547 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/setup.mdx +++ b/docusaurus/docs/Flutter/03-stream_chat_flutter/setup.mdx @@ -39,16 +39,16 @@ This section provides setup instructions for the respective platforms. #### Android -The package uses [photo_manager](https://pub.dev/packages/photo_manager) to access the device's photo library. Follow [this wiki](https://pub.dev/packages/photo_manager#android-10-q-29) to fulfill the Android requirements. +The package uses [`photo_manager`](https://pub.dev/packages/photo_manager) to access the device's photo library. Follow [this wiki](https://pub.dev/packages/photo_manager#android-10-q-29) to fulfill the Android requirements. #### iOS The library uses [flutter file picker plugin](https://github.com/miguelpruivo/flutter_file_picker) to pick files from the os. Follow [this wiki](https://github.com/miguelpruivo/flutter_file_picker/wiki/Setup#ios) to fulfill iOS requirements. -Stream Chat also uses the [video_player](https://pub.dev/packages/video_player) package to play videos. Follow [this guide](https://pub.dev/packages/video_player#installation) to fulfill the requirements. +Stream Chat also uses the [`video_player`](https://pub.dev/packages/video_player) package to play videos. Follow [this guide](https://pub.dev/packages/video_player#installation) to fulfill the requirements. -Stream Chat uses the [image_picker](https://pub.dev/packages/image_picker) plugin. +Stream Chat uses the [`image_picker`](https://pub.dev/packages/image_picker) plugin. Follow [these instructions](https://pub.dev/packages/image_picker#ios) to check the requirements. #### Web @@ -61,7 +61,7 @@ For the web, edit your `index.html` and add the following in the `` tag to #### macOS -For macOS Stream Chat uses the [file_selector](https://pub.dev/packages/file_selector#macos) package. Follow [these instructions](https://pub.dev/packages/file_selector#macos) to check the requirements. +For macOS Stream Chat uses the [`file_selector`](https://pub.dev/packages/file_selector#macos) package. Follow [these instructions](https://pub.dev/packages/file_selector#macos) to check the requirements. You also need to add the following [entitlements](https://docs.flutter.dev/development/platform-integration/desktop#entitlements-and-the-app-sandbox) to `Release.entitlement` and `DebugProfile.entitlement`: diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_channel_grid_view.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_grid_view.mdx similarity index 97% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_channel_grid_view.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_grid_view.mdx index 16bad7dc..0fcde5c1 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/stream_channel_grid_view.mdx +++ b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_grid_view.mdx @@ -40,7 +40,7 @@ class _ChannelGridPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - sort: const [SortOption('last_message_at')], + channelStateSort: const [SortOption('last_message_at')], ); @override diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_channel_header.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_header.mdx similarity index 100% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_channel_header.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_header.mdx diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_channel_list_header.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_header.mdx similarity index 94% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_channel_list_header.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_header.mdx index 4c8fbc63..54379bdd 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/stream_channel_list_header.mdx +++ b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_header.mdx @@ -44,7 +44,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - sort: const [SortOption('last_message_at')], + channelStateSort: const [SortOption('last_message_at')], ); @override @@ -90,7 +90,7 @@ StreamChannelListHeader( ![](../assets/channel_list_header_custom_subtitle.png) -The `titleBuilder` param helps you build different titles depending on the connection state: +The `titleBuilder` parameter helps you build different titles depending on the connection state: ```dart //... diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_channel_list_view.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_view.mdx similarity index 91% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_channel_list_view.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_view.mdx index dbb3f266..33376fcf 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/stream_channel_list_view.mdx +++ b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_view.mdx @@ -23,7 +23,7 @@ ONLY the channels that the user is a part of. This section goes into setting up widget. :::note -Make sure to check the [StreamChannelListController](./stream_channel_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamChannelListView`. +Make sure to check the [StreamChannelListController](../04-stream_chat_flutter_core/stream_channel_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamChannelListView`. ::: ### Basic Example @@ -50,7 +50,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - sort: const [SortOption('last_message_at')], + channelStateSort: const [SortOption('last_message_at')], ); @override diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_member_grid_view.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_member_grid_view.mdx similarity index 100% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_member_grid_view.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_member_grid_view.mdx diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_member_list_view.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_member_list_view.mdx similarity index 90% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_member_list_view.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_member_list_view.mdx index 06bfd341..26285876 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/stream_member_list_view.mdx +++ b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_member_list_view.mdx @@ -13,7 +13,7 @@ Find the pub.dev documentation [here](https://pub.dev/documentation/stream_chat_ A list of members is required for many different purposes, for example, showing a list of users in a Channel. The `StreamMemberListView` displays a list of members. :::note -Make sure to check the [StreamMemberListController](./stream_member_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamMemberListView`. +Make sure to check the [StreamMemberListController](../04-stream_chat_flutter_core/stream_member_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamMemberListView`. ::: ### Basic Example diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_message_input.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_message_input.mdx similarity index 93% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_message_input.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_message_input.mdx index b60696ae..8778f3a4 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/stream_message_input.mdx +++ b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_message_input.mdx @@ -57,7 +57,7 @@ class ChannelPage extends StatelessWidget { It is common to put this widget in the same page of a `StreamMessageListView` as the bottom widget. :::note -Make sure to check the [StreamMessageInputController](./stream_message_input_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamMessageInput`. +Make sure to check the [StreamMessageInputController](../04-stream_chat_flutter_core/stream_message_input_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamMessageInput`. ::: ### Adding Custom Actions diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_message_list_view.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_message_list_view.mdx similarity index 100% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_message_list_view.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_message_list_view.mdx diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_message_search_grid_view.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_message_search_grid_view.mdx similarity index 100% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_message_search_grid_view.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_message_search_grid_view.mdx diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_message_search_list_view.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_message_search_list_view.mdx similarity index 88% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_message_search_list_view.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_message_search_list_view.mdx index cf27facf..ca4fd11e 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/stream_message_search_list_view.mdx +++ b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_message_search_list_view.mdx @@ -17,7 +17,7 @@ message they are searching for. As such, there needs to be a way to search for a channels. This is where `StreamMessageSearchListView` comes in. :::note -Make sure to check the [StreamMessageSearchListController](./stream_message_search_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamMessageSearchListView`. +Make sure to check the [StreamMessageSearchListController](../04-stream_chat_flutter_core/stream_message_search_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamMessageSearchListView`. ::: ### Basic Example diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_message_widget.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_message_widget.mdx similarity index 100% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_message_widget.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_message_widget.mdx diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_user_grid_view.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_user_grid_view.mdx similarity index 100% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_user_grid_view.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_user_grid_view.mdx diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/stream_user_list_view.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_user_list_view.mdx similarity index 90% rename from docusaurus/docs/Flutter/stream_chat_flutter/stream_user_list_view.mdx rename to docusaurus/docs/Flutter/03-stream_chat_flutter/stream_user_list_view.mdx index 95bfbac9..f8fcbf2b 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/stream_user_list_view.mdx +++ b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_user_list_view.mdx @@ -17,7 +17,7 @@ selecting users to add in a channel, etc. The `StreamUserListView` displays a li of users. :::note -Make sure to check the [StreamUserListController](./stream_user_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamUserListView`. +Make sure to check the [StreamUserListController](../04-stream_chat_flutter_core/stream_user_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamUserListView`. ::: ### Basic Example diff --git a/docusaurus/docs/Flutter/04-stream_chat_flutter_core/_category_.json b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/_category_.json new file mode 100644 index 00000000..9737db75 --- /dev/null +++ b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/_category_.json @@ -0,0 +1,3 @@ +{ + "label": "Core Widgets" +} \ No newline at end of file diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/introduction.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/introduction.mdx similarity index 100% rename from docusaurus/docs/Flutter/stream_chat_flutter_core/introduction.mdx rename to docusaurus/docs/Flutter/04-stream_chat_flutter_core/introduction.mdx diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/lazy_load_scroll_view.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/lazy_load_scroll_view.mdx similarity index 100% rename from docusaurus/docs/Flutter/stream_chat_flutter_core/lazy_load_scroll_view.mdx rename to docusaurus/docs/Flutter/04-stream_chat_flutter_core/lazy_load_scroll_view.mdx diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/message_list_core.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/message_list_core.mdx similarity index 95% rename from docusaurus/docs/Flutter/stream_chat_flutter_core/message_list_core.mdx rename to docusaurus/docs/Flutter/04-stream_chat_flutter_core/message_list_core.mdx index 57f06b2a..2a20db92 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter_core/message_list_core.mdx +++ b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/message_list_core.mdx @@ -15,7 +15,7 @@ according to the filters and sort order given. However, in some cases, implement that cannot be done using the customization approaches given in the widget. To do this, we extracted the logic required for fetching channels into a 'Core' widget - a widget that -fetches channels in the expected way via the usual params but does not supply any UI and instead +fetches channels in the expected way via the usual parameters but does not supply any UI and instead exposes builders to build the UI in situations such as loading, empty data, errors, and on data received. ### Basic Example diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/paged_value_listenable_builder.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/paged_value_listenable_builder.mdx similarity index 100% rename from docusaurus/docs/Flutter/stream_chat_flutter_core/paged_value_listenable_builder.mdx rename to docusaurus/docs/Flutter/04-stream_chat_flutter_core/paged_value_listenable_builder.mdx diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/setup.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/setup.mdx similarity index 100% rename from docusaurus/docs/Flutter/stream_chat_flutter_core/setup.mdx rename to docusaurus/docs/Flutter/04-stream_chat_flutter_core/setup.mdx diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_channel_list_controller.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_channel_list_controller.mdx similarity index 96% rename from docusaurus/docs/Flutter/stream_chat_flutter_core/stream_channel_list_controller.mdx rename to docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_channel_list_controller.mdx index c37eeedd..6775ec02 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_channel_list_controller.mdx +++ b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_channel_list_controller.mdx @@ -12,7 +12,7 @@ Find the pub.dev documentation [here](https://pub.dev/documentation/stream_chat_ The `StreamChannelListController` is a controller class that allows you to control a list of channels. `StreamChannelListController` is a required parameter of the `StreamChannelListView` widget. -Check the [`StreamChannelListView` documentation](../stream_chat_flutter/stream_channel_list_view.mdx) to read more about that. +Check the [`StreamChannelListView` documentation](../03-stream_chat_flutter/stream_channel_list_view.mdx) to read more about that. The `StreamChannelListController` also listens for various events and manipulates the current list of channels accordingly. Passing a `StreamChannelListEventHandler` to the `StreamChannelListController` will allow you to customize this behaviour. @@ -58,7 +58,7 @@ void dispose() { } ``` -The `StreamChannelListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of channels has changed. +The `StreamChannelListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of channels has changed. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest channels. ```dart diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_channel_list_event_handler.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_channel_list_event_handler.mdx similarity index 100% rename from docusaurus/docs/Flutter/stream_chat_flutter_core/stream_channel_list_event_handler.mdx rename to docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_channel_list_event_handler.mdx diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_chat_core.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_chat_core.mdx similarity index 84% rename from docusaurus/docs/Flutter/stream_chat_flutter_core/stream_chat_core.mdx rename to docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_chat_core.mdx index e3434e7f..11743abf 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_chat_core.mdx +++ b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_chat_core.mdx @@ -11,7 +11,7 @@ Find the pub.dev documentation [here](https://pub.dev/documentation/stream_chat_ `StreamChatCore` is used to provide information about the chat client to the widget tree. This Widget is used to react to life cycle changes and system updates. -When the app goes into the background, the websocket connection is automatically closed and when it goes back to foreground the connection is opened again. +When the app goes into the background, the web socket connection is automatically closed and when it goes back to foreground the connection is opened again. Like the `StreamChat` widget in the higher level UI package, the `StreamChatCore` widget should be on the top level before using any Stream functionality: diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_member_list_controller.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_member_list_controller.mdx similarity index 94% rename from docusaurus/docs/Flutter/stream_chat_flutter_core/stream_member_list_controller.mdx rename to docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_member_list_controller.mdx index c58c6a88..a811d77e 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_member_list_controller.mdx +++ b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_member_list_controller.mdx @@ -12,7 +12,7 @@ Find the pub.dev documentation [here](https://pub.dev/documentation/stream_chat_ The `StreamMemberListController` is a controller class that allows you to control a list of users. `StreamMemberListController` is a required parameter of the `StreamMemberListView` widget. -Check the [`StreamMemberListView` documentation](../stream_chat_flutter/stream_member_list_view.mdx) to read more about that. +Check the [`StreamMemberListView` documentation](../03-stream_chat_flutter/stream_member_list_view.mdx) to read more about that. ### Basic Example @@ -46,7 +46,7 @@ void dispose() { } ``` -The `StreamMemberListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of members has changed. +The `StreamMemberListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of members has changed. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest members. ```dart diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_message_input_controller.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_message_input_controller.mdx similarity index 95% rename from docusaurus/docs/Flutter/stream_chat_flutter_core/stream_message_input_controller.mdx rename to docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_message_input_controller.mdx index 7139d15e..9520f13c 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_message_input_controller.mdx +++ b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_message_input_controller.mdx @@ -12,7 +12,7 @@ Find the pub.dev documentation [here](https://pub.dev/documentation/stream_chat_ The `StreamMessageInputController` is a controller class that embed the business logic to compose a message. `StreamMessageInputController` is a parameter of the `StreamMessageInput` widget. -Check the [`StreamMessageInput` documentation](../stream_chat_flutter/stream_message_input.mdx) to read more about that. +Check the [`StreamMessageInput` documentation](../03-stream_chat_flutter/stream_message_input.mdx) to read more about that. ### Basic Example diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_message_search_list_controller.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_message_search_list_controller.mdx similarity index 95% rename from docusaurus/docs/Flutter/stream_chat_flutter_core/stream_message_search_list_controller.mdx rename to docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_message_search_list_controller.mdx index f4546331..00b9e7e9 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_message_search_list_controller.mdx +++ b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_message_search_list_controller.mdx @@ -12,7 +12,7 @@ Find the pub.dev documentation [here](https://pub.dev/documentation/stream_chat_ The `StreamMessageSearchListController` is a controller class that allows you to control a list of searched messages. `StreamMessageSearchListController` is a required parameter of the `StreamMessageSearchListView` widget. -Check the [`StreamMessageSearchListView` documentation](../stream_chat_flutter/stream_message_search_list_view.mdx) to read more about that. +Check the [`StreamMessageSearchListView` documentation](../03-stream_chat_flutter/stream_message_search_list_view.mdx) to read more about that. ### Basic Example @@ -46,7 +46,7 @@ void dispose() { } ``` -The `StreamMessageSearchListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of responses has changed. +The `StreamMessageSearchListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of responses has changed. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest responses. ```dart diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_user_list_controller.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_user_list_controller.mdx similarity index 94% rename from docusaurus/docs/Flutter/stream_chat_flutter_core/stream_user_list_controller.mdx rename to docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_user_list_controller.mdx index 93a8bcd3..84705d49 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter_core/stream_user_list_controller.mdx +++ b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_user_list_controller.mdx @@ -12,7 +12,7 @@ Find the pub.dev documentation [here](https://pub.dev/documentation/stream_chat_ The `StreamUserListController` is a controller class that allows you to control a list of users. `StreamUserListController` is a required parameter of the `StreamUserListView` widget. -Check the [`StreamUserListView` documentation](../stream_chat_flutter/stream_user_list_view.mdx) to read more about that. +Check the [`StreamUserListView` documentation](../03-stream_chat_flutter/stream_user_list_view.mdx) to read more about that. ### Basic Example @@ -46,7 +46,7 @@ void dispose() { } ``` -The `StreamUserListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of users has changed. +The `StreamUserListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of users has changed. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest users. ```dart diff --git a/docusaurus/docs/Flutter/guides/understanding_filters.mdx b/docusaurus/docs/Flutter/05-guides/01-understanding_filters.mdx similarity index 91% rename from docusaurus/docs/Flutter/guides/understanding_filters.mdx rename to docusaurus/docs/Flutter/05-guides/01-understanding_filters.mdx index 292afd07..152a8a8f 100644 --- a/docusaurus/docs/Flutter/guides/understanding_filters.mdx +++ b/docusaurus/docs/Flutter/05-guides/01-understanding_filters.mdx @@ -1,7 +1,6 @@ --- id: understanding_filters -sidebar_position: 10 -title: Understanding Filters +title: Filters --- Understanding Filters @@ -24,7 +23,7 @@ Filter.equal('type', 'messaging'), #### Filter.notEqual -The 'notEqual' filter gets the objects where the given key does not have the specified value. +The `notEqual` filter gets the objects where the given key does not have the specified value. ```dart Filter.notEqual('type', 'messaging'), @@ -64,20 +63,20 @@ Filter.lessOrEqual('count', 5), #### Filter.in_ -The 'in_' filter allows getting objects where the key matches any in a specified array. +The `in_` filter allows getting objects where the key matches any in a specified array. ```dart Filter.in_('members', [user.id]) ``` :::note -Since 'in' is a keyword in Dart, the filter has an underscore added. This does not apply to the 'notIn' +Since 'in' is a keyword in Dart, the filter has an underscore added. This does not apply to the `notIn` keyword. ::: #### Filter.notIn -The 'notIn' filter allows getting objects where the key matches none in a specified array. +The `notIn` filter allows getting objects where the key matches none in a specified array. ```dart Filter.notIn('members', [user.id]) @@ -109,7 +108,7 @@ Filter.exists('name') #### Filter.notExists -The 'notExists' filter checks if the specified key doesn't exist. This is a simplified call to `Filter.exists` +The `notExists` filter checks if the specified key doesn't exist. This is a simplified call to `Filter.exists` with the value set to false. ```dart diff --git a/docusaurus/docs/Flutter/guides/adding_local_data_persistence.mdx b/docusaurus/docs/Flutter/05-guides/02-adding_local_data_persistence.mdx similarity index 91% rename from docusaurus/docs/Flutter/guides/adding_local_data_persistence.mdx rename to docusaurus/docs/Flutter/05-guides/02-adding_local_data_persistence.mdx index e6283ca0..3943b1f9 100644 --- a/docusaurus/docs/Flutter/guides/adding_local_data_persistence.mdx +++ b/docusaurus/docs/Flutter/05-guides/02-adding_local_data_persistence.mdx @@ -1,10 +1,9 @@ --- id: adding_local_data_persistence -sidebar_position: 9 -title: Adding Local Data Persistence +title: Offline Support --- -Adding Local Data Persistence +Adding Local Data Persistence for Offline Support ### Introduction @@ -28,7 +27,7 @@ final client = StreamChatClient( )..chatPersistenceClient = CustomChatPersistentClient(); ``` -We provide an official persistent client in the [stream_chat_persistence](https://pub.dev/packages/stream_chat_persistence) +We provide an official persistent client in the [`stream_chat_persistence`](https://pub.dev/packages/stream_chat_persistence) package that works using the library [moor](https://moor.simonbinder.eu), an SQLite ORM. Add this to your package's `pubspec.yaml` file, using the latest version. diff --git a/docusaurus/docs/Flutter/guides/user_token_generation_with_firebase_auth.mdx b/docusaurus/docs/Flutter/05-guides/03-user_token_generation_with_firebase_auth.mdx similarity index 96% rename from docusaurus/docs/Flutter/guides/user_token_generation_with_firebase_auth.mdx rename to docusaurus/docs/Flutter/05-guides/03-user_token_generation_with_firebase_auth.mdx index 56192f53..85a0250d 100644 --- a/docusaurus/docs/Flutter/guides/user_token_generation_with_firebase_auth.mdx +++ b/docusaurus/docs/Flutter/05-guides/03-user_token_generation_with_firebase_auth.mdx @@ -1,7 +1,6 @@ --- id: token_generation_with_firebase -sidebar_position: 5 -title: User Token Generation With Firebase Auth and Cloud Functions +title: Authentication --- Securely generate Stream Chat user tokens using Firebase Authentication and Cloud Functions. @@ -155,7 +154,7 @@ Running the above will give this: ![](../assets/authentication_demo_app.jpg) The `Auth` widget handles all of the authentication logic. It initializes a `FirebaseAuth.instance` and uses that -in the `createAccount`, `signIn` and `signOut` methods. There is a button to envoke each of these methods. +in the `createAccount`, `signIn` and `signOut` methods. There is a button to invoke each of these methods. The `FirebaseFunctions.instance` will be used later in this guide. @@ -289,7 +288,7 @@ firebase deploy --only functions ### Create a Stream User and Get the User's Token In the `createStreamUserAndGetToken` cloud function you create an `onCall` HTTPS handler, which exposes -a cloud function that can be envoked from your Flutter app. +a cloud function that can be invoked from your Flutter app. ```js // Create a Stream user and return auth token. @@ -325,13 +324,13 @@ by ensuring that `context.auth` is not null. If it is null, then it throws an `H message. This error can be caught in your Flutter application. If the caller is authenticated the function proceeds to use the `serverClient` to create a new Stream Chat -user by calling the `upsertUser` method and passing in some user data. It uses the authenticated caller's **uid** as an **id**. +user by calling the `upsertUser` method and passing in some user data. It uses the authenticated caller's **`uid`** as an **id**. After the user is created it generates a token for that user. This token is then returned to the caller. To call this from Flutter, you will need to use the `cloud_functions` package. -Update the **createAccount** method in your Flutter code to the following: +Update the **`createAccount`** method in your Flutter code to the following: ```dart Future createAccount() async { @@ -355,7 +354,7 @@ in the request. Once you have the Stream user token, you can authenticate your Stream Chat user as you normally would. -Please see our [initialization documention](https://getstream.io/chat/docs/flutter-dart/init_and_users/?language=dart) for more information. +Please see our [initialization documentation](https://getstream.io/chat/docs/flutter-dart/init_and_users/?language=dart) for more information. As you can see below, the User ID matches on both Firebase's and Stream's user database. @@ -373,7 +372,7 @@ As you can see below, the User ID matches on both Firebase's and Stream's user d The `getStreamUserToken` cloud function is very similar to the `createStreamUserAndGetToken` function. The only difference is that it only creates a user token and does not create a new user account on Stream. -Update the **signIn** method in your Flutter code to the following: +Update the **`signIn`** method in your Flutter code to the following: ```dart Future signIn() async { @@ -434,7 +433,7 @@ exports.deleteStreamUser = functions.auth.user().onDelete((user, context) => { ``` In this function, you are listening to delete events on Firebase auth. When an account is deleted, this function will be triggered, and you can get the -user's **uid** and call the `deleteUser` method on the `serverClient`. +user's **`uid`** and call the `deleteUser` method on the `serverClient`. This is not an external cloud function; it can only be triggered when an account is deleted. diff --git a/docusaurus/docs/Flutter/guides/adding_localization.mdx b/docusaurus/docs/Flutter/05-guides/04-adding_localization.mdx similarity index 98% rename from docusaurus/docs/Flutter/guides/adding_localization.mdx rename to docusaurus/docs/Flutter/05-guides/04-adding_localization.mdx index b62d887d..c6050d10 100644 --- a/docusaurus/docs/Flutter/guides/adding_localization.mdx +++ b/docusaurus/docs/Flutter/05-guides/04-adding_localization.mdx @@ -1,10 +1,9 @@ --- id: adding_localization -sidebar_position: 2 -title: Adding Localization (l10n) / Internationalization (i18n) +title: Localization --- -Adding Localization To UI Widgets +Adding Localization (l10n) / Internationalization (i18n) To UI Widgets ### Introduction diff --git a/docusaurus/docs/Flutter/05-guides/05-push-notifications/_category_.json b/docusaurus/docs/Flutter/05-guides/05-push-notifications/_category_.json new file mode 100644 index 00000000..26b1d64e --- /dev/null +++ b/docusaurus/docs/Flutter/05-guides/05-push-notifications/_category_.json @@ -0,0 +1,3 @@ +{ + "label": "Push Notifications" +} \ No newline at end of file diff --git a/docusaurus/docs/Flutter/guides/adding_push_notifications.mdx b/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications.mdx similarity index 84% rename from docusaurus/docs/Flutter/guides/adding_push_notifications.mdx rename to docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications.mdx index 328ba546..7385564e 100644 --- a/docusaurus/docs/Flutter/guides/adding_push_notifications.mdx +++ b/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications.mdx @@ -1,7 +1,7 @@ --- id: adding_push_notifications -sidebar_position: 1 -title: Adding Push Notifications (V1 legacy) +sidebar_position: 2 +title: Legacy --- Adding Push Notifications To Your Application @@ -21,7 +21,7 @@ Make sure to check [this section](https://getstream.io/chat/docs/flutter-dart/pu ### Setup FCM -To integrate push notifications in your Flutter app you need to use the package [firebase_messaging](https://pub.dev/packages/firebase_messaging). +To integrate push notifications in your Flutter app you need to use the package [`firebase_messaging`](https://pub.dev/packages/firebase_messaging). Follow the [Firebase documentation](https://firebase.flutter.dev/docs/messaging/overview/) to know how to set up the plugin for both Android and iOS. @@ -39,7 +39,7 @@ From the [Firebase Console](https://console.firebase.google.com/), select the pr Click on the gear icon next to `Project Overview` and navigate to **Project settings** -![](../assets/firebase_project_settings.jpeg) +![](../../assets/firebase_project_settings.jpeg) #### Step 3 @@ -49,26 +49,26 @@ Navigate to the `Cloud Messaging` tab Under `Project Credentials`, locate the `Server key` and copy it -![](../assets/server_key.png) +![](../../assets/server_key.png) #### Step 5 Upload the `Server Key` in your chat dashboard -![](../assets/dashboard_firebase_enable.jpeg) +![](../../assets/dashboard_firebase_enable.jpeg) -![](../assets/dashboard_firebase_key.jpeg) +![](../../assets/dashboard_firebase_key.jpeg) :::note -We are setting up the Android section, but this will work for both Android and iOS if you're using Firebase for both of them! +We are setting up the Android section, but this will work for both Android and iOS if you're using Firebase for both of them. ::: #### Step 6 Save your push notification settings changes -![](../assets/dashboard_save_changes.jpeg) +![](../../assets/dashboard_save_changes.jpeg) **OR** @@ -97,21 +97,21 @@ firebaseMessaging.onTokenRefresh.listen((token) { ### Possible issues -We only send push notifications when the user doesn't have any active websocket connection (which is established when you call `client.connectUser`). If you set the [onBackgroundEventReceived](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/onBackgroundEventReceived.html) property of the StreamChat widget, when your app goes to background, your device will keep the ws connection alive for 1 minute, and so within this period, you won't receive any push notification. +We only send push notifications when the user doesn't have any active web socket connection (which is established when you call `client.connectUser`). If you set the [onBackgroundEventReceived](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/onBackgroundEventReceived.html) property of the StreamChat widget, when your app goes to background, your device will keep the WS connection alive for 1 minute, and so within this period, you won't receive any push notification. Make sure to read the [general push docs](https://getstream.io/chat/docs/flutter-dart/push_introduction/?language=dart) in order to avoid known gotchas that may make your relationship with notifications go bad 😢 ### Testing if Push Notifications are Setup Correctly -If you're not sure if you've set up push notifications correctly (e.g. you don't always receive them, they work unreliably), you can follow these steps to make sure your config is correct and working: +If you're not sure if you've set up push notifications correctly (for example you don't always receive them, they work unreliably), you can follow these steps to make sure your configuration is correct and working: -1. Clone our repo for push testing git clone git@github.com:GetStream/chat-push-test.git +1. Clone our repository for push testing git clone git@github.com:GetStream/chat-push-test.git 2. `cd flutter` 3. In folder run `flutter pub get` -4. Input your api key and secret in `lib/main.dart` +4. Input your API key and secret in `lib/main.dart` 5. Change the bundle identifier/application ID and development team/user so you can run the app in your device (**do not** run on iOS simulator, Android emulator is fine) @@ -137,11 +137,11 @@ You should get a test push notification The [StreamChat](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat-class.html) widget lets you define a [onBackgroundEventReceived](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/onBackgroundEventReceived.html) handler in order to handle events while the app is in the background, but the client is still connected. -This is useful because it lets you keep the connection alive in cases in which the app goes in the background just for some seconds (eg: multitasking, picking pictures from the gallery...) +This is useful because it lets you keep the connection alive in cases in which the app goes in the background just for some seconds (for example multitasking, picking pictures from the gallery...) You can even customize the [backgroundKeepAlive](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/backgroundKeepAlive.html) duration. -In order to show notifications in such a case we suggest using the package [flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications); follow the package guide to successfully set up the plugin. +In order to show notifications in such a case we suggest using the package [`flutter_local_notifications`](https://pub.dev/packages/flutter_local_notifications); follow the package guide to successfully set up the plugin. Once that's done you should set the [onBackgroundEventReceived](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/onBackgroundEventReceived.html); here is an example: @@ -234,7 +234,7 @@ To do this we need to update the push notification data payload at Stream Dashbo } ``` -Then we need to integrate the package [stream_chat_persistence](https://pub.dev/packages/stream_chat_persistence) in our app that exports a persistence client, learn [here](https://pub.dev/packages/stream_chat_persistence#usage) how to set it up. +Then we need to integrate the package [`stream_chat_persistence`](https://pub.dev/packages/stream_chat_persistence) in our app that exports a persistence client, learn [here](https://pub.dev/packages/stream_chat_persistence#usage) how to set it up. Then during the call `firebaseMessaging.configure(...)` we need to set the `onBackgroundMessage` parameter using a TOP-LEVEL or STATIC function to handle background messages; here is an example: diff --git a/docusaurus/docs/Flutter/guides/adding_push_notifications_v2.mdx b/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx similarity index 53% rename from docusaurus/docs/Flutter/guides/adding_push_notifications_v2.mdx rename to docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx index 917d9216..c0678e3b 100644 --- a/docusaurus/docs/Flutter/guides/adding_push_notifications_v2.mdx +++ b/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx @@ -1,27 +1,63 @@ --- id: adding_push_notifications_v2 sidebar_position: 1 -title: Adding Push Notifications (V2) +title: Push Notifications --- -Adding Push Notifications To Your Application +Adding Push Notifications (V2) To Your Application ### Introduction +This guide details how to add push notifications to your app. + Push notifications are a core part of the experience for a messaging app. Users often need to be notified of new messages and old notifications sometimes need to be updated silently. -This guide details how to add push notifications to your app. +Stream Chat sends push notification to channel members that have at least one registered device. +Push notifications are only sent for new messages and not for other events. +You can use [Webhooks](https://getstream.io/chat/docs/android/webhooks_overview/) to send push notifications on other types of events. You can read more about Stream’s [push delivery logic](https://getstream.io/chat/docs/flutter-dart/push_introduction/?language=dart#push-delivery-rules). +To receive push notifications from Stream Chat, you'll need to: + +1. Configure your push notification provider on the Stream Dashboard. +2. Add the client-side integration. For Flutter this guide demonstrates using Firebase Cloud Messaging (FCM). + +### Push Delivery Rules + +Push message delivery behaves according to these rules: + +- Push notifications are sent only for new messages. +- Only channel members receive push messages. +- Members receive push notifications regardless of their online status. +- Replies inside a [thread](https://getstream.io/chat/docs/threads/) are only sent to users that are part of that thread: + - They posted at least one message + - They were mentioned +- Messages from muted users are not sent. +- Messages from muted channels are not sent. +- Messages are sent to all registered devices for a user (up to 25). +- The message doesn't contain the flag `skip_push` as true. +- `push_notifications` is enabled (default) on the channel type for message is sent. + +:::info + +If you would like get push notifications only when users are offline, please contact support. + +::: + +:::caution + +Push notifications require membership. Watching a channel isn't enough. + +::: + ### Setup FCM -To integrate push notifications in your Flutter app, you need to use the package [firebase_messaging](https://pub.dev/packages/firebase_messaging). - - -Follow the [Firebase documentation](https://firebase.flutter.dev/docs/messaging/overview/) to set up the plugin for Android and iOS. +To integrate push notifications in your Flutter app, you need to use the package [`firebase_messaging`](https://pub.dev/packages/firebase_messaging). +Follow the [Flutter Firebase documentation](https://firebase.flutter.dev/docs/messaging/overview/) to set up the plugin for Android and iOS. +Additional setup and instructions can be found [here](https://firebase.google.com/docs/cloud-messaging/flutter/client). Be sure to read this documentation to understand Firebase messaging functionality. Once that's done, FCM should be able to send push notifications to your devices. @@ -29,9 +65,9 @@ Once that's done, FCM should be able to send push notifications to your devices. #### Step 1 - Get the Firebase Credentials -These credentials are the [private key file](https://firebase.google.com/docs/admin/setup#:~:text=To%20generate%20a%20private%20key%20file%20for%20your%20service%20account%3A) for your service account, in firebase console. +These credentials are the [private key file](https://firebase.google.com/docs/admin/setup#:~:text=To%20generate%20a%20private%20key%20file%20for%20your%20service%20account%3A) for your service account, in Firebase console. -To generate a private key file for your service account, in the Firebase console: +To generate a private key file for your service account in the Firebase console: - Open Settings > Service Accounts. @@ -39,7 +75,7 @@ To generate a private key file for your service account, in the Firebase console - Securely store the JSON file containing the key. -This JSON file contains the credentials which needs to be uploaded to Stream’s server as explained in next step. +This JSON file contains the credentials that need to be uploaded to Stream’s server, as explained in the next step. #### Step 2 - Upload the Firebase Credentials to Stream @@ -47,21 +83,21 @@ You can upload your Firebase credentials using either the dashboard or the app s ##### Using the Stream Dashboard -1. Go to the **Chat Overview** page on Stream Dashboard +1. Go to the **Chat Overview** page on Stream Dashboard. -![](../assets/chat_overview_page-2fbd5bbfb70c5623bd37ff7d6c41bf4d.png) +![](../../assets/chat_overview_page-2fbd5bbfb70c5623bd37ff7d6c41bf4d.png) -2. Enable **Firebase Notification** toggle on **Chat Overview** +2. Enable **Firebase Notification** toggle on **Chat Overview**. -![](../assets/firebase_notifications_toggle-5aeabfcbdc24cb8f1fea7d41d0e845fc.png) +![](../../assets/firebase_notifications_toggle-5aeabfcbdc24cb8f1fea7d41d0e845fc.png) -3. Enter your Firebase Credentials and press "Save". +3. Enter your Firebase Credentials and press `"Save"`. ##### Using the API You can also enable Firebase notifications and upload the Firebase credentials using one of our server SDKs. -For example, using the JavaScript SDK: +For example, using the Stream JavaScript SDK: ```js const client = StreamChat.getInstance('api_key', 'api_secret'); @@ -76,55 +112,56 @@ client.updateAppSettings({ ), }); ``` + ### Registering a Device With Stream Backend -Once you configure a Firebase server key and set it up on Stream dashboard then a device that is supposed to receive push notifications needs to be registered on the Stream backend. This is usually done by listening for Firebase device token updates and passing them to the backend as follows: +Once you configure a Firebase server key and set it up on the Stream dashboard, a device that is supposed to receive push notifications needs to be registered on the Stream backend. This is usually done by listening for Firebase device token updates and passing them to the backend as follows: ```dart -firebaseMessaging.onTokenRefresh.listen((token) { - client.addDevice(token, PushProvider.firebase); -}); +firebaseMessaging.onTokenRefresh.listen((token) { + client.addDevice(token, PushProvider.firebase); +}); ``` -Push Notifications v2 also supports specifying a name to the push device tokens you register. By setting the optional `pushProviderName` param in the `addDevice` call you can support different configurations between the device and the `PushProvider`. +Push Notifications v2 also supports specifying a name for the push device tokens you register. By setting the optional `pushProviderName` parameter in the `addDevice` call, you can support different configurations between the device and the `PushProvider`. ```dart -firebaseMessaging.onTokenRefresh.listen((token) { - client.addDevice(token, PushProvider.firebase, pushProviderName: 'my-custom-config'); -}); +firebaseMessaging.onTokenRefresh.listen((token) { + client.addDevice(token, PushProvider.firebase, pushProviderName: 'my-custom-config'); +}); ``` ### Receiving Notifications -Push notifications behave a bit differently depending on whether you are using iOS or Android. +Push notifications behave differently depending on whether you are using iOS or Android. See [here](https://firebase.flutter.dev/docs/messaging/usage#message-types) to understand the difference between **notification** and **data** payloads. #### iOS -On iOS we send both a **notification** and a **data** payload. +On iOS, we send both a **notification** and a **data** payload. This means you don't need to do anything special to get the notification to show up. However, you might want to handle the data payload to perform some logic when the user taps on the notification. To update the template, you can use a backend SDK. -For example, using the javascript SDK: +For example, using the Stream JavaScript SDK: ```js const client = StreamChat.getInstance(‘api_key’, ‘api_secret’); const apn_template = `{ - "aps": { - "alert": { - "title": "New message from {{ sender.name }}", - "body": "{{ truncate message.text 2000 }}" - }, - "mutable-content": 1, - "category": "stream.chat" - }, - "stream": { - "sender": "stream.chat", + "aps": { + "alert": { + "title": "New message from {{ sender.name }}", + "body": "{{ truncate message.text 2000 }}" + }, + "mutable-content": 1, + "category": "stream.chat" + }, + "stream": { + "sender": "stream.chat", "type": "message.new", "version": "v2", "id": "{{ message.id }}", "cid": "{{ channel.cid }}" - } + } }`; client.updateAppSettings({ @@ -134,13 +171,23 @@ client.updateAppSettings({ ``` #### Android -On Android we send only a **data** payload. This gives you more flexibility and lets you decide what to do with the notification. + +On Android, we send only a **data** payload. This gives you more flexibility and lets you decide what to do with the notification. For example, you can listen and generate a notification from them. -To generate a notification when a **data-only** message is received and the app is in background: +The code below demonstrates how to generate a notification when a **data-only** message is received and the app is in the background. + +There are a few things to keep in mind about your background message handler: + +1. It must not be an anonymous function. +2. It must be a top-level function (not a class method which requires initialization). +3. It must be annotated with @pragma('vm:entry-point') right above the function declaration (otherwise it may be removed during tree shaking for release mode). + +For additional information on background messages, please see the [Firebase documentation](https://firebase.google.com/docs/cloud-messaging/flutter/receive#background_messages). ```dart +@pragma('vm:entry-point') Future onBackgroundMessage(RemoteMessage message) async { final chatClient = StreamChatClient(apiKey); @@ -164,7 +211,7 @@ void handleNotification( final flutterLocalNotificationsPlugin = await setupLocalNotifications(); final messageId = data['id']; final response = await chatClient.getMessage(messageId); - + flutterLocalNotificationsPlugin.show( 1, 'New message from ${response.message.user.name} in ${response.channel.name}', @@ -181,13 +228,13 @@ void handleNotification( FirebaseMessaging.onBackgroundMessage(onBackgroundMessage); ``` -In the above example, you get the message details using the `getMessage` method and then you use the [flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications) package to show the actual notification. +In the above example, you get the message details using the `getMessage` method, and then you use the [`flutter_local_notifications`](https://pub.dev/packages/flutter_local_notifications) package to show the actual notification. ##### Using a Template on Android -It's still possible to add a **notification** payload to Android notifications. +Adding a **notification** payload to Android notifications is still possible. You can do so by adding a template using a backend SDK. -For example, using the javascript SDK: +For example, using the Stream JavaScript SDK: ```js const client = StreamChat.getInstance(‘api_key’, ‘api_secret’); @@ -207,32 +254,33 @@ client.updateAppSettings({ ### Possible Issues -Make sure to read the [general push notification docs](https://getstream.io/chat/docs/flutter-dart/push_introduction/?language=dart) in order to avoid known gotchas that may make your relationship with notifications difficult 😢. +Make sure to read the [general push notification docs](https://getstream.io/chat/docs/flutter-dart/push_introduction/?language=dart) to prevent common issues with notifications 😢. ### Testing if Push Notifications are Setup Correctly -If you're not sure whether you've set up push notifications correctly, for example, you don't always receive them, or they don’t work reliably, then you can follow these steps to make sure your config is correct and working: -1. Clone our repo for push testing: `git clone git@github.com:GetStream/chat-push-test.git` +If you're not sure whether you've set up push notifications correctly, for example, you don't always receive them, or they don’t work reliably, then you can follow these steps to make sure your configuration is correct and working: + +1. Clone our repository for push testing: `git clone git@github.com:GetStream/chat-push-test.git` 2. `cd flutter` 3. In that folder run `flutter pub get` -4. Input your api key and secret in `lib/main.dart` +4. Input your API key and secret in `lib/main.dart` 5. Change the bundle identifier/application ID and development team/user so you can run the app on your physical device.**Do not** run on an iOS simulator, as it will not work. Testing on an Android emulator is fine. 6. Add your `google-services.json/GoogleService-Info.plist` 7. Run the app 8. Accept push notification permission (iOS only) 9. Tap on `Device ID` and copy it -11. After configuring [stream-cli](https://github.com/GetStream/stream-cli), run the following command using your user ID: +10. After configuring [stream-cli](https://github.com/GetStream/stream-cli), run the following command using your user ID: + ```shell -stream chat:push:test -u +stream chat:push:test -u ``` You should get a test push notification 🥳 - ### Foreground Notifications -Sometimes you may want to show a notification when the app is in the foreground. -For example, when you're in a channel and you receive a new message from someone in another channel. +You may want to show a notification when the app is in the foreground. +For example, when you're in a channel and receive a new message from someone in another channel. For this scenario, you can also use the `flutter_local_notifications` package to show a notification. @@ -248,25 +296,31 @@ FirebaseMessaging.onMessage.listen((message) async { ``` :::note -You should also check that the channel of the message is different than the channel in the foreground. +You should also check that the message's channel differs from the channel in the foreground. How you do this depends on your app infrastructure and how you handle navigation. + Take a look at the [Stream Chat v1 sample app](https://github.com/GetStream/flutter-samples/blob/main/packages/stream_chat_v1/lib/home_page.dart#L11) to see how we're doing it over there. ::: ### Saving Notification Messages to the Offline Storage (Only Android) -When the app is closed you may want to save received messages when you receive them via a notification so that later on when you open the app they're already there. +When the app is closed, you can save incoming messages when you receive them via a notification so that they're already there later when you open the app. -To do this you need to integrate the package [stream_chat_persistence](https://pub.dev/packages/stream_chat_persistence) in our app that exports a persistence client, see [here](https://pub.dev/packages/stream_chat_persistence#usage) how to set it up. +To do this, you need to integrate the package [`stream_chat_persistence`](https://pub.dev/packages/stream_chat_persistence) that exports a persistence client. See [here](https://pub.dev/packages/stream_chat_persistence#usage) for information on how to set it up. -Then calling `FirebaseMessaging.onBackgroundMessage(...)` you need to use a TOP-LEVEL or STATIC function to handle background messages; here is an example: +Then calling `FirebaseMessaging.onBackgroundMessage(...)` you need to use a TOP-LEVEL or STATIC function to handle background messages. + +For additional information on background messages, please see the [Firebase documentation](https://firebase.google.com/docs/cloud-messaging/flutter/receive#background_messages). + +Here is an example: ```dart +@pragma('vm:entry-point') Future onBackgroundMessage(RemoteMessage message) async { final chatClient = StreamChatClient(apiKey); - final persistenceClient = StreamChatPersistenceClient(); - - await persistenceClient.connect(userId); + final persistenceClient = StreamChatPersistenceClient(); + + await persistenceClient.connect(userId); chatClient.connectUser( User(id: userId), @@ -287,9 +341,9 @@ void handleNotification( final messageId = data['id']; final cid = data['cid']; final response = await chatClient.getMessage(messageId); - await persistenceClient.updateMessages(cid, [response.message]); - - persistenceClient.disconnect(); + await persistenceClient.updateMessages(cid, [response.message]); + + persistenceClient.disconnect(); flutterLocalNotificationsPlugin.show( 1, @@ -306,4 +360,3 @@ void handleNotification( FirebaseMessaging.onBackgroundMessage(onBackgroundMessage); ``` - diff --git a/docusaurus/docs/Flutter/guides/end_to_end_chat_encryption.mdx b/docusaurus/docs/Flutter/05-guides/06-end_to_end_chat_encryption.mdx similarity index 94% rename from docusaurus/docs/Flutter/guides/end_to_end_chat_encryption.mdx rename to docusaurus/docs/Flutter/05-guides/06-end_to_end_chat_encryption.mdx index 8a463af4..cf204cfc 100644 --- a/docusaurus/docs/Flutter/guides/end_to_end_chat_encryption.mdx +++ b/docusaurus/docs/Flutter/05-guides/06-end_to_end_chat_encryption.mdx @@ -1,9 +1,10 @@ --- id: end_to_end_chat_encryption -sidebar_position: 12 -title: End To End Chat Encryption +title: Encryption --- +Adding End To End Encryption to your Chat App + ## Introduction When you communicate over a chat application with another person or group, @@ -36,7 +37,7 @@ Check out the diagram below for an example: ### Dependencies -Add the [webcrypto](https://pub.dev/packages/webcrypto) package in your `pubspec.yaml` file. +Add the [`webcrypto`](https://pub.dev/packages/webcrypto) package in your `pubspec.yaml` file. ```yaml dependencies: @@ -76,9 +77,9 @@ class JsonWebKeyPair { } ``` -### Generate a Crypto Key +### Generate a Cryptographic Key -Next, create a symmetric **Crypto Key** using the keys generated in the previous step. +Next, create a symmetric **Cryptographic Key** using the keys generated in the previous step. You will use those keys to encrypt and decrypt messages. ```dart @@ -107,7 +108,7 @@ Future> deriveKey(String senderJwk, String receiverJwk) async { ### Encrypting Messages -Once you have generated the **Crypto Key**, you're ready to encrypt the message. +Once you have generated the **Cryptographic Key**, you're ready to encrypt the message. You can use the **AES-GCM** algorithm for its known security and performance balance and good browser availability. ```dart @@ -253,6 +254,6 @@ StreamMessageListView( ), ``` -That's it! That's all you need to implement E2EE in a Stream powered chat app. +That's it. That's all you need to implement E2EE in a Stream powered chat app. For more details, check out our [end-to-end encrypted chat article](https://getstream.io/blog/end-to-end-encrypted-chat-in-flutter/#whats-end-to-end-encryption). diff --git a/docusaurus/docs/Flutter/guides/error_reporting_with_sentry.mdx b/docusaurus/docs/Flutter/05-guides/07-error_reporting_with_sentry.mdx similarity index 98% rename from docusaurus/docs/Flutter/guides/error_reporting_with_sentry.mdx rename to docusaurus/docs/Flutter/05-guides/07-error_reporting_with_sentry.mdx index a192a613..dbbe312e 100644 --- a/docusaurus/docs/Flutter/guides/error_reporting_with_sentry.mdx +++ b/docusaurus/docs/Flutter/05-guides/07-error_reporting_with_sentry.mdx @@ -1,7 +1,6 @@ --- id: error_reporting_with_sentry -sidebar_position: 15 -title: Error Reporting With Sentry +title: Error Reporting --- Error Reporting With Sentry diff --git a/docusaurus/docs/Flutter/guides/adding_chat_to_video_livestreams.mdx b/docusaurus/docs/Flutter/05-guides/08-adding_chat_to_video_livestreams.mdx similarity index 97% rename from docusaurus/docs/Flutter/guides/adding_chat_to_video_livestreams.mdx rename to docusaurus/docs/Flutter/05-guides/08-adding_chat_to_video_livestreams.mdx index 9a2863b6..72f50120 100644 --- a/docusaurus/docs/Flutter/guides/adding_chat_to_video_livestreams.mdx +++ b/docusaurus/docs/Flutter/05-guides/08-adding_chat_to_video_livestreams.mdx @@ -1,7 +1,6 @@ --- id: adding_chat_to_video_livestreams -sidebar_position: 7 -title: Adding Chat To Video Livestreams +title: Livestreams Integration --- Adding Chat To Video Livestreams diff --git a/docusaurus/docs/Flutter/05-guides/08-migrations/_category_.json b/docusaurus/docs/Flutter/05-guides/08-migrations/_category_.json new file mode 100644 index 00000000..e30f7ae4 --- /dev/null +++ b/docusaurus/docs/Flutter/05-guides/08-migrations/_category_.json @@ -0,0 +1,3 @@ +{ + "label": "Migrations" +} \ No newline at end of file diff --git a/docusaurus/docs/Flutter/guides/migration_guide_4_0.mdx b/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_4_0.mdx similarity index 94% rename from docusaurus/docs/Flutter/guides/migration_guide_4_0.mdx rename to docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_4_0.mdx index 887cef3a..93c179de 100644 --- a/docusaurus/docs/Flutter/guides/migration_guide_4_0.mdx +++ b/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_4_0.mdx @@ -1,19 +1,20 @@ --- id: migration_guide_4_0 -sidebar_position: 14 -title: Migration Guide v4.0 +sidebar_position: 1 +title: v4.0 +slug: /guides/migration_guide_4_0/ --- **Version 4.0.0** of the Stream Chat Flutter SDK carries significant architectural changes to improve the developer experience by giving you more control and flexibility in how you use our core components and UI widgets. -This guide is intended to enumerate and better explain the changes in the SDK. +This v4.0 Migration Guide is intended to enumerate and better explain the changes in the SDK. If you find any bugs or have any questions, please file an [issue on our GitHub repository](https://github.com/GetStream/stream-chat-flutter/issues). We want to support you as much as we can with this migration. Code examples: - See our [Stream Chat Flutter tutorial](https://getstream.io/chat/flutter/tutorial/) for an up-to-date guide using the latest Stream Chat version. -- See the [Stream Flutter Samples repository](https://github.com/GetStream/flutter-samples) with our fully-fledged messaging [sample application](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1). +- See the [Stream Flutter Samples repository](https://github.com/GetStream/flutter-samples) with our full fledged messaging [sample application](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1). All of our documentation has also been updated to support v4, so all of the guides and examples will have updated code. @@ -76,9 +77,9 @@ The automatic video compression when uploading a video has been removed. You can ### Slidable Channel List Item -The default slidable channel preview behavior has been removed. We have created a [guide](slidable_channel_list_preview.mdx) showing you how you can easily add this functionality yourself. +The default slidable channel preview behavior has been removed. We have created a [guide](../../02-customization/01-custom-widgets/07-slidable_channel_list_preview.mdx) showing you how you can easily add this functionality yourself. -![Slidable demo](../assets/slidable_demo.jpg) +![Slidable demo](../../assets/slidable_demo.jpg) ### Pin Permission @@ -194,13 +195,13 @@ Version 4 of the Stream Chat Flutter packages introduces a new controller called - Return/Create a new channel and start watching it. - Pause and Resume all subscriptions added to this composite. -For more information see the [`StreamChannelListView` documentation](../stream_chat_flutter/stream_channel_list_view.mdx). +For more information see the [`StreamChannelListView` documentation](../../03-stream_chat_flutter/stream_channel_list_view.mdx). ### ChannelsBloc to StreamChannelListController The `ChannelsBloc` widget should be replaced with `StreamChannelListController`. This controller provides all the functionality needed to query and manipulate channel data previously accessible through `ChannelsBloc`. -For more information see the [`StreamChannelListController` documentation](../stream_chat_flutter_core/stream_channel_list_controller.mdx). +For more information see the [`StreamChannelListController` documentation](../../04-stream_chat_flutter_core/stream_channel_list_controller.mdx). ### StreamChannelListView Examples @@ -208,10 +209,10 @@ Let's explore some examples of the functional differences when using the new `St The **StreamChannelListController** provides various methods, such as: -- **deleteChannel** -- **loadMore** -- **muteChannel** -- **deleteChannel** +- **`deleteChannel`** +- **`loadMore`** +- **`muteChannel`** +- **`deleteChannel`** For a complete list with additional information, see the code documentation. @@ -267,7 +268,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - sort: const [SortOption('last_message_at')], + channelStateSort: const [SortOption('last_message_at')], ); @override @@ -310,13 +311,13 @@ Version 4 of the Stream Chat Flutter packages introduces a new controller called - Load more data using `loadMore`. - Refresh data. -For more information see the [`StreamMessageSearchListView` documentation](../stream_chat_flutter/stream_message_search_list_view.mdx). +For more information see the [`StreamMessageSearchListView` documentation](../../03-stream_chat_flutter/stream_message_search_list_view.mdx). ### MessageSearchBloc to StreamMessageSearchListController The `MessageSearchBloc` widget should be replaced with a `StreamMessageSearchListController`. This controller provides all the functionality needed to query and manipulate message search data previously accessible through `MessageSearchBloc`. -For more information see the [`StreamMessageSearchListController` documentation](../stream_chat_flutter_core/stream_message_search_list_controller.mdx). +For more information see the [`StreamMessageSearchListController` documentation](../../04-stream_chat_flutter_core/stream_message_search_list_controller.mdx). ### StreamMessageSearchListView Example @@ -421,13 +422,13 @@ Version 4 of the Stream Chat Flutter packages introduces a new controller called - Set filters. - Refresh data. -For more information see the [`StreamUserListView` documentation](../stream_chat_flutter/stream_user_list_view.mdx). +For more information see the [`StreamUserListView` documentation](../../03-stream_chat_flutter/stream_user_list_view.mdx). ### UsersBloc to StreamUserListController The `UsersBloc` widget should be replaced with a `StreamUserListController`. This controller provides all the functionality needed to query and manipulate user data previously accessible through `UsersBloc`. -For more information see the [`StreamUserListController` documentation](../stream_chat_flutter_core/stream_user_list_controller.mdx). +For more information see the [`StreamUserListController` documentation](../../04-stream_chat_flutter_core/stream_user_list_controller.mdx). ### StreamUserListView Example @@ -536,7 +537,7 @@ Creating a separate controller allows easier control over the message input cont The widget is also separated into smaller components: `StreamCountDownButton`, `StreamAttachmentPicker`, etc. -> ❗The `MessageInputController` is exposed by the **stream_chat_flutter_core** package. This allows you to use the controller even if you're not using the UI components. +> ❗The `MessageInputController` is exposed by the **`stream_chat_flutter_core`** package. This allows you to use the controller even if you're not using the UI components. As a result of this extra control, it is no longer needed for the new `StreamMessageInput` widget to expose these `MessageInput` arguments: @@ -558,7 +559,7 @@ The following arguments are newly introduced to the `StreamMessageInput`, and ar - `elevation`: elevation of the **StreamMessageInput** widget - `shadow`: **Shadow** for the **StreamMessageInput** widget -For more information see the [`StreamMessageInput` documentation](../stream_chat_flutter_core/stream_message_input_controller.mdx). +For more information see the [`StreamMessageInput` documentation](../../04-stream_chat_flutter_core/stream_message_input_controller.mdx). ### StreamMessageInput Examples @@ -733,7 +734,7 @@ The controller makes it much simpler to dynamically modify the message input. ## Stream Chat Flutter Core -Various changes have been made to the Core package, most notably, the indroduction of all of the controllers mentioned above. +Various changes have been made to the Core package, most notably, the introduction of all of the controllers mentioned above. These controllers replace the business logic implementations (Bloc). Please note that this is not related to the well-known Flutter Bloc package, but instead refers to the naming we used for our business logic components. diff --git a/docusaurus/docs/Flutter/guides/migration_guide_5_0.mdx b/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_5_0.mdx similarity index 85% rename from docusaurus/docs/Flutter/guides/migration_guide_5_0.mdx rename to docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_5_0.mdx index 2a085e1f..7f243b2a 100644 --- a/docusaurus/docs/Flutter/guides/migration_guide_5_0.mdx +++ b/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_5_0.mdx @@ -1,7 +1,8 @@ --- id: migration_guide_5_0 -sidebar_position: 15 -title: Migration Guide v5.0 +sidebar_position: 2 +title: v5.0 +slug: /guides/migration_guide_5_0/ --- **Version 5.0.0** of the Stream Chat Flutter SDK UI package has been overhauled to support larger screen sizes better and provide native feeling web and desktop platform interactions that feel intuitive and expected. @@ -15,7 +16,7 @@ If you find any bugs or have any questions, please file an [issue on our GitHub Code examples: - See our [Stream Chat Flutter tutorial](https://getstream.io/chat/flutter/tutorial/) for an up-to-date guide using the latest Stream Chat version. -- See the [Stream Flutter Samples repository](https://github.com/GetStream/flutter-samples) with our fully-fledged messaging [sample application](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1). +- See the [Stream Flutter Samples repository](https://github.com/GetStream/flutter-samples) with our full fledged messaging [sample application](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1). Our documentation has also been updated to support v5, so all guides and examples will have updated code. @@ -38,7 +39,7 @@ This section highlights our efforts on Desktop (macOS, Windows, and Linux) and W ### Setup -See the [setup guide](../stream_chat_flutter/setup.mdx) for platform specific instructions. +See the [setup guide](../../03-stream_chat_flutter/setup.mdx) for platform specific instructions. ### Supporting Larger Screens @@ -49,7 +50,7 @@ We've added support for larger screens and have made changes to the UI to suppor Below is an example running on macOS, with a split-screen view showing channels on the left and messages on the right. -![MacOS split](../assets/mac_os_split.png) +![MacOS split](../../assets/mac_os_split.png) ### Native Platform Interactions @@ -58,7 +59,7 @@ The user experience of interacting with a desktop application differs from a mob - Input controls: touch, keyboard, and mouse interactions - Native file system or gallery access (as well as sharing functionality) - Shortcuts -- Dialogs +- Dialog screens By default, Stream Chat Flutter will use the correct input controls and visual elements for the target platform. For example, touch and swipe controls will be the default on mobile, while on web and desktop these will be disabled and interactions with the mouse and keyboard will be preferred. @@ -69,7 +70,7 @@ On desktop and web it's also possible to add attachments by simply dragging them - Right-click context menus for messages and full-screen attachments. - Upload and download attachments using the native desktop file system. - Press the "enter" key to send a message. -- If you are quoting a message and have not yet typed any text, you can press the "esc" key to remove the quoted message. +- If you are quoting a message and have not yet typed any text, you can press the `"esc"` key to remove the quoted message. - A dedicated "X" button for removing a quoted message with your mouse. - Drag and drop attachment files to `StreamMessageInput`. - New `StreamMessageInput.draggingBorder` property to customize the border color of the message input when dropping a file. @@ -80,10 +81,10 @@ On desktop and web it's also possible to add attachments by simply dragging them - Gallery navigation controls with keyboard shortcuts (left and right arrow keys). - Appropriate message sizing for large screens. - Right-click context menu for `StreamMessageListView` items. -- `StreamMessageListView` items not swipeable on desktop & web. +- `StreamMessageListView` items not swipe-able on desktop & web. - Video support for Windows & Linux through `dart_vlc`. - Video support for macOS through `video_player_macos`. -- Replace bottom sheets with dialogs where appropriate. +- Replace bottom sheets with dialog screens where appropriate. ## What's New? @@ -105,19 +106,19 @@ For additional information, see [#1125](https://github.com/GetStream/stream-chat The `StreamMemberListView` and `StreamMemberGridView` widgets are new widgets that allow you to display a list of members in a channel. -Check out the dedicated [documentation](../stream_chat_flutter/stream_member_list_view.mdx) for more information. +Check out the dedicated [documentation](../../03-stream_chat_flutter/stream_member_list_view.mdx) for more information. ### Attachment Picker As part of the v5 release, we've refactored the `AttachmentPicker` to be more flexible and customizable. This allows you to use the `AttachmentPicker` in various ways and customize the UI to your liking. -Check out the dedicated [guide](./customize_attachment_picker_modal.mdx) for more information. +Check out the dedicated [guide](../../02-customization/01-custom-widgets/05-customize_attachment_picker_modal.mdx) for more information. ### Other Changes The following was also introduced: -- Added support for additional text field params in`StreamMessageInput`: `maxLines`, `minLines`, `textInputAction`, `keyboardType`, and `textCapitalization`. +- Added support for additional text field parameters in`StreamMessageInput`: `maxLines`, `minLines`, `textInputAction`, `keyboardType`, and `textCapitalization`. - Added `showStreamAttachmentPickerModalBottomSheet` to show the attachment picker modal bottom sheet. - Added `onQuotedMessageCleared` to `StreamMessageInput` - `selected` and `selectedTileColor` to `StreamChannelListTile` @@ -169,6 +170,6 @@ StreamImageAttachment( ) ``` -- Removed `StreamMessageInput.customOverlays` in favor of `StreamMessageInput.customAutocompleteTriggers`. Read the guide on [Adding Custom Autocomplete Triggers](./autocomplete_triggers.mdx) to learn how to migrate your code. +- Removed `StreamMessageInput.customOverlays` in favor of `StreamMessageInput.customAutocompleteTriggers`. Read the guide on [Adding Custom Autocomplete Triggers](../../02-customization/01-custom-widgets/06-autocomplete_triggers.mdx) to learn how to migrate your code. -- Removed the default emoji overlay picker. Read the guide on [Adding Custom Autocomplete Triggers](./autocomplete_triggers.mdx) to learn how to migrate your code. +- Removed the default emoji overlay picker. Read the guide on [Adding Custom Autocomplete Triggers](../../02-customization/01-custom-widgets/06-autocomplete_triggers.mdx) to learn how to migrate your code. diff --git a/docusaurus/docs/Flutter/05-guides/09-initialize_stream_chat_widget_tree.mdx b/docusaurus/docs/Flutter/05-guides/09-initialize_stream_chat_widget_tree.mdx new file mode 100644 index 00000000..645e38bd --- /dev/null +++ b/docusaurus/docs/Flutter/05-guides/09-initialize_stream_chat_widget_tree.mdx @@ -0,0 +1,695 @@ +--- +id: initialize_stream_chat_widget_tree +title: Initialize Stream Chat in Part of the Widget Tree +--- + +If you’re creating a full-scale chat application, you probably want to have Stream Chat Flutter initialized at the top of your widget tree and the Stream user connected as soon as they open the application. + +However, if you only need chat functionality in a part of your application, then it’ll be better to delay Stream Chat initialization to when it’s needed. +This guide demonstrates three alternative ways for you to initialize Stream Chat Flutter for a part of your widget tree and to only connect a user when needed. + +## What To Keep In Mind? + +Before investigating potential solutions, let’s first take a look at the relevant Stream Chat widgets and classes. + +Most of the Stream Chat Flutter UI widgets rely on having a [StreamChat](../../customization/stream_chat_and_theming/) ancestor in the widget tree. +The **StreamChat** widget is an [InheritedWidget](https://api.flutter.dev/flutter/widgets/InheritedWidget-class.html) that exposes the **StreamChatClient** through **BuildContext**. +This widget also initializes the [StreamChatCore](../04-stream_chat_flutter_core/stream_chat_core.mdx) widget and the **StreamChatTheme**. + +**StreamChatCore** is a **StatefulWidget** used to react to life cycle changes and system updates. +When the app goes into the background, the WebSocket connection is closed. +Conversely, a new connection is initiated when the app is back in the foreground. + +What is important to take note of is that **a connection is only established if a user is connected**. + +This means that if you have not yet called `client.connectUser(user, token)`, no connection will be made, and only background listeners will be registered to determine the app's foreground state. + +## Option 1: Builder and Connect/Disconnect User + +This option requires you to wrap your whole application with the **StreamChat** widget and to call `connectUser` and `disconnectUser` as needed. + +This option is the easiest, however, it requires **StreamChat** to be at the top of each route and as a result, will have a slight overhead as it’ll create the above-mentioned Stream widgets that may not yet be needed. + +### Exposing the StreamChat Widget + +First, you must expose the client and base Stream Chat widgets to the whole application. + +```dart +void main() { + final client = StreamChatClient( + 'q29npdvqjr99', + logLevel: Level.OFF, + ); + + runApp(MyApp(client: client)); +} + +class MyApp extends StatelessWidget { + const MyApp({ + Key? key, + required this.client, + }) : super(key: key); + + final StreamChatClient client; + + @override + Widget build(BuildContext context) { + return MaterialApp( + builder: (context, child) { + return StreamChat(client: client, child: child); + }, + home: const HomeScreen(), + ); + } +} +``` + +In the above code, you: + +1. Create a **StreamChatClient** instance +2. Pass the instance to the **StreamChat** widget +3. Expose **StreamChat** to the whole application within the **MaterialApp** `builder` + +A few important things to note: + +- The `builder` wraps the **StreamChat** widget for every route of our application. No matter where you are in the widget tree, you’ll be able to call `StreamChat.of(context)`. +- The state will only be created once for our application, as **StreamChat** is a **StatefulWidget** and the position of **StreamChat** in the widget tree remains the same throughout the application lifecycle. +- No connection will be made until you call `connectUser`. + +### Connecting and Disconnecting Users + +In **MaterialApp** above, the home page is set to **HomeScreen**. This screen could look something like the following: + +```dart +class HomeScreen extends StatelessWidget { + const HomeScreen({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(), + body: const Center( + child: Text('Home Screen'), + ), + floatingActionButton: FloatingActionButton( + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute(builder: (context) => const ChatSetup())); + }, + child: const Icon( + Icons.message, + ), + ), + ); + } +} +``` + +This screen shows a floating action button that on click navigates the user to the **ChatSetup**. We want to connect and disconnect a Stream user only when they go to the chat setup screen. + +```dart +class ChatSetup extends StatefulWidget { + const ChatSetup({ + super.key, + }); + + @override + State createState() => _ChatSetupState(); +} + +class _ChatSetupState extends State { + late final Future connectionFuture; + late final client = StreamChat.of(context).client; + + @override + void initState() { + super.initState(); + connectionFuture = client.connectUser( + User(id: 'USER_ID'), + 'TOKEN', + ); + } + + @override + void dispose() { + client.disconnectUser(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(), + body: FutureBuilder( + future: connectionFuture, + builder: (BuildContext context, AsyncSnapshot snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return const Center( + child: CircularProgressIndicator(), + ); + default: + if (snapshot.hasError) { + return Text('Error: ${snapshot.error}'); + } else { + return const ChannelListPage(); + } + } + }, + ), + ); + } +} +``` + +Within `initState` you call `connectUser`; once the future for `connectUser` has completed a connection to the Stream API is established, you can then display the relevant Stream Chat UI widgets. + +Once the **ChatScreen** widget is disposed of, then `disconnectUser` will be called within the `dispose` method. + +### Caution + +In this example, `disconnectUser` will **only** be called when the **ChatSetup** widget is disposed. + +You need to ensure that this widget (route) is completely disposed of, or you need to call `disconnectUser` and `connectUser` manually when navigating to relevant parts of your application. + +For example, let’s say you have a button within one of the chat screens to navigate to a completely different part of your app, then you want to make sure the **ChatScreen** route is disposed of by forcing it to be removed: + +```dart +Navigator.of(context).pushAndRemoveUntil( + MaterialPageRoute( + builder: ((context) => const HomeScreen()), + ), + (Route route) => false, +); +``` + +Or let’s say you wanted to pop back to the first route: + +```dart +Navigator.of(context).popUntil((route) => route.isFirst); +``` + +Both of these will ensure the route is disposed of and the user is disconnected as a result. + +## Option 2: A Nested Navigator + +Another approach would be to introduce a new [Navigator](https://api.flutter.dev/flutter/widgets/Navigator-class.html). +This has the benefit that everything related to Stream chat is contained to a specific part of the widget tree. + +### Defining Routes and Nested Routes + +In this example, our application has the following routes. + +```dart +const routeHome = '/'; +const routePrefixChat = '/chat/'; +const routeChatHome = '$routePrefixChat$routeChatChannels'; +const routeChatChannels = 'chat_channels'; +const routeChatChannel = 'chat_channel'; +``` + +For the `/chat/` nested routes (**routePrefixChat**), this approach initializes Stream Chat in our application and introduces a nested navigator. + +Let’s explore the code: + +```dart +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatefulWidget { + const MyApp({ + Key? key, + }) : super(key: key); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + final GlobalKey navigatorKey = GlobalKey(); + + @override + Widget build(BuildContext context) { + return Provider.value( + value: navigatorKey, + child: MaterialApp( + navigatorKey: navigatorKey, + initialRoute: routeHome, + onGenerateRoute: (settings) { + late Widget page; + if (settings.name == routeHome) { + page = const HomeScreen(); + } else if (settings.name!.startsWith(routePrefixChat)) { + final subRoute = settings.name!.substring(routePrefixChat.length); + page = ChatSetup( + setupChatRoute: subRoute, + ); + } else { + throw Exception('Unknown route: ${settings.name}'); + } + + return MaterialPageRoute( + builder: (context) { + return page; + }, + settings: settings, + ); + }, + ), + ); + } +} +``` + +In the above code you’re: + +1. Creating a navigator key, passing it to `MaterialApp`, and exposing it to the whole application using Provider (you can expose it however you want). +2. Creating `onGenerateRoute` that specifies what page to show depending on the route. Most importantly, if the route contains the **routePrefixChat,** it navigates to the **ChatSetup** page and passes in the remainder of the route. + +For example, `Navigator.pushNamed(context, routeChatHome)` will navigate to the **ChatSetup** page and pass in the nested route **routeChatChannels.** + +### Stream Chat Initialization, User Connection, and Nested Navigation + +Within the **ChatSetup** widget, we’ll initialize Stream chat, connect a user, and create a new Navigator that handles the sub-navigation for the chat-specific pages. + +```dart +class ChatSetup extends StatefulWidget { + const ChatSetup({Key? key, required this.setupChatRoute}) : super(key: key); + + final String setupChatRoute; + + @override + State createState() => _ChatSetupState(); +} + +class _ChatSetupState extends State { + late final Future connectionFuture; + late final client = StreamChatClient( + 'KEY', + logLevel: Level.OFF, + ); + + @override + void initState() { + super.initState(); + connectionFuture = client.connectUser( + User(id: 'USER_ID'), + 'TOKEN', + ); + } + + @override + void dispose() { + client.disconnectUser(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Material( + child: StreamChat( + client: client, + child: FutureBuilder( + future: connectionFuture, + builder: (BuildContext context, AsyncSnapshot snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return const Center( + child: CircularProgressIndicator(), + ); + default: + if (snapshot.hasError) { + return Text('Error: ${snapshot.error}'); + } else { + return Navigator( + initialRoute: widget.setupChatRoute, + onGenerateRoute: _onGenerateRoute, + ); + } + } + }, + ), + ), + ); + } + + Route _onGenerateRoute(RouteSettings settings) { + late Widget page; + switch (settings.name) { + case routeChatChannels: + page = ChannelListPage( + client: client, + ); + break; + case routeChatChannel: + final channel = settings.arguments as Channel; + page = StreamChannel( + channel: channel, + child: const ChannelPage(), + ); + break; + default: + throw Exception('Unknown route: ${settings.name}'); + } + return MaterialPageRoute( + builder: (context) { + return page; + }, + settings: settings, + ); + } +} +``` + +This **ChatSetup** widget is similar to what it was in the first option, the only difference is that we’re also introducing a nested navigator and handling those nested routes. + +The steps for the above code are: + +1. Create a **StreamChatClient** instance +2. Call `connectUser` within `initState` and await the result using a **FutureBuilder** +3. Introduce a **StreamChat** widget into the widget tree +4. Introduce a new **Navigator** for the chat-specific routes +5. Call `disconnectUser` within `dispose` + +### Displaying Stream Chat UI Widgets and Global Navigation + +Then finally, the **ChannelListPage** could look something like the following: + +```dart +class ChannelListPage extends StatefulWidget { + const ChannelListPage({ + super.key, + required this.client, + }); + + final StreamChatClient client; + + @override + State createState() => _ChannelListPageState(); +} + +class _ChannelListPageState extends State { + late final _controller = StreamChannelListController( + client: widget.client, + filter: Filter.in_( + 'members', + [StreamChat.of(context).currentUser!.id], + ), + channelStateSort: const [SortOption('last_message_at')], + ); + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + void _popChatPages() { + final nav = context.read>(); + nav.currentState!.pop(); + } + + @override + Widget build(BuildContext context) { + return WillPopScope( + onWillPop: () async { + _popChatPages(); + return true; + }, + child: Scaffold( + appBar: AppBar( + leading: BackButton( + onPressed: () { + _popChatPages(); + }, + ), + ), + body: RefreshIndicator( + onRefresh: _controller.refresh, + child: StreamChannelListView( + controller: _controller, + onChannelTap: (channel) { + Navigator.pushNamed(context, routeChatChannel, + arguments: channel); + }, + ), + ), + ), + ); + } +} +``` + +There are two important things to note in the above code: + +- We’re accessing the global **NavigatorState** using Provider and calling `pop()` on the back press. This will ensure that this entire route is disposed of and that the Stream connection is closed. +- Within `onChannelTap` we’re calling `pushNamed` and passing in the route to display a single channel page. This uses the navigator introduced in **ChatSetup**, which is the closest navigator within the widget tree. + +A few things to take note of: + +- You’ll always need to access the global navigator if you want to dispose of this route. you need to ensure that this route is popped or replaced, otherwise, the Stream connection will remain active for as long as the chat route is on the stack (or manually disconnected). + +## Option 3: Navigator 2.0 - Using GoRouter + +This final example will be a combination of the first two options. The following code is an example of how to initialize Stream Chat in a part of the widget tree using the [GoRouter package](https://pub.dev/packages/go_router). This solution will change depending on how you do routing in your Flutter application and which package (if any) you use. + +### Application Routes and Conditional Stream Initialization + +For this example we have the following routes and nested routes: + +```dart +|_ '/' -> home page + |_ 'settings/' - settings page + |_ 'chat/' - chat home, shows the channels list page + |_ 'channel/' - specific channel page +``` + +In the **MyApp** widget, we’ll initialize **GoRouter** and the **StreamChatClient**. +However, we will only expose the **StreamChat** widget for certain routes. +Additionally, we’ll create a **ChatSetup** widget that connects and disconnects the user. +This widget will also **only** be injected for the `/chat` routes. + +```dart +class MyApp extends StatefulWidget { + const MyApp({ + Key? key, + }) : super(key: key); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + final _client = StreamChatClient( + 'q29npdvqjr99', + logLevel: Level.OFF, + ); + bool wasPreviousRouteChat = false; + + late final _router = GoRouter( + initialLocation: '/', + navigatorBuilder: (context, state, child) { + if (state.location.startsWith('/chat')) { + wasPreviousRouteChat = true; + return StreamChat( + client: _client, + child: ChatSetup(client: _client, child: child), + ); + } else { + if (wasPreviousRouteChat) { + wasPreviousRouteChat = false; + return StreamChat( + client: _client, + child: child, + ); + } else { + return child; + } + } + }, + routes: [ + GoRoute( + path: '/', + builder: (context, state) => const HomeScreen(), + routes: [ + GoRoute( + path: 'settings', + builder: (context, state) => const SettingsPage(), + ), + GoRoute( + path: 'chat', + builder: (context, state) => const ChannelListPage(), + routes: [ + GoRoute( + path: 'channel', + builder: (context, state) { + final channel = state.extra as Channel; + return StreamChannel( + channel: channel, + child: const ChannelPage(), + ); + }, + ), + ], + ), + ], + ), + ], + ); + + @override + Widget build(BuildContext context) { + return MaterialApp.router( + routeInformationParser: _router.routeInformationParser, + routeInformationProvider: _router.routeInformationProvider, + routerDelegate: _router.routerDelegate, + ); + } +} +``` + +If you’re unfamiliar with GoRouter it will help to first read the documentation and then come back to this guide. + +There are a few important things to note in the above code: + +- Define our routes and nested routes +- Specify the initial route with `initialLocation` +- Use the `navigatorBuilder` to wrap certain routes with **StreamChat** and **ChatSetup**. + - The `wasPreviousRouteChat` \***\*boolean is used to determine if the previous route was a chat route. This is important because when you press the back button from the `/chat` route and navigate to the `/` route, the **StreamChat** widget still needs to be accessible while the navigation transition occurs. However, if you then navigate to the `/setting` route, you no longer need the **StreamChat\*\* widget and can safely remove it. + +### Navigating With GoRouter + +Within the **HomeScreen** you can create a button that on press navigates to the `/chat` route: + +```dart +GoRouter.of(context).go('/chat'); +``` + +### Connecting and Disconnecting Users + +Same as before, we’ll use the **ChatSetup** widget to connect and disconnect a user. +This time the widget also takes in a **child** widget to display once the connection is finished. +The child widget is dependent on the route we’re navigating to. + +```dart +class ChatSetup extends StatefulWidget { + const ChatSetup({ + Key? key, + required this.client, + required this.child, + }) : super(key: key); + + final StreamChatClient client; + final Widget child; + + @override + State createState() => _ChatSetupState(); +} + +class _ChatSetupState extends State { + late final Future connectionFuture; + + @override + void initState() { + super.initState(); + connectionFuture = widget.client.connectUser( + User(id: 'USER_ID'), + 'TOKEN', + ); + } + + @override + void dispose() { + widget.client.disconnectUser(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Material( + child: FutureBuilder( + future: connectionFuture, + builder: (BuildContext context, AsyncSnapshot snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return const Center( + child: CircularProgressIndicator(), + ); + default: + if (snapshot.hasError) { + return Text('Error: ${snapshot.error}'); + } else { + return widget.child; + } + } + }, + ), + ); + } +} +``` + +This will connect the Stream chat user within `initState` and disconnect the user on `dispose`. This is similar to the previous examples we explored. + +### Displaying the Stream UI Widgets + +The **ChannelListPage** can look something like the following: + +```dart +class ChannelListPage extends StatefulWidget { + const ChannelListPage({ + super.key, + }); + + @override + State createState() => _ChannelListPageState(); +} + +class _ChannelListPageState extends State { + late final client = StreamChat.of(context).client; + late final _controller = StreamChannelListController( + client: client, + filter: Filter.in_( + 'members', + [StreamChat.of(context).currentUser!.id], + ), + channelStateSort: const [SortOption('last_message_at')], + ); + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(), + body: RefreshIndicator( + onRefresh: _controller.refresh, + child: StreamChannelListView( + controller: _controller, + onChannelTap: (channel) { + GoRouter.of(context).go('/chat/channel', extra: channel); + }, + ), + ), + ); + } +} +``` + +This is the same as before, the only difference is that the navigation is slightly different; now we’re navigating to the `/chat/channel` route for individual channel pages. + +## Conclusion + +This guide demonstrated three different ways to initialize Stream Chat in a part of the Flutter widget tree. + +There are two key takeaways + +1. Accessing **StreamChat** depends on your location in the widget tree +2. How you ultimately decide to expose **StreamChat** and connect users will be up to your application architecture and how you manage routing. + +The above are only examples that can be refined and tweaked to suit your needs. diff --git a/docusaurus/docs/Flutter/05-guides/_category_.json b/docusaurus/docs/Flutter/05-guides/_category_.json new file mode 100644 index 00000000..14a4f173 --- /dev/null +++ b/docusaurus/docs/Flutter/05-guides/_category_.json @@ -0,0 +1,3 @@ +{ + "label": "Guides" +} \ No newline at end of file diff --git a/docusaurus/docs/Flutter/assets/firebase_cloud_secrets_management.jpg b/docusaurus/docs/Flutter/assets/firebase_cloud_secrets_management.jpg new file mode 100644 index 00000000..4f131df4 Binary files /dev/null and b/docusaurus/docs/Flutter/assets/firebase_cloud_secrets_management.jpg differ diff --git a/docusaurus/docs/Flutter/assets/firebase_stream_chat_extension_usage.jpg b/docusaurus/docs/Flutter/assets/firebase_stream_chat_extension_usage.jpg new file mode 100644 index 00000000..7374a67f Binary files /dev/null and b/docusaurus/docs/Flutter/assets/firebase_stream_chat_extension_usage.jpg differ diff --git a/docusaurus/docs/Flutter/assets/install_stream_chat_firebase_extension.jpg b/docusaurus/docs/Flutter/assets/install_stream_chat_firebase_extension.jpg new file mode 100644 index 00000000..309ecce1 Binary files /dev/null and b/docusaurus/docs/Flutter/assets/install_stream_chat_firebase_extension.jpg differ diff --git a/docusaurus/docs/Flutter/assets/stream_chat_app_access_keys.jpg b/docusaurus/docs/Flutter/assets/stream_chat_app_access_keys.jpg new file mode 100644 index 00000000..1a869cc8 Binary files /dev/null and b/docusaurus/docs/Flutter/assets/stream_chat_app_access_keys.jpg differ diff --git a/docusaurus/docs/Flutter/assets/stream_firebase_extension_configuration.jpg b/docusaurus/docs/Flutter/assets/stream_firebase_extension_configuration.jpg new file mode 100644 index 00000000..0c212931 Binary files /dev/null and b/docusaurus/docs/Flutter/assets/stream_firebase_extension_configuration.jpg differ diff --git a/docusaurus/docs/Flutter/basics/_category_.json b/docusaurus/docs/Flutter/basics/_category_.json deleted file mode 100644 index 76d33569..00000000 --- a/docusaurus/docs/Flutter/basics/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Introduction", - "position": 1 -} \ No newline at end of file diff --git a/docusaurus/docs/Flutter/guides/_category_.json b/docusaurus/docs/Flutter/guides/_category_.json deleted file mode 100644 index cb58ac0d..00000000 --- a/docusaurus/docs/Flutter/guides/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Guides", - "position": 2 -} \ No newline at end of file diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/_category_.json b/docusaurus/docs/Flutter/stream_chat_flutter/_category_.json deleted file mode 100644 index 242afb7b..00000000 --- a/docusaurus/docs/Flutter/stream_chat_flutter/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Stream Chat Flutter", - "position": 3 -} \ No newline at end of file diff --git a/docusaurus/docs/Flutter/stream_chat_flutter_core/_category_.json b/docusaurus/docs/Flutter/stream_chat_flutter_core/_category_.json deleted file mode 100644 index 8d738e89..00000000 --- a/docusaurus/docs/Flutter/stream_chat_flutter_core/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Stream Chat Flutter Core", - "position": 4 -} \ No newline at end of file diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/basics/choose_package.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/basics/choose_package.mdx index 8be73f01..5d1acf79 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/basics/choose_package.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/basics/choose_package.mdx @@ -14,7 +14,7 @@ which allows you persist data locally which works with all packages. ### How do I choose? -#### The case for stream_chat_flutter +#### The case for `stream_chat_flutter` For the quickest way to integrate Stream Chat with your app, the UI SDK (`stream_chat_flutter`) is the way to go. `stream_chat_flutter` contains prebuilt components that manage most operations like data @@ -30,26 +30,26 @@ to request this through our support channels. Summary: -For the quickest and easiest way to add Chat to your app with prebuilt UI components, use stream_chat_flutter +For the quickest and easiest way to add Chat to your app with prebuilt UI components, use `stream_chat_flutter` -#### The case for stream_chat_flutter_core +#### The case for `stream_chat_flutter_core` -If your application involves UI that does not fit in with the stream_chat_flutter components, stream_chat_flutter_core +If your application involves UI that does not fit in with the `stream_chat_flutter` components, `stream_chat_flutter_core` strips away the UI associated with the components and provides the data fetching and manipulation capabilities while supplying builders for UI. This allows you to implement your own UI and themes completely independently while not worrying about writing functions for data and pagination. Summary: -For implementing your own custom UI while not having to worry about lower level API calls, use stream_chat_flutter_core. +For implementing your own custom UI while not having to worry about lower level API calls, use `stream_chat_flutter_core`. -#### The case for stream_chat +#### The case for `stream_chat` -The stream_chat package is the Low-level Client (LLC) of Stream Chat in Flutter. This package wraps +The `stream_chat` package is the Low-level Client (LLC) of Stream Chat in Flutter. This package wraps the underlying functionality of Stream Chat and allows the most customization in terms of UI, data, and architecture. Summary: -For the most control over the SDK and dealing with low level calls to the API, use stream_chat. +For the most control over the SDK and dealing with low level calls to the API, use `stream_chat`. diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/basics/introduction.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/basics/introduction.mdx index 99170774..365c3fec 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/basics/introduction.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/basics/introduction.mdx @@ -20,18 +20,18 @@ giving you complete control to ones that give you a rich out-of-the-box chat exp The packages that make up the Stream Chat SDK are: -1. Low Level Client (stream_chat): a pure Dart package that can be used on any Dart project. +1. Low Level Client (`stream_chat`): a pure Dart package that can be used on any Dart project. It provides a low-level client to access the Stream Chat service. -2. Core (stream_chat_flutter_core): provides business logic to fetch common things required +2. Core (`stream_chat_flutter_core`): provides business logic to fetch common things required for integrating Stream Chat into your application. The core package allows more customisation and hence provides business logic but no UI components. -3. UI (stream_chat_flutter): this library includes both a low-level chat SDK and a set of -reusable and customisable UI components. -4. Persistence (stream_chat_persistence): provides a persistence client for fetching and +3. UI (`stream_chat_flutter`): this library includes both a low-level chat SDK and a set of +reusable and customizable UI components. +4. Persistence (`stream_chat_persistence`): provides a persistence client for fetching and saving chat data locally. -5. Localizations (stream_chat_localizations): provides a set of localizations for the SDK. +5. Localizations (`stream_chat_localizations`): provides a set of localizations for the SDK. -We recommend building prototypes using the full UI package, [stream_chat_flutter](https://pub.dev/packages/stream_chat_flutter), +We recommend building prototypes using the full UI package, [`stream_chat_flutter`](https://pub.dev/packages/stream_chat_flutter), since it contains UI widgets already integrated with Stream's API. It is the fastest way to get up and running using Stream chat in your app. @@ -39,7 +39,7 @@ The Flutter SDK enables you to build any type of chat or messaging experience fo and Desktop. If you're building a very custom UI and would prefer a more lean package, -[stream_chat_flutter_core](https://pub.dev/packages/stream_chat_flutter_core) will be suited to this +[`stream_chat_flutter_core`](https://pub.dev/packages/stream_chat_flutter_core) will be suited to this use case. Core allows you to build custom, expressive UIs while retaining the benefits of our full Flutter SDK. APIs for accessing and controlling users, sending messages, and so forth are seamlessly integrated into this package and accessible via providers and builders. @@ -69,7 +69,7 @@ While this is a simplistic overview of the service, the Flutter SDK handles the Before reading the docs, consider trying our [online API tour](https://getstream.io/chat/get_started/), it is a nice way to learn how the API works. -It's in-browser so you'll need to use Javascript but the core conceps are pretty much the same as Dart. +It's in-browser so you'll need to use JavaScript but the core concepts are pretty much the same as Dart. You may also like to look at the [Flutter tutorial](https://getstream.io/chat/flutter/tutorial/) which focuses on using the UI package to get Stream Chat integrated into a Flutter app. diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/basics/versioning_policy.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/basics/versioning_policy.mdx index 48f25d66..99ec8111 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/basics/versioning_policy.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/basics/versioning_policy.mdx @@ -4,7 +4,7 @@ sidebar_position: 3 title: Versioning Policy --- -All of the Stream Chat packages follow [semantic versioning (semver)](https://semver.org/). +All of the Stream Chat packages follow [semantic versioning](https://semver.org/). That means that with a version number x.y.z (major.minor.patch): - When releasing bug fixes (backwards compatible), we make a patch release by changing the z number (ex: 3.6.2 to 3.6.3). A bug fix is defined as an internal change that fixes incorrect behavior. diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_custom_attachments.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_custom_attachments.mdx index 9fe7f6aa..f8064ca2 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_custom_attachments.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_custom_attachments.mdx @@ -27,7 +27,7 @@ Let's build an example of location sharing option in the app: ![](../assets/location_sharing_example.jpg) -* Show a "Share Location" button next to MessageInput Textfield. +* Show a "Share Location" button next to MessageInput `Textfield`. * When the user presses this button, it should fetch the current location coordinates of the user, and send a message on the channel as follows: @@ -47,7 +47,7 @@ Message( ) ``` -For our example, we are going to use [geolocator](https://pub.dev/packages/geolocator) library. +For our example, we are going to use [`geolocator`](https://pub.dev/packages/geolocator) library. Please check their [setup instructions](https://pub.dev/packages/geolocator) on their docs. NOTE: If you are testing on iOS simulator, you will need to set some dummy coordinates, as mentioned [here](https://stackoverflow.com/a/31238119/7489541). @@ -55,7 +55,7 @@ Also don't forget to enable "location update" capability in background mode, fro On the receiver end, `location` type attachment should be rendered in map view, in the `MessageListView`. We are going to use [Google Static Maps API](https://developers.google.com/maps/documentation/maps-static/overview) to render the map in the message. -You can use other libraries as well such as [google_maps_flutter](https://pub.dev/packages/google_maps_flutter). +You can use other libraries as well such as [`google_maps_flutter`](https://pub.dev/packages/google_maps_flutter). First, we add a button which when clicked fetches and shares location into the `MessageInput`: diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_local_data_persistence.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_local_data_persistence.mdx index e6283ca0..452ffcae 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_local_data_persistence.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_local_data_persistence.mdx @@ -28,7 +28,7 @@ final client = StreamChatClient( )..chatPersistenceClient = CustomChatPersistentClient(); ``` -We provide an official persistent client in the [stream_chat_persistence](https://pub.dev/packages/stream_chat_persistence) +We provide an official persistent client in the [`stream_chat_persistence`](https://pub.dev/packages/stream_chat_persistence) package that works using the library [moor](https://moor.simonbinder.eu), an SQLite ORM. Add this to your package's `pubspec.yaml` file, using the latest version. diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_localization.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_localization.mdx index c61f26c7..b4e56efb 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_localization.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_localization.mdx @@ -32,6 +32,10 @@ At the moment we support the following languages: - [Spanish](https://github.com/GetStream/stream-chat-flutter/blob/master/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart) - [Japanese](https://github.com/GetStream/stream-chat-flutter/blob/master/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart) - [Korean](https://github.com/GetStream/stream-chat-flutter/blob/master/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart) +- [Portuguese](https://github.com/GetStream/stream-chat-flutter/blob/master/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart) +- [German](https://github.com/GetStream/stream-chat-flutter/blob/master/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart) + + More languages will be added in the future. Feel free to [contribute](https://github.com/GetStream/stream-chat-flutter/blob/master/CONTRIBUTING.md) to add more languages. ### Add dependency diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_push_notifications.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_push_notifications.mdx index 328ba546..3ec661aa 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_push_notifications.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_push_notifications.mdx @@ -21,7 +21,7 @@ Make sure to check [this section](https://getstream.io/chat/docs/flutter-dart/pu ### Setup FCM -To integrate push notifications in your Flutter app you need to use the package [firebase_messaging](https://pub.dev/packages/firebase_messaging). +To integrate push notifications in your Flutter app you need to use the package [`firebase_messaging`](https://pub.dev/packages/firebase_messaging). Follow the [Firebase documentation](https://firebase.flutter.dev/docs/messaging/overview/) to know how to set up the plugin for both Android and iOS. @@ -61,7 +61,7 @@ Upload the `Server Key` in your chat dashboard :::note -We are setting up the Android section, but this will work for both Android and iOS if you're using Firebase for both of them! +We are setting up the Android section, but this will work for both Android and iOS if you're using Firebase for both of them. ::: #### Step 6 @@ -97,21 +97,21 @@ firebaseMessaging.onTokenRefresh.listen((token) { ### Possible issues -We only send push notifications when the user doesn't have any active websocket connection (which is established when you call `client.connectUser`). If you set the [onBackgroundEventReceived](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/onBackgroundEventReceived.html) property of the StreamChat widget, when your app goes to background, your device will keep the ws connection alive for 1 minute, and so within this period, you won't receive any push notification. +We only send push notifications when the user doesn't have any active web socket connection (which is established when you call `client.connectUser`). If you set the [onBackgroundEventReceived](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/onBackgroundEventReceived.html) property of the StreamChat widget, when your app goes to background, your device will keep the WS connection alive for 1 minute, and so within this period, you won't receive any push notification. Make sure to read the [general push docs](https://getstream.io/chat/docs/flutter-dart/push_introduction/?language=dart) in order to avoid known gotchas that may make your relationship with notifications go bad 😢 ### Testing if Push Notifications are Setup Correctly -If you're not sure if you've set up push notifications correctly (e.g. you don't always receive them, they work unreliably), you can follow these steps to make sure your config is correct and working: +If you're not sure if you've set up push notifications correctly (for example you don't always receive them, they work unreliably), you can follow these steps to make sure your configuration is correct and working: -1. Clone our repo for push testing git clone git@github.com:GetStream/chat-push-test.git +1. Clone our repository for push testing git clone git@github.com:GetStream/chat-push-test.git 2. `cd flutter` 3. In folder run `flutter pub get` -4. Input your api key and secret in `lib/main.dart` +4. Input your API key and secret in `lib/main.dart` 5. Change the bundle identifier/application ID and development team/user so you can run the app in your device (**do not** run on iOS simulator, Android emulator is fine) @@ -137,11 +137,11 @@ You should get a test push notification The [StreamChat](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat-class.html) widget lets you define a [onBackgroundEventReceived](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/onBackgroundEventReceived.html) handler in order to handle events while the app is in the background, but the client is still connected. -This is useful because it lets you keep the connection alive in cases in which the app goes in the background just for some seconds (eg: multitasking, picking pictures from the gallery...) +This is useful because it lets you keep the connection alive in cases in which the app goes in the background just for some seconds (for example multitasking, picking pictures from the gallery...) You can even customize the [backgroundKeepAlive](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/backgroundKeepAlive.html) duration. -In order to show notifications in such a case we suggest using the package [flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications); follow the package guide to successfully set up the plugin. +In order to show notifications in such a case we suggest using the package [`flutter_local_notifications`](https://pub.dev/packages/flutter_local_notifications); follow the package guide to successfully set up the plugin. Once that's done you should set the [onBackgroundEventReceived](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/onBackgroundEventReceived.html); here is an example: @@ -234,7 +234,7 @@ To do this we need to update the push notification data payload at Stream Dashbo } ``` -Then we need to integrate the package [stream_chat_persistence](https://pub.dev/packages/stream_chat_persistence) in our app that exports a persistence client, learn [here](https://pub.dev/packages/stream_chat_persistence#usage) how to set it up. +Then we need to integrate the package [`stream_chat_persistence`](https://pub.dev/packages/stream_chat_persistence) in our app that exports a persistence client, learn [here](https://pub.dev/packages/stream_chat_persistence#usage) how to set it up. Then during the call `firebaseMessaging.configure(...)` we need to set the `onBackgroundMessage` parameter using a TOP-LEVEL or STATIC function to handle background messages; here is an example: diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_push_notifications_v2.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_push_notifications_v2.mdx index 285c2205..0fe36702 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_push_notifications_v2.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/adding_push_notifications_v2.mdx @@ -17,7 +17,7 @@ You can read more about Stream’s [push delivery logic](https://getstream.io/ch ### Setup FCM -To integrate push notifications in your Flutter app, you need to use the package [firebase_messaging](https://pub.dev/packages/firebase_messaging). +To integrate push notifications in your Flutter app, you need to use the package [`firebase_messaging`](https://pub.dev/packages/firebase_messaging). Follow the [Firebase documentation](https://firebase.flutter.dev/docs/messaging/overview/) to set up the plugin for Android and iOS. @@ -55,7 +55,7 @@ You can upload your Firebase credentials using either the dashboard or the app s ![](../assets/firebase_notifications_toggle-5aeabfcbdc24cb8f1fea7d41d0e845fc.png) -3. Enter your Firebase Credentials and press "Save". +3. Enter your Firebase Credentials and press `"Save"`. ##### Using the API @@ -97,7 +97,7 @@ On iOS we send both a **notification** and a **data** payload. This means you don't need to do anything special to get the notification to show up. However, you might want to handle the data payload to perform some logic when the user taps on the notification. To update the template, you can use a backend SDK. -For example, using the javascript SDK: +For example, using the JavaScript SDK: ```js const client = StreamChat.getInstance(‘api_key’, ‘api_secret’); @@ -173,13 +173,13 @@ void handleNotification( FirebaseMessaging.onBackgroundMessage(onBackgroundMessage); ``` -In the above example, you get the message details using the `getMessage` method and then you use the [flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications) package to show the actual notification. +In the above example, you get the message details using the `getMessage` method and then you use the [`flutter_local_notifications`](https://pub.dev/packages/flutter_local_notifications) package to show the actual notification. ##### Using a Template on Android It's still possible to add a **notification** payload to Android notifications. You can do so by adding a template using a backend SDK. -For example, using the javascript SDK: +For example, using the JavaScript SDK: ```js const client = StreamChat.getInstance(‘api_key’, ‘api_secret’); @@ -203,11 +203,11 @@ Make sure to read the [general push notification docs](https://getstream.io/chat ### Testing if Push Notifications are Setup Correctly -If you're not sure whether you've set up push notifications correctly, for example, you don't always receive them, or they don’t work reliably, then you can follow these steps to make sure your config is correct and working: -1. Clone our repo for push testing: `git clone git@github.com:GetStream/chat-push-test.git` +If you're not sure whether you've set up push notifications correctly, for example, you don't always receive them, or they don’t work reliably, then you can follow these steps to make sure your configuration is correct and working: +1. Clone our repository for push testing: `git clone git@github.com:GetStream/chat-push-test.git` 2. `cd flutter` 3. In that folder run `flutter pub get` -4. Input your api key and secret in `lib/main.dart` +4. Input your API key and secret in `lib/main.dart` 5. Change the bundle identifier/application ID and development team/user so you can run the app on your physical device.**Do not** run on an iOS simulator, as it will not work. Testing on an Android emulator is fine. 6. Add your `google-services.json/GoogleService-Info.plist` 7. Run the app @@ -249,7 +249,7 @@ Take a look at the [Stream Chat v1 sample app](https://github.com/GetStream/flut When the app is closed you may want to save received messages when you receive them via a notification so that later on when you open the app they're already there. -To do this you need to integrate the package [stream_chat_persistence](https://pub.dev/packages/stream_chat_persistence) in our app that exports a persistence client, see [here](https://pub.dev/packages/stream_chat_persistence#usage) how to set it up. +To do this you need to integrate the package [`stream_chat_persistence`](https://pub.dev/packages/stream_chat_persistence) in our app that exports a persistence client, see [here](https://pub.dev/packages/stream_chat_persistence#usage) how to set it up. Then calling `FirebaseMessaging.onBackgroundMessage(...)` you need to use a TOP-LEVEL or STATIC function to handle background messages; here is an example: diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/customize_message_actions.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/customize_message_actions.mdx index c3dc2aba..b2157444 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/customize_message_actions.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/customize_message_actions.mdx @@ -37,7 +37,7 @@ Additionally, pinning a message requires you to add the roles which are allowed ### Partially remove some message actions -For example, if you only want to keep "copy message" and "delete message", +For example, if you only want to keep `"copy message"` and `"delete message"`, here is how to do it using the `messageBuilder` with our `MessageWidget`. ```dart diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/end_to_end_chat_encryption.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/end_to_end_chat_encryption.mdx index 8a85c6a5..6c7b4ec0 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/end_to_end_chat_encryption.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/end_to_end_chat_encryption.mdx @@ -36,7 +36,7 @@ Check out the diagram below for an example: ### Dependencies -Add the [webcrypto](https://pub.dev/packages/webcrypto) package in your `pubspec.yaml` file. +Add the [`webcrypto`](https://pub.dev/packages/webcrypto) package in your `pubspec.yaml` file. ```yaml dependencies: @@ -76,9 +76,9 @@ class JsonWebKeyPair { } ``` -### Generate a Crypto Key +### Generate a Cryptographic Key -Next, create a symmetric **Crypto Key** using the keys generated in the previous step. +Next, create a symmetric **Cryptographic Key** using the keys generated in the previous step. You will use those keys to encrypt and decrypt messages. ```dart @@ -107,7 +107,7 @@ Future> deriveKey(String senderJwk, String receiverJwk) async { ### Encrypting Messages -Once you have generated the **Crypto Key**, you're ready to encrypt the message. +Once you have generated the **Cryptographic Key**, you're ready to encrypt the message. You can use the **AES-GCM** algorithm for its known security and performance balance and good browser availability. ```dart @@ -253,6 +253,6 @@ MessageListView( ), ``` -That's it! That's all you need to implement E2EE in a Stream powered chat app. +That's it. That's all you need to implement E2EE in a Stream powered chat app. For more details, check out our [end-to-end encrypted chat article](https://getstream.io/blog/end-to-end-encrypted-chat-in-flutter/#whats-end-to-end-encryption). diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/migration_guide_2_0.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/migration_guide_2_0.mdx index 89b6dacc..29619433 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/migration_guide_2_0.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/migration_guide_2_0.mdx @@ -75,7 +75,7 @@ Added video compress options (frame and quality) to MessageInput `TypingIndicator` now has a property called `parentId` to show typing indicator specific to threads #493: add support for `MessageListView` header/footer `MessageWidget` accepts a `userAvatarBuilder` -Added `pinMessage` ui support +Added `pinMessage` UI support Added `MessageListView.threadSeparatorBuilder` property Added `MessageInput.onError` property to allow error handling Added `GalleryHeader`/`GalleryFooter` theme classes @@ -202,20 +202,20 @@ in the constructor) #### 🛑️ Breaking Changes from 1.5.3 * Migrate this package to null safety -* `ConnectUserWithProvider` now requires `tokenProvider` as a required param. (Removed from the constructor) +* `ConnectUserWithProvider` now requires `tokenProvider` as a required parameter. (Removed from the constructor) * `client.disconnect()` is now divided into two different functions - * `client.closeConnection()` -> for closing user websocket connection. + * `client.closeConnection()` -> for closing user web socket connection. * `client.disconnectUser()` -> for disconnecting user and resetting client state. * `client.devToken()` now returns a Token model instead of String. * `ApiError` is removed in favor of `StreamChatError` * `StreamChatError` -> parent type for all the stream errors. - * `StreamWebSocketError` -> for user websocket related errors. + * `StreamWebSocketError` -> for user web socket related errors. * `StreamChatNetworkError` -> for network related errors. -* `client.queryChannels()`, `channel.query()` options param is removed in favor of individual params +* `client.queryChannels()`, `channel.query()` options parameter is removed in favor of individual parameters * `option.state` -> `bool state` * `option.watch` -> `bool watch` * `option.presence` -> `bool presence` -* `client.queryUsers()` options param is removed in favor of individual params +* `client.queryUsers()` options parameter is removed in favor of individual parameters * `option.presence` -> `bool presence` * Added typed filters @@ -227,8 +227,8 @@ in the constructor) #### ✅ Added -* New Location enum is introduced for easily changing the client location/baseUrl. -* New `client.openConnection()` and `client.closeConnection()` is introduced to connect/disconnect user ws connection. +* New Location `enum` is introduced for easily changing the client location/baseUrl. +* New `client.openConnection()` and `client.closeConnection()` is introduced to connect/disconnect user WS connection. * New `client.partialUpdateMessage` and `channel.partialUpdateMessage` methods * `connectWebSocket` parameter in connect user calls to use the client in "connection-less" mode. @@ -253,29 +253,29 @@ dependencies: Upon doing this, all breaking changes from the package will take immediate effect. Here are steps to remedy the issues: -1) Change over the constructor of `connectUserWithProvider()` to the new format which has `tokenProvider` as a required param. +1) Change over the constructor of `connectUserWithProvider()` to the new format which has `tokenProvider` as a required parameter. 2) We added more nuance to `disconnectUser()` by adding two new methods - one to close the connection and the other to disconnect the user. This allows more fine-grained control of disconnection. - * `client.closeConnection()` -> for closing user websocket connection. + * `client.closeConnection()` -> for closing user web socket connection. * `client.disconnectUser()` -> for disconnecting user and resetting client state. 3) We refactored how we handle errors - new error types are now introduced that replace ApiError. * `StreamChatError` -> parent type for all the stream errors. - * `StreamWebSocketError` -> for user websocket related errors. + * `StreamWebSocketError` -> for user web socket related errors. * `StreamChatNetworkError` -> for network related errors. 4) We changed over from a map full of options to a more type-safe and sound approach by changing over to explicit parameters. Use these explicit parameters in the query parameters instead of the option keys: -* `client.queryChannels()`, `channel.query()` options param is removed in favor of individual params +* `client.queryChannels()`, `channel.query()` options parameter is removed in favor of individual parameters * `option.state` -> `bool state` * `option.watch` -> `bool watch` * `option.presence` -> `bool presence` -* `client.queryUsers()` options param is removed in favor of individual params +* `client.queryUsers()` options parameter is removed in favor of individual parameters * `option.presence` -> `bool presence` 5) We added type-safe filters to make filtering in the app easier. Change over the filters to the diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/understanding_filters.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/understanding_filters.mdx index 292afd07..45810913 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/understanding_filters.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/understanding_filters.mdx @@ -24,7 +24,7 @@ Filter.equal('type', 'messaging'), #### Filter.notEqual -The 'notEqual' filter gets the objects where the given key does not have the specified value. +The `notEqual` filter gets the objects where the given key does not have the specified value. ```dart Filter.notEqual('type', 'messaging'), @@ -64,20 +64,20 @@ Filter.lessOrEqual('count', 5), #### Filter.in_ -The 'in_' filter allows getting objects where the key matches any in a specified array. +The ``in_` filter allows getting objects where the key matches any in a specified array. ```dart Filter.in_('members', [user.id]) ``` :::note -Since 'in' is a keyword in Dart, the filter has an underscore added. This does not apply to the 'notIn' +Since `in` is a keyword in Dart, the filter has an underscore added. This does not apply to the `notIn` keyword. ::: #### Filter.notIn -The 'notIn' filter allows getting objects where the key matches none in a specified array. +The `notIn` filter allows getting objects where the key matches none in a specified array. ```dart Filter.notIn('members', [user.id]) @@ -109,7 +109,7 @@ Filter.exists('name') #### Filter.notExists -The 'notExists' filter checks if the specified key doesn't exist. This is a simplified call to `Filter.exists` +The `notExists` filter checks if the specified key doesn't exist. This is a simplified call to `Filter.exists` with the value set to false. ```dart diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/user_token_generation_with_firebase_auth.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/user_token_generation_with_firebase_auth.mdx index 56192f53..98868400 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/user_token_generation_with_firebase_auth.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/guides/user_token_generation_with_firebase_auth.mdx @@ -155,7 +155,7 @@ Running the above will give this: ![](../assets/authentication_demo_app.jpg) The `Auth` widget handles all of the authentication logic. It initializes a `FirebaseAuth.instance` and uses that -in the `createAccount`, `signIn` and `signOut` methods. There is a button to envoke each of these methods. +in the `createAccount`, `signIn` and `signOut` methods. There is a button to invoke each of these methods. The `FirebaseFunctions.instance` will be used later in this guide. @@ -289,7 +289,7 @@ firebase deploy --only functions ### Create a Stream User and Get the User's Token In the `createStreamUserAndGetToken` cloud function you create an `onCall` HTTPS handler, which exposes -a cloud function that can be envoked from your Flutter app. +a cloud function that can be invoked from your Flutter app. ```js // Create a Stream user and return auth token. @@ -325,13 +325,13 @@ by ensuring that `context.auth` is not null. If it is null, then it throws an `H message. This error can be caught in your Flutter application. If the caller is authenticated the function proceeds to use the `serverClient` to create a new Stream Chat -user by calling the `upsertUser` method and passing in some user data. It uses the authenticated caller's **uid** as an **id**. +user by calling the `upsertUser` method and passing in some user data. It uses the authenticated caller's **`uid`** as an **id**. After the user is created it generates a token for that user. This token is then returned to the caller. To call this from Flutter, you will need to use the `cloud_functions` package. -Update the **createAccount** method in your Flutter code to the following: +Update the **`createAccount`** method in your Flutter code to the following: ```dart Future createAccount() async { @@ -355,7 +355,7 @@ in the request. Once you have the Stream user token, you can authenticate your Stream Chat user as you normally would. -Please see our [initialization documention](https://getstream.io/chat/docs/flutter-dart/init_and_users/?language=dart) for more information. +Please see our [initialization documentation](https://getstream.io/chat/docs/flutter-dart/init_and_users/?language=dart) for more information. As you can see below, the User ID matches on both Firebase's and Stream's user database. @@ -373,7 +373,7 @@ As you can see below, the User ID matches on both Firebase's and Stream's user d The `getStreamUserToken` cloud function is very similar to the `createStreamUserAndGetToken` function. The only difference is that it only creates a user token and does not create a new user account on Stream. -Update the **signIn** method in your Flutter code to the following: +Update the **`signIn`** method in your Flutter code to the following: ```dart Future signIn() async { @@ -434,7 +434,7 @@ exports.deleteStreamUser = functions.auth.user().onDelete((user, context) => { ``` In this function, you are listening to delete events on Firebase auth. When an account is deleted, this function will be triggered, and you can get the -user's **uid** and call the `deleteUser` method on the `serverClient`. +user's **`uid`** and call the `deleteUser` method on the `serverClient`. This is not an external cloud function; it can only be triggered when an account is deleted. diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter/channel_list_header.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter/channel_list_header.mdx index d6930cb4..8979d378 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter/channel_list_header.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter/channel_list_header.mdx @@ -60,7 +60,7 @@ ChannelListHeader( ![](../assets/channel_list_header_custom_subtitle.png) -The `titleBuilder` param helps you build different titles depending on the connection state: +The `titleBuilder` parameter helps you build different titles depending on the connection state: ```dart //... diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter/channel_list_view.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter/channel_list_view.mdx index eb7baf20..547e47b9 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter/channel_list_view.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter/channel_list_view.mdx @@ -25,7 +25,7 @@ widget. ### Basic Example Here is a basic example of the `ChannelListView` widget. It consists of the main widget itself, a `Filter` -to filter only the channels that the user is a part of, sorting by last message time, pagination params, +to filter only the channels that the user is a part of, sorting by last message time, pagination parameters, and the widget to use when a particular channel is clicked. ```dart @@ -54,7 +54,7 @@ the widget. ### Customizing the Channel Preview A common aspect of the widget needed to be tweaked according to each app is the Channel Preview (the -Channel tile in the list). To do this, we use the `channelPreviewBuilder` param like this: +Channel tile in the list). To do this, we use the `channelPreviewBuilder` parameter like this: ```dart ChannelListView( @@ -90,7 +90,7 @@ This adds two basic actions - info and delete: ![](../assets/swipe_channel.png) -To add custom actions of your own, use the `swipeActions` param: +To add custom actions of your own, use the `swipeActions` parameter: ```dart ChannelListView( diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter/setup.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter/setup.mdx index 22e5c6c5..6b33e612 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter/setup.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter/setup.mdx @@ -41,8 +41,8 @@ which will be addressed by the respective plugin creators over time. The library uses [flutter file picker plugin](https://github.com/miguelpruivo/flutter_file_picker) to pick files from the os. Follow [this wiki](https://github.com/miguelpruivo/flutter_file_picker/wiki/Setup#ios) to fulfill iOS requirements. -We also use [video_player](https://pub.dev/packages/video_player) to reproduce videos. +We also use [`video_player`](https://pub.dev/packages/video_player) to reproduce videos. Follow [this guide](https://pub.dev/packages/video_player#installation) to fulfill the requirements. -To pick images from the camera, we use the [image_picker](https://pub.dev/packages/image_picker) plugin. +To pick images from the camera, we use the [`image_picker`](https://pub.dev/packages/image_picker) plugin. Follow [these instructions](https://pub.dev/packages/image_picker#ios) to check the requirements. diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/channel_list_core.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/channel_list_core.mdx index 4196a14c..aa1490f2 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/channel_list_core.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/channel_list_core.mdx @@ -13,7 +13,7 @@ according to the filters and sort order given. However, in some cases, implement that cannot be done using the customization approaches given in the widget. To do this, we extracted the logic required for fetching channels into a 'Core' widget - a widget that -fetches channels in the expected way via the usual params but does not supply any UI and instead +fetches channels in the expected way via the usual parameters but does not supply any UI and instead exposes builders to build the UI in situations such as loading, empty data, errors, and on data received. ### Basic Example diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/message_list_core.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/message_list_core.mdx index 5fd5877a..7302ead6 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/message_list_core.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/message_list_core.mdx @@ -13,7 +13,7 @@ according to the filters and sort order given. However, in some cases, implement that cannot be done using the customization approaches given in the widget. To do this, we extracted the logic required for fetching channels into a 'Core' widget - a widget that -fetches channels in the expected way via the usual params but does not supply any UI and instead +fetches channels in the expected way via the usual parameters but does not supply any UI and instead exposes builders to build the UI in situations such as loading, empty data, errors, and on data received. ### Basic Example diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/message_search_list_core.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/message_search_list_core.mdx index f3be5e85..bd4ad95d 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/message_search_list_core.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/message_search_list_core.mdx @@ -13,7 +13,7 @@ according to the filters and sort order given. However, in some cases, implement that cannot be done using the customization approaches given in the widget. To do this, we extracted the logic required for fetching channels into a 'Core' widget - a widget that -fetches channels in the expected way via the usual params but does not supply any UI and instead +fetches channels in the expected way via the usual parameters but does not supply any UI and instead exposes builders to build the UI in situations such as loading, empty data, errors, and on data received. ### Basic Example diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/stream_chat_core.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/stream_chat_core.mdx index 2a43ae52..cc342ebf 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/stream_chat_core.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/stream_chat_core.mdx @@ -9,7 +9,7 @@ theme and initialisations. `StreamChatCore` is used to provide information about the chat client to the widget tree. This Widget is used to react to life cycle changes and system updates. -When the app goes into the background, the websocket connection is automatically closed and when it goes back to foreground the connection is opened again. +When the app goes into the background, the web socket connection is automatically closed and when it goes back to foreground the connection is opened again. Like the `StreamChat` widget in the higher level UI package, the `StreamChatCore` widget should be on the top level before using any Stream functionality: diff --git a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/user_list_core.mdx b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/user_list_core.mdx index 622d0025..130155cd 100644 --- a/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/user_list_core.mdx +++ b/docusaurus/flutter_versioned_docs/version-3.x.x/Flutter/stream_chat_flutter_core/user_list_core.mdx @@ -13,7 +13,7 @@ according to the filters and sort order given. However, in some cases, implement that cannot be done using the customization approaches given in the widget. To do this, we extracted the logic required for fetching channels into a 'Core' widget - a widget that -fetches channels in the expected way via the usual params but does not supply any UI and instead +fetches channels in the expected way via the usual parameters but does not supply any UI and instead exposes builders to build the UI in situations such as loading, empty data, errors, and on data received. ### Basic Example diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/basics/choose_package.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/basics/choose_package.mdx index 8be73f01..5d1acf79 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/basics/choose_package.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/basics/choose_package.mdx @@ -14,7 +14,7 @@ which allows you persist data locally which works with all packages. ### How do I choose? -#### The case for stream_chat_flutter +#### The case for `stream_chat_flutter` For the quickest way to integrate Stream Chat with your app, the UI SDK (`stream_chat_flutter`) is the way to go. `stream_chat_flutter` contains prebuilt components that manage most operations like data @@ -30,26 +30,26 @@ to request this through our support channels. Summary: -For the quickest and easiest way to add Chat to your app with prebuilt UI components, use stream_chat_flutter +For the quickest and easiest way to add Chat to your app with prebuilt UI components, use `stream_chat_flutter` -#### The case for stream_chat_flutter_core +#### The case for `stream_chat_flutter_core` -If your application involves UI that does not fit in with the stream_chat_flutter components, stream_chat_flutter_core +If your application involves UI that does not fit in with the `stream_chat_flutter` components, `stream_chat_flutter_core` strips away the UI associated with the components and provides the data fetching and manipulation capabilities while supplying builders for UI. This allows you to implement your own UI and themes completely independently while not worrying about writing functions for data and pagination. Summary: -For implementing your own custom UI while not having to worry about lower level API calls, use stream_chat_flutter_core. +For implementing your own custom UI while not having to worry about lower level API calls, use `stream_chat_flutter_core`. -#### The case for stream_chat +#### The case for `stream_chat` -The stream_chat package is the Low-level Client (LLC) of Stream Chat in Flutter. This package wraps +The `stream_chat` package is the Low-level Client (LLC) of Stream Chat in Flutter. This package wraps the underlying functionality of Stream Chat and allows the most customization in terms of UI, data, and architecture. Summary: -For the most control over the SDK and dealing with low level calls to the API, use stream_chat. +For the most control over the SDK and dealing with low level calls to the API, use `stream_chat`. diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/basics/introduction.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/basics/introduction.mdx index 99170774..c98aa34f 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/basics/introduction.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/basics/introduction.mdx @@ -20,18 +20,18 @@ giving you complete control to ones that give you a rich out-of-the-box chat exp The packages that make up the Stream Chat SDK are: -1. Low Level Client (stream_chat): a pure Dart package that can be used on any Dart project. +1. Low Level Client (stre`am_chat): a pure Dart package that can be used on any Dart project. It provides a low-level client to access the Stream Chat service. -2. Core (stream_chat_flutter_core): provides business logic to fetch common things required +2. Core (`stream_chat_flutter_core`): provides business logic to fetch common things required for integrating Stream Chat into your application. The core package allows more customisation and hence provides business logic but no UI components. -3. UI (stream_chat_flutter): this library includes both a low-level chat SDK and a set of -reusable and customisable UI components. -4. Persistence (stream_chat_persistence): provides a persistence client for fetching and +3. UI (`stream_chat_flutter`): this library includes both a low-level chat SDK and a set of +reusable and customizable UI components. +4. Persistence (`stream_chat_persistence`): provides a persistence client for fetching and saving chat data locally. -5. Localizations (stream_chat_localizations): provides a set of localizations for the SDK. +5. Localizations (`stream_chat_localizations`): provides a set of localizations for the SDK. -We recommend building prototypes using the full UI package, [stream_chat_flutter](https://pub.dev/packages/stream_chat_flutter), +We recommend building prototypes using the full UI package, [`stream_chat_flutter`](https://pub.dev/packages/stream_chat_flutter), since it contains UI widgets already integrated with Stream's API. It is the fastest way to get up and running using Stream chat in your app. @@ -39,7 +39,7 @@ The Flutter SDK enables you to build any type of chat or messaging experience fo and Desktop. If you're building a very custom UI and would prefer a more lean package, -[stream_chat_flutter_core](https://pub.dev/packages/stream_chat_flutter_core) will be suited to this +[`stream_chat_flutter_core`](https://pub.dev/packages/stream_chat_flutter_core) will be suited to this use case. Core allows you to build custom, expressive UIs while retaining the benefits of our full Flutter SDK. APIs for accessing and controlling users, sending messages, and so forth are seamlessly integrated into this package and accessible via providers and builders. @@ -69,7 +69,7 @@ While this is a simplistic overview of the service, the Flutter SDK handles the Before reading the docs, consider trying our [online API tour](https://getstream.io/chat/get_started/), it is a nice way to learn how the API works. -It's in-browser so you'll need to use Javascript but the core conceps are pretty much the same as Dart. +It's in-browser so you'll need to use JavaScript but the core concepts are pretty much the same as Dart. You may also like to look at the [Flutter tutorial](https://getstream.io/chat/flutter/tutorial/) which focuses on using the UI package to get Stream Chat integrated into a Flutter app. diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/basics/versioning_policy.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/basics/versioning_policy.mdx index 48f25d66..99ec8111 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/basics/versioning_policy.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/basics/versioning_policy.mdx @@ -4,7 +4,7 @@ sidebar_position: 3 title: Versioning Policy --- -All of the Stream Chat packages follow [semantic versioning (semver)](https://semver.org/). +All of the Stream Chat packages follow [semantic versioning](https://semver.org/). That means that with a version number x.y.z (major.minor.patch): - When releasing bug fixes (backwards compatible), we make a patch release by changing the z number (ex: 3.6.2 to 3.6.3). A bug fix is defined as an internal change that fixes incorrect behavior. diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_custom_attachments.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_custom_attachments.mdx index 510e8c22..2d38cab1 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_custom_attachments.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_custom_attachments.mdx @@ -27,7 +27,7 @@ Let's build an example of location sharing option in the app: ![](../assets/location_sharing_example.jpg) -* Show a "Share Location" button next to StreamMessageInput Textfield. +* Show a "Share Location" button next to StreamMessageInput `Textfield`. * When the user presses this button, it should fetch the current location coordinates of the user, and send a message on the channel as follows: @@ -47,7 +47,7 @@ Message( ) ``` -For our example, we are going to use [geolocator](https://pub.dev/packages/geolocator) library. +For our example, we are going to use [`geolocator`](https://pub.dev/packages/geolocator) library. Please check their [setup instructions](https://pub.dev/packages/geolocator) on their docs. NOTE: If you are testing on iOS simulator, you will need to set some dummy coordinates, as mentioned [here](https://stackoverflow.com/a/31238119/7489541). @@ -55,7 +55,7 @@ Also don't forget to enable "location update" capability in background mode, fro On the receiver end, `location` type attachment should be rendered in map view, in the `StreamMessageListView`. We are going to use [Google Static Maps API](https://developers.google.com/maps/documentation/maps-static/overview) to render the map in the message. -You can use other libraries as well such as [google_maps_flutter](https://pub.dev/packages/google_maps_flutter). +You can use other libraries as well such as [`google_maps_flutter`](https://pub.dev/packages/google_maps_flutter). First, we add a button which when clicked fetches and shares location into the `MessageInput`: diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_local_data_persistence.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_local_data_persistence.mdx index e6283ca0..452ffcae 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_local_data_persistence.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_local_data_persistence.mdx @@ -28,7 +28,7 @@ final client = StreamChatClient( )..chatPersistenceClient = CustomChatPersistentClient(); ``` -We provide an official persistent client in the [stream_chat_persistence](https://pub.dev/packages/stream_chat_persistence) +We provide an official persistent client in the [`stream_chat_persistence`](https://pub.dev/packages/stream_chat_persistence) package that works using the library [moor](https://moor.simonbinder.eu), an SQLite ORM. Add this to your package's `pubspec.yaml` file, using the latest version. diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_push_notifications.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_push_notifications.mdx index 328ba546..3ec661aa 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_push_notifications.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_push_notifications.mdx @@ -21,7 +21,7 @@ Make sure to check [this section](https://getstream.io/chat/docs/flutter-dart/pu ### Setup FCM -To integrate push notifications in your Flutter app you need to use the package [firebase_messaging](https://pub.dev/packages/firebase_messaging). +To integrate push notifications in your Flutter app you need to use the package [`firebase_messaging`](https://pub.dev/packages/firebase_messaging). Follow the [Firebase documentation](https://firebase.flutter.dev/docs/messaging/overview/) to know how to set up the plugin for both Android and iOS. @@ -61,7 +61,7 @@ Upload the `Server Key` in your chat dashboard :::note -We are setting up the Android section, but this will work for both Android and iOS if you're using Firebase for both of them! +We are setting up the Android section, but this will work for both Android and iOS if you're using Firebase for both of them. ::: #### Step 6 @@ -97,21 +97,21 @@ firebaseMessaging.onTokenRefresh.listen((token) { ### Possible issues -We only send push notifications when the user doesn't have any active websocket connection (which is established when you call `client.connectUser`). If you set the [onBackgroundEventReceived](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/onBackgroundEventReceived.html) property of the StreamChat widget, when your app goes to background, your device will keep the ws connection alive for 1 minute, and so within this period, you won't receive any push notification. +We only send push notifications when the user doesn't have any active web socket connection (which is established when you call `client.connectUser`). If you set the [onBackgroundEventReceived](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/onBackgroundEventReceived.html) property of the StreamChat widget, when your app goes to background, your device will keep the WS connection alive for 1 minute, and so within this period, you won't receive any push notification. Make sure to read the [general push docs](https://getstream.io/chat/docs/flutter-dart/push_introduction/?language=dart) in order to avoid known gotchas that may make your relationship with notifications go bad 😢 ### Testing if Push Notifications are Setup Correctly -If you're not sure if you've set up push notifications correctly (e.g. you don't always receive them, they work unreliably), you can follow these steps to make sure your config is correct and working: +If you're not sure if you've set up push notifications correctly (for example you don't always receive them, they work unreliably), you can follow these steps to make sure your configuration is correct and working: -1. Clone our repo for push testing git clone git@github.com:GetStream/chat-push-test.git +1. Clone our repository for push testing git clone git@github.com:GetStream/chat-push-test.git 2. `cd flutter` 3. In folder run `flutter pub get` -4. Input your api key and secret in `lib/main.dart` +4. Input your API key and secret in `lib/main.dart` 5. Change the bundle identifier/application ID and development team/user so you can run the app in your device (**do not** run on iOS simulator, Android emulator is fine) @@ -137,11 +137,11 @@ You should get a test push notification The [StreamChat](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat-class.html) widget lets you define a [onBackgroundEventReceived](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/onBackgroundEventReceived.html) handler in order to handle events while the app is in the background, but the client is still connected. -This is useful because it lets you keep the connection alive in cases in which the app goes in the background just for some seconds (eg: multitasking, picking pictures from the gallery...) +This is useful because it lets you keep the connection alive in cases in which the app goes in the background just for some seconds (for example multitasking, picking pictures from the gallery...) You can even customize the [backgroundKeepAlive](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/backgroundKeepAlive.html) duration. -In order to show notifications in such a case we suggest using the package [flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications); follow the package guide to successfully set up the plugin. +In order to show notifications in such a case we suggest using the package [`flutter_local_notifications`](https://pub.dev/packages/flutter_local_notifications); follow the package guide to successfully set up the plugin. Once that's done you should set the [onBackgroundEventReceived](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChat/onBackgroundEventReceived.html); here is an example: @@ -234,7 +234,7 @@ To do this we need to update the push notification data payload at Stream Dashbo } ``` -Then we need to integrate the package [stream_chat_persistence](https://pub.dev/packages/stream_chat_persistence) in our app that exports a persistence client, learn [here](https://pub.dev/packages/stream_chat_persistence#usage) how to set it up. +Then we need to integrate the package [`stream_chat_persistence`](https://pub.dev/packages/stream_chat_persistence) in our app that exports a persistence client, learn [here](https://pub.dev/packages/stream_chat_persistence#usage) how to set it up. Then during the call `firebaseMessaging.configure(...)` we need to set the `onBackgroundMessage` parameter using a TOP-LEVEL or STATIC function to handle background messages; here is an example: diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_push_notifications_v2.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_push_notifications_v2.mdx index 917d9216..85933e97 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_push_notifications_v2.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/adding_push_notifications_v2.mdx @@ -17,7 +17,7 @@ You can read more about Stream’s [push delivery logic](https://getstream.io/ch ### Setup FCM -To integrate push notifications in your Flutter app, you need to use the package [firebase_messaging](https://pub.dev/packages/firebase_messaging). +To integrate push notifications in your Flutter app, you need to use the package [`firebase_messaging`](https://pub.dev/packages/firebase_messaging). Follow the [Firebase documentation](https://firebase.flutter.dev/docs/messaging/overview/) to set up the plugin for Android and iOS. @@ -55,7 +55,7 @@ You can upload your Firebase credentials using either the dashboard or the app s ![](../assets/firebase_notifications_toggle-5aeabfcbdc24cb8f1fea7d41d0e845fc.png) -3. Enter your Firebase Credentials and press "Save". +3. Enter your Firebase Credentials and press `"Save"`. ##### Using the API @@ -86,7 +86,7 @@ firebaseMessaging.onTokenRefresh.listen((token) { }); ``` -Push Notifications v2 also supports specifying a name to the push device tokens you register. By setting the optional `pushProviderName` param in the `addDevice` call you can support different configurations between the device and the `PushProvider`. +Push Notifications v2 also supports specifying a name to the push device tokens you register. By setting the optional `pushProviderName` parameter in the `addDevice` call you can support different configurations between the device and the `PushProvider`. ```dart firebaseMessaging.onTokenRefresh.listen((token) { @@ -105,7 +105,7 @@ On iOS we send both a **notification** and a **data** payload. This means you don't need to do anything special to get the notification to show up. However, you might want to handle the data payload to perform some logic when the user taps on the notification. To update the template, you can use a backend SDK. -For example, using the javascript SDK: +For example, using the JavaScript SDK: ```js const client = StreamChat.getInstance(‘api_key’, ‘api_secret’); @@ -181,13 +181,13 @@ void handleNotification( FirebaseMessaging.onBackgroundMessage(onBackgroundMessage); ``` -In the above example, you get the message details using the `getMessage` method and then you use the [flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications) package to show the actual notification. +In the above example, you get the message details using the `getMessage` method and then you use the [`flutter_local_notifications`](https://pub.dev/packages/flutter_local_notifications) package to show the actual notification. ##### Using a Template on Android It's still possible to add a **notification** payload to Android notifications. You can do so by adding a template using a backend SDK. -For example, using the javascript SDK: +For example, using the JavaScript SDK: ```js const client = StreamChat.getInstance(‘api_key’, ‘api_secret’); @@ -211,11 +211,11 @@ Make sure to read the [general push notification docs](https://getstream.io/chat ### Testing if Push Notifications are Setup Correctly -If you're not sure whether you've set up push notifications correctly, for example, you don't always receive them, or they don’t work reliably, then you can follow these steps to make sure your config is correct and working: -1. Clone our repo for push testing: `git clone git@github.com:GetStream/chat-push-test.git` +If you're not sure whether you've set up push notifications correctly, for example, you don't always receive them, or they don’t work reliably, then you can follow these steps to make sure your configuration is correct and working: +1. Clone our repository for push testing: `git clone git@github.com:GetStream/chat-push-test.git` 2. `cd flutter` 3. In that folder run `flutter pub get` -4. Input your api key and secret in `lib/main.dart` +4. Input your API key and secret in `lib/main.dart` 5. Change the bundle identifier/application ID and development team/user so you can run the app on your physical device.**Do not** run on an iOS simulator, as it will not work. Testing on an Android emulator is fine. 6. Add your `google-services.json/GoogleService-Info.plist` 7. Run the app @@ -257,7 +257,7 @@ Take a look at the [Stream Chat v1 sample app](https://github.com/GetStream/flut When the app is closed you may want to save received messages when you receive them via a notification so that later on when you open the app they're already there. -To do this you need to integrate the package [stream_chat_persistence](https://pub.dev/packages/stream_chat_persistence) in our app that exports a persistence client, see [here](https://pub.dev/packages/stream_chat_persistence#usage) how to set it up. +To do this you need to integrate the package [`stream_chat_persistence`](https://pub.dev/packages/stream_chat_persistence) in our app that exports a persistence client, see [here](https://pub.dev/packages/stream_chat_persistence#usage) how to set it up. Then calling `FirebaseMessaging.onBackgroundMessage(...)` you need to use a TOP-LEVEL or STATIC function to handle background messages; here is an example: diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/autocomplete_triggers.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/autocomplete_triggers.mdx index 413d147a..b2c94be5 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/autocomplete_triggers.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/autocomplete_triggers.mdx @@ -7,7 +7,7 @@ Adding Custom Autocomplete Triggers ### Introduction -The [StreamMessageInput](../stream_chat_flutter/message_input.mdx) widget provides a way to add custom autocomplete triggers using the `StreamMessageInput.customAutocompleteTriggers` property. +The [StreamMessageInput](../stream_chat_flutter/stream_message_input.mdx) widget provides a way to add custom autocomplete triggers using the `StreamMessageInput.customAutocompleteTriggers` property. By default we provide autocomplete triggers for mentions and commands, but it's very easy to add your custom ones. @@ -19,7 +19,7 @@ This widget will be used to show the autocomplete options. For this example we're using two external dependencies: - [emojis](https://pub.dev/packages/emojis) -- [substring_highlight](https://pub.dev/packages/substring_highlight) +- [`substring_highlight`](https://pub.dev/packages/substring_highlight) ```dart import 'package:emojis/emoji.dart'; diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/customize_message_actions.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/customize_message_actions.mdx index 12cc7715..f390bb4c 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/customize_message_actions.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/customize_message_actions.mdx @@ -37,7 +37,7 @@ Additionally, pinning a message requires you to add the roles which are allowed ### Partially remove some message actions -For example, if you only want to keep "copy message" and "delete message", +For example, if you only want to keep `"copy message"` and `"delete message"` here is how to do it using the `messageBuilder` with our `StreamMessageWidget`. ```dart diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/end_to_end_chat_encryption.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/end_to_end_chat_encryption.mdx index 8a463af4..fd8ed102 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/end_to_end_chat_encryption.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/end_to_end_chat_encryption.mdx @@ -36,7 +36,7 @@ Check out the diagram below for an example: ### Dependencies -Add the [webcrypto](https://pub.dev/packages/webcrypto) package in your `pubspec.yaml` file. +Add the [web cryptographic](https://pub.dev/packages/webcrypto) package in your `pubspec.yaml` file. ```yaml dependencies: @@ -76,9 +76,9 @@ class JsonWebKeyPair { } ``` -### Generate a Crypto Key +### Generate a Cryptographic Key -Next, create a symmetric **Crypto Key** using the keys generated in the previous step. +Next, create a symmetric **Cryptographic Key** using the keys generated in the previous step. You will use those keys to encrypt and decrypt messages. ```dart @@ -107,7 +107,7 @@ Future> deriveKey(String senderJwk, String receiverJwk) async { ### Encrypting Messages -Once you have generated the **Crypto Key**, you're ready to encrypt the message. +Once you have generated the **Cryptographic Key**, you're ready to encrypt the message. You can use the **AES-GCM** algorithm for its known security and performance balance and good browser availability. ```dart @@ -253,6 +253,6 @@ StreamMessageListView( ), ``` -That's it! That's all you need to implement E2EE in a Stream powered chat app. +That's it. That's all you need to implement E2EE in a Stream powered chat app. For more details, check out our [end-to-end encrypted chat article](https://getstream.io/blog/end-to-end-encrypted-chat-in-flutter/#whats-end-to-end-encryption). diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/migration_guide_4_0.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/migration_guide_4_0.mdx index 887cef3a..88c10aa7 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/migration_guide_4_0.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/migration_guide_4_0.mdx @@ -13,7 +13,7 @@ If you find any bugs or have any questions, please file an [issue on our GitHub Code examples: - See our [Stream Chat Flutter tutorial](https://getstream.io/chat/flutter/tutorial/) for an up-to-date guide using the latest Stream Chat version. -- See the [Stream Flutter Samples repository](https://github.com/GetStream/flutter-samples) with our fully-fledged messaging [sample application](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1). +- See the [Stream Flutter Samples repository](https://github.com/GetStream/flutter-samples) with our full fledged messaging [sample application](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1). All of our documentation has also been updated to support v4, so all of the guides and examples will have updated code. @@ -208,10 +208,10 @@ Let's explore some examples of the functional differences when using the new `St The **StreamChannelListController** provides various methods, such as: -- **deleteChannel** -- **loadMore** -- **muteChannel** -- **deleteChannel** +- **`deleteChannel`** +- **`loadMore`** +- **`muteChannel`** +- **`deleteChannel`** For a complete list with additional information, see the code documentation. @@ -267,7 +267,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - sort: const [SortOption('last_message_at')], + channelStateSort: const [SortOption('last_message_at')], ); @override @@ -536,7 +536,7 @@ Creating a separate controller allows easier control over the message input cont The widget is also separated into smaller components: `StreamCountDownButton`, `StreamAttachmentPicker`, etc. -> ❗The `MessageInputController` is exposed by the **stream_chat_flutter_core** package. This allows you to use the controller even if you're not using the UI components. +> ❗The `MessageInputController` is exposed by the **`stream_chat_flutter_core`** package. This allows you to use the controller even if you're not using the UI components. As a result of this extra control, it is no longer needed for the new `StreamMessageInput` widget to expose these `MessageInput` arguments: @@ -733,7 +733,7 @@ The controller makes it much simpler to dynamically modify the message input. ## Stream Chat Flutter Core -Various changes have been made to the Core package, most notably, the indroduction of all of the controllers mentioned above. +Various changes have been made to the Core package, most notably, the introduction of all of the controllers mentioned above. These controllers replace the business logic implementations (Bloc). Please note that this is not related to the well-known Flutter Bloc package, but instead refers to the naming we used for our business logic components. diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/slidable_channel_list_preview.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/slidable_channel_list_preview.mdx index 9d57e709..b0803563 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/slidable_channel_list_preview.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/slidable_channel_list_preview.mdx @@ -39,7 +39,7 @@ In this example, you are doing a few important things in the ChannelListPage wid - Using the **flutter_slidable** package to easily add slide functionality. - Passing in the `itemBuilder` argument for the **StreamChannelListView** widget. This gives access to the current **BuildContext**, **Channel**, and **StreamChannelListTile**, and allows you to create, or customize, the stream channel list tiles. - Returning a Slidable widget with two CustomSlidableAction widgets - to delete a channel and show more options. These widgets come from the flutter_slidable package. -- Adding `onPressed` behaviour to call `showConfirmationDialog` and `showChannelInfoModalBottomSheet`. These methods come from the **stream_chat_flutter** package. They have a few different on-tap callbacks you can supply, for example, `onViewInfoTap`. Alternatively, you can create custom dialogs from scratch. +- Adding `onPressed` behaviour to call `showConfirmationDialog` and `showChannelInfoModalBottomSheet`. These methods come from the **`stream_chat_flutter`** package. They have a few different on-tap callbacks you can supply, for example, `onViewInfoTap`. Alternatively, you can create custom dialog screens from scratch. - Using the **StreamChannelListController** to perform actions, such as, `deleteChannel`. ```dart @@ -105,7 +105,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - sort: const [SortOption('last_message_at')], + channelStateSort: const [SortOption('last_message_at')], ); @override diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/understanding_filters.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/understanding_filters.mdx index 292afd07..347ad17f 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/understanding_filters.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/understanding_filters.mdx @@ -24,7 +24,7 @@ Filter.equal('type', 'messaging'), #### Filter.notEqual -The 'notEqual' filter gets the objects where the given key does not have the specified value. +The `notEqual` filter gets the objects where the given key does not have the specified value. ```dart Filter.notEqual('type', 'messaging'), @@ -64,20 +64,20 @@ Filter.lessOrEqual('count', 5), #### Filter.in_ -The 'in_' filter allows getting objects where the key matches any in a specified array. +The `in_` filter allows getting objects where the key matches any in a specified array. ```dart Filter.in_('members', [user.id]) ``` :::note -Since 'in' is a keyword in Dart, the filter has an underscore added. This does not apply to the 'notIn' +Since `in` is a keyword in Dart, the filter has an underscore added. This does not apply to the `notIn` keyword. ::: #### Filter.notIn -The 'notIn' filter allows getting objects where the key matches none in a specified array. +The `notIn` filter allows getting objects where the key matches none in a specified array. ```dart Filter.notIn('members', [user.id]) @@ -109,7 +109,7 @@ Filter.exists('name') #### Filter.notExists -The 'notExists' filter checks if the specified key doesn't exist. This is a simplified call to `Filter.exists` +The `notExists` filter checks if the specified key doesn't exist. This is a simplified call to `Filter.exists` with the value set to false. ```dart diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/user_token_generation_with_firebase_auth.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/user_token_generation_with_firebase_auth.mdx index 56192f53..98868400 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/user_token_generation_with_firebase_auth.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/user_token_generation_with_firebase_auth.mdx @@ -155,7 +155,7 @@ Running the above will give this: ![](../assets/authentication_demo_app.jpg) The `Auth` widget handles all of the authentication logic. It initializes a `FirebaseAuth.instance` and uses that -in the `createAccount`, `signIn` and `signOut` methods. There is a button to envoke each of these methods. +in the `createAccount`, `signIn` and `signOut` methods. There is a button to invoke each of these methods. The `FirebaseFunctions.instance` will be used later in this guide. @@ -289,7 +289,7 @@ firebase deploy --only functions ### Create a Stream User and Get the User's Token In the `createStreamUserAndGetToken` cloud function you create an `onCall` HTTPS handler, which exposes -a cloud function that can be envoked from your Flutter app. +a cloud function that can be invoked from your Flutter app. ```js // Create a Stream user and return auth token. @@ -325,13 +325,13 @@ by ensuring that `context.auth` is not null. If it is null, then it throws an `H message. This error can be caught in your Flutter application. If the caller is authenticated the function proceeds to use the `serverClient` to create a new Stream Chat -user by calling the `upsertUser` method and passing in some user data. It uses the authenticated caller's **uid** as an **id**. +user by calling the `upsertUser` method and passing in some user data. It uses the authenticated caller's **`uid`** as an **id**. After the user is created it generates a token for that user. This token is then returned to the caller. To call this from Flutter, you will need to use the `cloud_functions` package. -Update the **createAccount** method in your Flutter code to the following: +Update the **`createAccount`** method in your Flutter code to the following: ```dart Future createAccount() async { @@ -355,7 +355,7 @@ in the request. Once you have the Stream user token, you can authenticate your Stream Chat user as you normally would. -Please see our [initialization documention](https://getstream.io/chat/docs/flutter-dart/init_and_users/?language=dart) for more information. +Please see our [initialization documentation](https://getstream.io/chat/docs/flutter-dart/init_and_users/?language=dart) for more information. As you can see below, the User ID matches on both Firebase's and Stream's user database. @@ -373,7 +373,7 @@ As you can see below, the User ID matches on both Firebase's and Stream's user d The `getStreamUserToken` cloud function is very similar to the `createStreamUserAndGetToken` function. The only difference is that it only creates a user token and does not create a new user account on Stream. -Update the **signIn** method in your Flutter code to the following: +Update the **`signIn`** method in your Flutter code to the following: ```dart Future signIn() async { @@ -434,7 +434,7 @@ exports.deleteStreamUser = functions.auth.user().onDelete((user, context) => { ``` In this function, you are listening to delete events on Firebase auth. When an account is deleted, this function will be triggered, and you can get the -user's **uid** and call the `deleteUser` method on the `serverClient`. +user's **`uid`** and call the `deleteUser` method on the `serverClient`. This is not an external cloud function; it can only be triggered when an account is deleted. diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/setup.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/setup.mdx index 22e5c6c5..6b33e612 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/setup.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/setup.mdx @@ -41,8 +41,8 @@ which will be addressed by the respective plugin creators over time. The library uses [flutter file picker plugin](https://github.com/miguelpruivo/flutter_file_picker) to pick files from the os. Follow [this wiki](https://github.com/miguelpruivo/flutter_file_picker/wiki/Setup#ios) to fulfill iOS requirements. -We also use [video_player](https://pub.dev/packages/video_player) to reproduce videos. +We also use [`video_player`](https://pub.dev/packages/video_player) to reproduce videos. Follow [this guide](https://pub.dev/packages/video_player#installation) to fulfill the requirements. -To pick images from the camera, we use the [image_picker](https://pub.dev/packages/image_picker) plugin. +To pick images from the camera, we use the [`image_picker`](https://pub.dev/packages/image_picker) plugin. Follow [these instructions](https://pub.dev/packages/image_picker#ios) to check the requirements. diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_grid_view.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_grid_view.mdx index 16bad7dc..0fcde5c1 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_grid_view.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_grid_view.mdx @@ -40,7 +40,7 @@ class _ChannelGridPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - sort: const [SortOption('last_message_at')], + channelStateSort: const [SortOption('last_message_at')], ); @override diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_list_header.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_list_header.mdx index 4c8fbc63..54379bdd 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_list_header.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_list_header.mdx @@ -44,7 +44,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - sort: const [SortOption('last_message_at')], + channelStateSort: const [SortOption('last_message_at')], ); @override @@ -90,7 +90,7 @@ StreamChannelListHeader( ![](../assets/channel_list_header_custom_subtitle.png) -The `titleBuilder` param helps you build different titles depending on the connection state: +The `titleBuilder` parameter helps you build different titles depending on the connection state: ```dart //... diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_list_view.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_list_view.mdx index dbb3f266..a22c108c 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_list_view.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_list_view.mdx @@ -23,7 +23,7 @@ ONLY the channels that the user is a part of. This section goes into setting up widget. :::note -Make sure to check the [StreamChannelListController](./stream_channel_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamChannelListView`. +Make sure to check the [StreamChannelListController](../stream_chat_flutter_core/stream_channel_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamChannelListView`. ::: ### Basic Example @@ -50,7 +50,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - sort: const [SortOption('last_message_at')], + channelStateSort: const [SortOption('last_message_at')], ); @override diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_message_input.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_message_input.mdx index b60696ae..f6640f67 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_message_input.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_message_input.mdx @@ -57,7 +57,7 @@ class ChannelPage extends StatelessWidget { It is common to put this widget in the same page of a `StreamMessageListView` as the bottom widget. :::note -Make sure to check the [StreamMessageInputController](./stream_message_input_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamMessageInput`. +Make sure to check the [StreamMessageInputController](../stream_chat_flutter_core/stream_message_input_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamMessageInput`. ::: ### Adding Custom Actions diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_message_search_list_view.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_message_search_list_view.mdx index cf27facf..91108b5e 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_message_search_list_view.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_message_search_list_view.mdx @@ -17,7 +17,7 @@ message they are searching for. As such, there needs to be a way to search for a channels. This is where `StreamMessageSearchListView` comes in. :::note -Make sure to check the [StreamMessageSearchListController](./stream_message_search_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamMessageSearchListView`. +Make sure to check the [StreamMessageSearchListController](../stream_chat_flutter_core/stream_message_search_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamMessageSearchListView`. ::: ### Basic Example diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_user_list_view.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_user_list_view.mdx index 95bfbac9..6f424e38 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_user_list_view.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_user_list_view.mdx @@ -17,7 +17,7 @@ selecting users to add in a channel, etc. The `StreamUserListView` displays a li of users. :::note -Make sure to check the [StreamUserListController](./stream_user_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamUserListView`. +Make sure to check the [StreamUserListController](../stream_chat_flutter_core/stream_user_list_controller.mdx) documentation for more information on how to use the controller to manipulate the `StreamUserListView`. ::: ### Basic Example diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/message_list_core.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/message_list_core.mdx index 57f06b2a..2a20db92 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/message_list_core.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/message_list_core.mdx @@ -15,7 +15,7 @@ according to the filters and sort order given. However, in some cases, implement that cannot be done using the customization approaches given in the widget. To do this, we extracted the logic required for fetching channels into a 'Core' widget - a widget that -fetches channels in the expected way via the usual params but does not supply any UI and instead +fetches channels in the expected way via the usual parameters but does not supply any UI and instead exposes builders to build the UI in situations such as loading, empty data, errors, and on data received. ### Basic Example diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_channel_list_controller.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_channel_list_controller.mdx index c37eeedd..ca1eb3e7 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_channel_list_controller.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_channel_list_controller.mdx @@ -58,7 +58,7 @@ void dispose() { } ``` -The `StreamChannelListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of channels has changed. +The `StreamChannelListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of channels has changed. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest channels. ```dart diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_chat_core.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_chat_core.mdx index e3434e7f..11743abf 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_chat_core.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_chat_core.mdx @@ -11,7 +11,7 @@ Find the pub.dev documentation [here](https://pub.dev/documentation/stream_chat_ `StreamChatCore` is used to provide information about the chat client to the widget tree. This Widget is used to react to life cycle changes and system updates. -When the app goes into the background, the websocket connection is automatically closed and when it goes back to foreground the connection is opened again. +When the app goes into the background, the web socket connection is automatically closed and when it goes back to foreground the connection is opened again. Like the `StreamChat` widget in the higher level UI package, the `StreamChatCore` widget should be on the top level before using any Stream functionality: diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_message_search_list_controller.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_message_search_list_controller.mdx index f4546331..b3e09379 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_message_search_list_controller.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_message_search_list_controller.mdx @@ -46,7 +46,7 @@ void dispose() { } ``` -The `StreamMessageSearchListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of responses has changed. +The `StreamMessageSearchListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of responses has changed. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest responses. ```dart diff --git a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_user_list_controller.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_user_list_controller.mdx index 0bee29ed..b7504ab6 100644 --- a/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_user_list_controller.mdx +++ b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter_core/stream_user_list_controller.mdx @@ -46,7 +46,7 @@ void dispose() { } ``` -The `StreamUserListController` is basically a [`PagedValueNotifier`](./paged_value_notifier.mdx) that notifies you when the list of users has changed. +The `StreamUserListController` is basically a [`PagedValueNotifier`](./paged_value_listenable_builder.mdx) that notifies you when the list of users has changed. You can use a [`PagedValueListenableBuilder`](./paged_value_listenable_builder.mdx) to build your UI depending on the latest users. ```dart diff --git a/melos.yaml b/melos.yaml index 217f4bc5..baa8761d 100644 --- a/melos.yaml +++ b/melos.yaml @@ -51,11 +51,11 @@ scripts: description: Build all generated files for Dart & Flutter packages in this project. generate:dart: - run: melos exec -c 1 --depends-on="build_runner" --no-flutter -- "dart run build_runner build --delete-conflicting-outputs --enable-experiment=super-parameters,enhanced-enums" + run: melos exec -c 1 --depends-on="build_runner" --no-flutter -- "dart run build_runner build --delete-conflicting-outputs" description: Build all generated files for Dart packages in this project. generate:flutter: - run: melos exec -c 1 --depends-on="build_runner" --flutter -- "flutter run build_runner build --delete-conflicting-outputs --enable-experiment=super-parameters,enhanced-enums" + run: melos exec -c 1 --depends-on="build_runner" --flutter -- "flutter pub run build_runner build --delete-conflicting-outputs" description: Build all generated files for Flutter packages in this project. test:all: @@ -65,29 +65,29 @@ scripts: test:dart: run: melos exec -c 1 --fail-fast -- "flutter test --coverage" description: Run Dart tests for a specific package in this project. - select-package: + packageFilters: flutter: false - dir-exists: test + dirExists: test test:flutter: run: melos exec -c 4 --fail-fast -- "flutter test --coverage" description: Run Flutter tests for a specific package in this project. - select-package: + packageFilters: flutter: true - dir-exists: test + dirExists: test clean:flutter: run: melos exec -c 4 --fail-fast -- "flutter clean" description: Run Flutter clean for a specific package in this project. - select-package: + packageFilters: flutter: true coverage:ignore-file: run: | melos exec -c 5 --fail-fast -- "\$MELOS_ROOT_PATH/.github/workflows/scripts/remove-from-coverage.sh" description: Removes all the ignored files from the coverage report. - select-package: - dir-exists: coverage + packageFilters: + dirExists: coverage docs: run: | diff --git a/packages/stream_chat/.gitignore b/packages/stream_chat/.gitignore index 2ea557c4..3e9aac7c 100644 --- a/packages/stream_chat/.gitignore +++ b/packages/stream_chat/.gitignore @@ -50,7 +50,7 @@ pubspec.lock # If you don't generate documentation locally you can remove this line. doc/api/ -# Avoid committing generated Javascript files: +# Avoid committing generated JavaScript files: *.dart.js *.info.json # Produced by the --dump-info flag. *.js # When generated by dart2js. Don't specify *.js if your diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 2937a2c9..c3d089af 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -1,3 +1,35 @@ +## Upcoming + +🐞 Fixed + +- Fixed streamWatchers. Before it was always new, now it is possible to follow the watchers of a channel. +- Make `Message.i18n` field read-only. + +🔄 Changed + +- Cancelling a attachment upload now removes the attachment from the message. +- Updated `dio` and other dependencies to resolvable versions. + +✅ Added + +- Added `presence` property to `Channel::watch` method. + +## 5.3.0 + +🔄 Changed + +- Updated `rate_limiter` dependency to `^1.0.0` + +## 5.2.0 + +✅ Added + +- Added `Huawei` and `Xiaomi` PushProviders. + +🐞 Fixed + +- Fixed initializing last synced date. + ## 5.1.0 ✅ Added @@ -17,7 +49,7 @@ 🛑️ Breaking Changes from `5.0.0-beta.2` - `Channel.addMembers`, `Channel.removeMembers`, `Channel.inviteMembers` and `Channel.update` - positional params are now optional params. + positional parameters are now optional parameters. ```dart // previous @@ -390,21 +422,21 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🛑️ Breaking Changes from `1.5.3` - migrate this package to null safety -- `ConnectUserWithProvider` now requires `tokenProvider` as a required param. (Removed from the +- `ConnectUserWithProvider` now requires `tokenProvider` as a required parameter. (Removed from the constructor) - `client.disconnect()` is now divided into two different functions - - `client.closeConnection()` -> for closing user websocket connection. + - `client.closeConnection()` -> for closing user web socket connection. - `client.disconnectUser()` -> for disconnecting user and resetting client state. - `client.devToken()` now returns a `Token` model instead of `String`. - `ApiError` is removed in favor of `StreamChatError` - `StreamChatError` -> parent type for all the stream errors. - - `StreamWebSocketError` -> for user websocket related errors. + - `StreamWebSocketError` -> for user web socket related errors. - `StreamChatNetworkError` -> for network related errors. -- `client.queryChannels()`, `channel.query()` options param is removed in favor of individual params +- `client.queryChannels()`, `channel.query()` options parameter is removed in favor of individual parameters - `option.state` -> bool state - `option.watch` -> bool watch - `option.presence` -> bool presence -- `client.queryUsers()` options param is removed in favor of individual params +- `client.queryUsers()` options parameter is removed in favor of individual parameters - `option.presence` -> bool presence - Migrate this package to null safety - Added typed filters @@ -438,28 +470,28 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🛑️ Breaking Changes from `2.0.0-nullsafety.6` -- `ConnectUserWithProvider` now requires `tokenProvider` as a required param. (Removed from the +- `ConnectUserWithProvider` now requires `tokenProvider` as a required parameter. (Removed from the constructor) - `client.disconnect()` is now divided into two different functions - - `client.closeConnection()` -> for closing user websocket connection. + - `client.closeConnection()` -> for closing user web socket connection. - `client.disconnectUser()` -> for disconnecting user and resetting client state. - `client.devToken()` now returns a `Token` model instead of `String`. - `ApiError` is removed in favor of `StreamChatError` - `StreamChatError` -> parent type for all the stream errors. - - `StreamWebSocketError` -> for user websocket related errors. + - `StreamWebSocketError` -> for user web socket related errors. - `StreamChatNetworkError` -> for network related errors. -- `client.queryChannels()`, `channel.query()` options param is removed in favor of individual params +- `client.queryChannels()`, `channel.query()` options parameter is removed in favor of individual parameters - `option.state` -> bool state - `option.watch` -> bool watch - `option.presence` -> bool presence -- `client.queryUsers()` options param is removed in favor of individual params +- `client.queryUsers()` options parameter is removed in favor of individual parameters - `option.presence` -> bool presence ✅ Added - New `Location` enum is introduced for easily changing the client location/baseUrl. - New `client.openConnection()` and `client.closeConnection()` is introduced to connect/disconnect - user ws connection. + user WS connection. 🔄 Changed @@ -562,7 +594,7 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra - 🛑 **BREAKING** Renamed `Client` to less generic `StreamChatClient` - 🛑 **BREAKING** Segregated the persistence layer into separate - package [stream_chat_persistence](https://pub.dev/packages/stream_chat_persistence) + package [`stream_chat_persistence`](https://pub.dev/packages/stream_chat_persistence) - 🛑 **BREAKING** Moved `Client.backgroundKeepAlive` to [core package](https://pub.dev/packages/stream_chat_core) - 🛑 **BREAKING** Moved `Client.showLocalNotification` diff --git a/packages/stream_chat/README.md b/packages/stream_chat/README.md index bb1eab75..4ec58e03 100644 --- a/packages/stream_chat/README.md +++ b/packages/stream_chat/README.md @@ -39,7 +39,7 @@ There is a detailed Flutter example project in the `example` folder. You can dir ## Setup API Client -First you need to instantiate a chat client. The Chat client will manage API call, event handling and manage the websocket connection to Stream Chat servers. You should only create the client once and re-use it across your application. +First you need to instantiate a chat client. The Chat client will manage API call, event handling and manage the web socket connection to Stream Chat servers. You should only create the client once and re-use it across your application. ```dart final client = StreamChatClient("stream-chat-api-key"); @@ -47,7 +47,7 @@ final client = StreamChatClient("stream-chat-api-key"); ### Logging -By default the Chat Client will write all messages with level Warn or Error to stdout. +By default the Chat Client will write all messages with level Warn or Error to `stdout`. #### Change Logging Level @@ -59,7 +59,7 @@ final client = StreamChatClient("stream-chat-api-key", logLevel: Level.INFO); #### Custom Logger -You can handle the log messages directly instead of have them written to stdout, this is very convenient if you use an error tracking tool or if you want to centralize your logs into one facility. +You can handle the log messages directly instead of have them written to `stdout`, this is very convenient if you use an error tracking tool or if you want to centralize your logs into one facility. ```dart myLogHandlerFunction = (LogRecord record) { @@ -71,7 +71,7 @@ final client = StreamChatClient("stream-chat-api-key", logHandlerFunction: myLog ### Offline storage -To add data persistance you can extend the class `ChatPersistenceClient` and pass an instance to the `StreamChatClient`. +To add data persistence, you can extend the class `ChatPersistenceClient` and pass an instance to the `StreamChatClient`. ```dart class CustomChatPersistentClient extends ChatPersistenceClient { @@ -84,7 +84,7 @@ final client = StreamChatClient( )..chatPersistenceClient = CustomChatPersistentClient(); ``` -We provide an official persistent client in the [stream_chat_persistence](https://pub.dev/packages/stream_chat_persistence) package. +We provide an official persistent client in the [`stream_chat_persistence`](https://pub.dev/packages/stream_chat_persistence) package. ```dart import 'package:stream_chat_persistence/stream_chat_persistence.dart'; @@ -104,7 +104,7 @@ final client = StreamChatClient( ### Code conventions -- Make sure that you run `dartfmt` before commiting your code +- Make sure that you run `dartfmt` before you commit your code - Make sure all public methods and functions are well documented ### Running tests diff --git a/packages/stream_chat/example/android/app/build.gradle b/packages/stream_chat/example/android/app/build.gradle index 3932aa91..778f092c 100644 --- a/packages/stream_chat/example/android/app/build.gradle +++ b/packages/stream_chat/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 29 + compileSdkVersion 33 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -40,7 +40,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.example" minSdkVersion 16 - targetSdkVersion 29 + targetSdkVersion 33 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } diff --git a/packages/stream_chat/example/android/app/src/main/AndroidManifest.xml b/packages/stream_chat/example/android/app/src/main/AndroidManifest.xml index 55ca830c..764fe004 100644 --- a/packages/stream_chat/example/android/app/src/main/AndroidManifest.xml +++ b/packages/stream_chat/example/android/app/src/main/AndroidManifest.xml @@ -6,15 +6,16 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> + android:name="${applicationName}" + android:icon="@mipmap/ic_launcher" + android:label="example"> + android:icon="@mipmap/ic_launcher" + android:label="example"> + android:icon="@mipmap/ic_launcher" + android:label="example">