File tree Expand file tree Collapse file tree 3 files changed +23
-11
lines changed Expand file tree Collapse file tree 3 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -72,17 +72,26 @@ class FeedModel {
72
72
}
73
73
if (map["likeList" ] != null ) {
74
74
likeList = List <String >();
75
- try {
76
- final list = map['likeList' ];
77
- if (list is List ) {
78
- map['likeList' ].forEach ((value) {
75
+
76
+ final list = map['likeList' ];
77
+ /// In new tweet db schema likeList is stored as a List<String>()
78
+ ///
79
+ if (list is List ) {
80
+ map['likeList' ].forEach ((value) {
81
+ if (value is String ) {
79
82
likeList.add (value);
80
- });
81
- likeCount = likeList.length ?? 0 ;
82
- }
83
- } catch (e) {
84
- likeCount = 0 ;
85
- likeList = [];
83
+ }
84
+ });
85
+ likeCount = likeList.length ?? 0 ;
86
+ }
87
+ /// In old database tweet db schema likeList is saved in the form of map
88
+ /// like list map is removed from latest code but to support old schema below code is required
89
+ /// Once all user migrated to new version like list map support will be removed
90
+ else if (list is Map ){
91
+ list.forEach ((key, value) {
92
+ likeList.add (value["userId" ]);
93
+ });
94
+ likeCount = list.length;
86
95
}
87
96
} else {
88
97
likeList = [];
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class UsersListPage extends StatelessWidget {
36
36
icon: appBarIcon),
37
37
body: Consumer <SearchState >(
38
38
builder: (context, state, child) {
39
- if (userIdsList != null ) {
39
+ if (userIdsList != null && userIdsList.isNotEmpty ) {
40
40
userList = state.getuserDetail (userIdsList);
41
41
}
42
42
return ! (userList != null && userList.isNotEmpty)
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ class TweetIconsRow extends StatelessWidget {
31
31
32
32
Widget _likeCommentsIcons (BuildContext context, FeedModel model) {
33
33
var authState = Provider .of <AuthState >(context, listen: false );
34
+
34
35
return Container (
35
36
color: Colors .transparent,
36
37
padding: EdgeInsets .only (bottom: 0 , top: 0 ),
@@ -229,6 +230,8 @@ class TweetIconsRow extends StatelessWidget {
229
230
builder: (BuildContext context) => UsersListPage (
230
231
pageTitle: "Liked by" ,
231
232
userIdsList: model.likeList.map ((userId) => userId).toList (),
233
+ emptyScreenText: "This tweet has no like yet" ,
234
+ emptyScreenSubTileText: "Once a user likes this tweet, user list will be shown here" ,
232
235
),
233
236
),
234
237
);
You can’t perform that action at this time.
0 commit comments