-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request LikeMindsCommunity#79 from LikeMindsCommunity/rele…
…ase/v1.4.1 Release/v1.4.1
- Loading branch information
Showing
16 changed files
with
1,076 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:likeminds_feed_ss_fl/likeminds_feed_ss_fl.dart'; | ||
|
||
class ActivityScreen extends StatefulWidget { | ||
const ActivityScreen({ | ||
super.key, | ||
}); | ||
|
||
@override | ||
State<ActivityScreen> createState() => _ActivityScreenState(); | ||
} | ||
|
||
class _ActivityScreenState extends State<ActivityScreen> { | ||
late String userId; | ||
@override | ||
void initState() { | ||
userId = UserLocalPreference.instance | ||
.fetchUserData() | ||
.sdkClientInfo! | ||
.userUniqueId; | ||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
// backgroundColor: ColorTheme.backgroundColor, | ||
appBar: AppBar( | ||
title: const Text('My Activity'), | ||
// backgroundColor: ColorTheme.backgroundColor, | ||
), | ||
body: SSActivityWidget( | ||
uuid: userId, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:likeminds_feed_ss_sample/screens/activity_screen.dart'; | ||
|
||
class TabApp extends StatefulWidget { | ||
final Widget feedWidget; | ||
const TabApp({ | ||
super.key, | ||
required this.feedWidget, | ||
}); | ||
|
||
@override | ||
State<TabApp> createState() => _TabAppState(); | ||
} | ||
|
||
class _TabAppState extends State<TabApp> with TickerProviderStateMixin { | ||
late TabController tabController; | ||
|
||
@override | ||
void initState() { | ||
// TODO: implement initState | ||
super.initState(); | ||
tabController = TabController(length: 2, vsync: this); | ||
tabController.addListener(() { | ||
setState(() {}); | ||
}); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
home: Scaffold( | ||
bottomNavigationBar: NavigationBar( | ||
selectedIndex: tabController.index, | ||
onDestinationSelected: (index) { | ||
tabController.animateTo(index); | ||
setState(() {}); | ||
}, | ||
elevation: 10, | ||
indicatorColor: const Color(0xFF3B82F6), | ||
backgroundColor: const Color(0xFF3B82F6).withOpacity(0.1), | ||
destinations: const [ | ||
NavigationDestination( | ||
icon: Icon( | ||
Icons.home, | ||
), | ||
selectedIcon: Icon( | ||
Icons.home, | ||
color: Colors.white, | ||
), | ||
label: 'Home', | ||
), | ||
NavigationDestination( | ||
icon: Icon( | ||
Icons.person_2_sharp, | ||
), | ||
selectedIcon: Icon( | ||
Icons.person_2_sharp, | ||
color: Colors.white, | ||
), | ||
label: 'Activity', | ||
), | ||
], | ||
), | ||
body: TabBarView( | ||
controller: tabController, | ||
children: [ | ||
HomeScreen( | ||
feedWidget: widget.feedWidget, | ||
), // First tab content | ||
const ActivityScreen( | ||
), // Second tab content | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class HomeScreen extends StatelessWidget { | ||
final Widget feedWidget; | ||
|
||
const HomeScreen({ | ||
super.key, | ||
required this.feedWidget, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return feedWidget; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import 'package:likeminds_feed/likeminds_feed.dart'; | ||
import 'package:likeminds_feed_ss_fl/src/utils/constants/ui_constants.dart'; | ||
import 'package:likeminds_feed_ui_fl/likeminds_feed_ui_fl.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class ActivityUtils { | ||
static const String notificationTagRoute = | ||
r'<<([^<>]+)\|route://([^<>]+)/([a-zA-Z-0-9_]+)>>'; | ||
|
||
static Map<String, String> decodeNotificationString( | ||
String string, String currentUserId) { | ||
Map<String, String> result = {}; | ||
final Iterable<RegExpMatch> matches = | ||
RegExp(notificationTagRoute).allMatches(string); | ||
for (final match in matches) { | ||
String tag = match.group(1)!; | ||
final String mid = match.group(2)!; | ||
final String id = match.group(3)!; | ||
if (id == currentUserId) { | ||
tag = 'You'; | ||
} | ||
string = string.replaceAll('<<$tag|route://$mid/$id>>', '@$tag'); | ||
result.addAll({tag: id}); | ||
} | ||
return result; | ||
} | ||
|
||
static List<TextSpan> extractNotificationTags( | ||
String text, String currentUserId) { | ||
List<TextSpan> textSpans = []; | ||
final Iterable<RegExpMatch> matches = | ||
RegExp(notificationTagRoute).allMatches(text); | ||
int lastIndex = 0; | ||
for (Match match in matches) { | ||
int startIndex = match.start; | ||
int endIndex = match.end; | ||
String? link = match.group(0); | ||
|
||
if (lastIndex != startIndex) { | ||
// Add a TextSpan for the preceding text | ||
textSpans.add( | ||
TextSpan( | ||
text: text.substring(lastIndex, startIndex), | ||
style: const TextStyle( | ||
fontWeight: FontWeight.w400, | ||
fontSize: 14, | ||
color: LMThemeData.kGrey1Color, | ||
), | ||
), | ||
); | ||
} | ||
// Add a TextSpan for the URL | ||
textSpans.add( | ||
TextSpan( | ||
text: decodeNotificationString(link!, currentUserId).keys.first, | ||
style: const TextStyle( | ||
fontWeight: FontWeight.w600, | ||
fontSize: 14, | ||
color: LMThemeData.kGrey1Color, | ||
), | ||
), | ||
); | ||
|
||
lastIndex = endIndex; | ||
} | ||
|
||
if (lastIndex != text.length) { | ||
// Add a TextSpan for the remaining text | ||
textSpans.add(TextSpan( | ||
text: text.substring(lastIndex), | ||
style: const TextStyle( | ||
fontWeight: FontWeight.w400, | ||
fontSize: 14, | ||
color: LMThemeData.kGrey1Color, | ||
), | ||
)); | ||
} | ||
|
||
return textSpans; | ||
} | ||
|
||
static PostViewData postViewDataFromActivity(UserActivityItem activity) { | ||
return activity.action == 7 | ||
? PostViewData.fromPost(post: activity.activityEntityData.postData!) | ||
: (PostViewDataBuilder() | ||
..id(activity.activityEntityData.id) | ||
..isEdited(activity.activityEntityData.isEdited!) | ||
..text(activity.activityEntityData.text) | ||
..attachments(activity.activityEntityData.attachments!) | ||
..communityId(activity.activityEntityData.communityId) | ||
..isPinned(activity.activityEntityData.isPinned!) | ||
..topics(activity.activityEntityData.topics!) | ||
..userId(activity.activityEntityData.userId!) | ||
..likeCount(activity.activityEntityData.likesCount!) | ||
..commentCount(activity.activityEntityData.commentsCount!) | ||
..isSaved(activity.activityEntityData.isSaved!) | ||
..isLiked(activity.activityEntityData.isLiked!) | ||
..menuItems(activity.activityEntityData.menuItems!) | ||
..createdAt(DateTime.fromMillisecondsSinceEpoch( | ||
activity.activityEntityData.createdAt)) | ||
..updatedAt(DateTime.fromMillisecondsSinceEpoch( | ||
activity.activityEntityData.updatedAt!))) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.