Skip to content

Commit

Permalink
Merge branch 'develop' into volunteer
Browse files Browse the repository at this point in the history
  • Loading branch information
Dante291 authored Sep 23, 2024
2 parents d12b7a6 + 4ae4151 commit f34e6bc
Show file tree
Hide file tree
Showing 57 changed files with 1,819 additions and 694 deletions.
47 changes: 43 additions & 4 deletions lib/constants/constants.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
// ignore_for_file: talawa_api_doc
// ignore_for_file: talawa_good_doc_comments

import 'package:talawa/models/language/language_model.dart';

/// This file contains the prototypes of all the languages available and supported currencies.
/// This file contains the prototypes of all the supported languages and currencies used in the application.
///
/// A list of [Language] objects representing the languages supported by the application.
///
/// Each [Language] object contains the following properties:
/// * `countryCode`: The country code associated with the language.
/// * `langCode`: The language code representing the language.
/// * `langName`: The name of the language in its native script.
/// * `langSample`: A sample text phrase in the language, used for display purposes.
List<Language> languages = [
Language(
countryCode: 'US',
Expand Down Expand Up @@ -55,6 +60,10 @@ List<Language> languages = [
),
];

/// A list of supported currency codes used in the application.
///
/// Each currency code is represented as a string in the list. This list is used to ensure that the application
/// supports various currencies for transactions, conversions, or displays.
List<String> supportedCurrencies = [
'AED',
'ALL',
Expand Down Expand Up @@ -150,3 +159,33 @@ List<String> supportedCurrencies = [
'YER',
'ZAR',
];

/// A class containing static constants representing the keys used to identify Hive boxes in the application.
///
/// These keys are used to open or access specific Hive boxes, which store various types of data such as user information,
/// organization details, and cached actions.
class HiveKeys {
/// The key used to identify the Hive box that stores the current user information.
static const userBoxKey = 'currentUser';

/// The key used to identify the Hive box that stores the current organization's information.
static const orgBoxKey = 'currentOrg';

/// The key used to identify the Hive box that stores asymmetric keys for the user.
static const asymetricKeyBoxKey = 'user_keys';

/// The key used to identify the Hive box that stores plugin-related data.
static const pluginBoxKey = 'pluginBox';

/// The key used to identify the Hive box that stores URLs.
static const urlBoxKey = 'url';

/// The key used to identify the Hive box that stores the post feed data.
static const postFeedKey = 'post_feed_key';

/// The key used to identify the Hive box that stores the event feed data.
static const eventFeedKey = 'event_feed_key';

/// The key used to identify the Hive box that stores the offline action queue.
static const offlineActionQueueKey = 'offline_action_queue';
}
19 changes: 3 additions & 16 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import 'package:provider/provider.dart';
import 'package:quick_actions/quick_actions.dart';
import 'package:talawa/constants/quick_actions.dart';
import 'package:talawa/locator.dart';
import 'package:talawa/models/asymetric_keys/asymetric_keys.dart';
import 'package:talawa/models/organization/org_info.dart';
import 'package:talawa/models/user/user_info.dart';
import 'package:talawa/plugins/fetch_plugin_list.dart';
import 'package:talawa/router.dart' as router;
import 'package:talawa/services/hive_manager.dart';
import 'package:talawa/utils/app_localization.dart';
import 'package:talawa/view_model/base_view_model.dart';
import 'package:talawa/view_model/connectivity_view_model.dart';
Expand All @@ -26,21 +24,10 @@ Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();

final Directory dir = await path.getApplicationDocumentsDirectory();
Hive
..init(dir.path)
..registerAdapter(UserAdapter())
..registerAdapter(OrgInfoAdapter())
..registerAdapter(AsymetricKeysAdapter());

await Hive.openBox<User>('currentUser');
await Hive.openBox<OrgInfo>('currentOrg');
await Hive.openBox<AsymetricKeys>('user_keys');
await Hive.openBox('pluginBox');
await Hive.openBox('url');

setupLocator();
await HiveManager.initializeHive(dir: dir);

await cacheService.initialise();
setupLocator();

// The runApp() function takes the given Widget and makes it the root of the widget tree.
runApp(MyApp());
Expand Down
21 changes: 18 additions & 3 deletions lib/models/comment/comment_model.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// ignore_for_file: talawa_api_doc
// ignore_for_file: talawa_good_doc_comments

import 'package:hive/hive.dart';
import 'package:talawa/models/user/user_info.dart';

part 'comment_model.g.dart';

///This class returns a Comment instance.
@HiveType(typeId: 12)
class Comment {
Comment({this.text, this.createdAt, this.creator, this.post, this.likeCount});
//Creating a new Comment instance from a map structure.
Expand All @@ -23,9 +24,23 @@ class Comment {
);
}

/// The text of the comment.
@HiveField(0)
String? text;

/// The creation date of the comment.
@HiveField(1)
String? createdAt;

/// The creator of the comment.
@HiveField(2)
User? creator;

/// The post associated with the comment.
@HiveField(3)
String? post;

/// The like count of the comment.
@HiveField(4)
String? likeCount;
}
53 changes: 53 additions & 0 deletions lib/models/comment/comment_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 29 additions & 3 deletions lib/models/events/event_model.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import 'package:hive/hive.dart';
import 'package:talawa/models/organization/org_info.dart';
import 'package:talawa/models/user/user_info.dart';

part 'event_model.g.dart';

///This class creates an event model and returns an Event instance.
@HiveType(typeId: 10)
class Event {
Event({
this.id,
Expand Down Expand Up @@ -66,59 +70,77 @@ class Event {
);
}

///Unique identifier for the event.
/// Unique identifier for the event.
@HiveField(0)
String? id;

/// The title of the event.
@HiveField(1)
String? title;

/// The description of the event.
@HiveField(2)
String? description;

/// The location of the event.
@HiveField(3)
String? location;

/// A boolean value that indicates if the event is recurring.
@HiveField(4)
bool? recurring;

/// A boolean value that indicates if the event is an all-day event.
@HiveField(5)
bool? allDay;

/// The start date of the event.
@HiveField(6)
String? startDate;

/// The end date of the event.
@HiveField(7)
String? endDate;

/// The start time of the event.
@HiveField(8)
String? startTime;

/// The end time of the event.
@HiveField(9)
String? endTime;

/// A boolean value that indicates if the event is public.
@HiveField(10)
bool? isPublic;

/// A boolean value that indicates if the user is registered for the event.
@HiveField(11)
bool? isRegistered;

/// A boolean value that indicates if the event is registerable.
@HiveField(12)
bool? isRegisterable;

/// The creator of the event.
@HiveField(13)
User? creator;

/// The organization of the event.
@HiveField(14)
OrgInfo? organization;

/// The admins of the event.
@HiveField(15)
List<User>? admins;

/// The attendees of the event.
@HiveField(16)
List<Attendee>? attendees;
}

///This class creates an attendee model and returns an Attendee instance.
@HiveType(typeId: 11)
class Attendee {
Attendee({this.id, this.firstName, this.lastName, this.image});

Expand All @@ -129,16 +151,20 @@ class Attendee {
image = json['image'] as String?;
}

///Unique identifier for the attendee.
/// Unique identifier for the attendee.
@HiveField(0)
String? id;

/// The first name of the attendee.
@HiveField(1)
String? firstName;

/// The last name of the attendee.
@HiveField(2)
String? lastName;

/// The image of the attendee.
/// The image URL of the attendee.
@HiveField(3)
String? image;

/// Converts the Attendee instance to a map structure..
Expand Down
Loading

0 comments on commit f34e6bc

Please sign in to comment.