Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dogfooding): enhanced dogfooding readme #765

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 80 additions & 9 deletions dogfooding/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,87 @@
# dogfooding
# Dogfooding App

A new Flutter project.
The Dogfooding App is built using the [Stream Video Flutter](https://pub.dev/packages/stream_video_flutter) package, designed to showcase both core and advanced features of the package. It also serves as an internal testing tool for the Stream team.

For a more basic example of how to use the Stream Video Flutter package, check out the [example app here](https://github.com/GetStream/stream-video-flutter/tree/main/packages/stream_video_flutter/example).

## Features

- **Video Calls**: Test various aspects of video call functionality.
- Create or join a video meeting.
- Make direct calls to other users with ringing.

- **Screen Sharing**: Experience seamless screen sharing between participants.

- **Picture-in-Picture (PiP)**: Test Picture-in-Picture mode on both iOS and Android devices.

- **Chat Integration**: Send and receive messages during calls.

- **Testing Ground**: Used by Stream developers for feature validation and bug testing.

## Getting Started

This project is a starting point for a Flutter application.
To set up and run the app, follow these steps:

1. Clone the repo and install the dependencies
First, clone the repository to your local machine and install the required Flutter packages:

```bash
git clone https://github.com/GetStream/stream-video-flutter.git
cd stream-video-flutter/dogfooding
flutter pub get
```

2. (iOS setup) Open iOS project in Xcode

```bash
cd ios
open Runner.xcworkspace
```

3. (iOS setup) Update the Bundle Identifier and Configure Signing

- In Xcode, go to the Signing & Capabilities tab.
- Under Team, select your own development team.
- Update the bundle identifier for both Runner and ScreenSharing targets to something unique:
- Example: `com.yourname.StreamDogfooding`
- Example (ScreenSharing): com.yourname.StreamDogfooding.ScreenSharing
- Update the App Group for both targets:
- Remove the existing group.
- Create a new app group based on your updated bundle identifier.
- Example: `group.com.yourname.StreamDogfooding`

4. Run the app
Once the setup is complete, you can run the app using Flutter:

```bash
## Ensure you're in the dogfooding directory
flutter run
```

The app should now launch on your connected device or simulator.

:::note
When logging in with an email address, note that the user_id for the created user will automatically replace the `@` and `.` characters with underscores (`_`).

For example, if you log in with `[email protected]`, the corresponding `user_id` will be `test_test_com`.

This is crucial to keep in mind, especially when testing direct calls, as you'll need to reference the correct `user_id`.
:::

## License

```
Copyright (c) 2014-2024 Stream.io Inc. All rights reserved.

A few resources to get you started if this is your first Flutter project:
Licensed under the Stream License;
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
https://github.com/GetStream/stream-video-android/blob/main/LICENSE

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
7 changes: 2 additions & 5 deletions dogfooding/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -574,11 +574,9 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = ScreenSharing/ScreenSharing.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = EHV7XZLAHA;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -598,7 +596,6 @@
PRODUCT_BUNDLE_IDENTIFIER = io.getstream.video.flutter.dogfooding.ScreenSharing;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match Development io.getstream.video.flutter.dogfooding.ScreenSharing";
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -814,7 +811,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = EHV7XZLAHA;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Flutter Dogfooding";
Expand Down
13 changes: 13 additions & 0 deletions dogfooding/lib/app/app_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,19 @@ class _StreamDogFoodingAppContentState
},
),
);

// UNCOMMENT THIS TO SHOW IN-APP INCOMING SCREEN
// _compositeSubscription.add(streamVideo.state.incomingCall.listen((call) {
// if (call == null) return;

// // Navigate to the call screen.
// final extra = (
// call: call,
// connectOptions: null,
// );

// _router.push(CallRoute($extra: extra).location, extra: extra);
// }));
}

_observeFcmMessages() {
Expand Down
4 changes: 2 additions & 2 deletions dogfooding/lib/di/injector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Future<void> _backgroundVoipCallHandler() async {
user: User(info: userCredentials.userInfo),
userToken: userCredentials.token.rawValue,
options: const StreamVideoOptions(
logPriority: Priority.info,
logPriority: Priority.verbose,
muteAudioWhenInBackground: true,
muteVideoWhenInBackground: true,
),
Expand Down Expand Up @@ -192,7 +192,7 @@ StreamVideo _initStreamVideo(
user: user,
tokenLoader: tokenLoader,
options: const StreamVideoOptions(
logPriority: Priority.info,
logPriority: Priority.verbose,
muteAudioWhenInBackground: true,
muteVideoWhenInBackground: true,
),
Expand Down
2 changes: 1 addition & 1 deletion dogfooding/lib/screens/call_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class _CallScreenState extends State<CallScreen> {
call: call,
localParticipant: localParticipant,
screenShareConstraints: const ScreenShareConstraints(
useiOSBroadcastExtension: false,
useiOSBroadcastExtension: true,
),
enabledScreenShareBackgroundColor:
AppColorPalette.primary,
Expand Down
10 changes: 10 additions & 0 deletions dogfooding/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ dependencies:
stream_video_screen_sharing: ^0.5.3
uni_links: ^0.5.1

dependency_overrides:
stream_video:
path: ../packages/stream_video
stream_video_flutter:
path: ../packages/stream_video_flutter
stream_video_push_notification:
path: ../packages/stream_video_push_notification
stream_video_screen_sharing:
path: ../packages/stream_video_screen_sharing

dev_dependencies:
build_runner: ^2.4.6
envied_generator: ^0.3.0+3
Expand Down
54 changes: 45 additions & 9 deletions packages/stream_video_flutter/example/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,52 @@
# example
# Stream Video Flutter Example App

An example project for the stream_video_flutter package.
This is an example app built using the [Stream Video Flutter](https://pub.dev/packages/stream_video_flutter) package, designed to showcase both core features of the package. It's a great starting point to explore how the Stream Video SDK works in real-world scenarios.

For a more advanced example of how to use the Stream Video Flutter package, check out the [dogfooding app here](https://github.com/GetStream/stream-video-flutter/tree/main/dogfooding).

## Features

- **Video Calls**: Test various aspects of video call functionality.
- Create or join a video meeting (with or without a Lobby).
- Make direct calls to other users (without CallKit integration - only in-app ringing screen)

## Getting Started

This project is a starting point for a Flutter application.
To set up and run the app, follow these steps:

1. Clone the repo and install the dependencies
First, clone the repository to your local machine and install the required Flutter packages:

```bash
git clone https://github.com/GetStream/stream-video-flutter.git
cd stream-video-flutter/packages/stream_video_flutter/example
flutter pub get
```

2. Run the app
Once the setup is complete, you can run the app using Flutter:

```bash
## Ensure you're in the example directory
flutter run
```

The app should now launch on your connected device or simulator.

## License

```
Copyright (c) 2014-2024 Stream.io Inc. All rights reserved.

A few resources to get you started if this is your first Flutter project:
Licensed under the Stream License;
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
https://github.com/GetStream/stream-video-android/blob/main/LICENSE

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
39 changes: 20 additions & 19 deletions packages/stream_video_flutter/example/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import 'dart:async';
import 'dart:convert';

import 'package:example/stream_video_sdk.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -30,58 +31,58 @@ Future<void> _onFirebaseBackgroundMessage(RemoteMessage message) async {
final authRepository = await AuthRepository.getInstance();
final credentials = authRepository.getCredentials();
if (credentials == null) return;
/*final client = await StreamVideoSdk.initialize(

final client = await StreamVideoSdk.initialize(
apiKey: credentials.apiKey,
user: credentials.userInfo,
userToken: credentials.token,
);
final handled = await client.handleVoipPushNotification(message.data);
if (!handled) {
}
*/

client.observeCallDeclinedCallKitEvent();

await _handlePushNotification(message);

await StreamVideo.reset(disconnect: true);
}

Future<bool> _handlePushNotification(RemoteMessage message) async {
try {
final payload = message.data;
// Only handle messages from stream.video
final sender = payload['sender'] as String?;
if (sender != 'stream.video') {
debugPrint('Not a stream.video message');
return;
return false;
}

// Only handle ringing calls.
final type = payload['type'] as String?;
if (type != 'call.ring' && type != 'call.missed') {
debugPrint('Not a call.ring or call.missed message');
return;
return false;
}

// Return if the payload does not contain a call cid.
final callCid = payload['call_cid'] as String?;
if (callCid == null) {
debugPrint('No call cid in payload');
return;
return false;
}

final receiverId = payload['receiver_id'] as String?;
if (receiverId != credentials.userInfo.id) {
debugPrint(
'Not a call for this user($receiverId != ${credentials.userInfo.id})',
);
return;
}
final createdByDisplayName = payload['created_by_display_name'] as String?;
if (createdByDisplayName == null) {
debugPrint('No created_by_display_name in payload');
return;
return false;
}

await showNotification(callCid, type, createdByDisplayName);
return true;
} catch (e, stk) {
debugPrint('Error handling remote message: $e');
debugPrint(stk.toString());

return false;
}
await StreamVideo.reset(disconnect: true);
}

final ln.FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
Expand Down Expand Up @@ -176,7 +177,7 @@ class _MyAppState extends State<MyApp> {

Future<bool> _onFirebaseForegroundMessage(RemoteMessage message) async {
debugPrint('[onFirebaseForegroundMessage] message: ${message.toMap()}');
return StreamVideo.instance.handleVoipPushNotification(message.data);
return _handlePushNotification(message);
}

@override
Expand All @@ -191,7 +192,7 @@ class _MyAppState extends State<MyApp> {
final lightAppTheme = StreamVideoTheme.light();

return MaterialApp(
title: 'Stream Video UI Example',
title: 'Stream Video Example',
theme: ThemeData(
textTheme: GoogleFonts.robotoMonoTextTheme(),
extensions: <ThemeExtension<dynamic>>[lightAppTheme],
Expand Down
Loading
Loading