Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
imtoori committed Sep 30, 2022
2 parents 1e40294 + 4f25422 commit 54a0e29
Show file tree
Hide file tree
Showing 556 changed files with 29,651 additions and 135,846 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dart_code_metrics.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Dart Code Metrics

env:
flutter_version: "3.0.0"
flutter_version: "3.3.3"
folders: "lib, test"
melos_version: "2.1.0"
melos_version: "2.7.1"

on:
pull_request:
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/stream_flutter_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: stream_flutter_workflow

env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
flutter_version: "3.0.0"
melos_version: "2.1.0"
flutter_version: "3.3.3"
melos_version: "2.7.1"

on:
pull_request:
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
test:
runs-on: macos-latest
if: github.event.pull_request.draft == false
timeout-minutes: 20
timeout-minutes: 30
steps:
- name: "Git Checkout"
uses: actions/checkout@v2
Expand Down Expand Up @@ -111,22 +111,27 @@ jobs:
uses: VeryGoodOpenSource/[email protected]
with:
path: packages/stream_chat/coverage/lcov.info
min_coverage: 80
min_coverage: 79
- name: "Stream Chat Persistence Coverage Check"
uses: VeryGoodOpenSource/[email protected]
with:
path: packages/stream_chat_localizations/coverage/lcov.info
min_coverage: 88
- name: "Stream Chat Persistence Coverage Check"
uses: VeryGoodOpenSource/[email protected]
with:
path: packages/stream_chat_persistence/coverage/lcov.info
min_coverage: 95
min_coverage: 97
- name: "Stream Chat Flutter Core Coverage Check"
uses: VeryGoodOpenSource/[email protected]
with:
path: packages/stream_chat_flutter_core/coverage/lcov.info
min_coverage: 90
min_coverage: 30
- name: "Stream Chat Flutter Coverage Check"
uses: VeryGoodOpenSource/[email protected]
with:
path: packages/stream_chat_flutter/coverage/lcov.info
min_coverage: 67
min_coverage: 44

draft-build:
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ analyzer:
exclude:
- packages/*/lib/**/*.g.dart
- packages/*/example/**
- packages/*/lib/src/emoji
- packages/*/lib/**/*.freezed.dart
- packages/*/test/**

Expand Down
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ analyzer:
- dart_code_metrics
exclude:
- packages/*/lib/**/*.g.dart
- packages/*/lib/src/emoji/**
- packages/*/lib/scrollable_positioned_list/**
- packages/*/lib/**/*.freezed.dart

Expand Down
118 changes: 118 additions & 0 deletions docusaurus/docs/Flutter/guides/autocomplete_triggers.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
id: autocomplete_triggers
title: Adding Custom Autocomplete Triggers
---

Adding Custom Autocomplete Triggers

### Introduction

The [StreamMessageInput](../stream_chat_flutter/message_input.mdx) widget provides a way to add custom autocomplete triggers using the `StreamMessageInput.customAutocompleteTriggers` property.

By default we provide autocomplete triggers for mentions and commands, but it's very easy to add your custom ones.

### Add Emoji Autocomplete Trigger

To add a custom emoji autocomplete trigger, you must first create an `AutoCompleteOptions` widget.
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)

```dart
import 'package:emojis/emoji.dart';
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:substring_highlight/substring_highlight.dart';
/// Overlay for displaying emoji that can be used
class StreamEmojiAutocompleteOptions extends StatelessWidget {
/// Constructor for creating a [StreamEmojiAutocompleteOptions]
const StreamEmojiAutocompleteOptions({
super.key,
required this.query,
this.onEmojiSelected,
});
/// Query for searching emoji.
final String query;
/// Callback called when an emoji is selected.
final ValueSetter<Emoji>? onEmojiSelected;
@override
Widget build(BuildContext context) {
final emojis = Emoji.all().where((it) {
final normalizedQuery = query.toUpperCase();
final normalizedShortName = it.shortName.toUpperCase();
return normalizedShortName.contains(normalizedQuery);
});
if (emojis.isEmpty) return const SizedBox.shrink();
return StreamAutocompleteOptions<Emoji>(
options: emojis,
optionBuilder: (context, emoji) {
final themeData = Theme.of(context);
return ListTile(
dense: true,
horizontalTitleGap: 0,
leading: Text(
emoji.char,
style: themeData.textTheme.headline6!.copyWith(
fontSize: 24,
),
),
title: SubstringHighlight(
text: emoji.shortName,
term: query,
textStyleHighlight: themeData.textTheme.headline6!.copyWith(
color: Colors.yellow,
fontSize: 14.5,
fontWeight: FontWeight.bold,
),
textStyle: themeData.textTheme.headline6!.copyWith(
fontSize: 14.5,
),
),
onTap: onEmojiSelected == null ? null : () => onEmojiSelected!(emoji),
);
},
);
}
}
```

