Skip to content

Commit

Permalink
Added capability to save userid
Browse files Browse the repository at this point in the history
  • Loading branch information
Decoder07 committed Dec 27, 2023
1 parent 9621c9a commit ed4b0f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
16 changes: 11 additions & 5 deletions packages/hmssdk_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ class HomePage extends StatefulWidget {

class _HomePageState extends State<HomePage> {
TextEditingController meetingLinkController = TextEditingController();
late Uuid uuid;
Uuid? uuid;
String uuidString = "";

PackageInfo _packageInfo = PackageInfo(
appName: 'Unknown',
Expand All @@ -235,12 +236,17 @@ class _HomePageState extends State<HomePage> {
void initState() {
super.initState();
_initPackageInfo();
uuid = Uuid();
getData();
}

void getData() async {
String savedMeetingUrl = await Utilities.getStringData(key: 'meetingLink');
uuidString = await Utilities.getStringData(key: "uuid");
if (uuidString.isEmpty) {
uuid = Uuid();
uuidString = uuid!.v4();
Utilities.saveStringData(key: "uuid", value: uuidString);
}
if (widget.deepLinkURL == null && savedMeetingUrl.isNotEmpty) {
meetingLinkController.text = savedMeetingUrl;
} else {
Expand Down Expand Up @@ -321,8 +327,8 @@ class _HomePageState extends State<HomePage> {
? null
: "Flutter User",
endPoints: endPoints,
userId: uuid
.v4(), // pass your custom unique user identifier here
userId:
uuidString, // pass your custom unique user identifier here
iOSScreenshareConfig: HMSIOSScreenshareConfig(
appGroup: "group.flutterhms",
preferredExtension:
Expand Down Expand Up @@ -560,7 +566,7 @@ class _HomePageState extends State<HomePage> {
context,
MaterialPageRoute(
builder: (_) => QRCodeScreen(
uuid: uuid,
uuidString: uuidString,
)));
}
},
Expand Down
7 changes: 3 additions & 4 deletions packages/hmssdk_flutter/example/lib/qr_code_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import 'package:flutter/material.dart';
import 'package:hms_room_kit/hms_room_kit.dart';
import 'package:hmssdk_flutter_example/room_service.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart';
import 'package:uuid/uuid.dart';

class QRCodeScreen extends StatefulWidget {
final Uuid uuid;
QRCodeScreen({Key? key, required this.uuid}) : super(key: key);
final String uuidString;
QRCodeScreen({Key? key, required this.uuidString}) : super(key: key);

@override
State<QRCodeScreen> createState() => _QRCodeScreenState();
Expand Down Expand Up @@ -85,7 +84,7 @@ class _QRCodeScreenState extends State<QRCodeScreen> {
userName: AppDebugConfig.nameChangeOnPreview
? null
: "Flutter User",
userId: widget.uuid.v4(),
userId: widget.uuidString,
endPoints: endPoints,
iOSScreenshareConfig: HMSIOSScreenshareConfig(
appGroup: "group.flutterhms",
Expand Down

0 comments on commit ed4b0f5

Please sign in to comment.