Skip to content

Commit

Permalink
Merge pull request #1691 from 100mslive/rbac-bug-fix
Browse files Browse the repository at this point in the history
Bug fixes for release build
  • Loading branch information
Decoder07 authored Jan 12, 2024
2 parents 06fa0e1 + 65aa83a commit 24288af
Show file tree
Hide file tree
Showing 7 changed files with 453 additions and 415 deletions.
561 changes: 293 additions & 268 deletions packages/hms_room_kit/lib/src/hls_viewer/overlay_chat_component.dart

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ class _MeetingBottomNavigationBarState
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom +
15),
child: OverlayChatComponent(
height: MediaQuery.of(context).size.height * 0.3,
),
child: const OverlayChatComponent(),
))
: const SizedBox();
}),
Expand Down
12 changes: 7 additions & 5 deletions packages/hms_room_kit/lib/src/meeting/meeting_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1772,11 +1772,13 @@ class MeetingStore extends ChangeNotifier
if (value != null) {
var data = jsonDecode(value);
if (data != null && data.isNotEmpty) {
data.forEach((element) => pinnedMessages.add({
"id": element["id"],
"text": element["text"],
"pinnedBy": element["pinnedBy"]
}));
data.forEach((element) {
pinnedMessages.add({
"id": element["id"],
"text": element["text"],
"pinnedBy": element["pinnedBy"]
});
});
}
}
notifyListeners();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ class _ChatBottomSheetState extends State<ChatBottomSheet> {
child: const HMSEmptyChatWidget())))
: Expanded(
child: Column(children: [
PinChatWidget(
pinnedMessage:
data.item3.reversed.toList()),
const PinChatWidget(),

/// List containing chats
Expanded(
Expand Down
235 changes: 125 additions & 110 deletions packages/hms_room_kit/lib/src/widgets/chat_widgets/pin_chat_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
import 'package:url_launcher/url_launcher.dart';

///Project imports
Expand All @@ -13,12 +14,9 @@ import 'package:hms_room_kit/src/meeting/meeting_store.dart';

///[PinChatWidget] renders the pinned message widget
class PinChatWidget extends StatefulWidget {
final List<dynamic> pinnedMessage;
final Color? backgroundColor;

const PinChatWidget(
{Key? key, required this.pinnedMessage, this.backgroundColor})
: super(key: key);
const PinChatWidget({Key? key, this.backgroundColor}) : super(key: key);

@override
State<PinChatWidget> createState() => _PinChatWidgetState();
Expand Down Expand Up @@ -61,116 +59,133 @@ class _PinChatWidgetState extends State<PinChatWidget> {
Widget build(BuildContext context) {
///If there are no pinnedMessage we render an empty SizedBox
///else we render the pinned message widget
return widget.pinnedMessage.isEmpty
? const SizedBox()
: GestureDetector(
onTap: () => toggleExpand(),
child: Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Row(
children: [
AnimatedContainer(
height: MediaQuery.of(context).size.height *
(isExpanded ? 0.13 : 0.09),
width:
(HMSRoomLayout.chatData?.allowPinningMessages ?? false)
? MediaQuery.of(context).size.width * 0.83
: MediaQuery.of(context).size.width * 0.9,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: widget.backgroundColor ??
HMSThemeColors.surfaceDefault),
duration: const Duration(milliseconds: 0),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (widget.pinnedMessage.length > 1)
DotsIndicator(
axis: Axis.vertical,
mainAxisSize: MainAxisSize.min,
dotsCount: widget.pinnedMessage.length,
position:
currentPage >= widget.pinnedMessage.length
? 0
: currentPage,
decorator: DotsDecorator(
spacing: const EdgeInsets.only(
bottom: 3.0, right: 8),
size: Size(2.0, isExpanded ? 24 : 9.0),
activeSize: Size(2.0, isExpanded ? 24 : 9.0),
color: HMSThemeColors.onSurfaceLowEmphasis,
activeColor:
HMSThemeColors.onSurfaceHighEmphasis,
activeShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16.0)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16.0)),
),
onTap: (position) => setCurrentPage(position),
),
Expanded(
child: PageView.builder(
scrollDirection: Axis.vertical,
controller: _pageController,
itemCount: widget.pinnedMessage.length,
physics: const PageScrollPhysics(),
onPageChanged: (value) => setCurrentPage(value),
itemBuilder: (context, index) =>
SelectableLinkify(
maxLines: 3,
scrollPhysics: isExpanded
? const BouncingScrollPhysics()
: const NeverScrollableScrollPhysics(),
text: widget.pinnedMessage[index]["text"],
onOpen: (link) async {
Uri url = Uri.parse(link.url);
if (await canLaunchUrl(url)) {
await launchUrl(url,
mode: LaunchMode.externalApplication);
}
},
onTap: () => toggleExpand(),
options: const LinkifyOptions(humanize: false),
style: HMSTextStyle.setTextStyle(
fontSize: 14.0,
color: HMSThemeColors.onSurfaceHighEmphasis,
letterSpacing: 0.25,
height: 20 / 14,
fontWeight: FontWeight.w400,
return Selector<MeetingStore, Tuple2<List<dynamic>, int>>(
selector: (_, meetingStore) => Tuple2(
meetingStore.pinnedMessages.reversed.toList(),
meetingStore.pinnedMessages.length),
builder: (_, data, __) {
return data.item2 == 0
? const SizedBox()
: GestureDetector(
onTap: () => toggleExpand(),
child: Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Row(
children: [
AnimatedContainer(
height: MediaQuery.of(context).size.height *
(isExpanded ? 0.13 : 0.09),
width:
(HMSRoomLayout.chatData?.allowPinningMessages ??
false)
? MediaQuery.of(context).size.width * 0.83
: MediaQuery.of(context).size.width * 0.9,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: widget.backgroundColor ??
HMSThemeColors.surfaceDefault),
duration: const Duration(milliseconds: 0),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (data.item2 > 1)
DotsIndicator(
axis: Axis.vertical,
mainAxisSize: MainAxisSize.min,
dotsCount: data.item2,
position: currentPage >= data.item2
? 0
: currentPage,
decorator: DotsDecorator(
spacing: const EdgeInsets.only(
bottom: 3.0, right: 8),
size: Size(2.0, isExpanded ? 24 : 9.0),
activeSize:
Size(2.0, isExpanded ? 24 : 9.0),
color:
HMSThemeColors.onSurfaceLowEmphasis,
activeColor:
HMSThemeColors.onSurfaceHighEmphasis,
activeShape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(16.0)),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(16.0)),
),
onTap: (position) =>
setCurrentPage(position),
),
Expanded(
child: PageView.builder(
scrollDirection: Axis.vertical,
controller: _pageController,
itemCount: data.item2,
physics: const PageScrollPhysics(),
onPageChanged: (value) =>
setCurrentPage(value),
itemBuilder: (context, index) =>
SelectableLinkify(
maxLines: 3,
scrollPhysics: isExpanded
? const BouncingScrollPhysics()
: const NeverScrollableScrollPhysics(),
text: data.item1[index]["text"],
onOpen: (link) async {
Uri url = Uri.parse(link.url);
if (await canLaunchUrl(url)) {
await launchUrl(url,
mode: LaunchMode
.externalApplication);
}
},
onTap: () => toggleExpand(),
options:
const LinkifyOptions(humanize: false),
style: HMSTextStyle.setTextStyle(
fontSize: 14.0,
color: HMSThemeColors
.onSurfaceHighEmphasis,
letterSpacing: 0.25,
height: 20 / 14,
fontWeight: FontWeight.w400,
),
linkStyle: HMSTextStyle.setTextStyle(
fontSize: 14.0,
color: HMSThemeColors.primaryDefault,
letterSpacing: 0.25,
height: 20 / 14,
fontWeight: FontWeight.w400),
),
),
),
linkStyle: HMSTextStyle.setTextStyle(
fontSize: 14.0,
color: HMSThemeColors.primaryDefault,
letterSpacing: 0.25,
height: 20 / 14,
fontWeight: FontWeight.w400),
),
],
),
),
),
const SizedBox(width: 8),
if (HMSRoomLayout.chatData?.allowPinningMessages ??
false)
GestureDetector(
onTap: () => context
.read<MeetingStore>()
.unpinMessage(data.item1[currentPage]["id"]),
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/unpin.svg",
height: 20,
width: 20,
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceMediumEmphasis,
BlendMode.srcIn),
),
),
],
),
],
),
),
const SizedBox(width: 8),
if (HMSRoomLayout.chatData?.allowPinningMessages ?? false)
GestureDetector(
onTap: () => context.read<MeetingStore>().unpinMessage(
widget.pinnedMessage[currentPage]["id"]),
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/unpin.svg",
height: 20,
width: 20,
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceMediumEmphasis,
BlendMode.srcIn),
),
),
],
),
),
);
);
});
}
}
26 changes: 13 additions & 13 deletions packages/hmssdk_flutter/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.18.0"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -362,10 +362,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -647,18 +647,18 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
Expand All @@ -679,10 +679,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.1"
tuple:
dependency: transitive
description:
Expand Down Expand Up @@ -839,10 +839,10 @@ packages:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
version: "0.3.0"
win32:
dependency: transitive
description:
Expand All @@ -868,5 +868,5 @@ packages:
source: hosted
version: "6.3.0"
sdks:
dart: ">=3.1.0 <4.0.0"
dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.13.0"
Loading

0 comments on commit 24288af

Please sign in to comment.