Now it's time to use the `StreamEmojiAutocompleteOptions` widget.

```dart
StreamMessageInput(
customAutocompleteTriggers: [
StreamAutocompleteTrigger(
trigger: ':',
minimumRequiredCharacters: 2,
optionsViewBuilder: (
context,
autocompleteQuery,
messageEditingController,
) {
final query = autocompleteQuery.query;
return StreamEmojiAutocompleteOptions(
query: query,
onEmojiSelected: (emoji) {
// accepting the autocomplete option.
StreamAutocomplete.of(context).acceptAutocompleteOption(
emoji.char,
keepTrigger: false,
);
},
);
},
),
],
),
```
14 changes: 2 additions & 12 deletions melos.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: stream_chat_flutter
repository: https://github.com/GetStream/stream-chat-flutter

versioning:
mode: independent

packages:
- packages/**

Expand Down Expand Up @@ -54,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"
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"
description: Build all generated files for Dart packages in this project.

generate:flutter:
run: melos exec -c 1 --depends-on="build_runner" --flutter -- "flutter pub run build_runner build --delete-conflicting-outputs"
run: melos exec -c 1 --depends-on="build_runner" --flutter -- "flutter run build_runner build --delete-conflicting-outputs --enable-experiment=super-parameters,enhanced-enums"
description: Build all generated files for Flutter packages in this project.

test:all:
Expand Down Expand Up @@ -97,10 +94,3 @@ scripts:
npm install -g https://github.com/GetStream/stream-chat-docusaurus-cli &&
npx stream-chat-docusaurus -i -s
description: Runs the docusaurus documentation locally.

dev_dependencies:
dart_code_metrics: ^4.4.0

environment:
sdk: '>=2.17.0 <3.0.0'
flutter: '>=1.17.0 <3.0.0'
73 changes: 73 additions & 0 deletions packages/stream_chat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,76 @@
## 5.0.0

- Included the changes from version [4.5.0](#450).

🛑️ Breaking Changes from `5.0.0-beta.2`

- `Channel.addMembers`, `Channel.removeMembers`, `Channel.inviteMembers` and `Channel.update`
positional params are now optional params.

```dart
// previous
channel.addMembers([...ids], message, hideHistory);
channel.removeMembers([...ids], message);
channel.inviteMembers([...ids], message);
channel.update({...channelData}, updateMessage);
// new
channel.addMembers([...ids], message: ..., hideHistory: ...);
channel.removeMembers([...ids], message: ...);
channel.inviteMembers([...ids], message: ...);
channel.update({...channelData}, updateMessage: ...);
```
## 5.0.0-beta.2
- Included the changes from version [4.4.0](#440) and [4.4.1](#441).
## 5.0.0-beta.1
- Minor fixes.
- Removed deprecated code.
## 4.6.0
✅ Added
- Added `StreamChatClient.getCallToken` and `StreamChatClient.createCall` methods.
🐞 Fixed
- Only listen to client events when the user is connected to the websocket.
## 4.5.0
🐞 Fixed
- Fix `Channel.removeMessage` not able to remove thread message.
✅ Added
- Added `hide_history` flag in `client.addChannelMembers`, `channel.addMembers`.
## 4.4.1
🐞 Fixed
- Do not serialize `AttachmentFile.bytes`
## 4.4.0
🐞 Fixed
- Fix WebSocket contemporary connection calls while disconnecting
✅ Added
- Export `StreamAttachmentFileUploader`.
🔄 Changed
- Deprecated `StreamChatClient.attachmentFileUploader`,
Use `StreamChatClient.attachmentFileUploaderProvider` instead.
## 4.3.0
🐞 Fixed
Expand Down
5 changes: 4 additions & 1 deletion packages/stream_chat/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import 'package:stream_chat/stream_chat.dart';
Future<void> main() async {
/// Create a new instance of [StreamChatClient]
/// by passing the apikey obtained from your project dashboard.
final client = StreamChatClient('b67pax5b2wdq', logLevel: Level.INFO);
final client = StreamChatClient(
'b67pax5b2wdq',
logLevel: Level.INFO,
);

/// Set the current user. In a production scenario, this should be done using
/// a backend to generate a user token using our server SDK.
Expand Down
Loading

0 comments on commit 54a0e29

Please sign in to comment.