From 749b7144c350a7a1b3e38150f892a291354b586b Mon Sep 17 00:00:00 2001 From: Jeroen Leenarts Date: Tue, 6 Dec 2022 15:40:17 +0100 Subject: [PATCH 01/26] Add vale config --- .styles/Google/AMPM.yml | 9 ++ .styles/Google/Acronyms.yml | 64 +++++++++ .styles/Google/Colons.yml | 8 ++ .styles/Google/Contractions.yml | 30 +++++ .styles/Google/DateFormat.yml | 9 ++ .styles/Google/Ellipses.yml | 9 ++ .styles/Google/EmDash.yml | 12 ++ .styles/Google/EnDash.yml | 13 ++ .styles/Google/Exclamation.yml | 7 + .styles/Google/FirstPerson.yml | 13 ++ .styles/Google/Gender.yml | 9 ++ .styles/Google/GenderBias.yml | 45 +++++++ .styles/Google/HeadingPunctuation.yml | 13 ++ .styles/Google/Headings.yml | 29 ++++ .styles/Google/Latin.yml | 11 ++ .styles/Google/LyHyphens.yml | 14 ++ .styles/Google/OptionalPlurals.yml | 12 ++ .styles/Google/Ordinal.yml | 7 + .styles/Google/OxfordComma.yml | 7 + .styles/Google/Parens.yml | 7 + .styles/Google/Passive.yml | 184 ++++++++++++++++++++++++++ .styles/Google/Periods.yml | 7 + .styles/Google/Quotes.yml | 7 + .styles/Google/Ranges.yml | 7 + .styles/Google/Semicolons.yml | 8 ++ .styles/Google/Slang.yml | 11 ++ .styles/Google/Spacing.yml | 8 ++ .styles/Google/Spelling.yml | 8 ++ .styles/Google/Units.yml | 8 ++ .styles/Google/We.yml | 11 ++ .styles/Google/Will.yml | 7 + .styles/Google/WordList.yml | 80 +++++++++++ .styles/Google/meta.json | 4 + .styles/Google/vocab.txt | 0 .styles/Vocab/Base/accept.txt | 15 +++ .styles/Vocab/Base/reject.txt | 0 .vale.ini | 19 +++ 37 files changed, 712 insertions(+) create mode 100644 .styles/Google/AMPM.yml create mode 100644 .styles/Google/Acronyms.yml create mode 100644 .styles/Google/Colons.yml create mode 100644 .styles/Google/Contractions.yml create mode 100644 .styles/Google/DateFormat.yml create mode 100644 .styles/Google/Ellipses.yml create mode 100644 .styles/Google/EmDash.yml create mode 100644 .styles/Google/EnDash.yml create mode 100644 .styles/Google/Exclamation.yml create mode 100644 .styles/Google/FirstPerson.yml create mode 100644 .styles/Google/Gender.yml create mode 100644 .styles/Google/GenderBias.yml create mode 100644 .styles/Google/HeadingPunctuation.yml create mode 100644 .styles/Google/Headings.yml create mode 100644 .styles/Google/Latin.yml create mode 100644 .styles/Google/LyHyphens.yml create mode 100644 .styles/Google/OptionalPlurals.yml create mode 100644 .styles/Google/Ordinal.yml create mode 100644 .styles/Google/OxfordComma.yml create mode 100644 .styles/Google/Parens.yml create mode 100644 .styles/Google/Passive.yml create mode 100644 .styles/Google/Periods.yml create mode 100644 .styles/Google/Quotes.yml create mode 100644 .styles/Google/Ranges.yml create mode 100644 .styles/Google/Semicolons.yml create mode 100644 .styles/Google/Slang.yml create mode 100644 .styles/Google/Spacing.yml create mode 100644 .styles/Google/Spelling.yml create mode 100644 .styles/Google/Units.yml create mode 100644 .styles/Google/We.yml create mode 100644 .styles/Google/Will.yml create mode 100644 .styles/Google/WordList.yml create mode 100644 .styles/Google/meta.json create mode 100644 .styles/Google/vocab.txt create mode 100644 .styles/Vocab/Base/accept.txt create mode 100644 .styles/Vocab/Base/reject.txt create mode 100644 .vale.ini 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/We.yml b/.styles/Google/We.yml new file mode 100644 index 00000000..c7ac7d36 --- /dev/null +++ b/.styles/Google/We.yml @@ -0,0 +1,11 @@ +extends: existence +message: "Try to avoid using first-person plural like '%s'." +link: 'https://developers.google.com/style/pronouns#personal-pronouns' +level: warning +ignorecase: true +tokens: + - we + - we'(?:ve|re) + - ours? + - us + - let's diff --git a/.styles/Google/Will.yml b/.styles/Google/Will.yml 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..5e1c46bf --- /dev/null +++ b/.vale.ini @@ -0,0 +1,19 @@ +StylesPath = .styles + +MinAlertLevel = error +Vocab = Base + +Packages = Google + +# The "formats" section allows you to associate an "unknown" format +# with one of Vale's supported formats. +[formats] +mdx = md + +# Since we mapped `mdx` to `md` in the `formats`section we have to declare our format to be `md` +[*.md] +BasedOnStyles = Vale, Google +# TokenIgnores = ("integrationguide"), ^<[ ]{0}img(.*)+[ ]{0}/>$, <[ ]{0}img(.*\n)+/> +# BlockIgnores = import \w* from '.*', \w*\.gradle + + From dbbb2f26becdb5a1a92424fbe71b67d57365406b Mon Sep 17 00:00:00 2001 From: Jeroen Leenarts Date: Tue, 6 Dec 2022 15:40:29 +0100 Subject: [PATCH 02/26] Add GitHub Action workflow file --- .github/workflows/vale-doc-lint.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/vale-doc-lint.yml diff --git a/.github/workflows/vale-doc-lint.yml b/.github/workflows/vale-doc-lint.yml new file mode 100644 index 00000000..2ef15f47 --- /dev/null +++ b/.github/workflows/vale-doc-lint.yml @@ -0,0 +1,22 @@ +name: Check Docusaurus docs with Vale linter + +on: [pull_request] + +jobs: + vale: + name: Vale doc linter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: errata-ai/vale-action@reviewdog + with: + # added, diff_context, file, nofilter + filter_mode: nofilter + # github-pr-check, github-pr-review, github-check + reporter: github-pr-check + fail_on_error: true + files: docusaurus + env: + # Required, set by GitHub actions automatically: + # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} From a338b9b95f652a37ed3e0933d7f7360f0aebc712 Mon Sep 17 00:00:00 2001 From: Jeroen Leenarts Date: Tue, 6 Dec 2022 15:41:05 +0100 Subject: [PATCH 03/26] Fix a couple Vale linter warnings --- CONTRIBUTING.md | 30 +++++++++---------- README.md | 16 +++++----- .../docs/Flutter/01-basics/choose_package.mdx | 16 +++++----- .../docs/Flutter/01-basics/introduction.mdx | 18 +++++------ .../Flutter/01-basics/versioning_policy.mdx | 2 +- .../03-customize_message_actions.mdx | 2 +- .../04-adding_custom_attachments.mdx | 6 ++-- .../06-autocomplete_triggers.mdx | 2 +- .../07-slidable_channel_list_preview.mdx | 2 +- .../Flutter/03-stream_chat_flutter/setup.mdx | 8 ++--- .../stream_channel_list_header.mdx | 2 +- .../message_list_core.mdx | 2 +- .../stream_chat_core.mdx | 2 +- .../05-guides/01-understanding_filters.mdx | 10 +++---- .../02-adding_local_data_persistence.mdx | 2 +- ...er_token_generation_with_firebase_auth.mdx | 14 ++++----- .../adding_push_notifications.mdx | 18 +++++------ .../adding_push_notifications_v2.mdx | 20 ++++++------- .../06-end_to_end_chat_encryption.mdx | 10 +++---- .../08-migrations/migration_guide_4_0.mdx | 14 ++++----- .../08-migrations/migration_guide_5_0.mdx | 12 ++++---- .../09-initialize_stream_chat_widget_tree.mdx | 10 +++---- .../Flutter/basics/choose_package.mdx | 16 +++++----- .../Flutter/basics/introduction.mdx | 18 +++++------ .../Flutter/basics/versioning_policy.mdx | 2 +- .../guides/adding_custom_attachments.mdx | 6 ++-- .../guides/adding_local_data_persistence.mdx | 2 +- .../guides/adding_push_notifications.mdx | 18 +++++------ .../guides/adding_push_notifications_v2.mdx | 18 +++++------ .../guides/customize_message_actions.mdx | 2 +- .../guides/end_to_end_chat_encryption.mdx | 10 +++---- .../Flutter/guides/migration_guide_2_0.mdx | 26 ++++++++-------- .../Flutter/guides/understanding_filters.mdx | 10 +++---- ...er_token_generation_with_firebase_auth.mdx | 14 ++++----- .../channel_list_header.mdx | 2 +- .../stream_chat_flutter/channel_list_view.mdx | 6 ++-- .../Flutter/stream_chat_flutter/setup.mdx | 4 +-- .../channel_list_core.mdx | 2 +- .../message_list_core.mdx | 2 +- .../message_search_list_core.mdx | 2 +- .../stream_chat_core.mdx | 2 +- .../user_list_core.mdx | 2 +- .../Flutter/basics/choose_package.mdx | 16 +++++----- .../Flutter/basics/introduction.mdx | 18 +++++------ .../Flutter/basics/versioning_policy.mdx | 2 +- .../guides/adding_custom_attachments.mdx | 6 ++-- .../guides/adding_local_data_persistence.mdx | 2 +- .../guides/adding_push_notifications.mdx | 18 +++++------ .../guides/adding_push_notifications_v2.mdx | 20 ++++++------- .../Flutter/guides/autocomplete_triggers.mdx | 2 +- .../guides/customize_message_actions.mdx | 2 +- .../guides/end_to_end_chat_encryption.mdx | 10 +++---- .../Flutter/guides/migration_guide_4_0.mdx | 14 ++++----- .../guides/slidable_channel_list_preview.mdx | 2 +- .../Flutter/guides/understanding_filters.mdx | 10 +++---- ...er_token_generation_with_firebase_auth.mdx | 14 ++++----- .../Flutter/stream_chat_flutter/setup.mdx | 4 +-- .../stream_channel_list_header.mdx | 2 +- .../message_list_core.mdx | 2 +- .../stream_chat_core.mdx | 2 +- packages/stream_chat/.gitignore | 2 +- packages/stream_chat/CHANGELOG.md | 26 ++++++++-------- packages/stream_chat/README.md | 12 ++++---- packages/stream_chat_flutter/.gitignore | 2 +- packages/stream_chat_flutter/CHANGELOG.md | 16 +++++----- packages/stream_chat_flutter/README.md | 18 +++++------ .../example/lib/tutorial_part_1.dart | 2 +- 67 files changed, 303 insertions(+), 303 deletions(-) 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/choose_package.mdx b/docusaurus/docs/Flutter/01-basics/choose_package.mdx index cd311b63..104b9381 100644 --- a/docusaurus/docs/Flutter/01-basics/choose_package.mdx +++ b/docusaurus/docs/Flutter/01-basics/choose_package.mdx @@ -16,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 @@ -32,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/01-basics/introduction.mdx b/docusaurus/docs/Flutter/01-basics/introduction.mdx index 93f0572d..02487dab 100644 --- a/docusaurus/docs/Flutter/01-basics/introduction.mdx +++ b/docusaurus/docs/Flutter/01-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/docs/Flutter/01-basics/versioning_policy.mdx b/docusaurus/docs/Flutter/01-basics/versioning_policy.mdx index 48f25d66..99ec8111 100644 --- a/docusaurus/docs/Flutter/01-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/02-customization/01-custom-widgets/03-customize_message_actions.mdx b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/03-customize_message_actions.mdx index 31e2b9d5..966a996d 100644 --- a/docusaurus/docs/Flutter/02-customization/01-custom-widgets/03-customize_message_actions.mdx +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/03-customize_message_actions.mdx @@ -36,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/02-customization/01-custom-widgets/04-adding_custom_attachments.mdx b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/04-adding_custom_attachments.mdx index 089dd3e6..03f9f129 100644 --- a/docusaurus/docs/Flutter/02-customization/01-custom-widgets/04-adding_custom_attachments.mdx +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/04-adding_custom_attachments.mdx @@ -26,7 +26,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: @@ -46,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). @@ -54,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`: diff --git a/docusaurus/docs/Flutter/02-customization/01-custom-widgets/06-autocomplete_triggers.mdx b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/06-autocomplete_triggers.mdx index d9a90f39..ac38087b 100644 --- a/docusaurus/docs/Flutter/02-customization/01-custom-widgets/06-autocomplete_triggers.mdx +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/06-autocomplete_triggers.mdx @@ -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/02-customization/01-custom-widgets/07-slidable_channel_list_preview.mdx b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/07-slidable_channel_list_preview.mdx index 67372ef5..9e350f90 100644 --- a/docusaurus/docs/Flutter/02-customization/01-custom-widgets/07-slidable_channel_list_preview.mdx +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/07-slidable_channel_list_preview.mdx @@ -38,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 diff --git a/docusaurus/docs/Flutter/03-stream_chat_flutter/setup.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/setup.mdx index dc20a604..e07e1547 100644 --- a/docusaurus/docs/Flutter/03-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/03-stream_chat_flutter/stream_channel_list_header.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_header.mdx index 4c8fbc63..e5b548e4 100644 --- a/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_header.mdx +++ b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_header.mdx @@ -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/04-stream_chat_flutter_core/message_list_core.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/message_list_core.mdx index 57f06b2a..2a20db92 100644 --- a/docusaurus/docs/Flutter/04-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/04-stream_chat_flutter_core/stream_chat_core.mdx b/docusaurus/docs/Flutter/04-stream_chat_flutter_core/stream_chat_core.mdx index e3434e7f..11743abf 100644 --- a/docusaurus/docs/Flutter/04-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/05-guides/01-understanding_filters.mdx b/docusaurus/docs/Flutter/05-guides/01-understanding_filters.mdx index 88f5ee61..152a8a8f 100644 --- a/docusaurus/docs/Flutter/05-guides/01-understanding_filters.mdx +++ b/docusaurus/docs/Flutter/05-guides/01-understanding_filters.mdx @@ -23,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'), @@ -63,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]) @@ -108,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/05-guides/02-adding_local_data_persistence.mdx b/docusaurus/docs/Flutter/05-guides/02-adding_local_data_persistence.mdx index dd7ce0c9..3943b1f9 100644 --- a/docusaurus/docs/Flutter/05-guides/02-adding_local_data_persistence.mdx +++ b/docusaurus/docs/Flutter/05-guides/02-adding_local_data_persistence.mdx @@ -27,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/05-guides/03-user_token_generation_with_firebase_auth.mdx b/docusaurus/docs/Flutter/05-guides/03-user_token_generation_with_firebase_auth.mdx index 0fbe8b69..85a0250d 100644 --- a/docusaurus/docs/Flutter/05-guides/03-user_token_generation_with_firebase_auth.mdx +++ b/docusaurus/docs/Flutter/05-guides/03-user_token_generation_with_firebase_auth.mdx @@ -154,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. @@ -288,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. @@ -324,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 { @@ -354,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. @@ -372,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 { @@ -433,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/05-guides/05-push-notifications/adding_push_notifications.mdx b/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications.mdx index 1926b93c..7385564e 100644 --- a/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications.mdx +++ b/docusaurus/docs/Flutter/05-guides/05-push-notifications/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/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx b/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx index 351e8021..0c5c3d87 100644 --- a/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx +++ b/docusaurus/docs/Flutter/05-guides/05-push-notifications/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/docs/Flutter/05-guides/06-end_to_end_chat_encryption.mdx b/docusaurus/docs/Flutter/05-guides/06-end_to_end_chat_encryption.mdx index 10699b2d..cf204cfc 100644 --- a/docusaurus/docs/Flutter/05-guides/06-end_to_end_chat_encryption.mdx +++ b/docusaurus/docs/Flutter/05-guides/06-end_to_end_chat_encryption.mdx @@ -37,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: @@ -77,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 @@ -108,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 @@ -254,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/05-guides/08-migrations/migration_guide_4_0.mdx b/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_4_0.mdx index fa2d21b4..2fc5ace5 100644 --- a/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_4_0.mdx +++ b/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_4_0.mdx @@ -14,7 +14,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. @@ -209,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. @@ -537,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: @@ -734,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/05-guides/08-migrations/migration_guide_5_0.mdx b/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_5_0.mdx index 3e4d2052..7f243b2a 100644 --- a/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_5_0.mdx +++ b/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_5_0.mdx @@ -16,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. @@ -59,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. @@ -70,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. @@ -81,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? @@ -118,7 +118,7 @@ Check out the dedicated [guide](../../02-customization/01-custom-widgets/05-cust 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` 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 index 17476d21..4a657515 100644 --- 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 @@ -196,7 +196,7 @@ Both of these will ensure the route is disposed of and the user is disconnected 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 Subroutes +### Defining Routes and Nested Routes In this example, our application has the following routes. @@ -208,7 +208,7 @@ const routeChatChannels = 'chat_channels'; const routeChatChannel = 'chat_channel'; ``` -For the `/chat/` subroutes (**routePrefixChat**), this approach initializes Stream Chat in our application and introduces a nested navigator. +For the `/chat/` nested routes (**routePrefixChat**), this approach initializes Stream Chat in our application and introduces a nested navigator. Let’s explore the code: @@ -267,7 +267,7 @@ 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 subroute **routeChatChannels.** +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 @@ -456,7 +456,7 @@ This final example will be a combination of the first two options. The following ### Application Routes and Conditional Stream Initialization -For this example we have the following routes and subroutes: +For this example we have the following routes and nested routes: ```dart |_ '/' -> home page @@ -553,7 +553,7 @@ If you’re unfamiliar with GoRouter it will help to first read the documentatio There are a few important things to note in the above code: -- Define our routes and subroutes +- 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. 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_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 50bfb6a0..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 @@ -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..80bb4426 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. @@ -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..a7ae5575 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 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_list_header.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/stream_chat_flutter/stream_channel_list_header.mdx index 4c8fbc63..e5b548e4 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 @@ -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_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_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/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..db5cf2ab 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -17,7 +17,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 +390,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 +438,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 +562,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_flutter/.gitignore b/packages/stream_chat_flutter/.gitignore index fe82edc9..69e23451 100644 --- a/packages/stream_chat_flutter/.gitignore +++ b/packages/stream_chat_flutter/.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_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 6c3980d2..2d4604d8 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -1,4 +1,4 @@ -## Upcomming +## Upcoming 🔄 Changed @@ -43,7 +43,7 @@ ✅ Added - Added `StreamMemberGridView` and `StreamMemberListView`. -- Added support for additional text field params in `StreamMessageInput` +- Added support for additional text field parameters in `StreamMessageInput` * `maxLines` * `minLines` * `textInputAction` @@ -228,7 +228,7 @@ - Fix commands resetting the `StreamMessageInputController.value`. - [[#996]](https://github.com/GetStream/stream-chat-flutter/issues/996) Videos break bottom photo carousal. -- Fix: URLs with path and/or query params are not enriched. +- Fix: URLs with path and/or query parameters are not enriched. - [[#1194]](https://github.com/GetStream/stream-chat-flutter/issues/1194) Request permission to access gallery when opening the file picker. @@ -892,11 +892,11 @@ typedef MessageBuilder = Widget Function( ## 1.0.0-beta - **Refreshed widgets design** -- Improved api documentation +- Improved API documentation - Updated `stream_chat` dependency to `^1.0.0-beta` -- Extracted sample app into dedicated [repo](https://github.com/GetStream/flutter-samples) -- Reimplemented existing widgets - using [stream_chat_flutter_core](https://pub.dev/packages/stream_chat_flutter_core) +- Extracted sample app into dedicated [repository](https://github.com/GetStream/flutter-samples) +- Re-implemented existing widgets + using [`stream_chat_flutter_core`](https://pub.dev/packages/stream_chat_flutter_core) ## 0.2.21 @@ -905,7 +905,7 @@ typedef MessageBuilder = Widget Function( ## 0.2.20+4 -- Fix channelPreview when the message list is empty +- Fix `channelPreview` when the message list is empty ## 0.2.20+3 diff --git a/packages/stream_chat_flutter/README.md b/packages/stream_chat_flutter/README.md index aedafb1d..8fd09fa0 100644 --- a/packages/stream_chat_flutter/README.md +++ b/packages/stream_chat_flutter/README.md @@ -32,7 +32,7 @@ It teaches you how to use this SDK and also shows how to make frequently require ## Example App -This repo includes a fully functional example app with setup instructions. +This repository includes a fully functional example app with setup instructions. The example is available under the [example](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_flutter/example) folder. ## Add dependency @@ -46,7 +46,7 @@ You should then run `flutter packages get` ### Android -The package uses [photo_manager](https://pub.dev/packages/photo_manager) to access the device's photo library. +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 fulfil the Android requirements. ### iOS @@ -55,9 +55,9 @@ The library uses [flutter file picker plugin](https://github.com/miguelpruivo/fl 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. Follow [this guide](https://pub.dev/packages/video_player#installation) to fulfill the requirements. +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. ### Web @@ -70,7 +70,7 @@ For the web, edit your `index.html` and add the following in the `` tag in ### MacOS -For MacOS use the [file_selector](https://pub.dev/packages/file_selector#macos) package. +For MacOS use 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 [entitlement](https://docs.flutter.dev/development/platform-integration/desktop#entitlements-and-the-app-sandbox): @@ -88,8 +88,8 @@ If it seems related to the [flutter file picker plugin](https://github.com/migue ## Docs This package provides UI components required for integrating Stream Chat into your application. -Alternatively, you may use the core package [stream_chat_flutter_core](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_flutter_core) which allows more customisation and provides business logic but no UI components. -If you require the maximum amount of control over the API, please use the low level client package: [stream_chat](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat). +Alternatively, you may use the core package [`stream_chat_flutter_core`](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat_flutter_core) which allows more customisation and provides business logic but no UI components. +If you require the maximum amount of control over the API, please use the low level client package: [`stream_chat`](https://github.com/GetStream/stream-chat-flutter/tree/master/packages/stream_chat). ### UI Components @@ -175,7 +175,7 @@ Out of the box, all chat widgets use their default styling, and there are two wa ### 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 { @@ -207,7 +207,7 @@ final client = StreamChatClient( ## Contributing We welcome code changes that improve this library or fix a problem, -please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github. +please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on GitHub. We are pleased to merge your code into the official repository. Make sure to sign our [Contributor License Agreement (CLA)](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) first. See our license file for more details. diff --git a/packages/stream_chat_flutter/example/lib/tutorial_part_1.dart b/packages/stream_chat_flutter/example/lib/tutorial_part_1.dart index b25311d5..d847fa3a 100644 --- a/packages/stream_chat_flutter/example/lib/tutorial_part_1.dart +++ b/packages/stream_chat_flutter/example/lib/tutorial_part_1.dart @@ -21,7 +21,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; /// /// - We set up the Chat [StreamChatClient] with the API key /// -/// - We set the the current user for Chat with [StreamChatClient.connectUser] +/// - We set the current user for Chat with [StreamChatClient.connectUser] /// and a pre-generated user token /// /// - We make [StreamChat] the root Widget of our application From e6e311bfcb5e3dbcc9071ed556ab55def6ffb911 Mon Sep 17 00:00:00 2001 From: Enzo Conty Date: Wed, 8 Feb 2023 14:44:14 +0100 Subject: [PATCH 04/26] replacing sort by channelStateSort since it's deprecated --- .../01-custom-widgets/07-slidable_channel_list_preview.mdx | 2 +- .../03-stream_chat_flutter/stream_channel_grid_view.mdx | 2 +- .../03-stream_chat_flutter/stream_channel_list_header.mdx | 2 +- .../03-stream_chat_flutter/stream_channel_list_view.mdx | 2 +- .../Flutter/05-guides/08-migrations/migration_guide_4_0.mdx | 2 +- .../05-guides/09-initialize_stream_chat_widget_tree.mdx | 4 ++-- .../version-4.x.x/Flutter/guides/migration_guide_4_0.mdx | 2 +- .../Flutter/guides/slidable_channel_list_preview.mdx | 2 +- .../Flutter/stream_chat_flutter/stream_channel_grid_view.mdx | 2 +- .../stream_chat_flutter/stream_channel_list_header.mdx | 2 +- .../Flutter/stream_chat_flutter/stream_channel_list_view.mdx | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docusaurus/docs/Flutter/02-customization/01-custom-widgets/07-slidable_channel_list_preview.mdx b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/07-slidable_channel_list_preview.mdx index 67372ef5..35593ba6 100644 --- a/docusaurus/docs/Flutter/02-customization/01-custom-widgets/07-slidable_channel_list_preview.mdx +++ b/docusaurus/docs/Flutter/02-customization/01-custom-widgets/07-slidable_channel_list_preview.mdx @@ -104,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/03-stream_chat_flutter/stream_channel_grid_view.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_grid_view.mdx index 16bad7dc..0fcde5c1 100644 --- a/docusaurus/docs/Flutter/03-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/03-stream_chat_flutter/stream_channel_list_header.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_header.mdx index 4c8fbc63..f05c8863 100644 --- a/docusaurus/docs/Flutter/03-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 diff --git a/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_view.mdx b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_view.mdx index e8706290..33376fcf 100644 --- a/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_view.mdx +++ b/docusaurus/docs/Flutter/03-stream_chat_flutter/stream_channel_list_view.mdx @@ -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/05-guides/08-migrations/migration_guide_4_0.mdx b/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_4_0.mdx index fa2d21b4..14fa46eb 100644 --- a/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_4_0.mdx +++ b/docusaurus/docs/Flutter/05-guides/08-migrations/migration_guide_4_0.mdx @@ -268,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 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 index 17476d21..5443c51f 100644 --- 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 @@ -396,7 +396,7 @@ class _ChannelListPageState extends State { 'members', [StreamChat.of(context).currentUser!.id], ), - sort: const [SortOption('last_message_at')], + channelStateSort: const [SortOption('last_message_at')], ); @override @@ -654,7 +654,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/migration_guide_4_0.mdx b/docusaurus/flutter_versioned_docs/version-4.x.x/Flutter/guides/migration_guide_4_0.mdx index 887cef3a..1e27ec6a 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 @@ -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 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..35dc6a75 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 @@ -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/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..f05c8863 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 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 258c0b64..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 @@ -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 From 608049f71dff354eec7a26fc38f84e619cb6486a Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 3 Apr 2023 18:01:09 +0530 Subject: [PATCH 05/26] feat(llc,core,ui,persistence,localization): update dependencies. Signed-off-by: xsahil03x --- melos.yaml | 4 +- packages/stream_chat/example/pubspec.yaml | 1 + .../lib/src/core/error/stream_chat_error.dart | 6 +- .../http/interceptor/logging_interceptor.dart | 11 +- .../lib/src/core/http/stream_http_client.dart | 4 +- .../core/models/attachment_file.freezed.dart | 157 +++++++++--------- .../lib/src/core/models/channel_model.g.dart | 45 ++--- .../lib/src/core/models/message.g.dart | 50 +++--- .../lib/src/core/models/reaction.g.dart | 28 +--- .../lib/src/core/models/user.g.dart | 16 +- packages/stream_chat/pubspec.yaml | 38 ++--- .../stream_chat_flutter/example/pubspec.yaml | 3 +- packages/stream_chat_flutter/pubspec.yaml | 16 +- .../example/pubspec.yaml | 2 + .../lib/src/paged_value_notifier.dart | 2 +- .../lib/src/paged_value_notifier.freezed.dart | 117 +++++++------ .../lib/src/stream_channel.dart | 4 +- .../stream_chat_flutter_core/pubspec.yaml | 11 +- .../test/stream_channel_test.dart | 2 +- .../stream_chat_localizations/pubspec.yaml | 1 + .../example/pubspec.yaml | 2 + packages/stream_chat_persistence/pubspec.yaml | 13 +- pubspec.yaml | 7 + 23 files changed, 267 insertions(+), 273 deletions(-) create mode 100644 pubspec.yaml diff --git a/melos.yaml b/melos.yaml index 217f4bc5..7a5016ff 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: diff --git a/packages/stream_chat/example/pubspec.yaml b/packages/stream_chat/example/pubspec.yaml index 9faa8ec7..49e226c2 100644 --- a/packages/stream_chat/example/pubspec.yaml +++ b/packages/stream_chat/example/pubspec.yaml @@ -6,6 +6,7 @@ version: 1.0.0+1 environment: sdk: '>=2.17.0 <3.0.0' + flutter: ">=1.17.0" dependencies: cupertino_icons: ^1.0.0 diff --git a/packages/stream_chat/lib/src/core/error/stream_chat_error.dart b/packages/stream_chat/lib/src/core/error/stream_chat_error.dart index fc069a90..1df28558 100644 --- a/packages/stream_chat/lib/src/core/error/stream_chat_error.dart +++ b/packages/stream_chat/lib/src/core/error/stream_chat_error.dart @@ -98,8 +98,10 @@ class StreamChatNetworkError extends StreamChatError { } return StreamChatNetworkError.raw( code: errorResponse?.code ?? -1, - message: - errorResponse?.message ?? response?.statusMessage ?? error.message, + message: errorResponse?.message ?? + response?.statusMessage ?? + error.message ?? + '', statusCode: errorResponse?.statusCode ?? response?.statusCode, data: errorResponse, isRequestCancelledError: error.type == DioErrorType.cancel, diff --git a/packages/stream_chat/lib/src/core/http/interceptor/logging_interceptor.dart b/packages/stream_chat/lib/src/core/http/interceptor/logging_interceptor.dart index 57ffda7d..6b07495d 100644 --- a/packages/stream_chat/lib/src/core/http/interceptor/logging_interceptor.dart +++ b/packages/stream_chat/lib/src/core/http/interceptor/logging_interceptor.dart @@ -87,8 +87,8 @@ class LoggingInterceptor extends Interceptor { requestHeaders['contentType'] = options.contentType?.toString(); requestHeaders['responseType'] = options.responseType.toString(); requestHeaders['followRedirects'] = options.followRedirects; - requestHeaders['connectTimeout'] = options.connectTimeout; - requestHeaders['receiveTimeout'] = options.receiveTimeout; + requestHeaders['connectTimeout'] = options.connectTimeout?.toString(); + requestHeaders['receiveTimeout'] = options.receiveTimeout?.toString(); _printMapAsTable(_logPrintRequest, requestHeaders, header: 'Headers'); _printMapAsTable(_logPrintRequest, options.extra, header: 'Extras'); } @@ -101,7 +101,8 @@ class LoggingInterceptor extends Interceptor { options.data as Map?, header: 'Body', ); - } else if (data is FormData) { + } + if (data is FormData) { final formDataMap = {} ..addEntries(data.fields) ..addEntries(data.files); @@ -121,7 +122,7 @@ class LoggingInterceptor extends Interceptor { @override void onError(DioError err, ErrorInterceptorHandler handler) { if (error) { - if (err.type == DioErrorType.response) { + if (err.type == DioErrorType.badResponse) { final uri = err.response?.requestOptions.uri; _printBoxed( _logPrintError, @@ -162,7 +163,7 @@ class LoggingInterceptor extends Interceptor { _logPrintResponse('║'); _printResponse(_logPrintResponse, response); _logPrintResponse('║'); - _printLine(_logPrintResponse, '╚'); + _logPrintResponse('╚'); } super.onResponse(response, handler); } diff --git a/packages/stream_chat/lib/src/core/http/stream_http_client.dart b/packages/stream_chat/lib/src/core/http/stream_http_client.dart index 7052ce38..4a13fbaf 100644 --- a/packages/stream_chat/lib/src/core/http/stream_http_client.dart +++ b/packages/stream_chat/lib/src/core/http/stream_http_client.dart @@ -29,8 +29,8 @@ class StreamHttpClient { httpClient = dio ?? Dio() { httpClient ..options.baseUrl = _options.baseUrl - ..options.receiveTimeout = _options.receiveTimeout.inMilliseconds - ..options.connectTimeout = _options.connectTimeout.inMilliseconds + ..options.receiveTimeout = _options.receiveTimeout + ..options.connectTimeout = _options.connectTimeout ..options.queryParameters = { 'api_key': apiKey, ..._options.queryParameters, diff --git a/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart b/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart index f0ccc584..9a0f3d1c 100644 --- a/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart +++ b/packages/stream_chat/lib/src/core/models/attachment_file.freezed.dart @@ -1,7 +1,7 @@ // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'attachment_file.dart'; @@ -43,10 +43,10 @@ mixin _$UploadState { throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull({ - TResult Function()? preparing, - TResult Function(int uploaded, int total)? inProgress, - TResult Function()? success, - TResult Function(String error)? failed, + TResult? Function()? preparing, + TResult? Function(int uploaded, int total)? inProgress, + TResult? Function()? success, + TResult? Function(String error)? failed, }) => throw _privateConstructorUsedError; @optionalTypeArgs @@ -68,10 +68,10 @@ mixin _$UploadState { throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull({ - TResult Function(Preparing value)? preparing, - TResult Function(InProgress value)? inProgress, - TResult Function(Success value)? success, - TResult Function(Failed value)? failed, + TResult? Function(Preparing value)? preparing, + TResult? Function(InProgress value)? inProgress, + TResult? Function(Success value)? success, + TResult? Function(Failed value)? failed, }) => throw _privateConstructorUsedError; @optionalTypeArgs @@ -90,16 +90,18 @@ mixin _$UploadState { abstract class $UploadStateCopyWith<$Res> { factory $UploadStateCopyWith( UploadState value, $Res Function(UploadState) then) = - _$UploadStateCopyWithImpl<$Res>; + _$UploadStateCopyWithImpl<$Res, UploadState>; } /// @nodoc -class _$UploadStateCopyWithImpl<$Res> implements $UploadStateCopyWith<$Res> { +class _$UploadStateCopyWithImpl<$Res, $Val extends UploadState> + implements $UploadStateCopyWith<$Res> { _$UploadStateCopyWithImpl(this._value, this._then); - final UploadState _value; // ignore: unused_field - final $Res Function(UploadState) _then; + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; } /// @nodoc @@ -110,14 +112,12 @@ abstract class _$$PreparingCopyWith<$Res> { } /// @nodoc -class __$$PreparingCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res> +class __$$PreparingCopyWithImpl<$Res> + extends _$UploadStateCopyWithImpl<$Res, _$Preparing> implements _$$PreparingCopyWith<$Res> { __$$PreparingCopyWithImpl( _$Preparing _value, $Res Function(_$Preparing) _then) - : super(_value, (v) => _then(v as _$Preparing)); - - @override - _$Preparing get _value => super._value as _$Preparing; + : super(_value, _then); } /// @nodoc @@ -162,10 +162,10 @@ class _$Preparing extends Preparing { @override @optionalTypeArgs TResult? whenOrNull({ - TResult Function()? preparing, - TResult Function(int uploaded, int total)? inProgress, - TResult Function()? success, - TResult Function(String error)? failed, + TResult? Function()? preparing, + TResult? Function(int uploaded, int total)? inProgress, + TResult? Function()? success, + TResult? Function(String error)? failed, }) { return preparing?.call(); } @@ -199,10 +199,10 @@ class _$Preparing extends Preparing { @override @optionalTypeArgs TResult? mapOrNull({ - TResult Function(Preparing value)? preparing, - TResult Function(InProgress value)? inProgress, - TResult Function(Success value)? success, - TResult Function(Failed value)? failed, + TResult? Function(Preparing value)? preparing, + TResult? Function(InProgress value)? inProgress, + TResult? Function(Success value)? success, + TResult? Function(Failed value)? failed, }) { return preparing?.call(this); } @@ -242,30 +242,30 @@ abstract class _$$InProgressCopyWith<$Res> { factory _$$InProgressCopyWith( _$InProgress value, $Res Function(_$InProgress) then) = __$$InProgressCopyWithImpl<$Res>; + @useResult $Res call({int uploaded, int total}); } /// @nodoc -class __$$InProgressCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res> +class __$$InProgressCopyWithImpl<$Res> + extends _$UploadStateCopyWithImpl<$Res, _$InProgress> implements _$$InProgressCopyWith<$Res> { __$$InProgressCopyWithImpl( _$InProgress _value, $Res Function(_$InProgress) _then) - : super(_value, (v) => _then(v as _$InProgress)); - - @override - _$InProgress get _value => super._value as _$InProgress; + : super(_value, _then); + @pragma('vm:prefer-inline') @override $Res call({ - Object? uploaded = freezed, - Object? total = freezed, + Object? uploaded = null, + Object? total = null, }) { return _then(_$InProgress( - uploaded: uploaded == freezed + uploaded: null == uploaded ? _value.uploaded : uploaded // ignore: cast_nullable_to_non_nullable as int, - total: total == freezed + total: null == total ? _value.total : total // ignore: cast_nullable_to_non_nullable as int, @@ -302,19 +302,18 @@ class _$InProgress extends InProgress { return identical(this, other) || (other.runtimeType == runtimeType && other is _$InProgress && - const DeepCollectionEquality().equals(other.uploaded, uploaded) && - const DeepCollectionEquality().equals(other.total, total)); + (identical(other.uploaded, uploaded) || + other.uploaded == uploaded) && + (identical(other.total, total) || other.total == total)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(uploaded), - const DeepCollectionEquality().hash(total)); + int get hashCode => Object.hash(runtimeType, uploaded, total); @JsonKey(ignore: true) @override + @pragma('vm:prefer-inline') _$$InProgressCopyWith<_$InProgress> get copyWith => __$$InProgressCopyWithImpl<_$InProgress>(this, _$identity); @@ -332,10 +331,10 @@ class _$InProgress extends InProgress { @override @optionalTypeArgs TResult? whenOrNull({ - TResult Function()? preparing, - TResult Function(int uploaded, int total)? inProgress, - TResult Function()? success, - TResult Function(String error)? failed, + TResult? Function()? preparing, + TResult? Function(int uploaded, int total)? inProgress, + TResult? Function()? success, + TResult? Function(String error)? failed, }) { return inProgress?.call(uploaded, total); } @@ -369,10 +368,10 @@ class _$InProgress extends InProgress { @override @optionalTypeArgs TResult? mapOrNull({ - TResult Function(Preparing value)? preparing, - TResult Function(InProgress value)? inProgress, - TResult Function(Success value)? success, - TResult Function(Failed value)? failed, + TResult? Function(Preparing value)? preparing, + TResult? Function(InProgress value)? inProgress, + TResult? Function(Success value)? success, + TResult? Function(Failed value)? failed, }) { return inProgress?.call(this); } @@ -422,13 +421,11 @@ abstract class _$$SuccessCopyWith<$Res> { } /// @nodoc -class __$$SuccessCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res> +class __$$SuccessCopyWithImpl<$Res> + extends _$UploadStateCopyWithImpl<$Res, _$Success> implements _$$SuccessCopyWith<$Res> { __$$SuccessCopyWithImpl(_$Success _value, $Res Function(_$Success) _then) - : super(_value, (v) => _then(v as _$Success)); - - @override - _$Success get _value => super._value as _$Success; + : super(_value, _then); } /// @nodoc @@ -473,10 +470,10 @@ class _$Success extends Success { @override @optionalTypeArgs TResult? whenOrNull({ - TResult Function()? preparing, - TResult Function(int uploaded, int total)? inProgress, - TResult Function()? success, - TResult Function(String error)? failed, + TResult? Function()? preparing, + TResult? Function(int uploaded, int total)? inProgress, + TResult? Function()? success, + TResult? Function(String error)? failed, }) { return success?.call(); } @@ -510,10 +507,10 @@ class _$Success extends Success { @override @optionalTypeArgs TResult? mapOrNull({ - TResult Function(Preparing value)? preparing, - TResult Function(InProgress value)? inProgress, - TResult Function(Success value)? success, - TResult Function(Failed value)? failed, + TResult? Function(Preparing value)? preparing, + TResult? Function(InProgress value)? inProgress, + TResult? Function(Success value)? success, + TResult? Function(Failed value)? failed, }) { return success?.call(this); } @@ -552,24 +549,24 @@ abstract class Success extends UploadState { abstract class _$$FailedCopyWith<$Res> { factory _$$FailedCopyWith(_$Failed value, $Res Function(_$Failed) then) = __$$FailedCopyWithImpl<$Res>; + @useResult $Res call({String error}); } /// @nodoc -class __$$FailedCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res> +class __$$FailedCopyWithImpl<$Res> + extends _$UploadStateCopyWithImpl<$Res, _$Failed> implements _$$FailedCopyWith<$Res> { __$$FailedCopyWithImpl(_$Failed _value, $Res Function(_$Failed) _then) - : super(_value, (v) => _then(v as _$Failed)); - - @override - _$Failed get _value => super._value as _$Failed; + : super(_value, _then); + @pragma('vm:prefer-inline') @override $Res call({ - Object? error = freezed, + Object? error = null, }) { return _then(_$Failed( - error: error == freezed + error: null == error ? _value.error : error // ignore: cast_nullable_to_non_nullable as String, @@ -603,16 +600,16 @@ class _$Failed extends Failed { return identical(this, other) || (other.runtimeType == runtimeType && other is _$Failed && - const DeepCollectionEquality().equals(other.error, error)); + (identical(other.error, error) || other.error == error)); } @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(error)); + int get hashCode => Object.hash(runtimeType, error); @JsonKey(ignore: true) @override + @pragma('vm:prefer-inline') _$$FailedCopyWith<_$Failed> get copyWith => __$$FailedCopyWithImpl<_$Failed>(this, _$identity); @@ -630,10 +627,10 @@ class _$Failed extends Failed { @override @optionalTypeArgs TResult? whenOrNull({ - TResult Function()? preparing, - TResult Function(int uploaded, int total)? inProgress, - TResult Function()? success, - TResult Function(String error)? failed, + TResult? Function()? preparing, + TResult? Function(int uploaded, int total)? inProgress, + TResult? Function()? success, + TResult? Function(String error)? failed, }) { return failed?.call(error); } @@ -667,10 +664,10 @@ class _$Failed extends Failed { @override @optionalTypeArgs TResult? mapOrNull({ - TResult Function(Preparing value)? preparing, - TResult Function(InProgress value)? inProgress, - TResult Function(Success value)? success, - TResult Function(Failed value)? failed, + TResult? Function(Preparing value)? preparing, + TResult? Function(InProgress value)? inProgress, + TResult? Function(Success value)? success, + TResult? Function(Failed value)? failed, }) { return failed?.call(this); } diff --git a/packages/stream_chat/lib/src/core/models/channel_model.g.dart b/packages/stream_chat/lib/src/core/models/channel_model.g.dart index 9bd8f062..d86c2941 100644 --- a/packages/stream_chat/lib/src/core/models/channel_model.g.dart +++ b/packages/stream_chat/lib/src/core/models/channel_model.g.dart @@ -38,30 +38,21 @@ ChannelModel _$ChannelModelFromJson(Map json) => ChannelModel( cooldown: json['cooldown'] as int? ?? 0, ); -Map _$ChannelModelToJson(ChannelModel instance) { - final val = { - 'id': instance.id, - 'type': instance.type, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('cid', readonly(instance.cid)); - writeNotNull('own_capabilities', readonly(instance.ownCapabilities)); - writeNotNull('config', readonly(instance.config)); - writeNotNull('created_by', readonly(instance.createdBy)); - val['frozen'] = instance.frozen; - writeNotNull('last_message_at', readonly(instance.lastMessageAt)); - writeNotNull('created_at', readonly(instance.createdAt)); - writeNotNull('updated_at', readonly(instance.updatedAt)); - writeNotNull('deleted_at', readonly(instance.deletedAt)); - writeNotNull('member_count', readonly(instance.memberCount)); - val['cooldown'] = instance.cooldown; - val['extra_data'] = instance.extraData; - writeNotNull('team', readonly(instance.team)); - return val; -} +Map _$ChannelModelToJson(ChannelModel instance) => + { + 'id': instance.id, + 'type': instance.type, + 'cid': readonly(instance.cid), + 'own_capabilities': readonly(instance.ownCapabilities), + 'config': readonly(instance.config), + 'created_by': readonly(instance.createdBy), + 'frozen': instance.frozen, + 'last_message_at': readonly(instance.lastMessageAt), + 'created_at': readonly(instance.createdAt), + 'updated_at': readonly(instance.updatedAt), + 'deleted_at': readonly(instance.deletedAt), + 'member_count': readonly(instance.memberCount), + 'cooldown': instance.cooldown, + 'extra_data': instance.extraData, + 'team': readonly(instance.team), + }; diff --git a/packages/stream_chat/lib/src/core/models/message.g.dart b/packages/stream_chat/lib/src/core/models/message.g.dart index e2ff89b4..8023cb79 100644 --- a/packages/stream_chat/lib/src/core/models/message.g.dart +++ b/packages/stream_chat/lib/src/core/models/message.g.dart @@ -75,6 +75,31 @@ Map _$MessageToJson(Message instance) { final val = { 'id': instance.id, 'text': instance.text, + 'type': readonly(instance.type), + 'attachments': instance.attachments.map((e) => e.toJson()).toList(), + 'mentioned_users': User.toIds(instance.mentionedUsers), + 'reaction_counts': readonly(instance.reactionCounts), + 'reaction_scores': readonly(instance.reactionScores), + 'latest_reactions': readonly(instance.latestReactions), + 'own_reactions': readonly(instance.ownReactions), + 'parent_id': instance.parentId, + 'quoted_message': readonly(instance.quotedMessage), + 'quoted_message_id': instance.quotedMessageId, + 'reply_count': readonly(instance.replyCount), + 'thread_participants': readonly(instance.threadParticipants), + 'show_in_channel': instance.showInChannel, + 'silent': instance.silent, + 'shadowed': readonly(instance.shadowed), + 'command': readonly(instance.command), + 'deleted_at': readonly(instance.deletedAt), + 'created_at': readonly(instance.createdAt), + 'updated_at': readonly(instance.updatedAt), + 'user': readonly(instance.user), + 'pinned': instance.pinned, + 'pinned_at': readonly(instance.pinnedAt), + 'pin_expires': instance.pinExpires?.toIso8601String(), + 'pinned_by': readonly(instance.pinnedBy), + 'extra_data': instance.extraData, }; void writeNotNull(String key, dynamic value) { @@ -83,31 +108,6 @@ Map _$MessageToJson(Message instance) { } } - writeNotNull('type', readonly(instance.type)); - val['attachments'] = instance.attachments.map((e) => e.toJson()).toList(); - val['mentioned_users'] = User.toIds(instance.mentionedUsers); - writeNotNull('reaction_counts', readonly(instance.reactionCounts)); - writeNotNull('reaction_scores', readonly(instance.reactionScores)); - writeNotNull('latest_reactions', readonly(instance.latestReactions)); - writeNotNull('own_reactions', readonly(instance.ownReactions)); - val['parent_id'] = instance.parentId; - val['quoted_message'] = readonly(instance.quotedMessage); - val['quoted_message_id'] = instance.quotedMessageId; - writeNotNull('reply_count', readonly(instance.replyCount)); - writeNotNull('thread_participants', readonly(instance.threadParticipants)); - val['show_in_channel'] = instance.showInChannel; - val['silent'] = instance.silent; - writeNotNull('shadowed', readonly(instance.shadowed)); - writeNotNull('command', readonly(instance.command)); - writeNotNull('deleted_at', readonly(instance.deletedAt)); - writeNotNull('created_at', readonly(instance.createdAt)); - writeNotNull('updated_at', readonly(instance.updatedAt)); - writeNotNull('user', readonly(instance.user)); - val['pinned'] = instance.pinned; - val['pinned_at'] = readonly(instance.pinnedAt); - val['pin_expires'] = instance.pinExpires?.toIso8601String(); - val['pinned_by'] = readonly(instance.pinnedBy); - val['extra_data'] = instance.extraData; writeNotNull('i18n', instance.i18n); return val; } diff --git a/packages/stream_chat/lib/src/core/models/reaction.g.dart b/packages/stream_chat/lib/src/core/models/reaction.g.dart index 3554106d..c669e850 100644 --- a/packages/stream_chat/lib/src/core/models/reaction.g.dart +++ b/packages/stream_chat/lib/src/core/models/reaction.g.dart @@ -20,22 +20,12 @@ Reaction _$ReactionFromJson(Map json) => Reaction( extraData: json['extra_data'] as Map? ?? const {}, ); -Map _$ReactionToJson(Reaction instance) { - final val = { - 'message_id': instance.messageId, - 'type': instance.type, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('created_at', readonly(instance.createdAt)); - writeNotNull('user', readonly(instance.user)); - val['score'] = instance.score; - writeNotNull('user_id', readonly(instance.userId)); - val['extra_data'] = instance.extraData; - return val; -} +Map _$ReactionToJson(Reaction instance) => { + 'message_id': instance.messageId, + 'type': instance.type, + 'created_at': readonly(instance.createdAt), + 'user': readonly(instance.user), + 'score': instance.score, + 'user_id': readonly(instance.userId), + 'extra_data': instance.extraData, + }; diff --git a/packages/stream_chat/lib/src/core/models/user.g.dart b/packages/stream_chat/lib/src/core/models/user.g.dart index 9e6ae3dc..3736cad1 100644 --- a/packages/stream_chat/lib/src/core/models/user.g.dart +++ b/packages/stream_chat/lib/src/core/models/user.g.dart @@ -33,6 +33,14 @@ User _$UserFromJson(Map json) => User( Map _$UserToJson(User instance) { final val = { 'id': instance.id, + 'role': readonly(instance.role), + 'teams': readonly(instance.teams), + 'created_at': readonly(instance.createdAt), + 'updated_at': readonly(instance.updatedAt), + 'last_active': readonly(instance.lastActive), + 'online': readonly(instance.online), + 'banned': readonly(instance.banned), + 'ban_expires': readonly(instance.banExpires), }; void writeNotNull(String key, dynamic value) { @@ -41,14 +49,6 @@ Map _$UserToJson(User instance) { } } - writeNotNull('role', readonly(instance.role)); - writeNotNull('teams', readonly(instance.teams)); - writeNotNull('created_at', readonly(instance.createdAt)); - writeNotNull('updated_at', readonly(instance.updatedAt)); - writeNotNull('last_active', readonly(instance.lastActive)); - writeNotNull('online', readonly(instance.online)); - writeNotNull('banned', readonly(instance.banned)); - writeNotNull('ban_expires', readonly(instance.banExpires)); writeNotNull('language', instance.language); val['extra_data'] = instance.extraData; return val; diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index 67eb5a21..fe2bfe00 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -9,26 +9,26 @@ environment: sdk: '>=2.17.0 <3.0.0' dependencies: - async: ^2.5.0 - collection: ^1.15.0 - dio: ^4.0.0 - equatable: ^2.0.0 - freezed_annotation: ^2.0.3 - http_parser: ^4.0.0 - jose: ^0.3.2 - json_annotation: ^4.5.0 - logging: ^1.0.1 - meta: ^1.3.0 - mime: ^1.0.0 + async: ^2.10.0 + collection: ^1.17.0 + dio: ^5.1.1 + equatable: ^2.0.5 + freezed_annotation: ^2.2.0 + http_parser: ^4.0.2 + jose: ^0.3.3 + json_annotation: ^4.8.0 + logging: ^1.1.1 + meta: ^1.8.0 + mime: ^1.0.4 rate_limiter: ^1.0.0 - rxdart: ^0.27.0 - uuid: ^3.0.4 - web_socket_channel: ^2.0.0 + rxdart: ^0.27.7 + uuid: ^3.0.7 + web_socket_channel: ^2.3.0 dev_dependencies: - build_runner: ^2.0.1 - dart_code_metrics: ^4.4.0 - freezed: ^2.0.3 - json_serializable: ^6.2.0 + build_runner: ^2.3.3 + dart_code_metrics: ^5.7.0 + freezed: ^2.3.2 + json_serializable: ^6.6.1 mocktail: ^0.3.0 - test: ^1.17.12 + test: ^1.24.1 diff --git a/packages/stream_chat_flutter/example/pubspec.yaml b/packages/stream_chat_flutter/example/pubspec.yaml index c9fc3f0a..defb7257 100644 --- a/packages/stream_chat_flutter/example/pubspec.yaml +++ b/packages/stream_chat_flutter/example/pubspec.yaml @@ -19,6 +19,7 @@ version: 1.0.0+1 environment: sdk: '>=2.17.0 <3.0.0' + flutter: ">=1.17.0" dependencies: # The following adds the Cupertino Icons font to your application. @@ -27,7 +28,7 @@ dependencies: cupertino_icons: ^1.0.4 flutter: sdk: flutter - responsive_builder: ^0.4.2 + responsive_builder: ^0.6.4 stream_chat_flutter: path: ../ stream_chat_localizations: diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index 8bc6e544..d67aa740 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -12,12 +12,11 @@ environment: dependencies: cached_network_image: ^3.0.0 chewie: ^1.3.4 - collection: ^1.15.0 + collection: ^1.17.0 contextmenu: ^3.0.0 dart_vlc: ^0.4.0 desktop_drop: ^0.4.0 diacritic: ^0.1.3 - dio: ^4.0.6 ezanimation: ^0.6.0 file_picker: ^5.2.4 file_selector: ^0.9.0 @@ -25,14 +24,13 @@ dependencies: sdk: flutter flutter_markdown: ^0.6.1 flutter_portal: ^1.0.0 - flutter_svg: ^1.0.1 - http: ^0.13.4 + flutter_svg: ^2.0.4 http_parser: ^4.0.0 image_gallery_saver: ^1.7.1 image_picker: ^0.8.2 jiffy: ^5.0.0 lottie: ^2.0.0 - meta: ^1.3.0 + meta: ^1.8.0 path_provider: ^2.0.9 photo_manager: ^2.5.2 photo_view: ^0.14.0 @@ -44,7 +42,7 @@ dependencies: thumblr: ^0.0.4 url_launcher: ^6.1.0 video_player: ^2.4.5 - video_player_macos: ^1.0.6 + video_player_macos: ^2.0.1 video_thumbnail: ^0.5.0 flutter: @@ -56,9 +54,9 @@ flutter: uses-material-design: true dev_dependencies: - dart_code_metrics: ^4.4.0 + dart_code_metrics: ^5.7.0 flutter_test: sdk: flutter - golden_toolkit: ^0.13.0 + golden_toolkit: ^0.15.0 mocktail: ^0.3.0 - path: ^1.8.0 + path: ^1.8.2 diff --git a/packages/stream_chat_flutter_core/example/pubspec.yaml b/packages/stream_chat_flutter_core/example/pubspec.yaml index 7cd391bc..0abc0cdc 100644 --- a/packages/stream_chat_flutter_core/example/pubspec.yaml +++ b/packages/stream_chat_flutter_core/example/pubspec.yaml @@ -19,6 +19,7 @@ version: 1.0.0+1 environment: sdk: '>=2.17.0 <3.0.0' + flutter: ">=1.17.0" dependencies: # The following adds the Cupertino Icons font to your application. @@ -27,6 +28,7 @@ dependencies: flutter: sdk: flutter stream_chat_flutter_core: ^5.1.0 + dev_dependencies: flutter_test: sdk: flutter diff --git a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart index c122be1d..0209c223 100644 --- a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart +++ b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.dart @@ -83,7 +83,7 @@ abstract class PagedValueNotifier /// Paged value that can be used with [PagedValueNotifier]. @freezed -abstract class PagedValue with _$PagedValue { +class PagedValue with _$PagedValue { /// Represents the success state of the [PagedValue] // @Assert( // 'nextPageKey != null', diff --git a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart index 9e325531..4a85ff07 100644 --- a/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart +++ b/packages/stream_chat_flutter_core/lib/src/paged_value_notifier.freezed.dart @@ -1,7 +1,7 @@ // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark part of 'paged_value_notifier.dart'; @@ -27,11 +27,11 @@ mixin _$PagedValue { throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull( - TResult Function( + TResult? Function( List items, Key? nextPageKey, StreamChatError? error)? $default, { - TResult Function()? loading, - TResult Function(StreamChatError error)? error, + TResult? Function()? loading, + TResult? Function(StreamChatError error)? error, }) => throw _privateConstructorUsedError; @optionalTypeArgs @@ -53,9 +53,9 @@ mixin _$PagedValue { throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull( - TResult Function(Success value)? $default, { - TResult Function(Loading value)? loading, - TResult Function(Error value)? error, + TResult? Function(Success value)? $default, { + TResult? Function(Loading value)? loading, + TResult? Function(Error value)? error, }) => throw _privateConstructorUsedError; @optionalTypeArgs @@ -72,17 +72,19 @@ mixin _$PagedValue { abstract class $PagedValueCopyWith { factory $PagedValueCopyWith(PagedValue value, $Res Function(PagedValue) then) = - _$PagedValueCopyWithImpl; + _$PagedValueCopyWithImpl>; } /// @nodoc -class _$PagedValueCopyWithImpl +class _$PagedValueCopyWithImpl> implements $PagedValueCopyWith { _$PagedValueCopyWithImpl(this._value, this._then); - final PagedValue _value; // ignore: unused_field - final $Res Function(PagedValue) _then; + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; } /// @nodoc @@ -90,36 +92,35 @@ abstract class _$$SuccessCopyWith { factory _$$SuccessCopyWith(_$Success value, $Res Function(_$Success) then) = __$$SuccessCopyWithImpl; + @useResult $Res call({List items, Key? nextPageKey, StreamChatError? error}); } /// @nodoc class __$$SuccessCopyWithImpl - extends _$PagedValueCopyWithImpl + extends _$PagedValueCopyWithImpl> implements _$$SuccessCopyWith { __$$SuccessCopyWithImpl( _$Success _value, $Res Function(_$Success) _then) - : super(_value, (v) => _then(v as _$Success)); - - @override - _$Success get _value => super._value as _$Success; + : super(_value, _then); + @pragma('vm:prefer-inline') @override $Res call({ - Object? items = freezed, + Object? items = null, Object? nextPageKey = freezed, Object? error = freezed, }) { return _then(_$Success( - items: items == freezed + items: null == items ? _value._items : items // ignore: cast_nullable_to_non_nullable as List, - nextPageKey: nextPageKey == freezed + nextPageKey: freezed == nextPageKey ? _value.nextPageKey : nextPageKey // ignore: cast_nullable_to_non_nullable as Key?, - error: error == freezed + error: freezed == error ? _value.error : error // ignore: cast_nullable_to_non_nullable as StreamChatError?, @@ -142,6 +143,7 @@ class _$Success extends Success /// List with all items loaded so far. @override List get items { + if (_items is EqualUnmodifiableListView) return _items; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(_items); } @@ -177,7 +179,7 @@ class _$Success extends Success const DeepCollectionEquality().equals(other._items, _items) && const DeepCollectionEquality() .equals(other.nextPageKey, nextPageKey) && - const DeepCollectionEquality().equals(other.error, error)); + (identical(other.error, error) || other.error == error)); } @override @@ -185,10 +187,11 @@ class _$Success extends Success runtimeType, const DeepCollectionEquality().hash(_items), const DeepCollectionEquality().hash(nextPageKey), - const DeepCollectionEquality().hash(error)); + error); @JsonKey(ignore: true) @override + @pragma('vm:prefer-inline') _$$SuccessCopyWith> get copyWith => __$$SuccessCopyWithImpl>( this, _$identity); @@ -208,11 +211,11 @@ class _$Success extends Success @override @optionalTypeArgs TResult? whenOrNull( - TResult Function( + TResult? Function( List items, Key? nextPageKey, StreamChatError? error)? $default, { - TResult Function()? loading, - TResult Function(StreamChatError error)? error, + TResult? Function()? loading, + TResult? Function(StreamChatError error)? error, }) { return $default?.call(items, nextPageKey, this.error); } @@ -246,9 +249,9 @@ class _$Success extends Success @override @optionalTypeArgs TResult? mapOrNull( - TResult Function(Success value)? $default, { - TResult Function(Loading value)? loading, - TResult Function(Error value)? error, + TResult? Function(Success value)? $default, { + TResult? Function(Loading value)? loading, + TResult? Function(Error value)? error, }) { return $default?.call(this); } @@ -276,13 +279,13 @@ abstract class Success extends PagedValue { const Success._() : super._(); /// List with all items loaded so far. - List get items => throw _privateConstructorUsedError; + List get items; /// The key for the next page to be fetched. - Key? get nextPageKey => throw _privateConstructorUsedError; + Key? get nextPageKey; /// The current error, if any. - StreamChatError? get error => throw _privateConstructorUsedError; + StreamChatError? get error; @JsonKey(ignore: true) _$$SuccessCopyWith> get copyWith => throw _privateConstructorUsedError; @@ -297,14 +300,11 @@ abstract class _$$LoadingCopyWith { /// @nodoc class __$$LoadingCopyWithImpl - extends _$PagedValueCopyWithImpl + extends _$PagedValueCopyWithImpl> implements _$$LoadingCopyWith { __$$LoadingCopyWithImpl( _$Loading _value, $Res Function(_$Loading) _then) - : super(_value, (v) => _then(v as _$Loading)); - - @override - _$Loading get _value => super._value as _$Loading; + : super(_value, _then); } /// @nodoc @@ -349,11 +349,11 @@ class _$Loading extends Loading @override @optionalTypeArgs TResult? whenOrNull( - TResult Function( + TResult? Function( List items, Key? nextPageKey, StreamChatError? error)? $default, { - TResult Function()? loading, - TResult Function(StreamChatError error)? error, + TResult? Function()? loading, + TResult? Function(StreamChatError error)? error, }) { return loading?.call(); } @@ -387,9 +387,9 @@ class _$Loading extends Loading @override @optionalTypeArgs TResult? mapOrNull( - TResult Function(Success value)? $default, { - TResult Function(Loading value)? loading, - TResult Function(Error value)? error, + TResult? Function(Success value)? $default, { + TResult? Function(Loading value)? loading, + TResult? Function(Error value)? error, }) { return loading?.call(this); } @@ -419,26 +419,25 @@ abstract class _$$ErrorCopyWith { factory _$$ErrorCopyWith( _$Error value, $Res Function(_$Error) then) = __$$ErrorCopyWithImpl; + @useResult $Res call({StreamChatError error}); } /// @nodoc class __$$ErrorCopyWithImpl - extends _$PagedValueCopyWithImpl + extends _$PagedValueCopyWithImpl> implements _$$ErrorCopyWith { __$$ErrorCopyWithImpl( _$Error _value, $Res Function(_$Error) _then) - : super(_value, (v) => _then(v as _$Error)); - - @override - _$Error get _value => super._value as _$Error; + : super(_value, _then); + @pragma('vm:prefer-inline') @override $Res call({ - Object? error = freezed, + Object? error = null, }) { return _then(_$Error( - error == freezed + null == error ? _value.error : error // ignore: cast_nullable_to_non_nullable as StreamChatError, @@ -473,15 +472,15 @@ class _$Error extends Error return identical(this, other) || (other.runtimeType == runtimeType && other is _$Error && - const DeepCollectionEquality().equals(other.error, error)); + (identical(other.error, error) || other.error == error)); } @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(error)); + int get hashCode => Object.hash(runtimeType, error); @JsonKey(ignore: true) @override + @pragma('vm:prefer-inline') _$$ErrorCopyWith> get copyWith => __$$ErrorCopyWithImpl>(this, _$identity); @@ -500,11 +499,11 @@ class _$Error extends Error @override @optionalTypeArgs TResult? whenOrNull( - TResult Function( + TResult? Function( List items, Key? nextPageKey, StreamChatError? error)? $default, { - TResult Function()? loading, - TResult Function(StreamChatError error)? error, + TResult? Function()? loading, + TResult? Function(StreamChatError error)? error, }) { return error?.call(this.error); } @@ -538,9 +537,9 @@ class _$Error extends Error @override @optionalTypeArgs TResult? mapOrNull( - TResult Function(Success value)? $default, { - TResult Function(Loading value)? loading, - TResult Function(Error value)? error, + TResult? Function(Success value)? $default, { + TResult? Function(Loading value)? loading, + TResult? Function(Error value)? error, }) { return error?.call(this); } @@ -564,7 +563,7 @@ abstract class Error extends PagedValue { const factory Error(final StreamChatError error) = _$Error; const Error._() : super._(); - StreamChatError get error => throw _privateConstructorUsedError; + StreamChatError get error; @JsonKey(ignore: true) _$$ErrorCopyWith> get copyWith => throw _privateConstructorUsedError; diff --git a/packages/stream_chat_flutter_core/lib/src/stream_channel.dart b/packages/stream_chat_flutter_core/lib/src/stream_channel.dart index bf37aa11..9842c3e2 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_channel.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_channel.dart @@ -425,8 +425,8 @@ class StreamChannelState extends State { var message = snapshot.error.toString(); if (snapshot.error is DioError) { final dioError = snapshot.error as DioError?; - if (dioError?.type == DioErrorType.response) { - message = dioError!.message; + if (dioError?.type == DioErrorType.badResponse) { + message = dioError!.message ?? 'Bad response'; } else { message = 'Check your connection and retry'; } diff --git a/packages/stream_chat_flutter_core/pubspec.yaml b/packages/stream_chat_flutter_core/pubspec.yaml index 81fbe319..78a3e813 100644 --- a/packages/stream_chat_flutter_core/pubspec.yaml +++ b/packages/stream_chat_flutter_core/pubspec.yaml @@ -10,20 +10,21 @@ environment: flutter: ">=1.17.0" dependencies: - collection: ^1.15.0 + collection: ^1.17.0 connectivity_plus: ^3.0.2 flutter: sdk: flutter freezed_annotation: ^2.0.3 - meta: ^1.3.0 + meta: ^1.8.0 rxdart: ^0.27.0 stream_chat: ^5.3.0 + dev_dependencies: - build_runner: ^2.0.1 - dart_code_metrics: ^4.4.0 + build_runner: ^2.3.3 + dart_code_metrics: ^5.7.0 fake_async: ^1.2.0 flutter_test: sdk: flutter - freezed: ^2.0.3 + freezed: ^2.3.2 mocktail: ^0.3.0 diff --git a/packages/stream_chat_flutter_core/test/stream_channel_test.dart b/packages/stream_chat_flutter_core/test/stream_channel_test.dart index 86ce7c2b..875b885d 100644 --- a/packages/stream_chat_flutter_core/test/stream_channel_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_channel_test.dart @@ -92,7 +92,7 @@ void main() { const errorMessage = 'Error! Error! Error!'; final error = DioError( - type: DioErrorType.response, + type: DioErrorType.badResponse, error: errorMessage, requestOptions: RequestOptions(path: ''), ); diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index ce2e5e3a..7462a287 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -15,6 +15,7 @@ dependencies: flutter_localizations: sdk: flutter stream_chat_flutter: ^5.3.0 + dev_dependencies: dart_code_metrics: ^4.16.0 flutter_test: diff --git a/packages/stream_chat_persistence/example/pubspec.yaml b/packages/stream_chat_persistence/example/pubspec.yaml index 435b1442..80a35fc7 100644 --- a/packages/stream_chat_persistence/example/pubspec.yaml +++ b/packages/stream_chat_persistence/example/pubspec.yaml @@ -6,6 +6,7 @@ version: 1.0.0+1 environment: sdk: '>=2.17.0 <3.0.0' + flutter: ">=1.17.0" dependencies: cupertino_icons: ^1.0.3 @@ -13,6 +14,7 @@ dependencies: sdk: flutter stream_chat: ^5.1.0 stream_chat_persistence: ^5.1.0 + dev_dependencies: flutter_test: sdk: flutter diff --git a/packages/stream_chat_persistence/pubspec.yaml b/packages/stream_chat_persistence/pubspec.yaml index dcdf8bd1..5628688b 100644 --- a/packages/stream_chat_persistence/pubspec.yaml +++ b/packages/stream_chat_persistence/pubspec.yaml @@ -10,20 +10,21 @@ environment: flutter: ">=1.17.0" dependencies: - drift: ^1.5.0 + drift: ^1.7.1 flutter: sdk: flutter logging: ^1.0.1 - meta: ^1.3.0 + meta: ^1.8.0 mutex: ^3.0.0 - path: ^1.8.0 + path: ^1.8.2 path_provider: ^2.0.1 sqlite3_flutter_libs: ^0.5.0 stream_chat: ^5.1.0 + dev_dependencies: - build_runner: ^2.0.1 - dart_code_metrics: ^4.4.0 - drift_dev: ^1.5.2 + build_runner: ^2.3.3 + dart_code_metrics: ^4.18.0 + drift_dev: ^1.7.1 flutter_test: sdk: flutter mocktail: ^0.3.0 diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 00000000..9016fa8f --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,7 @@ +name: stream_chat_flutter_workspace + +environment: + sdk: '>=2.18.0 <3.0.0' + +dev_dependencies: + melos: ^3.0.0 From c771aa96d5b8003fed116438502ba2d13328378b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 3 Apr 2023 18:07:31 +0530 Subject: [PATCH 06/26] ci(repo): update melos version Signed-off-by: xsahil03x --- .github/workflows/dart_code_metrics.yaml | 3 +-- .github/workflows/stream_flutter_workflow.yml | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dart_code_metrics.yaml b/.github/workflows/dart_code_metrics.yaml index 9162b1a7..09374717 100644 --- a/.github/workflows/dart_code_metrics.yaml +++ b/.github/workflows/dart_code_metrics.yaml @@ -3,7 +3,6 @@ name: Dart Code Metrics env: flutter_version: "3.3.3" folders: "lib, test" - melos_version: "2.7.1" on: pull_request: @@ -34,7 +33,7 @@ jobs: 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 diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index 9de7ca4d..5cfbce79 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -3,7 +3,6 @@ name: stream_flutter_workflow env: ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' flutter_version: "3.3.3" - melos_version: "2.7.1" on: pull_request: @@ -34,7 +33,7 @@ jobs: 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" @@ -65,7 +64,7 @@ jobs: 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" @@ -94,7 +93,7 @@ jobs: 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 From ffb00d0309bf0b6489e04d7a1f9702702bc1e949 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 3 Apr 2023 18:13:45 +0530 Subject: [PATCH 07/26] ci(repo): update flutter version Signed-off-by: xsahil03x --- .github/workflows/dart_code_metrics.yaml | 2 +- .github/workflows/stream_flutter_workflow.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dart_code_metrics.yaml b/.github/workflows/dart_code_metrics.yaml index 09374717..265ec829 100644 --- a/.github/workflows/dart_code_metrics.yaml +++ b/.github/workflows/dart_code_metrics.yaml @@ -1,7 +1,7 @@ name: Dart Code Metrics env: - flutter_version: "3.3.3" + flutter_version: "3.7.0" folders: "lib, test" on: diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index 5cfbce79..c979229e 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -2,7 +2,7 @@ name: stream_flutter_workflow env: ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' - flutter_version: "3.3.3" + flutter_version: "3.7.0" on: pull_request: From caec2647d3113ee07b349a278b86737401d6d7ed Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 3 Apr 2023 18:19:17 +0530 Subject: [PATCH 08/26] chore(core): fix format Signed-off-by: xsahil03x --- .../lib/src/stream_channel_list_controller.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart index bc98780d..71bc0694 100644 --- a/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart +++ b/packages/stream_chat_flutter_core/lib/src/stream_channel_list_controller.dart @@ -244,10 +244,11 @@ class StreamChannelListController extends PagedValueNotifier { _unsubscribeFromChannelListEvents(); } - _channelEventSubscription = - client.on().skip(1) // Skipping the last emitted event. - // We only need to handle the latest events. - .listen((event) { + _channelEventSubscription = client + .on() + .skip(1) // Skipping the last emitted event. + // We only need to handle the latest events. + .listen((event) { // Only handle the event if the value is in success state. if (value.isNotSuccess) return; From 61170a09215b0a5a76d817e37ef6f581141180ec Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 3 Apr 2023 18:26:57 +0530 Subject: [PATCH 09/26] ci(repo): add cache and concurrency Signed-off-by: xsahil03x --- .github/workflows/dart_code_metrics.yaml | 13 ++++++------- .github/workflows/pana.yml | 4 ++++ .github/workflows/pr_title.yml | 4 ++++ .github/workflows/stream_flutter_workflow.yml | 12 ++++++------ 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/dart_code_metrics.yaml b/.github/workflows/dart_code_metrics.yaml index 265ec829..23be0561 100644 --- a/.github/workflows/dart_code_metrics.yaml +++ b/.github/workflows/dart_code_metrics.yaml @@ -10,6 +10,10 @@ on: branches: - master - develop + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: check: @@ -21,15 +25,10 @@ jobs: 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" diff --git a/.github/workflows/pana.yml b/.github/workflows/pana.yml index a6a7e822..39d2b898 100644 --- a/.github/workflows/pana.yml +++ b/.github/workflows/pana.yml @@ -14,6 +14,10 @@ on: - master paths-ignore: - 'docs/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: stream_chat: 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 c979229e..478ed227 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -11,6 +11,10 @@ on: branches: - master - develop + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: analyze: @@ -22,14 +26,10 @@ jobs: uses: actions/checkout@v2 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: | From 7e7ce696addc88f97a5d494d6eb4411f7e2b23dc Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 3 Apr 2023 18:45:06 +0530 Subject: [PATCH 10/26] chore(core): remove redundant matchers Signed-off-by: xsahil03x --- .../test/matchers/channel_matcher.dart | 48 ----------------- .../get_message_response_matcher.dart | 54 ------------------- .../test/matchers/message_matcher.dart | 48 ----------------- .../test/matchers/users_matcher.dart | 46 ---------------- 4 files changed, 196 deletions(-) delete mode 100644 packages/stream_chat_flutter_core/test/matchers/channel_matcher.dart delete mode 100644 packages/stream_chat_flutter_core/test/matchers/get_message_response_matcher.dart delete mode 100644 packages/stream_chat_flutter_core/test/matchers/message_matcher.dart delete mode 100644 packages/stream_chat_flutter_core/test/matchers/users_matcher.dart diff --git a/packages/stream_chat_flutter_core/test/matchers/channel_matcher.dart b/packages/stream_chat_flutter_core/test/matchers/channel_matcher.dart deleted file mode 100644 index 514462e0..00000000 --- a/packages/stream_chat_flutter_core/test/matchers/channel_matcher.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; - -Matcher isSameChannelAs(Channel targetChannel) => - _IsSameChannelAs(targetChannel: targetChannel); - -class _IsSameChannelAs extends Matcher { - const _IsSameChannelAs({ - required this.targetChannel, - }); - - final Channel targetChannel; - - @override - bool matches(covariant Channel channel, Map matchState) => - channel.cid == targetChannel.cid; - - @override - Description describe(Description description) => - description.add('is same channel as $targetChannel'); -} - -Matcher isSameChannelListAs(List targetChannelList) => - _IsSameChannelListAs(targetChannelList: targetChannelList); - -class _IsSameChannelListAs extends Matcher { - const _IsSameChannelListAs({ - required this.targetChannelList, - }); - - final List targetChannelList; - - @override - bool matches(covariant List channelList, Map matchState) { - var matches = true; - for (var i = 0; i < channelList.length; i++) { - final channel = channelList[i]; - final targetChannel = targetChannelList[i]; - matches = isSameChannelAs(targetChannel).matches(channel, matchState); - if (!matches) break; - } - return matches; - } - - @override - Description describe(Description description) => - description.add('is same channelList as $targetChannelList'); -} diff --git a/packages/stream_chat_flutter_core/test/matchers/get_message_response_matcher.dart b/packages/stream_chat_flutter_core/test/matchers/get_message_response_matcher.dart deleted file mode 100644 index c3a6629d..00000000 --- a/packages/stream_chat_flutter_core/test/matchers/get_message_response_matcher.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; - -Matcher isSameMessageResponseAs(GetMessageResponse targetResponse) => - _IsSameMessageResponseAs(targetResponse: targetResponse); - -class _IsSameMessageResponseAs extends Matcher { - const _IsSameMessageResponseAs({ - required this.targetResponse, - }); - - final GetMessageResponse targetResponse; - - @override - bool matches(covariant GetMessageResponse response, Map matchState) => - response.message.id == targetResponse.message.id && - response.channel?.cid == targetResponse.channel?.cid; - - @override - Description describe(Description description) => - description.add('is same message response as $targetResponse'); -} - -Matcher isSameMessageResponseListAs( - List targetResponseList) => - _IsSameMessageResponseListAs(targetResponseList: targetResponseList); - -class _IsSameMessageResponseListAs extends Matcher { - const _IsSameMessageResponseListAs({ - required this.targetResponseList, - }); - - final List targetResponseList; - - @override - bool matches( - covariant List responseList, Map matchState) { - var matches = true; - for (var i = 0; i < responseList.length; i++) { - final response = responseList[i]; - final targetResponse = targetResponseList[i]; - matches = isSameMessageResponseAs(targetResponse).matches( - response, - matchState, - ); - if (!matches) break; - } - return matches; - } - - @override - Description describe(Description description) => - description.add('is same userResponseList as $targetResponseList'); -} diff --git a/packages/stream_chat_flutter_core/test/matchers/message_matcher.dart b/packages/stream_chat_flutter_core/test/matchers/message_matcher.dart deleted file mode 100644 index 776665ff..00000000 --- a/packages/stream_chat_flutter_core/test/matchers/message_matcher.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; - -Matcher isSameMessageAs(Message targetMessage) => - _IsSameMessageAs(targetMessage: targetMessage); - -class _IsSameMessageAs extends Matcher { - const _IsSameMessageAs({ - required this.targetMessage, - }); - - final Message targetMessage; - - @override - bool matches(covariant Message message, Map matchState) => - message.id == targetMessage.id; - - @override - Description describe(Description description) => - description.add('is same message as $targetMessage'); -} - -Matcher isSameMessageListAs(List targetMessageList) => - _IsSameMessageListAs(targetMessageList: targetMessageList); - -class _IsSameMessageListAs extends Matcher { - const _IsSameMessageListAs({ - required this.targetMessageList, - }); - - final List targetMessageList; - - @override - bool matches(covariant List messageList, Map matchState) { - var matches = true; - for (var i = 0; i < messageList.length; i++) { - final message = messageList[i]; - final targetMessage = targetMessageList[i]; - matches = isSameMessageAs(targetMessage).matches(message, matchState); - if (!matches) break; - } - return matches; - } - - @override - Description describe(Description description) => - description.add('is same messageList as $targetMessageList'); -} diff --git a/packages/stream_chat_flutter_core/test/matchers/users_matcher.dart b/packages/stream_chat_flutter_core/test/matchers/users_matcher.dart deleted file mode 100644 index fa0f0c08..00000000 --- a/packages/stream_chat_flutter_core/test/matchers/users_matcher.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; - -Matcher isSameUserAs(User targetUser) => _IsSameUserAs(targetUser: targetUser); - -class _IsSameUserAs extends Matcher { - const _IsSameUserAs({ - required this.targetUser, - }); - - final User targetUser; - - @override - bool matches(covariant User user, Map matchState) => user.id == targetUser.id; - - @override - Description describe(Description description) => - description.add('is same user as $targetUser'); -} - -Matcher isSameUserListAs(List targetUserList) => - _IsSameUserListAs(targetUserList: targetUserList); - -class _IsSameUserListAs extends Matcher { - const _IsSameUserListAs({ - required this.targetUserList, - }); - - final List targetUserList; - - @override - bool matches(covariant List userList, Map matchState) { - var matches = true; - for (var i = 0; i < userList.length; i++) { - final user = userList[i]; - final targetUser = targetUserList[i]; - matches = isSameUserAs(targetUser).matches(user, matchState); - if (!matches) break; - } - return matches; - } - - @override - Description describe(Description description) => - description.add('is same userList as $targetUserList'); -} From 4f46983e5f36d8337b6480d54ed4630ee0cbf4ed Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 3 Apr 2023 18:47:26 +0530 Subject: [PATCH 11/26] ci(repo): enable flutter cache Signed-off-by: xsahil03x --- .github/workflows/stream_flutter_workflow.yml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index 478ed227..22d341b9 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -53,14 +53,10 @@ jobs: uses: actions/checkout@v2 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: | @@ -82,14 +78,10 @@ jobs: uses: actions/checkout@v2 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: | From 99dd1dbaabc84ed9485e614e69d595dffa764e74 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 3 Apr 2023 18:58:55 +0530 Subject: [PATCH 12/26] push Signed-off-by: xsahil03x --- .../example/ios/Runner.xcodeproj/project.pbxproj | 4 +++- .../example/ios/Runner/Info.plist | 2 ++ .../linux/flutter/generated_plugin_registrant.cc | 12 ++++-------- .../example/linux/flutter/generated_plugins.cmake | 3 +-- .../example/macos/Runner.xcodeproj/project.pbxproj | 11 ++++++----- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../windows/flutter/generated_plugin_registrant.cc | 14 ++++---------- .../windows/flutter/generated_plugins.cmake | 6 ++---- .../windows/flutter/generated_plugin_registrant.cc | 2 +- .../windows/flutter/generated_plugins.cmake | 2 +- 10 files changed, 25 insertions(+), 33 deletions(-) diff --git a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj index 9b47e613..e5d8f743 100644 --- a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -199,6 +199,7 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -235,6 +236,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); diff --git a/packages/stream_chat_flutter/example/ios/Runner/Info.plist b/packages/stream_chat_flutter/example/ios/Runner/Info.plist index 299ebd4c..d49f0173 100644 --- a/packages/stream_chat_flutter/example/ios/Runner/Info.plist +++ b/packages/stream_chat_flutter/example/ios/Runner/Info.plist @@ -61,5 +61,7 @@ Explain why your app uses the mic CADisableMinimumFrameDurationOnPhone + UIApplicationSupportsIndirectInputEvents + diff --git a/packages/stream_chat_flutter/example/linux/flutter/generated_plugin_registrant.cc b/packages/stream_chat_flutter/example/linux/flutter/generated_plugin_registrant.cc index bb19d0b5..5d1305ad 100644 --- a/packages/stream_chat_flutter/example/linux/flutter/generated_plugin_registrant.cc +++ b/packages/stream_chat_flutter/example/linux/flutter/generated_plugin_registrant.cc @@ -8,10 +8,9 @@ #include #include -#include +#include #include #include -#include void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) dart_vlc_registrar = @@ -20,16 +19,13 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) desktop_drop_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopDropPlugin"); desktop_drop_plugin_register_with_registrar(desktop_drop_registrar); - g_autoptr(FlPluginRegistrar) screen_retriever_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin"); - screen_retriever_plugin_register_with_registrar(screen_retriever_registrar); + g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); + file_selector_plugin_register_with_registrar(file_selector_linux_registrar); g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin"); sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar); g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); - g_autoptr(FlPluginRegistrar) window_manager_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "WindowManagerPlugin"); - window_manager_plugin_register_with_registrar(window_manager_registrar); } diff --git a/packages/stream_chat_flutter/example/linux/flutter/generated_plugins.cmake b/packages/stream_chat_flutter/example/linux/flutter/generated_plugins.cmake index fb9923e9..631f39a5 100644 --- a/packages/stream_chat_flutter/example/linux/flutter/generated_plugins.cmake +++ b/packages/stream_chat_flutter/example/linux/flutter/generated_plugins.cmake @@ -5,10 +5,9 @@ list(APPEND FLUTTER_PLUGIN_LIST dart_vlc desktop_drop - screen_retriever + file_selector_linux sqlite3_flutter_libs url_launcher_linux - window_manager ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/packages/stream_chat_flutter/example/macos/Runner.xcodeproj/project.pbxproj b/packages/stream_chat_flutter/example/macos/Runner.xcodeproj/project.pbxproj index f8c105bb..747ee4d9 100644 --- a/packages/stream_chat_flutter/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/stream_chat_flutter/example/macos/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXAggregateTarget section */ @@ -203,7 +203,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { @@ -256,6 +256,7 @@ /* Begin PBXShellScriptBuildPhase section */ 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -404,7 +405,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -484,7 +485,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -531,7 +532,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.11; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/packages/stream_chat_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/stream_chat_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index ae8ff59d..7fd7126b 100644 --- a/packages/stream_chat_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/stream_chat_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ +#include #include #include #include -#include -#include +#include #include #include #include -#include void RegisterPlugins(flutter::PluginRegistry* registry) { ConnectivityPlusWindowsPluginRegisterWithRegistrar( @@ -26,16 +24,12 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("DesktopDropPlugin")); FileSelectorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("FileSelectorWindows")); - FlutterNativeViewPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FlutterNativeViewPlugin")); - ScreenRetrieverPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("ScreenRetrieverPlugin")); + SharePlusWindowsPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); Sqlite3FlutterLibsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin")); ThumblrWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("ThumblrWindowsPlugin")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); - WindowManagerPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("WindowManagerPlugin")); } diff --git a/packages/stream_chat_flutter/example/windows/flutter/generated_plugins.cmake b/packages/stream_chat_flutter/example/windows/flutter/generated_plugins.cmake index 72783874..aeb58c22 100644 --- a/packages/stream_chat_flutter/example/windows/flutter/generated_plugins.cmake +++ b/packages/stream_chat_flutter/example/windows/flutter/generated_plugins.cmake @@ -3,16 +3,14 @@ # list(APPEND FLUTTER_PLUGIN_LIST - connectivity_plus_windows + connectivity_plus dart_vlc desktop_drop file_selector_windows - flutter_native_view - screen_retriever + share_plus sqlite3_flutter_libs thumblr_windows url_launcher_windows - window_manager ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/packages/stream_chat_flutter_core/example/windows/flutter/generated_plugin_registrant.cc b/packages/stream_chat_flutter_core/example/windows/flutter/generated_plugin_registrant.cc index 8083d749..8777c93d 100644 --- a/packages/stream_chat_flutter_core/example/windows/flutter/generated_plugin_registrant.cc +++ b/packages/stream_chat_flutter_core/example/windows/flutter/generated_plugin_registrant.cc @@ -6,7 +6,7 @@ #include "generated_plugin_registrant.h" -#include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { ConnectivityPlusWindowsPluginRegisterWithRegistrar( diff --git a/packages/stream_chat_flutter_core/example/windows/flutter/generated_plugins.cmake b/packages/stream_chat_flutter_core/example/windows/flutter/generated_plugins.cmake index 8cf5d426..cc1361d8 100644 --- a/packages/stream_chat_flutter_core/example/windows/flutter/generated_plugins.cmake +++ b/packages/stream_chat_flutter_core/example/windows/flutter/generated_plugins.cmake @@ -3,7 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST - connectivity_plus_windows + connectivity_plus ) list(APPEND FLUTTER_FFI_PLUGIN_LIST From 36d3ca925815045f19e396a60f3096b15a3f5b14 Mon Sep 17 00:00:00 2001 From: xsahil03x Date: Mon, 3 Apr 2023 20:27:14 +0530 Subject: [PATCH 13/26] fix tests Signed-off-by: xsahil03x --- melos.yaml | 14 ++++---- .../lib/src/core/models/attachment.dart | 4 +-- .../lib/src/core/models/channel_model.dart | 26 +++++++------- .../lib/src/core/models/channel_model.g.dart | 10 ------ .../lib/src/core/models/message.dart | 34 ++++++++----------- .../lib/src/core/models/message.g.dart | 13 ------- .../lib/src/core/models/reaction.dart | 6 ++-- .../lib/src/core/models/reaction.g.dart | 3 -- .../stream_chat/lib/src/core/models/user.dart | 29 ++++++---------- .../lib/src/core/models/user.g.dart | 8 ----- .../core/http/stream_http_client_test.dart | 6 +++- .../test/stream_channel_test.dart | 2 +- 12 files changed, 55 insertions(+), 100 deletions(-) diff --git a/melos.yaml b/melos.yaml index 7a5016ff..baa8761d 100644 --- a/melos.yaml +++ b/melos.yaml @@ -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/lib/src/core/models/attachment.dart b/packages/stream_chat/lib/src/core/models/attachment.dart index 4d9a3b30..c757a174 100644 --- a/packages/stream_chat/lib/src/core/models/attachment.dart +++ b/packages/stream_chat/lib/src/core/models/attachment.dart @@ -146,13 +146,13 @@ class Attachment extends Equatable { /// Shortcut for file size. /// /// {@macro fileSize} - @JsonKey(ignore: true) + @JsonKey(includeToJson: false, includeFromJson: false) int? get fileSize => extraData['file_size'] as int?; /// Shortcut for file mimeType. /// /// {@macro mimeType} - @JsonKey(ignore: true) + @JsonKey(includeToJson: false, includeFromJson: false) String? get mimeType => extraData['mime_type'] as String?; /// Known top level fields. diff --git a/packages/stream_chat/lib/src/core/models/channel_model.dart b/packages/stream_chat/lib/src/core/models/channel_model.dart index 8d01f89d..b3523743 100644 --- a/packages/stream_chat/lib/src/core/models/channel_model.dart +++ b/packages/stream_chat/lib/src/core/models/channel_model.dart @@ -62,19 +62,19 @@ class ChannelModel { final String type; /// The cid of this channel - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final String cid; /// List of user permissions on this channel - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final List? ownCapabilities; /// The channel configuration data - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final ChannelConfig config; /// The user that created this channel - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final User? createdBy; /// True if this channel is frozen @@ -82,23 +82,23 @@ class ChannelModel { final bool frozen; /// The date of the last message - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final DateTime? lastMessageAt; /// The date of channel creation - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final DateTime createdAt; /// The date of the last channel update - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final DateTime updatedAt; /// The date of channel deletion - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final DateTime? deletedAt; /// The count of this channel members - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final int memberCount; /// The number of seconds in a cooldown @@ -106,15 +106,15 @@ class ChannelModel { final int cooldown; /// True if the channel is disabled - @JsonKey(ignore: true) + @JsonKey(includeToJson: false, includeFromJson: false) bool? get disabled => extraData['disabled'] as bool?; /// True if the channel is hidden - @JsonKey(ignore: true) + @JsonKey(includeToJson: false, includeFromJson: false) bool? get hidden => extraData['hidden'] as bool?; /// The date of the last time channel got truncated - @JsonKey(ignore: true) + @JsonKey(includeToJson: false, includeFromJson: false) DateTime? get truncatedAt { final truncatedAt = extraData['truncated_at'] as String?; if (truncatedAt == null) return null; @@ -126,7 +126,7 @@ class ChannelModel { final Map extraData; /// The team the channel belongs to - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final String? team; /// Known top level fields. diff --git a/packages/stream_chat/lib/src/core/models/channel_model.g.dart b/packages/stream_chat/lib/src/core/models/channel_model.g.dart index d86c2941..b1a691e3 100644 --- a/packages/stream_chat/lib/src/core/models/channel_model.g.dart +++ b/packages/stream_chat/lib/src/core/models/channel_model.g.dart @@ -42,17 +42,7 @@ Map _$ChannelModelToJson(ChannelModel instance) => { 'id': instance.id, 'type': instance.type, - 'cid': readonly(instance.cid), - 'own_capabilities': readonly(instance.ownCapabilities), - 'config': readonly(instance.config), - 'created_by': readonly(instance.createdBy), 'frozen': instance.frozen, - 'last_message_at': readonly(instance.lastMessageAt), - 'created_at': readonly(instance.createdAt), - 'updated_at': readonly(instance.updatedAt), - 'deleted_at': readonly(instance.deletedAt), - 'member_count': readonly(instance.memberCount), 'cooldown': instance.cooldown, 'extra_data': instance.extraData, - 'team': readonly(instance.team), }; diff --git a/packages/stream_chat/lib/src/core/models/message.dart b/packages/stream_chat/lib/src/core/models/message.dart index 017bb06f..6f3a5b13 100644 --- a/packages/stream_chat/lib/src/core/models/message.dart +++ b/packages/stream_chat/lib/src/core/models/message.dart @@ -95,14 +95,11 @@ class Message extends Equatable { final String? text; /// The status of a sending message. - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) final MessageSendingStatus status; /// The message type. - @JsonKey( - includeIfNull: false, - toJson: Serializer.readOnly, - ) + @JsonKey(includeToJson: false) final String type; /// The list of attachments, either provided by the user or generated from a @@ -115,19 +112,19 @@ class Message extends Equatable { final List mentionedUsers; /// A map describing the count of number of every reaction. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final Map? reactionCounts; /// A map describing the count of score of every reaction. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final Map? reactionScores; /// The latest reactions to the message created by any user. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final List? latestReactions; /// The reactions added to the message by the current user. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final List? ownReactions; /// The ID of the parent message, if the message is a thread reply. @@ -143,11 +140,11 @@ class Message extends Equatable { String? get quotedMessageId => _quotedMessageId ?? quotedMessage?.id; /// Reserved field indicating the number of replies for this message. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final int? replyCount; /// Reserved field indicating the thread participants for this message. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final List? threadParticipants; /// Check if this message needs to show in the channel. @@ -157,34 +154,31 @@ class Message extends Equatable { final bool silent; /// If true the message is shadowed. - @JsonKey( - includeIfNull: false, - toJson: Serializer.readOnly, - ) + @JsonKey(includeToJson: false) final bool shadowed; /// A used command name. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final String? command; final DateTime? _createdAt; /// Reserved field indicating when the message was deleted. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final DateTime? deletedAt; /// Reserved field indicating when the message was created. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) DateTime get createdAt => _createdAt ?? DateTime.now(); final DateTime? _updatedAt; /// Reserved field indicating when the message was updated last time. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) DateTime get updatedAt => _updatedAt ?? DateTime.now(); /// User who sent the message. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final User? user; /// If true the message is pinned. diff --git a/packages/stream_chat/lib/src/core/models/message.g.dart b/packages/stream_chat/lib/src/core/models/message.g.dart index 8023cb79..cbf849cc 100644 --- a/packages/stream_chat/lib/src/core/models/message.g.dart +++ b/packages/stream_chat/lib/src/core/models/message.g.dart @@ -75,26 +75,13 @@ Map _$MessageToJson(Message instance) { final val = { 'id': instance.id, 'text': instance.text, - 'type': readonly(instance.type), 'attachments': instance.attachments.map((e) => e.toJson()).toList(), 'mentioned_users': User.toIds(instance.mentionedUsers), - 'reaction_counts': readonly(instance.reactionCounts), - 'reaction_scores': readonly(instance.reactionScores), - 'latest_reactions': readonly(instance.latestReactions), - 'own_reactions': readonly(instance.ownReactions), 'parent_id': instance.parentId, 'quoted_message': readonly(instance.quotedMessage), 'quoted_message_id': instance.quotedMessageId, - 'reply_count': readonly(instance.replyCount), - 'thread_participants': readonly(instance.threadParticipants), 'show_in_channel': instance.showInChannel, 'silent': instance.silent, - 'shadowed': readonly(instance.shadowed), - 'command': readonly(instance.command), - 'deleted_at': readonly(instance.deletedAt), - 'created_at': readonly(instance.createdAt), - 'updated_at': readonly(instance.updatedAt), - 'user': readonly(instance.user), 'pinned': instance.pinned, 'pinned_at': readonly(instance.pinnedAt), 'pin_expires': instance.pinExpires?.toIso8601String(), diff --git a/packages/stream_chat/lib/src/core/models/reaction.dart b/packages/stream_chat/lib/src/core/models/reaction.dart index f16fb09f..2bc6f52b 100644 --- a/packages/stream_chat/lib/src/core/models/reaction.dart +++ b/packages/stream_chat/lib/src/core/models/reaction.dart @@ -33,18 +33,18 @@ class Reaction { final String type; /// The date of the reaction - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final DateTime createdAt; /// The user that sent the reaction - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final User? user; /// The score of the reaction (ie. number of reactions sent) final int score; /// The userId that sent the reaction - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final String? userId; /// Reaction custom extraData diff --git a/packages/stream_chat/lib/src/core/models/reaction.g.dart b/packages/stream_chat/lib/src/core/models/reaction.g.dart index c669e850..6dcac5e1 100644 --- a/packages/stream_chat/lib/src/core/models/reaction.g.dart +++ b/packages/stream_chat/lib/src/core/models/reaction.g.dart @@ -23,9 +23,6 @@ Reaction _$ReactionFromJson(Map json) => Reaction( Map _$ReactionToJson(Reaction instance) => { 'message_id': instance.messageId, 'type': instance.type, - 'created_at': readonly(instance.createdAt), - 'user': readonly(instance.user), 'score': instance.score, - 'user_id': readonly(instance.userId), 'extra_data': instance.extraData, }; diff --git a/packages/stream_chat/lib/src/core/models/user.dart b/packages/stream_chat/lib/src/core/models/user.dart index 6cce01df..ca60e614 100644 --- a/packages/stream_chat/lib/src/core/models/user.dart +++ b/packages/stream_chat/lib/src/core/models/user.dart @@ -79,7 +79,7 @@ class User extends Equatable { /// Shortcut for user name. /// /// {@macro name} - @JsonKey(ignore: true) + @JsonKey(includeToJson: false, includeFromJson: false) String get name { if (extraData.containsKey('name') && extraData['name'] != null) { final name = extraData['name']! as String; @@ -91,48 +91,39 @@ class User extends Equatable { /// Shortcut for user image. /// /// {@macro image} - @JsonKey(ignore: true) + @JsonKey(includeToJson: false, includeFromJson: false) String? get image => extraData['image'] as String?; /// User role. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final String? role; /// User teams - @JsonKey( - includeIfNull: false, - toJson: Serializer.readOnly, - ) + @JsonKey(includeToJson: false) final List teams; /// Date of user creation. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final DateTime createdAt; /// Date of last user update. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final DateTime updatedAt; /// Date of last user connection. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final DateTime? lastActive; /// True if user is online. - @JsonKey( - includeIfNull: false, - toJson: Serializer.readOnly, - ) + @JsonKey(includeToJson: false) final bool online; /// True if user is banned from the chat. - @JsonKey( - includeIfNull: false, - toJson: Serializer.readOnly, - ) + @JsonKey(includeToJson: false) final bool banned; /// The date at which the ban will expire. - @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final DateTime? banExpires; /// The language this user prefers. diff --git a/packages/stream_chat/lib/src/core/models/user.g.dart b/packages/stream_chat/lib/src/core/models/user.g.dart index 3736cad1..47094ffc 100644 --- a/packages/stream_chat/lib/src/core/models/user.g.dart +++ b/packages/stream_chat/lib/src/core/models/user.g.dart @@ -33,14 +33,6 @@ User _$UserFromJson(Map json) => User( Map _$UserToJson(User instance) { final val = { 'id': instance.id, - 'role': readonly(instance.role), - 'teams': readonly(instance.teams), - 'created_at': readonly(instance.createdAt), - 'updated_at': readonly(instance.updatedAt), - 'last_active': readonly(instance.lastActive), - 'online': readonly(instance.online), - 'banned': readonly(instance.banned), - 'ban_expires': readonly(instance.banExpires), }; void writeNotNull(String key, dynamic value) { diff --git a/packages/stream_chat/test/src/core/http/stream_http_client_test.dart b/packages/stream_chat/test/src/core/http/stream_http_client_test.dart index 6abed8ae..4854b98f 100644 --- a/packages/stream_chat/test/src/core/http/stream_http_client_test.dart +++ b/packages/stream_chat/test/src/core/http/stream_http_client_test.dart @@ -129,7 +129,11 @@ void main() { await client.get('path'); } on StreamChatNetworkError catch (e) { expect(e, isA()); - expect(e.message, "Dio can't establish new connection after closed."); + expect( + e.message, + "The connection errored: Dio can't establish a new connection" + ' after it was closed.', + ); } }); diff --git a/packages/stream_chat_flutter_core/test/stream_channel_test.dart b/packages/stream_chat_flutter_core/test/stream_channel_test.dart index 875b885d..60a199f2 100644 --- a/packages/stream_chat_flutter_core/test/stream_channel_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_channel_test.dart @@ -93,7 +93,7 @@ void main() { const errorMessage = 'Error! Error! Error!'; final error = DioError( type: DioErrorType.badResponse, - error: errorMessage, + message: errorMessage, requestOptions: RequestOptions(path: ''), ); when(() => mockChannel.initialized) From 7992a51bef1041bc3b4407db466e84266f96478a Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 4 Apr 2023 02:47:46 +0530 Subject: [PATCH 14/26] fix analysis issues Signed-off-by: xsahil03x --- .../lib/src/core/api/requests.dart | 2 +- .../lib/src/core/models/attachment_file.dart | 2 +- .../stream_chat_flutter/example/lib/main.dart | 2 +- .../example/lib/split_view.dart | 2 +- .../lib/src/channel/channel_header.dart | 4 +-- .../lib/src/channel/channel_list_header.dart | 9 +++-- .../lib/src/gallery/gallery_header.dart | 4 +-- .../stream_message_text_field.dart | 35 +------------------ .../lib/src/misc/stream_svg_icon.dart | 7 +++- .../lib/src/misc/thread_header.dart | 4 +-- .../stream_channel_list_view.dart | 2 +- .../test/stream_channel_test.dart | 2 +- .../test/basics_test.dart | 2 +- 13 files changed, 26 insertions(+), 51 deletions(-) diff --git a/packages/stream_chat/lib/src/core/api/requests.dart b/packages/stream_chat/lib/src/core/api/requests.dart index 719b2b9b..f81ee70b 100644 --- a/packages/stream_chat/lib/src/core/api/requests.dart +++ b/packages/stream_chat/lib/src/core/api/requests.dart @@ -40,7 +40,7 @@ class SortOption { final int direction; /// Sorting field Comparator required for offline sorting - @JsonKey(ignore: true) + @JsonKey(includeToJson: false, includeFromJson: false) final Comparator? comparator; /// Serialize model to json diff --git a/packages/stream_chat/lib/src/core/models/attachment_file.dart b/packages/stream_chat/lib/src/core/models/attachment_file.dart index e6750843..ee6690ca 100644 --- a/packages/stream_chat/lib/src/core/models/attachment_file.dart +++ b/packages/stream_chat/lib/src/core/models/attachment_file.dart @@ -52,7 +52,7 @@ class AttachmentFile { /// Byte data for this file. Particularly useful if you want to manipulate /// its data or easily upload to somewhere else. - @JsonKey(ignore: true) + @JsonKey(includeToJson: false, includeFromJson: false) final Uint8List? bytes; /// The file size in bytes. diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index c8978a45..e4f291fe 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -177,7 +177,7 @@ class _SplitViewState extends State { : Center( child: Text( 'Pick a channel to show the messages 💬', - style: Theme.of(context).textTheme.headline5, + style: Theme.of(context).textTheme.headlineSmall, ), ), ), diff --git a/packages/stream_chat_flutter/example/lib/split_view.dart b/packages/stream_chat_flutter/example/lib/split_view.dart index 2ae8e8aa..bbfe6301 100644 --- a/packages/stream_chat_flutter/example/lib/split_view.dart +++ b/packages/stream_chat_flutter/example/lib/split_view.dart @@ -78,7 +78,7 @@ class _SplitViewState extends State { : Center( child: Text( 'Pick a channel to show the messages 💬', - style: Theme.of(context).textTheme.headline5, + style: Theme.of(context).textTheme.headlineSmall, ), ), ), diff --git a/packages/stream_chat_flutter/lib/src/channel/channel_header.dart b/packages/stream_chat_flutter/lib/src/channel/channel_header.dart index d8dce9ff..b97af492 100644 --- a/packages/stream_chat_flutter/lib/src/channel/channel_header.dart +++ b/packages/stream_chat_flutter/lib/src/channel/channel_header.dart @@ -162,8 +162,8 @@ class StreamChannelHeader extends StatelessWidget showMessage: showConnectionStateTile && showStatus, message: statusString, child: AppBar( - toolbarTextStyle: theme.textTheme.bodyText2, - titleTextStyle: theme.textTheme.headline6, + toolbarTextStyle: theme.textTheme.bodyMedium, + titleTextStyle: theme.textTheme.titleLarge, systemOverlayStyle: theme.brightness == Brightness.dark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark, diff --git a/packages/stream_chat_flutter/lib/src/channel/channel_list_header.dart b/packages/stream_chat_flutter/lib/src/channel/channel_list_header.dart index 95cf640d..20c214b1 100644 --- a/packages/stream_chat_flutter/lib/src/channel/channel_list_header.dart +++ b/packages/stream_chat_flutter/lib/src/channel/channel_list_header.dart @@ -131,8 +131,8 @@ class StreamChannelListHeader extends StatelessWidget showMessage: showConnectionStateTile && showStatus, message: statusString, child: AppBar( - toolbarTextStyle: theme.textTheme.bodyText2, - titleTextStyle: theme.textTheme.headline6, + toolbarTextStyle: theme.textTheme.bodyMedium, + titleTextStyle: theme.textTheme.titleLarge, systemOverlayStyle: theme.brightness == Brightness.dark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark, @@ -181,7 +181,10 @@ class StreamChannelListHeader extends StatelessWidget package: 'stream_chat_flutter', width: 24, height: 24, - color: color, + colorFilter: ColorFilter.mode( + color, + BlendMode.srcIn, + ), ); }, ), diff --git a/packages/stream_chat_flutter/lib/src/gallery/gallery_header.dart b/packages/stream_chat_flutter/lib/src/gallery/gallery_header.dart index 866e3c5e..19aed6e6 100644 --- a/packages/stream_chat_flutter/lib/src/gallery/gallery_header.dart +++ b/packages/stream_chat_flutter/lib/src/gallery/gallery_header.dart @@ -80,8 +80,8 @@ class StreamGalleryHeader extends StatelessWidget final galleryHeaderThemeData = StreamGalleryHeaderTheme.of(context); final theme = Theme.of(context); return AppBar( - toolbarTextStyle: theme.textTheme.bodyText2, - titleTextStyle: theme.textTheme.headline6, + toolbarTextStyle: theme.textTheme.bodyMedium, + titleTextStyle: theme.textTheme.titleLarge, systemOverlayStyle: theme.brightness == Brightness.dark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark, diff --git a/packages/stream_chat_flutter/lib/src/message_input/stream_message_text_field.dart b/packages/stream_chat_flutter/lib/src/message_input/stream_message_text_field.dart index 5a0fd63a..a04ab829 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/stream_message_text_field.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/stream_message_text_field.dart @@ -80,7 +80,6 @@ class StreamMessageTextField extends StatefulWidget { this.textAlignVertical, this.textDirection, this.readOnly = false, - ToolbarOptions? toolbarOptions, this.showCursor, this.autofocus = false, this.obscuringCharacter = '•', @@ -155,31 +154,7 @@ class StreamMessageTextField extends StatefulWidget { keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline), enableInteractiveSelection = - enableInteractiveSelection ?? (!readOnly || !obscureText), - toolbarOptions = toolbarOptions ?? - (obscureText - ? (readOnly - // No point in even offering "Select All" in a read-only obscured - // field. - ? const ToolbarOptions() - // Writable, but obscured. - : const ToolbarOptions( - selectAll: true, - paste: true, - )) - : (readOnly - // Read-only, not obscured. - ? const ToolbarOptions( - selectAll: true, - copy: true, - ) - // Writable, not obscured. - : const ToolbarOptions( - copy: true, - cut: true, - selectAll: true, - paste: true, - ))); + enableInteractiveSelection ?? (!readOnly || !obscureText); /// Controls the message being edited. /// @@ -304,13 +279,6 @@ class StreamMessageTextField extends StatefulWidget { /// {@macro flutter.widgets.editableText.readOnly} final bool readOnly; - /// Configuration of toolbar options. - /// - /// If not set, select all and paste will default to be enabled. Copy and cut - /// will be disabled if [obscureText] is true. If [readOnly] is true, - /// paste and cut will be disabled regardless. - final ToolbarOptions toolbarOptions; - /// {@macro flutter.widgets.editableText.showCursor} final bool? showCursor; @@ -720,7 +688,6 @@ class _StreamMessageTextFieldState extends State textAlignVertical: widget.textAlignVertical, textDirection: widget.textDirection, readOnly: widget.readOnly, - toolbarOptions: widget.toolbarOptions, showCursor: widget.showCursor, autofocus: widget.autofocus, obscuringCharacter: widget.obscuringCharacter, diff --git a/packages/stream_chat_flutter/lib/src/misc/stream_svg_icon.dart b/packages/stream_chat_flutter/lib/src/misc/stream_svg_icon.dart index 8472af6e..a040bd42 100644 --- a/packages/stream_chat_flutter/lib/src/misc/stream_svg_icon.dart +++ b/packages/stream_chat_flutter/lib/src/misc/stream_svg_icon.dart @@ -1088,7 +1088,12 @@ class StreamSvgIcon extends StatelessWidget { key: key, width: width, height: height, - color: color, + colorFilter: color != null + ? ColorFilter.mode( + color!, + BlendMode.srcIn, + ) + : null, ); } } diff --git a/packages/stream_chat_flutter/lib/src/misc/thread_header.dart b/packages/stream_chat_flutter/lib/src/misc/thread_header.dart index b6e24cf9..1142ac45 100644 --- a/packages/stream_chat_flutter/lib/src/misc/thread_header.dart +++ b/packages/stream_chat_flutter/lib/src/misc/thread_header.dart @@ -149,8 +149,8 @@ class StreamThreadHeader extends StatelessWidget final theme = Theme.of(context); return AppBar( automaticallyImplyLeading: false, - toolbarTextStyle: theme.textTheme.bodyText2, - titleTextStyle: theme.textTheme.headline6, + toolbarTextStyle: theme.textTheme.bodyMedium, + titleTextStyle: theme.textTheme.titleLarge, systemOverlayStyle: theme.brightness == Brightness.dark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark, diff --git a/packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_view.dart b/packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_view.dart index 6cc18e69..d2829ffd 100644 --- a/packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_view.dart @@ -409,7 +409,7 @@ class StreamChannelListErrorWidget extends StatelessWidget { TextSpan(text: context.translations.loadingChannelsError), ], ), - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, ), TextButton( onPressed: onPressed, diff --git a/packages/stream_chat_flutter_core/test/stream_channel_test.dart b/packages/stream_chat_flutter_core/test/stream_channel_test.dart index 60a199f2..f4acf3c9 100644 --- a/packages/stream_chat_flutter_core/test/stream_channel_test.dart +++ b/packages/stream_chat_flutter_core/test/stream_channel_test.dart @@ -94,7 +94,7 @@ void main() { final error = DioError( type: DioErrorType.badResponse, message: errorMessage, - requestOptions: RequestOptions(path: ''), + requestOptions: RequestOptions(), ); when(() => mockChannel.initialized) .thenAnswer((_) => Future.error(error)); diff --git a/packages/stream_chat_localizations/test/basics_test.dart b/packages/stream_chat_localizations/test/basics_test.dart index ae52a1af..2c8bb4db 100644 --- a/packages/stream_chat_localizations/test/basics_test.dart +++ b/packages/stream_chat_localizations/test/basics_test.dart @@ -103,7 +103,7 @@ class LocalizationTrackerState extends State { @override Widget build(BuildContext context) { - captionFontSize = Theme.of(context).textTheme.caption!.fontSize!; + captionFontSize = Theme.of(context).textTheme.bodySmall!.fontSize!; return Container(); } } From 4be55961e86beb2ef384a3531b687da6056fab94 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 4 Apr 2023 02:57:59 +0530 Subject: [PATCH 15/26] update dcm action Signed-off-by: xsahil03x --- .github/workflows/dart_code_metrics.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dart_code_metrics.yaml b/.github/workflows/dart_code_metrics.yaml index 23be0561..18742e1f 100644 --- a/.github/workflows/dart_code_metrics.yaml +++ b/.github/workflows/dart_code_metrics.yaml @@ -10,7 +10,7 @@ on: branches: - master - develop - + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -37,35 +37,35 @@ jobs: 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' From cbc8eeddd8da5df53b5b5dfb9ebb1242c771573f Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 4 Apr 2023 03:07:27 +0530 Subject: [PATCH 16/26] update action checkout Signed-off-by: xsahil03x --- .github/workflows/dart_code_metrics.yaml | 2 +- .github/workflows/docusaurus.yml | 2 +- .github/workflows/pana.yml | 8 ++++---- .github/workflows/stream_flutter_workflow.yml | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dart_code_metrics.yaml b/.github/workflows/dart_code_metrics.yaml index 18742e1f..52837c1e 100644 --- a/.github/workflows/dart_code_metrics.yaml +++ b/.github/workflows/dart_code_metrics.yaml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: "Git Checkout" - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/docusaurus.yml b/.github/workflows/docusaurus.yml index f46fa893..fc29804f 100644 --- a/.github/workflows/docusaurus.yml +++ b/.github/workflows/docusaurus.yml @@ -11,7 +11,7 @@ jobs: push_docusaurus: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: push uses: GetStream/push-stream-chat-docusaurus-action@main with: diff --git a/.github/workflows/pana.yml b/.github/workflows/pana.yml index 39d2b898..aa72f61a 100644 --- a/.github/workflows/pana.yml +++ b/.github/workflows/pana.yml @@ -23,7 +23,7 @@ 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: @@ -43,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: @@ -64,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: @@ -84,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/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index 22d341b9..8e6df33b 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - name: "Git Checkout" - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: "Install Flutter" @@ -50,7 +50,7 @@ jobs: timeout-minutes: 15 steps: - name: "Git Checkout" - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: "Install Flutter" @@ -70,12 +70,12 @@ 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: "Install Flutter" From 23fae50fefd3d4ec05a20d95792965eaae9cd02a Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 4 Apr 2023 15:31:10 +0530 Subject: [PATCH 17/26] update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat/CHANGELOG.md | 1 + packages/stream_chat_flutter/CHANGELOG.md | 2 +- packages/stream_chat_flutter_core/CHANGELOG.md | 4 ++++ packages/stream_chat_persistence/CHANGELOG.md | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 04a47600..6b7301fc 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -7,6 +7,7 @@ 🔄 Changed - Cancelling a attachment upload now removes the attachment from the message. +- Updated `dio` and other dependencies to resolvable versions. ✅ Added diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index cf0d4372..61ab52cc 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -12,7 +12,7 @@ 🔄 Changed -- Updated `share_plus` dependency to `^6.3.0` +- Updated dependencies to resolvable versions. ## 5.3.0 diff --git a/packages/stream_chat_flutter_core/CHANGELOG.md b/packages/stream_chat_flutter_core/CHANGELOG.md index 60d41e05..6f26af26 100644 --- a/packages/stream_chat_flutter_core/CHANGELOG.md +++ b/packages/stream_chat_flutter_core/CHANGELOG.md @@ -1,3 +1,7 @@ +## Upcoming + +- Updated dependencies to resolvable versions. + ## 5.3.0 - Updated `stream_chat` dependency to [`5.3.0`](https://pub.dev/packages/stream_chat/changelog). diff --git a/packages/stream_chat_persistence/CHANGELOG.md b/packages/stream_chat_persistence/CHANGELOG.md index 5622e0ab..e0dabaa7 100644 --- a/packages/stream_chat_persistence/CHANGELOG.md +++ b/packages/stream_chat_persistence/CHANGELOG.md @@ -1,3 +1,7 @@ +## Upcoming + +- Updated dependencies to resolvable versions. + ## 5.1.0 - Reintroduce support for experimental indexedDB on Web. From 125014848af7bd11d75519ad4a4101e66bb65aaa Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 4 Apr 2023 17:33:57 +0530 Subject: [PATCH 18/26] fix(llc): make message.i18n readonly Signed-off-by: xsahil03x --- packages/stream_chat/lib/src/core/models/message.dart | 2 +- packages/stream_chat/lib/src/core/models/message.g.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/stream_chat/lib/src/core/models/message.dart b/packages/stream_chat/lib/src/core/models/message.dart index 017bb06f..3645b00a 100644 --- a/packages/stream_chat/lib/src/core/models/message.dart +++ b/packages/stream_chat/lib/src/core/models/message.dart @@ -217,7 +217,7 @@ class Message extends Equatable { bool get isEphemeral => type == 'ephemeral'; /// A Map of translations. - @JsonKey(includeIfNull: false) + @JsonKey(includeIfNull: false, toJson: Serializer.readOnly) final Map? i18n; /// Known top level fields. diff --git a/packages/stream_chat/lib/src/core/models/message.g.dart b/packages/stream_chat/lib/src/core/models/message.g.dart index e2ff89b4..695e6332 100644 --- a/packages/stream_chat/lib/src/core/models/message.g.dart +++ b/packages/stream_chat/lib/src/core/models/message.g.dart @@ -108,6 +108,6 @@ Map _$MessageToJson(Message instance) { val['pin_expires'] = instance.pinExpires?.toIso8601String(); val['pinned_by'] = readonly(instance.pinnedBy); val['extra_data'] = instance.extraData; - writeNotNull('i18n', instance.i18n); + writeNotNull('i18n', readonly(instance.i18n)); return val; } From 3bddca8b29c0b691b9187b1d7d0c943d30d2460a Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 4 Apr 2023 17:34:52 +0530 Subject: [PATCH 19/26] chore(llc): update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 04a47600..cd32c621 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -3,6 +3,7 @@ 🐞 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 From 3e6fc826ee144768af2d58cb809d84d790f1f6d3 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 4 Apr 2023 18:09:08 +0530 Subject: [PATCH 20/26] chore(llc): json annotation changes Signed-off-by: xsahil03x --- .../lib/src/core/models/attachment.dart | 1 - .../lib/src/core/models/channel_model.dart | 1 - .../lib/src/core/models/message.dart | 9 ++--- .../lib/src/core/models/message.g.dart | 40 ++++++------------- .../lib/src/core/models/reaction.dart | 1 - .../stream_chat/lib/src/core/models/user.dart | 1 - .../lib/src/core/util/serializer.dart | 7 ---- 7 files changed, 17 insertions(+), 43 deletions(-) diff --git a/packages/stream_chat/lib/src/core/models/attachment.dart b/packages/stream_chat/lib/src/core/models/attachment.dart index c757a174..bceaaacc 100644 --- a/packages/stream_chat/lib/src/core/models/attachment.dart +++ b/packages/stream_chat/lib/src/core/models/attachment.dart @@ -135,7 +135,6 @@ class Attachment extends Equatable { late final UploadState uploadState; /// Map of custom channel extraData - @JsonKey(includeIfNull: false) final Map extraData; /// The attachment ID. diff --git a/packages/stream_chat/lib/src/core/models/channel_model.dart b/packages/stream_chat/lib/src/core/models/channel_model.dart index b3523743..00fa1fcc 100644 --- a/packages/stream_chat/lib/src/core/models/channel_model.dart +++ b/packages/stream_chat/lib/src/core/models/channel_model.dart @@ -122,7 +122,6 @@ class ChannelModel { } /// Map of custom channel extraData - @JsonKey(includeIfNull: false) final Map extraData; /// The team the channel belongs to diff --git a/packages/stream_chat/lib/src/core/models/message.dart b/packages/stream_chat/lib/src/core/models/message.dart index 6f3a5b13..f8631e1c 100644 --- a/packages/stream_chat/lib/src/core/models/message.dart +++ b/packages/stream_chat/lib/src/core/models/message.dart @@ -131,7 +131,7 @@ class Message extends Equatable { final String? parentId; /// A quoted reply message. - @JsonKey(toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final Message? quotedMessage; final String? _quotedMessageId; @@ -185,7 +185,7 @@ class Message extends Equatable { final bool pinned; /// Reserved field indicating when the message was pinned. - @JsonKey(toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final DateTime? pinnedAt; /// Reserved field indicating when the message will expire. @@ -194,11 +194,10 @@ class Message extends Equatable { final DateTime? pinExpires; /// Reserved field indicating who pinned the message. - @JsonKey(toJson: Serializer.readOnly) + @JsonKey(includeToJson: false) final User? pinnedBy; /// Message custom extraData. - @JsonKey(includeIfNull: false) final Map extraData; /// True if the message is a system info. @@ -211,7 +210,7 @@ class Message extends Equatable { bool get isEphemeral => type == 'ephemeral'; /// A Map of translations. - @JsonKey(includeIfNull: false) + @JsonKey(includeToJson: false) final Map? i18n; /// Known top level fields. diff --git a/packages/stream_chat/lib/src/core/models/message.g.dart b/packages/stream_chat/lib/src/core/models/message.g.dart index cbf849cc..506ac7a9 100644 --- a/packages/stream_chat/lib/src/core/models/message.g.dart +++ b/packages/stream_chat/lib/src/core/models/message.g.dart @@ -71,30 +71,16 @@ Message _$MessageFromJson(Map json) => Message( ), ); -Map _$MessageToJson(Message instance) { - final val = { - 'id': instance.id, - 'text': instance.text, - 'attachments': instance.attachments.map((e) => e.toJson()).toList(), - 'mentioned_users': User.toIds(instance.mentionedUsers), - 'parent_id': instance.parentId, - 'quoted_message': readonly(instance.quotedMessage), - 'quoted_message_id': instance.quotedMessageId, - 'show_in_channel': instance.showInChannel, - 'silent': instance.silent, - 'pinned': instance.pinned, - 'pinned_at': readonly(instance.pinnedAt), - 'pin_expires': instance.pinExpires?.toIso8601String(), - 'pinned_by': readonly(instance.pinnedBy), - 'extra_data': instance.extraData, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('i18n', instance.i18n); - return val; -} +Map _$MessageToJson(Message instance) => { + 'id': instance.id, + 'text': instance.text, + 'attachments': instance.attachments.map((e) => e.toJson()).toList(), + 'mentioned_users': User.toIds(instance.mentionedUsers), + 'parent_id': instance.parentId, + 'quoted_message_id': instance.quotedMessageId, + 'show_in_channel': instance.showInChannel, + 'silent': instance.silent, + 'pinned': instance.pinned, + 'pin_expires': instance.pinExpires?.toIso8601String(), + 'extra_data': instance.extraData, + }; diff --git a/packages/stream_chat/lib/src/core/models/reaction.dart b/packages/stream_chat/lib/src/core/models/reaction.dart index 2bc6f52b..474b6dff 100644 --- a/packages/stream_chat/lib/src/core/models/reaction.dart +++ b/packages/stream_chat/lib/src/core/models/reaction.dart @@ -48,7 +48,6 @@ class Reaction { final String? userId; /// Reaction custom extraData - @JsonKey(includeIfNull: false) final Map extraData; /// Map of custom user extraData diff --git a/packages/stream_chat/lib/src/core/models/user.dart b/packages/stream_chat/lib/src/core/models/user.dart index ca60e614..a280d18c 100644 --- a/packages/stream_chat/lib/src/core/models/user.dart +++ b/packages/stream_chat/lib/src/core/models/user.dart @@ -131,7 +131,6 @@ class User extends Equatable { final String? language; /// Map of custom user extraData. - @JsonKey(includeIfNull: false) final Map extraData; /// List of users to list of userIds. diff --git a/packages/stream_chat/lib/src/core/util/serializer.dart b/packages/stream_chat/lib/src/core/util/serializer.dart index 2bf92e39..9c1cb71f 100644 --- a/packages/stream_chat/lib/src/core/util/serializer.dart +++ b/packages/stream_chat/lib/src/core/util/serializer.dart @@ -1,12 +1,5 @@ -/// Used to avoid to serialize properties to json -// ignore: prefer_void_to_null -Null readonly(_) => null; - /// Helper class for serialization to and from json class Serializer { - /// Used to avoid to serialize properties to json - static const Function readOnly = readonly; - /// Takes unknown json keys and puts them in the `extra_data` key static Map moveToExtraDataFromRoot( Map json, From 05681f73a9cb626ce455038a833a8168792faf75 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 5 Apr 2023 15:22:14 +0530 Subject: [PATCH 21/26] test(llc): fix test Signed-off-by: xsahil03x --- .../stream_chat/test/src/core/api/message_api_test.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/stream_chat/test/src/core/api/message_api_test.dart b/packages/stream_chat/test/src/core/api/message_api_test.dart index ed7fefd6..8ae82e94 100644 --- a/packages/stream_chat/test/src/core/api/message_api_test.dart +++ b/packages/stream_chat/test/src/core/api/message_api_test.dart @@ -394,7 +394,12 @@ void main() { path, data: {'language': language}, )).thenAnswer((_) async => successResponse(path, data: { - 'message': translatedMessage.toJson(), + 'message': { + ...translatedMessage.toJson(), + 'i18n': { + language: translatedMessageText, + }, + }, })); final res = await messageApi.translateMessage(messageId, language); From 19339c1fde6fcfa51a9fa6da8d7461e681bb712c Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 5 Apr 2023 16:25:57 +0530 Subject: [PATCH 22/26] test(llc): fix test Signed-off-by: xsahil03x --- .../test/fixtures/channel_state_to_json.json | 126 ++++-------------- .../test/fixtures/message_to_json.json | 3 - 2 files changed, 25 insertions(+), 104 deletions(-) diff --git a/packages/stream_chat/test/fixtures/channel_state_to_json.json b/packages/stream_chat/test/fixtures/channel_state_to_json.json index c0c06f9e..aedc5ccd 100644 --- a/packages/stream_chat/test/fixtures/channel_state_to_json.json +++ b/packages/stream_chat/test/fixtures/channel_state_to_json.json @@ -1,4 +1,3 @@ - { "channel": { "id": "dev", @@ -18,400 +17,325 @@ "text": "fasdfa", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "dry-meadow-0-e8e74482-b4cd-48db-9d1e-30e6c191786f", "text": "test message", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "dry-meadow-0-53e6299f-9b97-4a9c-a27e-7e2dde49b7e0", "text": "test message", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "dry-meadow-0-80925be0-786e-40a5-b225-486518dafd35", "text": "asdfadf", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "dry-meadow-0-64d7970f-ede8-4b31-9738-1bc1756d2bfe", "text": "test", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "withered-cell-0-84cbd760-cf55-4f7e-9207-c5f66cccc6dc", "text": "hi", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "dry-meadow-0-e9203588-43c3-40b1-91f7-f217fc42aa53", "text": "fantastic", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "withered-cell-0-7e3552d7-7a0d-45f2-a856-e91b23a7e240", "text": "nice to meet you", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "dry-meadow-0-1ffeafd4-e4fc-4c84-9394-9d7cb10fff42", "text": "hey", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "dry-meadow-0-3f147324-12c8-4b41-9fb5-2db88d065efa", "text": "hello, everyone", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "dry-meadow-0-51a348ae-0c0a-44de-a556-eac7891c0cf0", "text": "who is there?", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "icy-recipe-7-a29e237b-8d81-4a97-9bc8-d42bca3f1356", "text": "하이", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "icy-recipe-7-935c396e-ddf8-4a9a-951c-0a12fa5bf055", "text": "what are you doing?", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "throbbing-boat-5-1e4d5730-5ff0-4d25-9948-9f34ffda43e4", "text": "👍", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "snowy-credit-3-3e0c1a0d-d22f-42ee-b2a1-f9f49477bf21", "text": "sdasas", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "snowy-credit-3-3319537e-2d0e-4876-8170-a54f046e4b7d", "text": "cjshsa", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "snowy-credit-3-cfaf0b46-1daa-49c5-947c-b16d6697487d", "text": "nhisagdhsadz", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "snowy-credit-3-cebe25a7-a3a3-49fc-9919-91c6725e81f3", "text": "hvadhsahzd", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "divine-glade-9-0cea9262-5766-48e9-8b22-311870aed3bf", "text": "hello", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "red-firefly-9-c4e9007b-bb7d-4238-ae08-5f8e3cd03d73", "text": "hello", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "bitter-glade-2-02aee4eb-4093-4736-808b-2de75820e854", "text": "hello", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "morning-sea-1-0c700bcb-46dd-4224-b590-e77bdbccc480", "text": "http://jaeger.ui.gtstrm.com/", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "ancient-salad-0-53e8b4e6-5b7b-43ad-aeee-8bfb6a9ed0be", "text": "hi", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "ancient-salad-0-8c225075-bd4c-42e2-8024-530aae13cd40", "text": "hi", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null }, { "id": "proud-sea-7-17802096-cbf8-4e3c-addd-4ee31f4c8b5c", "text": "😃", "attachments": [], "parent_id": null, - "quoted_message": null, "quoted_message_id": null, "show_in_channel": null, "mentioned_users": [], "status": "SENT", "silent": false, "pinned": false, - "pinned_at": null, - "pin_expires": null, - "pinned_by": null + "pin_expires": null } ], "pinned_messages": [], diff --git a/packages/stream_chat/test/fixtures/message_to_json.json b/packages/stream_chat/test/fixtures/message_to_json.json index b3b1dd6b..bfd9d71c 100644 --- a/packages/stream_chat/test/fixtures/message_to_json.json +++ b/packages/stream_chat/test/fixtures/message_to_json.json @@ -18,12 +18,9 @@ ], "mentioned_users": [], "parent_id": "parentId", - "quoted_message": null, "quoted_message_id": null, "pinned": false, - "pinned_at": null, "pin_expires": null, - "pinned_by": null, "show_in_channel": true, "hey": "test" } \ No newline at end of file From d94a059c55525fedbdcadf20cde627faa838ea46 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 7 Apr 2023 02:08:04 +0530 Subject: [PATCH 23/26] update .styles Signed-off-by: xsahil03x --- .styles/Google/We.yml | 11 ----------- .vale.ini | 8 +++----- 2 files changed, 3 insertions(+), 16 deletions(-) delete mode 100644 .styles/Google/We.yml diff --git a/.styles/Google/We.yml b/.styles/Google/We.yml deleted file mode 100644 index c7ac7d36..00000000 --- a/.styles/Google/We.yml +++ /dev/null @@ -1,11 +0,0 @@ -extends: existence -message: "Try to avoid using first-person plural like '%s'." -link: 'https://developers.google.com/style/pronouns#personal-pronouns' -level: warning -ignorecase: true -tokens: - - we - - we'(?:ve|re) - - ours? - - us - - let's diff --git a/.vale.ini b/.vale.ini index 5e1c46bf..f295edca 100644 --- a/.vale.ini +++ b/.vale.ini @@ -9,11 +9,9 @@ Packages = Google # with one of Vale's supported formats. [formats] mdx = md - + # Since we mapped `mdx` to `md` in the `formats`section we have to declare our format to be `md` [*.md] BasedOnStyles = Vale, Google -# TokenIgnores = ("integrationguide"), ^<[ ]{0}img(.*)+[ ]{0}/>$, <[ ]{0}img(.*\n)+/> -# BlockIgnores = import \w* from '.*', \w*\.gradle - - +BlockIgnores = (^import .*;), (import .*;), (\n(.*\n)+
), (\| .* \|) +TokenIgnores = (^import .*;),(import .*;) From d7e6878a6006b164b10146937ff681f31742ca85 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 7 Apr 2023 02:21:54 +0530 Subject: [PATCH 24/26] update vale workflow and lints. Signed-off-by: xsahil03x --- .github/workflows/vale-doc-lint.yml | 17 ++++++++++------- .../adding_push_notifications_v2.mdx | 18 +++++++++--------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/vale-doc-lint.yml b/.github/workflows/vale-doc-lint.yml index 2ef15f47..d0253fb4 100644 --- a/.github/workflows/vale-doc-lint.yml +++ b/.github/workflows/vale-doc-lint.yml @@ -1,4 +1,4 @@ -name: Check Docusaurus docs with Vale linter +name: Check Docusaurus docs with vale linter on: [pull_request] @@ -7,16 +7,19 @@ jobs: name: Vale doc linter runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - 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 - 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}} + 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/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx b/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx index 8459b323..c0678e3b 100644 --- a/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx +++ b/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx @@ -54,7 +54,7 @@ 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). +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. @@ -91,7 +91,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 @@ -123,7 +123,7 @@ firebaseMessaging.onTokenRefresh.listen((token) { }); ``` -Push Notifications v2 also supports specifying a name for 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) { @@ -181,7 +181,7 @@ The code below demonstrates how to generate a notification when a **data-only** 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 (e.g. not a class method which requires initialization). +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). @@ -228,7 +228,7 @@ 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 @@ -258,12 +258,12 @@ 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: +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 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 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 @@ -306,7 +306,7 @@ Take a look at the [Stream Chat v1 sample app](https://github.com/GetStream/flut 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) that exports a persistence client. See [here](https://pub.dev/packages/stream_chat_persistence#usage) for information on 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. From eabb9d778b68b3990b8fe6da171fdc1721062c14 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 7 Apr 2023 02:28:18 +0530 Subject: [PATCH 25/26] add path check to package workflows Signed-off-by: xsahil03x --- .github/workflows/dart_code_metrics.yaml | 2 ++ .github/workflows/stream_flutter_workflow.yml | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dart_code_metrics.yaml b/.github/workflows/dart_code_metrics.yaml index 52837c1e..a5ffc54d 100644 --- a/.github/workflows/dart_code_metrics.yaml +++ b/.github/workflows/dart_code_metrics.yaml @@ -6,6 +6,8 @@ env: on: pull_request: + paths: + - 'packages/**' push: branches: - master diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index 8e6df33b..af57f49f 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -6,7 +6,8 @@ env: on: pull_request: - types: [opened, synchronize, reopened, ready_for_review, converted_to_draft] + paths: + - 'packages/**' push: branches: - master From 3eb1756f706bd218a1b062309a72cf213d8ae195 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 7 Apr 2023 02:57:54 +0530 Subject: [PATCH 26/26] Update docusaurus.yml --- .github/workflows/docusaurus.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docusaurus.yml b/.github/workflows/docusaurus.yml index fc29804f..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@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 }}