Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created Session Management. #2362

Merged
merged 13 commits into from
Feb 11, 2024
Merged
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Talawa

[💬 Join the community on Slack](https://join.slack.com/t/thepalisadoes-dyb6419/shared_invite/zt-29oltereu-qJ931LcKxswuCAy29iA9WA)
[💬 Join the community on Slack](https://join.slack.com/t/thepalisadoes-dyb6419/shared_invite/zt-2bxpoi56o-pVK3m3YK_rBFojDHLInLxQ)

![talawa-logo-lite-200x200](https://github.com/PalisadoesFoundation/talawa-admin/assets/16875803/26291ec5-d3c1-4135-8bc7-80885dff613d)

Expand Down
4 changes: 0 additions & 4 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
</intent>
</queries>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:label="talawa"
android:icon="@mipmap/ic_launcher"
Expand Down Expand Up @@ -74,8 +72,6 @@
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="YOUR_KEY_HERE"/>
<activity android:name="com.braintreepayments.api.BraintreeBrowserSwitchActivity"
android:launchMode="singleTask">
<intent-filter>
Expand Down
2 changes: 0 additions & 2 deletions ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import UIKit
import Flutter
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GMSServices.provideAPIKey("YOUR_KEY_HERE")
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
Expand Down
1 change: 0 additions & 1 deletion lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
"Add tag": "Tag hinzufügen",
"Enter the Tag": "Geben Sie das Tag ein",
"Title": "Titel",
"Choose on map": "Auf der Karte wählen",
"Where is the event?": "Wo ist das Ereignis?",
"Add Members": "Mitglieder hinzufügen",
"All Events": "Alle Veranstaltungen",
Expand Down
1 change: 0 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
"Add tag": "Add tag",
"Enter the Tag": "Enter the Tag",
"Title": "Title",
"Choose on map": "Choose on map",
"Where is the event?": "Where is the event?",
"Add Members": "Add Members",
"All Events": "All Events",
Expand Down
1 change: 0 additions & 1 deletion lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
"Add tag": "Añadir etiqueta",
"Enter the Tag": "Ingrese la Etiqueta",
"Title": "Título",
"Choose on map": "Elegir en el mapa",
"Where is the event?": "¿Dónde está el evento?",
"Add Members": "Añadir miembros",
"All Events": "Todos los eventos",
Expand Down
1 change: 0 additions & 1 deletion lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
"Add tag": "Ajouter un tag",
"Enter the Tag": "Entrez le Tag",
"Title": "Titre",
"Choose on map": "Choisir sur la carte",
"Where is the event?": "Où se trouve l'événement?",
"Add Members": "Ajouter des membres",
"All Events": "Tous les événements",
Expand Down
1 change: 0 additions & 1 deletion lang/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
"Add tag": "टैग जोड़ें",
"Enter the Tag": "टैग दर्ज करें",
"Title": "शीर्षक",
"Choose on map": "नक्शे पर चुनें",
"Where is the event?": "इवेंट कहाँ है?",
"Add Members": "सदस्य जोड़ें",
"All Events": "सभी ईवेंट्स",
Expand Down
1 change: 0 additions & 1 deletion lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
"Add tag": "タグを追加する",
"Enter the Tag": "タグを入力してください",
"Title": "タイトル",
"Choose on map": "地図上で選択する",
"Where is the event?": "イベントはどこですか?",
"Add Members": "メンバーを追加する",
"All Events": "すべてのイベント",
Expand Down
1 change: 0 additions & 1 deletion lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
"Add tag": "Adicionar tag",
"Enter the Tag": "Digite a Tag",
"Title": "Título",
"Choose on map": "Escolher no mapa",
"Where is the event?": "Onde é o evento?",
"Add Members": "Adicionar membros",
"All Events": "Todos os eventos",
Expand Down
1 change: 0 additions & 1 deletion lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
"Add tag": "添加标签",
"Enter the Tag": "输入标签",
"Title": "标题",
"Choose on map": "在地图上选择",
"Where is the event?": "事件在哪里?",
"Add Members": "添加成员",
"All Events": "所有活动",
Expand Down
3 changes: 0 additions & 3 deletions lib/constants/routing_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ class Routes {
/// static variables.
static const String chatMessageScreen = '/chatMessageScreen';

/// static variables.
static const String mapScreen = '/mapScreen';

/// static variables.
static const String calendar = '/calendar';

Expand Down
27 changes: 17 additions & 10 deletions lib/locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:talawa/services/image_service.dart';
import 'package:talawa/services/navigation_service.dart';
import 'package:talawa/services/org_service.dart';
import 'package:talawa/services/post_service.dart';
import 'package:talawa/services/session_manager.dart';
import 'package:talawa/services/size_config.dart';
import 'package:talawa/services/task_service.dart';
import 'package:talawa/services/third_party_service/multi_media_pick_service.dart';
Expand Down Expand Up @@ -44,37 +45,40 @@ import 'package:talawa/view_model/widgets_view_models/custom_drawer_view_model.d
import 'package:talawa/view_model/widgets_view_models/like_button_view_model.dart';
import 'package:talawa/view_model/widgets_view_models/progress_dialog_view_model.dart';

// Creating an instance of GetIt and storing it in a global variable
// Instance of GetIt and storing it in a global variable
/// Intializaing the locator.
GetIt locator = GetIt.instance;

///creating GetIt for UserConfig.
///GetIt for UserConfig.
final userConfig = locator<UserConfig>();

///creating GetIt for NavigationService.
///GetIt for NavigationService.
final navigationService = locator<NavigationService>();

///creating GetIt for DataBaseMutationFunctions.
///GetIt for DataBaseMutationFunctions.
final databaseFunctions = locator<DataBaseMutationFunctions>();

///creating GetIt for GraphqlConfig.
///GetIt for GraphqlConfig.
final graphqlConfig = locator<GraphqlConfig>();

///creating GetIt for SizeConfig.
///GetIt for SizeConfig.
final sizeConfig = locator<SizeConfig>();

///creating GetIt for Queries.
///GetIt for Queries.
final queries = locator<Queries>();

///creating GetIt for Connectivity.
///GetIt for Connectivity.
final connectivity = locator<Connectivity>();

///creating GetIt for OrganizationService.
///GetIt for OrganizationService.
final organizationService = locator<OrganizationService>();

///creating GetIt for ImageService.
///GetIt for ImageService.
final imageService = locator<ImageService>();

///GetIt for SessionManager.
final sessionManager = locator<SessionManager>();

/// This function registers the widgets/objects in "GetIt".
///
/// **params**:
Expand All @@ -94,6 +98,9 @@ void setupLocator() {
//userConfig
locator.registerSingleton(UserConfig());

//sessionManager
locator.registerSingleton(SessionManager());

//Services
locator.registerLazySingleton(() => PostService());
locator.registerLazySingleton(() => EventService());
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/fetch_plugin_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ class FetchPluginList {
),
);
box = Hive.box('pluginBox');
box.put('plugins', result.data!["getPlugins"]);
box.put('plugins', result.data?["getPlugins"]);
}
}
16 changes: 0 additions & 16 deletions lib/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:talawa/models/post/post_model.dart';
import 'package:talawa/models/task/task_model.dart';
import 'package:talawa/splash_screen.dart';
import 'package:talawa/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart';
import 'package:talawa/views/after_auth_screens/add_post_page.dart';
import 'package:talawa/views/after_auth_screens/app_settings/app_settings_page.dart';
import 'package:talawa/views/after_auth_screens/chat/chat_message_screen.dart';
Expand All @@ -31,7 +30,6 @@ import 'package:talawa/views/after_auth_screens/tasks/create_task_page.dart';
import 'package:talawa/views/after_auth_screens/tasks/edit_task_page.dart';
import 'package:talawa/views/after_auth_screens/tasks/event_tasks_page.dart';
import 'package:talawa/views/after_auth_screens/tasks/user_tasks_page.dart';
import 'package:talawa/views/after_auth_screens/venue/map_screen.dart';
import 'package:talawa/views/demo_screens/explore_events_demo.dart';
import 'package:talawa/views/demo_screens/organization_feed_demo.dart';
import 'package:talawa/views/demo_screens/profile_page_demo.dart';
Expand Down Expand Up @@ -275,20 +273,6 @@ Route<dynamic> generateRoute(RouteSettings settings) {
),
);

// Returns the MapScreen Widget
case Routes.mapScreen:
final arguments = settings.arguments! as Map<String, dynamic>;
final model = arguments['model'] as CreateEventViewModel?;
final latitude = arguments['latitude'] as double;
final longitude = arguments['longitude'] as double;
return MaterialPageRoute(
builder: (context) => MapScreen(
model,
latitude,
longitude,
key: const Key('MapScreen'),
),
);
case Routes.calendar:
return MaterialPageRoute(
builder: (context) => EventCalendar(
Expand Down
3 changes: 1 addition & 2 deletions lib/services/comment_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:talawa/locator.dart';
import 'package:talawa/services/database_mutation_functions.dart';
import 'package:talawa/services/navigation_service.dart';
import 'package:talawa/utils/comment_queries.dart';
import 'package:talawa/utils/post_queries.dart';

/// CommentService class have different member functions which provides service in the context of commenting.
///
Expand Down Expand Up @@ -62,7 +61,7 @@ class CommentService {
/// * `Future<List<dynamic>>`: promise that will be fulfilled with list of comments.
///
Future<List<dynamic>> getCommentsForPost(String postId) async {
final String getCommmentQuery = PostQueries().getPostById(postId);
final String getCommmentQuery = CommentQueries().getPostsComments(postId);

final dynamic result = await _dbFunctions.gqlAuthMutation(getCommmentQuery);

Expand Down
35 changes: 24 additions & 11 deletions lib/services/database_mutation_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DataBaseMutationFunctions {
/// Query passed by fucntion calling this function.
late Queries _query;

/// initialization function.
/// Initialization function.
///
/// **params**:
/// None
Expand All @@ -39,6 +39,19 @@ class DataBaseMutationFunctions {
_query = Queries();
}

/// Initializes [clientNonAuth] function.
///
/// **params**:
/// None
///
/// **returns**:
/// None
void initClientNonAuth() {
graphqlConfig.getOrgUrl();
clientNonAuth = graphqlConfig.clientToQuery();
_query = Queries();
}

/// Graphql error for handling.
GraphQLError userNotFound = const GraphQLError(message: 'User not found');

Expand Down Expand Up @@ -86,7 +99,7 @@ class DataBaseMutationFunctions {
OperationException exception, {
bool showSnackBar = true,
}) {
// if server link is wrong.
// If server link is wrong.
if (exception.linkException != null) {
debugPrint(exception.linkException.toString());
if (showSnackBar) {
Expand All @@ -100,7 +113,7 @@ class DataBaseMutationFunctions {
return false;
}

/// looping through graphQL errors.
/// Looping through graphQL errors.
debugPrint(exception.graphqlErrors.toString());
for (int i = 0; i < exception.graphqlErrors.length; i++) {
// if the error message is "Access Token has expired. Please refresh session.: Undefined location"
Expand All @@ -116,7 +129,7 @@ class DataBaseMutationFunctions {
return true;
}

/// if the error message is "User is not authenticated"
/// If the error message is "User is not authenticated"
if (exception.graphqlErrors[i].message == userNotAuthenticated.message) {
print('client refreshed');
refreshAccessToken(userConfig.currentUser.refreshToken!).then(
Expand All @@ -127,7 +140,7 @@ class DataBaseMutationFunctions {
return true;
}

/// if the error message is "User not found"
/// If the error message is "User not found"
if (exception.graphqlErrors[i].message == userNotFound.message) {
if (showSnackBar) {
WidgetsBinding.instance.addPostFrameCallback(
Expand All @@ -140,7 +153,7 @@ class DataBaseMutationFunctions {
return false;
}

/// if the error message is "Membership Request already exists"
/// If the error message is "Membership Request already exists"
if (exception.graphqlErrors[i].message == memberRequestExist.message) {
if (showSnackBar) {
WidgetsBinding.instance.addPostFrameCallback(
Expand All @@ -153,7 +166,7 @@ class DataBaseMutationFunctions {
return false;
}

/// if the error message is "Invalid credentials"
/// If the error message is "Invalid credentials"
if (exception.graphqlErrors[i].message == wrongCredentials.message) {
if (showSnackBar) {
WidgetsBinding.instance.addPostFrameCallback(
Expand All @@ -166,7 +179,7 @@ class DataBaseMutationFunctions {
return false;
}

/// if the error message is "Organization not found"
/// If the error message is "Organization not found"
if (exception.graphqlErrors[i].message == organizationNotFound.message) {
if (showSnackBar) {
WidgetsBinding.instance.addPostFrameCallback(
Expand All @@ -179,7 +192,7 @@ class DataBaseMutationFunctions {
return false;
}

/// if the error message is "Email address already exists"
/// If the error message is "Email address already exists"
if (exception.graphqlErrors[i].message == emailAccountPresent.message) {
if (showSnackBar) {
WidgetsBinding.instance.addPostFrameCallback(
Expand All @@ -192,7 +205,7 @@ class DataBaseMutationFunctions {
return false;
}
}
// if the error is unknown
// If the error is unknown

WidgetsBinding.instance.addPostFrameCallback(
(_) => navigationService.showTalawaErrorDialog(
Expand Down Expand Up @@ -250,7 +263,7 @@ class DataBaseMutationFunctions {
variables: variables ?? <String, dynamic>{},
),
);
// if there is an error or exception in [result]
// If there is an error or exception in [result]
if (result.hasException) {
final exception = encounteredExceptionOrError(result.exception!);
if (exception!) {
Expand Down
Loading
Loading