Skip to content

Commit

Permalink
Merge branch 'develop' into FLUT-262
Browse files Browse the repository at this point in the history
  • Loading branch information
ygit authored Apr 9, 2024
2 parents a9d7b9b + d593b9a commit 9179ce1
Show file tree
Hide file tree
Showing 84 changed files with 3,000 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ sample apps/flutter-quickstart-app/.dart_tool/
sample apps/hms-callkit-app/.dart_tool/
sample apps/flutter-quickstart-app/build/ios/Pods.build/
sample apps/hms-callkit-app/.dart_tool/flutter_build/
sample apps/flutter-meet/.dart_tool/
sample apps/flutter-meet/android/.idea/


##GIT Files
.dart_tool/package_config.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class PreviewBottomButtonSection extends StatelessWidget {
onTap: () {
previewStore.toggleNoiseCancellation();
},
isActive: previewStore.isNoiseCancellationEnabled,
isActive: !previewStore.isNoiseCancellationEnabled,
child: SvgPicture.asset(
'packages/hms_room_kit/lib/src/assets/icons/music_wave.svg',
colorFilter: ColorFilter.mode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@
</intent-filter>
</activity>

<service
android:name="com.pravera.flutter_foreground_task.service.ForegroundService"
android:stopWithTask="true"
android:foregroundServiceType="camera|microphone"
android:exported="false" />

<!--Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public static void registerWith(@NonNull FlutterEngine flutterEngine) {
} catch (Exception e) {
Log.e(TAG, "Error registering plugin firebase_performance, io.flutter.plugins.firebase.performance.FlutterFirebasePerformancePlugin", e);
}
try {
flutterEngine.getPlugins().add(new com.pravera.flutter_foreground_task.FlutterForegroundTaskPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin flutter_foreground_task, com.pravera.flutter_foreground_task.FlutterForegroundTaskPlugin", e);
}
try {
flutterEngine.getPlugins().add(new live.hms.hmssdk_flutter.HmssdkFlutterPlugin());
} catch (Exception e) {
Expand Down
8 changes: 7 additions & 1 deletion packages/hmssdk_flutter/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ PODS:
- PromisesSwift (~> 2.1)
- FirebaseSharedSwift (10.23.0)
- Flutter (1.0.0)
- flutter_foreground_task (0.0.1):
- Flutter
- GoogleDataTransport (9.4.1):
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30911.0, >= 2.30908.0)
Expand Down Expand Up @@ -188,6 +190,7 @@ DEPENDENCIES:
- firebase_dynamic_links (from `.symlinks/plugins/firebase_dynamic_links/ios`)
- firebase_performance (from `.symlinks/plugins/firebase_performance/ios`)
- Flutter (from `Flutter`)
- flutter_foreground_task (from `.symlinks/plugins/flutter_foreground_task/ios`)
- HMSBroadcastExtensionSDK
- hmssdk_flutter (from `.symlinks/plugins/hmssdk_flutter/ios`)
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`)
Expand Down Expand Up @@ -246,6 +249,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_performance/ios"
Flutter:
:path: Flutter
flutter_foreground_task:
:path: ".symlinks/plugins/flutter_foreground_task/ios"
hmssdk_flutter:
:path: ".symlinks/plugins/hmssdk_flutter/ios"
mobile_scanner:
Expand Down Expand Up @@ -283,6 +288,7 @@ SPEC CHECKSUMS:
FirebaseSessions: f06853e30f99fe42aa511014d7ee6c8c319f08a3
FirebaseSharedSwift: c92645b392db3c41a83a0aa967de16f8bad25568
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_foreground_task: 21ef182ab0a29a3005cc72cd70e5f45cb7f7f817
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
GoogleMLKit: 2bd0dc6253c4d4f227aad460f69215a504b2980e
GoogleToolboxForMac: 8bef7c7c5cf7291c687cf5354f39f9db6399ad34
Expand Down Expand Up @@ -313,4 +319,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 9fb9f6e431a2c6c79942252e94b241ac7972ac90

COCOAPODS: 1.15.2
COCOAPODS: 1.14.3
10 changes: 10 additions & 0 deletions packages/hmssdk_flutter/example/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ import Flutter
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)

SwiftFlutterForegroundTaskPlugin.setPluginRegistrantCallback(registerPlugins)
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}

return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}

func registerPlugins(registry: FlutterPluginRegistry) {
GeneratedPluginRegistrant.register(with: registry)
}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#import "GeneratedPluginRegistrant.h"
#import <flutter_foreground_task/FlutterForegroundTaskPlugin.h>
82 changes: 82 additions & 0 deletions packages/hmssdk_flutter/example/lib/foreground_task_handler.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import 'dart:isolate';

import 'package:flutter_foreground_task/flutter_foreground_task.dart';
import 'package:hmssdk_flutter_example/main.dart';

///[ForegroundTaskHandler] is a class that extends [TaskHandler]
///This class is used to handle the foreground task
class ForegroundTaskHandler extends TaskHandler {
SendPort? _sendPort;

// Called when the task is started.
@override
void onStart(DateTime timestamp, SendPort? sendPort) async {
_sendPort = sendPort;

// You can use the getData function to get the stored data.
final customData =
await FlutterForegroundTask.getData<String>(key: 'customData');
print('customData: $customData');
}

// Called every [interval] milliseconds in [ForegroundTaskOptions].
@override
void onRepeatEvent(DateTime timestamp, SendPort? sendPort) async {
// Send data to the main isolate.
sendPort?.send(timestamp);
}

// Called when the notification button on the Android platform is pressed.
@override
void onDestroy(DateTime timestamp, SendPort? sendPort) async {}

// Called when the notification button on the Android platform is pressed.
@override
void onNotificationButtonPressed(String id) {
print('onNotificationButtonPressed >> $id');
}

// Called when the notification itself on the Android platform is pressed.
//
// "android.permission.SYSTEM_ALERT_WINDOW" permission must be granted for
// this function to be called.
@override
void onNotificationPressed() {
// Note that the app will only route to "/resume-route" when it is exited so
// it will usually be necessary to send a message through the send port to
// signal it to restore state when the app is already started.
FlutterForegroundTask.launchApp("/resume-route");
_sendPort?.send('onNotificationPressed');
}
}

void initForegroundTask() {
FlutterForegroundTask.init(
androidNotificationOptions: AndroidNotificationOptions(
channelId: '100ms_flutter_notification',
channelName: '100ms Flutter Notification',
channelDescription:
'This notification appears when the foreground service is running.',
channelImportance: NotificationChannelImportance.LOW,
priority: NotificationPriority.LOW,
iconData: NotificationIconData(
resType: ResourceType.mipmap,
resPrefix: ResourcePrefix.ic,
name: "launcher")),
iosNotificationOptions:
const IOSNotificationOptions(showNotification: false),
foregroundTaskOptions: const ForegroundTaskOptions(),
);

///[startService] starts the foreground task
FlutterForegroundTask.startService(
notificationTitle: 'Foreground Service is running',
notificationText: 'Tap to return to the app',
callback: startCallback);
}

///[stopForegroundTask] stops the foreground task
///Called in onLeave callback
void stopForegroundTask() {
FlutterForegroundTask.stopService();
}
41 changes: 27 additions & 14 deletions packages/hmssdk_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import 'package:firebase_dynamic_links/firebase_dynamic_links.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_foreground_task/flutter_foreground_task.dart';
import 'package:flutter_svg/svg.dart';
import 'package:hms_room_kit/hms_room_kit.dart';
import 'package:hmssdk_flutter_example/app_settings_bottom_sheet.dart';
import 'package:hmssdk_flutter_example/foreground_task_handler.dart';
import 'package:hmssdk_flutter_example/qr_code_screen.dart';
import 'package:hmssdk_flutter_example/room_service.dart';
import 'package:lottie/lottie.dart';
Expand Down Expand Up @@ -50,6 +52,13 @@ void main() async {
runApp(HMSExampleApp(initialLink: initialLink?.link));
}

///This function sets up the foreground service interaction
@pragma('vm:entry-point')
void startCallback() {
// The setTaskHandler function must be called to handle the task in the background.
FlutterForegroundTask.setTaskHandler(ForegroundTaskHandler());
}

class HMSExampleApp extends StatefulWidget {
final Uri? initialLink;
HMSExampleApp({Key? key, this.initialLink}) : super(key: key);
Expand Down Expand Up @@ -320,23 +329,27 @@ class _HomePageState extends State<HomePage> {
Utilities.saveStringData(
key: "meetingLink", value: meetingLinkController.text.trim());
FocusManager.instance.primaryFocus?.unfocus();
initForegroundTask();
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => HMSPrebuilt(
roomCode: Constant.roomCode,
options: HMSPrebuiltOptions(
userName: AppDebugConfig.nameChangeOnPreview
? null
: "Flutter User",
endPoints: endPoints,
userId:
uuidString, // pass your custom unique user identifier here
iOSScreenshareConfig: HMSIOSScreenshareConfig(
appGroup: "group.flutterhms",
preferredExtension:
"live.100ms.flutter.FlutterBroadcastUploadExtension"),
enableNoiseCancellation: true))));
builder: (_) => WithForegroundTask(
child: HMSPrebuilt(
roomCode: Constant.roomCode,
onLeave: stopForegroundTask,
options: HMSPrebuiltOptions(
userName: AppDebugConfig.nameChangeOnPreview
? null
: "Flutter User",
endPoints: endPoints,
userId:
uuidString, // pass your custom unique user identifier here
iOSScreenshareConfig: HMSIOSScreenshareConfig(
appGroup: "group.flutterhms",
preferredExtension:
"live.100ms.flutter.FlutterBroadcastUploadExtension"),
enableNoiseCancellation: true)),
)));
}

@override
Expand Down
33 changes: 20 additions & 13 deletions packages/hmssdk_flutter/example/lib/qr_code_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import 'dart:developer';

///Package imports
import 'package:flutter/material.dart';
import 'package:flutter_foreground_task/flutter_foreground_task.dart';
import 'package:hms_room_kit/hms_room_kit.dart';
import 'package:hmssdk_flutter_example/foreground_task_handler.dart';
import 'package:hmssdk_flutter_example/room_service.dart';
import 'package:mobile_scanner/mobile_scanner.dart';

///[QRCodeScreen] is a StatefulWidget that is used to handle the scan the QR code functionality
class QRCodeScreen extends StatefulWidget {
final String uuidString;
QRCodeScreen({Key? key, required this.uuidString}) : super(key: key);
Expand Down Expand Up @@ -72,20 +75,24 @@ class _QRCodeScreenState extends State<QRCodeScreen> {
Constant.roomCode = rawValue.trim();
}
Utilities.saveStringData(key: "meetingLink", value: rawValue.trim());
initForegroundTask();
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (_) => HMSPrebuilt(
roomCode: Constant.roomCode,
options: HMSPrebuiltOptions(
userName: AppDebugConfig.nameChangeOnPreview
? null
: "Flutter User",
userId: widget.uuidString,
endPoints: endPoints,
iOSScreenshareConfig: HMSIOSScreenshareConfig(
appGroup: "group.flutterhms",
preferredExtension:
"live.100ms.flutter.FlutterBroadcastUploadExtension"),
enableNoiseCancellation: true))));
builder: (_) => WithForegroundTask(
child: HMSPrebuilt(
roomCode: Constant.roomCode,
onLeave: stopForegroundTask,
options: HMSPrebuiltOptions(
userName: AppDebugConfig.nameChangeOnPreview
? null
: "Flutter User",
userId: widget.uuidString,
endPoints: endPoints,
iOSScreenshareConfig: HMSIOSScreenshareConfig(
appGroup: "group.flutterhms",
preferredExtension:
"live.100ms.flutter.FlutterBroadcastUploadExtension"),
enableNoiseCancellation: true)),
)));
}
}
} catch (e) {
Expand Down
8 changes: 8 additions & 0 deletions packages/hmssdk_flutter/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_foreground_task:
dependency: "direct main"
description:
name: flutter_foreground_task
sha256: "9bcfcb43bba4a5446a056e723d21118ff6e184926b5557365c32c13caca157c2"
url: "https://pub.dev"
source: hosted
version: "6.1.3"
flutter_linkify:
dependency: transitive
description:
Expand Down
3 changes: 2 additions & 1 deletion packages/hmssdk_flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ dependencies:
url_launcher:
mobile_scanner:
app_links:
uuid:
uuid:
flutter_foreground_task: ^6.1.3

dev_dependencies:
flutter_test:
Expand Down
6 changes: 6 additions & 0 deletions sample apps/flutter-meet/.flutter-plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This is a generated file; do not edit or check into version control.
hmssdk_flutter=/Users/decode/.pub-cache/hosted/pub.dev/hmssdk_flutter-1.9.14/
permission_handler=/Users/decode/.pub-cache/hosted/pub.dev/permission_handler-11.0.0/
permission_handler_android=/Users/decode/.pub-cache/hosted/pub.dev/permission_handler_android-11.0.1/
permission_handler_apple=/Users/decode/.pub-cache/hosted/pub.dev/permission_handler_apple-9.1.4/
permission_handler_windows=/Users/decode/.pub-cache/hosted/pub.dev/permission_handler_windows-0.1.3/
1 change: 1 addition & 0 deletions sample apps/flutter-meet/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"hmssdk_flutter","path":"/Users/decode/.pub-cache/hosted/pub.dev/hmssdk_flutter-1.9.14/","native_build":true,"dependencies":[]},{"name":"permission_handler_apple","path":"/Users/decode/.pub-cache/hosted/pub.dev/permission_handler_apple-9.1.4/","native_build":true,"dependencies":[]}],"android":[{"name":"hmssdk_flutter","path":"/Users/decode/.pub-cache/hosted/pub.dev/hmssdk_flutter-1.9.14/","native_build":true,"dependencies":[]},{"name":"permission_handler_android","path":"/Users/decode/.pub-cache/hosted/pub.dev/permission_handler_android-11.0.1/","native_build":true,"dependencies":[]}],"macos":[],"linux":[],"windows":[{"name":"permission_handler_windows","path":"/Users/decode/.pub-cache/hosted/pub.dev/permission_handler_windows-0.1.3/","native_build":true,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"hmssdk_flutter","dependencies":[]},{"name":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_windows","dependencies":[]}],"date_created":"2024-04-02 12:09:59.548114","version":"3.13.5"}
28 changes: 28 additions & 0 deletions sample apps/flutter-meet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Flutter x Meet - Google Meet clone made in Flutter

Google Meet clone made in Flutter using 100ms.

## User Interface

<table>
<tr>
<td>
<img src="https://user-images.githubusercontent.com/53579386/152325280-d150b1a8-50fc-4369-846d-2c18a8446537.jpeg" alt="">
</td>
<td>
<img src="https://user-images.githubusercontent.com/53579386/152325366-f8b97a56-3982-4b67-b38b-d00a2fb7a995.jpeg" alt="">
</td>
<td>
<img src="https://user-images.githubusercontent.com/53579386/152325466-dd88f96a-c2c8-4d6e-9442-b7037878040a.jpeg" alt="">
</td>
<td>
<img src="https://user-images.githubusercontent.com/53579386/152325545-e35c125b-556e-458e-8730-c6bf1df7d953.jpeg" alt="">
</td>
</tr>
</table>
<br>

## Demo

https://user-images.githubusercontent.com/53579386/153129731-a5123b2a-c782-4c06-8d49-a6a431d8fa6d.mp4

Loading

0 comments on commit 9179ce1

Please sign in to comment.