Skip to content

Commit 1f47281

Browse files
Merge branch 'develop' into Ayush0Chaudhary/organization_feed_test
2 parents 7ceddee + ac0571b commit 1f47281

File tree

142 files changed

+1945
-196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+1945
-196
lines changed

.github/workflows/pull-request.yml

-36
Original file line numberDiff line numberDiff line change
@@ -41,42 +41,6 @@ jobs:
4141
run: ./.github/workflows/countline.py --exclude_directories test/ --exclude_files lib/custom_painters/talawa_logo.dart lib/custom_painters/language_icon.dart lib/custom_painters/whatsapp_logo.dart lib/utils/queries.dart lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart lib/view_model/pre_auth_view_models/select_organization_view_model.dart lib/views/after_auth_screens/profile/profile_page.dart lib/view_model/main_screen_view_model.dart lib/views/after_auth_screens/events/create_event_page.dart
4242
- name: Analysing codebase for linting
4343
run: flutter analyze --no-pub
44-
- uses: actions/checkout@v3
45-
- uses: jitterbit/get-changed-files@v1
46-
id: abc
47-
with:
48-
format: space-delimited
49-
token: ${{ secrets.GITHUB_TOKEN }}
50-
- name: Checking doc updated
51-
run: |
52-
echo "${{ steps.abc.outputs.added_modified }}"
53-
IFS=' '
54-
read -ra ADDR <<<"${{ steps.abc.outputs.added_modified }}"
55-
doc=0
56-
source=0
57-
for i in "${ADDR[@]}"; #accessing each element of array
58-
do
59-
echo "$i"
60-
if [[ $i == ./doc* ]]
61-
then
62-
doc=doc+1
63-
elif [[ $i == ./lib* ]]
64-
then
65-
source=source+1
66-
fi
67-
done
68-
Red='0;31'
69-
Green='0;32'
70-
NoColor='\033[0m'
71-
if [[ $doc == 0 ]] && [[ $source == 0 ]]
72-
then
73-
echo "🚀${Green} Hurrah! no source editted${NoColor}"; exit 0;
74-
fi
75-
if [[ $doc == 0 ]] && [[ $source -ge 0 ]]
76-
then
77-
echo "🔍${Red} DOCUMENTATION NOT UPDATED: Files with missing or not updated documentation found please consider fixing to get the PR approved${NoColor}";exit 1;
78-
fi
79-
echo "🚀 ${Green}Hurrah! documentation was updated in all modified/added files${NoColor}"; exit 0;
8044

8145
Flutter-Testing:
8246
name: Testing codebase

.github/workflows/stale.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@ jobs:
2525
runs-on: ubuntu-latest
2626

2727
steps:
28-
- uses: actions/stale@v4.1.0
28+
- uses: actions/stale@v7
2929
with:
3030
repo-token: ${{ secrets.GITHUB_TOKEN }}
31-
stale-issue-message: 'This issue did not get any activity in the past 60 days and will be closed in 365 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.'
32-
stale-pr-message: 'This pull request did not get any activity in the past 60 days and will be closed in 365 days if no update occurs. Please verify it has no conflicts with the develop branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work.'
31+
stale-issue-message: 'This issue did not get any activity in the past 14 days and will be closed in 365 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.'
32+
stale-pr-message: 'This pull request did not get any activity in the past 14 days and will be closed in 365 days if no update occurs. Please verify it has no conflicts with the develop branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work.'
3333
close-issue-message: 'This issue did not get any activity in the past 365 days and thus has been closed. Please check if the newest release or develop branch has it fixed. Please, create a new issue if the issue is not fixed.'
3434
close-pr-message: 'This pull request did not get any activity in the past 365 days and thus has been closed.'
3535
stale-issue-label: 'no-issue-activity'
3636
stale-pr-label: 'no-pr-activity'
37-
days-before-stale: 60
37+
days-before-stale: 14
3838
days-before-close: 365
3939
remove-stale-when-updated: true
4040
exempt-all-milestones: true
41-
exempt-pr-labels: 'bug'
42-
exempt-issue-labels: 'bug, wip, test'
41+
exempt-pr-labels: 'wip'
42+
exempt-issue-labels: 'wip'
4343
operations-per-run: 30

lib/constants/constants.dart

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:talawa/models/language/language_model.dart';
22

3+
/// This file contains the prototypes of all the languages available and supported currencies.
34
List<Language> languages = [
45
Language(
56
countryCode: 'US',

lib/constants/custom_theme.dart

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import 'package:flutter/material.dart';
22

3+
///This file contains various custom themes.
4+
///For instance, lightTheme, darkTheme, _lightTextTheme, _darkTextTheme, etc.
5+
///These are imported to other files/widgets to apply the required themes.
36
class TalawaTheme {
47
static const Color _lightCursorColor = Color(0xff34AD64);
58
static const Color _lightAccentColor = Color(0xff34AD64);

lib/constants/quick_actions.dart

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import 'package:quick_actions/quick_actions.dart';
22

3+
///This file contains the shortcuts by which user can manage and interact with the
4+
///application. quick_actions package is used for this purpose.
35
class ShortCutMenu {
46
static final quickActionsList = <ShortcutItem>[
57
eventAction,

lib/constants/routing_constants.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//routes
1+
///This file contains the routes.
22
33
class Routes {
44
static const String demoPageViewRoute = "/demoPageViewRoute";

lib/custom_painters/language_icon.dart

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import 'package:flutter/material.dart';
22

3+
///This class draws the language icon using custom paint.
4+
///CustomPaint is a widget from the Flutter SDK, which enables
5+
/// you to use a canvas to draw different shapes.
36
class LanguageIcon extends CustomPainter {
47
@override
58
void paint(Canvas canvas, Size size) {

lib/custom_painters/talawa_logo.dart

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import 'package:flutter/material.dart';
22

3+
///This class draws the app logo using custom paint.
4+
///CustomPaint is a widget from the Flutter SDK, which enables
5+
/// you to use a canvas to draw different shapes.
36
class AppLogo extends CustomPainter {
47
@override
58
void paint(Canvas canvas, Size size) {

lib/custom_painters/telegram_logo.dart

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import 'dart:ui' as ui;
22

33
import 'package:flutter/material.dart';
44

5+
///This class draws the telegram logo using custom paint.
6+
///CustomPaint is a widget from the Flutter SDK, which enables
7+
/// you to use a canvas to draw different shapes.
8+
59
//Copy this CustomPainter code to the Bottom of the File
610
class TelegramLogo extends CustomPainter {
711
@override

lib/custom_painters/whatsapp_logo.dart

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import 'package:flutter/material.dart';
22

3+
///This class draws the whatsapp logo using custom paint.
4+
///CustomPaint is a widget from the Flutter SDK, which enables
5+
/// you to use a canvas to draw different shapes.
36
class WhatsappLogo extends CustomPainter {
47
@override
58
void paint(Canvas canvas, Size size) {

lib/demo_server_data/direct_chat_demo_data.dart

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
///This file contains demo data. It contains a list of type Map<String, Object>
2+
/// and sample data of chats.
13
const directChatDemoData = [
24
{
35
"sender": {

lib/demo_server_data/events_demo_data.dart

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
///This file contains demo data. It contains a list of type Map<String, Object>
2+
/// and sample data of events.
13
const eventsDemoData = [
24
{
35
"title": "Calculus",

lib/demo_server_data/pinned_post_demo_data.dart

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
///This file contains demo data for pinned posts. It contains a list of type Map<String, Object>
2+
/// and sample data.
13
const pinnedPostsDemoData = [
24
{
35
"_id": "1",

lib/demo_server_data/post_demo_data.dart

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
///This file contains demo data for posts. It contains a list of type Map<String, Object>
2+
/// and sample data of posts.
13
const postsDemoData = [
24
{
35
"_id": "asdasdasd",

lib/enums/enums.dart

+6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
///This file contains different enums.
2+
///The enum keyword is used to define an enumeration type in Dart.
3+
/// The use case of enumeration is to store finite data members under the same type definition.
4+
15
/// Represents the state of the view
26
enum ViewState {
37
idle,
48
busy,
59
}
610

11+
/// Represents the state of the chat
712
enum ChatState { initial, loading, complete }
813

14+
/// Represents the type of the tile
915
enum TileType { user, org, option }
1016

1117
enum CallFor { login, signup, joinPublicOrg }

lib/locator.dart

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import 'package:talawa/view_model/widgets_view_models/custom_drawer_view_model.d
3939
import 'package:talawa/view_model/widgets_view_models/like_button_view_model.dart';
4040
import 'package:talawa/view_model/widgets_view_models/progress_dialog_view_model.dart';
4141

42+
// Creating an instance of GetIt and storing it in a global variable
4243
GetIt locator = GetIt.instance;
4344
final userConfig = locator<UserConfig>();
4445
final navigationService = locator<NavigationService>();
@@ -49,6 +50,7 @@ final queries = locator<Queries>();
4950
final connectivity = locator<Connectivity>();
5051
final organizationService = locator<OrganizationService>();
5152

53+
/// This function registers the widgets/objects in "GetIt"
5254
void setupLocator() {
5355
//services
5456
locator.registerSingleton(NavigationService());

lib/main.dart

+16-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
5757

5858
/// This is the main function
5959
Future<void> main() async {
60+
// Returns an instance of the binding that implements WidgetsBinding.
6061
WidgetsFlutterBinding.ensureInitialized();
6162

6263
if (!kIsWeb) {
@@ -102,6 +103,7 @@ Future<void> main() async {
102103
}
103104

104105
setupLocator();
106+
// The runApp() function takes the given Widget and makes it the root of the widget tree.
105107
runApp(MyApp());
106108
}
107109

@@ -132,12 +134,17 @@ class MyApp extends StatefulWidget {
132134
_MyAppState createState() => _MyAppState();
133135
}
134136

137+
/// The _MyAppState class extends the State.
138+
/// All the coding related to state updation is inside this class.
135139
class _MyAppState extends State<MyApp> {
136140
final quickActions = const QuickActions();
137141
late int mainScreenQuickActionindex = 0;
138142
@override
139143
void initState() {
140-
// TODO: implement initState
144+
// initState() is a method that is called once when the Stateful Widget
145+
// is inserted in the widget tree. We generally override this method if
146+
// we need to do some sort of initialization work like
147+
// registering a listener because, unlike build(), this method is called once.
141148
initQuickActions();
142149
FetchPluginList();
143150
super.initState();
@@ -149,6 +156,7 @@ class _MyAppState extends State<MyApp> {
149156
);
150157
}
151158

159+
// It allows to manage and interact with the application’s home screen quick actions.
152160
initQuickActions() async {
153161
final bool userLoggedIn = await userConfig.userLoggedIn();
154162
if (userLoggedIn &&
@@ -166,6 +174,8 @@ class _MyAppState extends State<MyApp> {
166174
}
167175
}
168176

177+
// The build method is called any time you call setState ,your widget's
178+
// dependencies update, or any of the parent widgets are rebuilt.
169179
@override
170180
Widget build(BuildContext context) {
171181
return BaseView<AppLanguage>(
@@ -231,6 +241,8 @@ class _MyAppState extends State<MyApp> {
231241
}
232242
}
233243

244+
/// PageView is a scrollable list that works page by page.
245+
/// DemoPageView is demo PageView of Talawa Mobile App.
234246
class DemoPageView extends StatelessWidget {
235247
const DemoPageView({required Key key}) : super(key: key);
236248

@@ -251,6 +263,9 @@ class DemoPageView extends StatelessWidget {
251263
}
252264
}
253265

266+
/// ViewModel uses property-based data binding to establish a connection
267+
/// between the ViewModel and the View, and drives the View changes
268+
/// through the ViewModel. DemoViewModel is the ViewModel for DemoPageView.
254269
class DemoViewModel extends BaseModel {
255270
final String _title = "Title from the viewMode GSoC branch";
256271
String get title => _title;

lib/models/chats/chat_list_tile_data_model.dart

+5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ import 'package:talawa/models/chats/chat_user.dart';
44
part 'chat_list_tile_data_model.g.dart';
55

66
@JsonSerializable()
7+
8+
/// This class creates JSON code using the JsonSerializable package.
79
class ChatListTileDataModel {
810
ChatListTileDataModel(this.users, this.id);
911

12+
// Connect the generated [_$ChatListTileDataModelFromJson] function to the `fromJson`
13+
// factory.
1014
factory ChatListTileDataModel.fromJson(Map<String, dynamic> json) =>
1115
_$ChatListTileDataModelFromJson(json);
1216

17+
// Connect the generated [_$ChatListTileDataModelToJson] function to the `toJson` method.
1318
Map<String, dynamic> toJson() => _$ChatListTileDataModelToJson(this);
1419

1520
List<ChatUser>? users;

lib/models/chats/chat_message.dart

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,22 @@ import 'package:talawa/models/chats/chat_user.dart';
33
part 'chat_message.g.dart';
44

55
@JsonSerializable(explicitToJson: true)
6+
7+
/// This class creates JSON code for chat message using the JsonSerializable package.
8+
69
class ChatMessage {
710
ChatMessage(
811
this.id,
912
this.sender,
1013
this.messageContent,
1114
this.receiver,
1215
);
13-
16+
// Connect the generated [_$ChatMessageFromJson] function to the `fromJson`
17+
// factory.
1418
factory ChatMessage.fromJson(Map<String, dynamic> json) =>
1519
_$ChatMessageFromJson(json);
20+
21+
// Connect the generated [_$ChatMessageToJson] function to the `toJson` method.
1622
Map<String, dynamic> toJson() => _$ChatMessageToJson(this);
1723

1824
String? id;

lib/models/chats/chat_user.dart

+6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ import 'package:json_annotation/json_annotation.dart';
22
part 'chat_user.g.dart';
33

44
@JsonSerializable()
5+
6+
/// This class creates JSON code for chat user using the JsonSerializable package.
57
class ChatUser {
68
ChatUser({this.firstName, this.id, this.image});
79

10+
// Connect the generated [_$ChatUserFromJson] function to the `fromJson`
11+
// factory.
812
factory ChatUser.fromJson(Map<String, dynamic> json) =>
913
_$ChatUserFromJson(json);
14+
15+
// Connect the generated [_$ChatUserFromJson] function to the `toJson` method.
1016
Map<String, dynamic> toJson() => _$ChatUserToJson(this);
1117

1218
String? firstName;

lib/models/comment/comment_model.dart

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import 'package:talawa/models/user/user_info.dart';
22

3+
///This class returns a Comment instance.
34
class Comment {
45
Comment({this.text, this.createdAt, this.creator, this.post, this.likeCount});
5-
6+
//Creating a new Comment instance from a map structure.
67
factory Comment.fromJson(Map<String, dynamic> json) {
78
return Comment(
89
text: json['text'] as String?,
910
createdAt: json['createdAt'] as String?,
1011
creator: json['creator'] == null
1112
? null
13+
//Creating a new User instance from a map structure.
1214
: User.fromJson(
1315
json['creator'] as Map<String, dynamic>,
1416
fromOrg: true,

lib/models/events/event_model.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:talawa/models/organization/org_info.dart';
22
import 'package:talawa/models/user/user_info.dart';
33

4+
///This class creates an event model and returns an Event instance.
45
class Event {
56
Event({
67
this.id,
@@ -25,7 +26,7 @@ class Event {
2526
this.admins,
2627
this.registrants,
2728
});
28-
29+
//Creating a new Event instance from a map structure.
2930
factory Event.fromJson(
3031
Map<String, dynamic> json,
3132
) {
@@ -49,12 +50,14 @@ class Event {
4950
isRegisterable: json['isRegisterable'] as bool?,
5051
creator: json['creator'] == null
5152
? null
53+
//Creating a new User instance from a map structure.
5254
: User.fromJson(
5355
json['creator'] as Map<String, dynamic>,
5456
fromOrg: true,
5557
),
5658
organization: json['organization'] == null
5759
? null
60+
//Creating a new OrgInfo instance from a map structure.
5861
: OrgInfo.fromJson(json['organization'] as Map<String, dynamic>),
5962
admins: json['admins'] == null
6063
? null

lib/models/language/language_model.dart

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
///This class creates an langauge model.
12
class Language {
23
Language({
34
required this.countryCode,

lib/models/options/options.dart

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22

3+
///This class creates a Option model.
34
class Options {
45
Options({
56
required this.icon,

0 commit comments

Comments
 (0)