Skip to content

Commit

Permalink
Extract helper_functions.dart into a separate helper_functions pa…
Browse files Browse the repository at this point in the history
…ckage (#1194)

The package `sharezone_widgets` used the `isNullOrEmpty()` /
`isNotNullOrEmpty()` method from the `sharezone_common` package.
However, the `sharezone_common` package has a lot of Firebase
dependencies. With extracting the `helper_functions.dart` into a
`helper_functions` package, I removed all Firebase dependencies from
`sharezone_widgets` 👍
  • Loading branch information
nilsreichardt authored Dec 19, 2023
1 parent 0100afb commit 575da42
Show file tree
Hide file tree
Showing 98 changed files with 417 additions and 970 deletions.
2 changes: 1 addition & 1 deletion app/lib/account/change_data_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:rxdart/rxdart.dart';
import 'package:sharezone/util/api/user_api.dart';
import 'package:sharezone_common/api_errors.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_utils/internet_access.dart';

class ChangeDataBloc extends BlocBase with AuthentificationValidators {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:flutter/material.dart';
import 'package:key_value_store/key_value_store.dart';
import 'package:rxdart/rxdart.dart';
import 'package:sharezone/sharezone_plus/subscription_service/subscription_flag.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

import '../models/enter_activation_code_result.dart';
import 'enter_activation_code_activator.dart';
Expand Down
2 changes: 1 addition & 1 deletion app/lib/auth/email_and_password_link_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'package:rxdart/rxdart.dart';
import 'package:sharezone/account/account_page_bloc.dart';
import 'package:sharezone/account/profile/user_edit/user_edit_bloc.dart';
import 'package:sharezone_common/api_errors.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

// * Using a shortcut getter method on the class to create simpler and friendlier API for the class to provide access of a particular function on StreamController
Expand Down
2 changes: 1 addition & 1 deletion app/lib/auth/reset_pw_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:rxdart/rxdart.dart';
import 'package:rxdart/subjects.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

import 'email_and_password_link_page.dart';
Expand Down
2 changes: 1 addition & 1 deletion app/lib/blackboard/blackboard_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:sharezone/blackboard/blocs/blackboard_card_bloc.dart';
import 'package:sharezone/blackboard/details/blackboard_details.dart';
import 'package:sharezone/main/application_bloc.dart';
import 'package:sharezone/util/launch_link.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

import 'blackboard_view.dart';
Expand Down
2 changes: 1 addition & 1 deletion app/lib/blackboard/blackboard_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// SPDX-License-Identifier: EUPL-1.2

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:sharezone_common/firebase_helper.dart';

class BlackboardItem {
final String id;
Expand Down
2 changes: 1 addition & 1 deletion app/lib/blackboard/blocs/blackboard_dialog_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'package:sharezone/markdown/markdown_analytics.dart';
import 'package:sharezone/util/api.dart';
import 'package:sharezone_common/api_errors.dart';
import 'package:sharezone_common/blackboard_validators.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_common/validators.dart';

class BlackboardDialogBloc extends BlocBase with BlackboardValidators {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import 'package:key_value_store/key_value_store.dart';
import 'package:sharezone/calendrical_events/models/calendrical_events_layout.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

class CalendricalEventsPageCache {
final KeyValueStore keyValueStore;
Expand Down
2 changes: 1 addition & 1 deletion app/lib/changelog/change_database_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:sharezone/changelog/change.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:sharezone_common/firebase_helper.dart';

class ChangeDatabaseModel {
final String id;
Expand Down
2 changes: 1 addition & 1 deletion app/lib/comments/comment_data_models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:sharezone/comments/comment.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:sharezone_common/firebase_helper.dart';

class CommentDataModel {
final String? id;
Expand Down
2 changes: 1 addition & 1 deletion app/lib/comments/comments_analytics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// SPDX-License-Identifier: EUPL-1.2

import 'package:analytics/analytics.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

import 'comments_gateway.dart';

Expand Down
2 changes: 1 addition & 1 deletion app/lib/comments/widgets/user_comment_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:bloc_provider/bloc_provider.dart';
import 'package:flutter/material.dart';
import 'package:sharezone/auth/login_button.dart';
import 'package:sharezone/comments/comments_bloc.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

class UserCommentField extends StatefulWidget {
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dashboard/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import 'package:sharezone/widgets/animated_stream_list.dart';
import 'package:sharezone/homework/shared/homework_card.dart';
import 'package:sharezone/widgets/matching_type_of_user_builder.dart';
import 'package:sharezone/widgets/material/modal_bottom_sheet_big_icon_button.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:platform_check/platform_check.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';
import 'package:user/user.dart';
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dashboard/widgets/blackboard_card_dashboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:sharezone/blackboard/blackboard_card.dart';
import 'package:sharezone/blackboard/blackboard_view.dart';
import 'package:sharezone/blackboard/blocs/blackboard_card_bloc.dart';
import 'package:sharezone/main/application_bloc.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

/// Diese BlackboardCard wird nun auf der Dashboard-Seite verwendet
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dynamic_links/einkommender_link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// SPDX-License-Identifier: EUPL-1.2

import 'package:dynamic_links/dynamic_links.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

enum EinkommensZeitpunkt { appstart, laufzeit, unbekannt }

Expand Down
2 changes: 1 addition & 1 deletion app/lib/feedback/src/models/user_feedback.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// SPDX-License-Identifier: EUPL-1.2

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

class UserFeedback {
final double? rating;
Expand Down
2 changes: 1 addition & 1 deletion app/lib/filesharing/logic/select_cloud_file_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'package:sharezone/filesharing/widgets/download_unknown_file_type_dialog_
import 'package:sharezone/filesharing/widgets/move_file_page.dart';
import 'package:sharezone/report/page/report_page.dart';
import 'package:sharezone/report/report_item.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:platform_check/platform_check.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

Expand Down
2 changes: 1 addition & 1 deletion app/lib/groups/group_join/models/group_join_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import 'package:group_domain_models/group_domain_models.dart';
import 'package:sharezone/groups/group_join/models/group_info_with_selection_state.dart';
import 'package:sharezone/groups/group_join/models/group_join_exception.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:sharezone_common/firebase_helper.dart';

abstract class GroupJoinResult {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:group_domain_models/group_domain_models.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart';
import 'package:sharezone/main/application_bloc.dart';
import 'package:sharezone/groups/group_join/bloc/group_join_bloc.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:platform_check/platform_check.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import 'package:group_domain_models/group_domain_models.dart';
import 'package:sharezone/groups/src/pages/course/course_details/course_details_bloc.dart';
import 'package:sharezone/groups/src/widgets/member_list.dart';
import 'package:sharezone/main/application_bloc.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

Future<void> showCourseMemberOptionsSheet({
required BuildContext context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import 'package:flutter/material.dart';
import 'package:group_domain_models/group_domain_models.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

import 'course_settings.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'package:rxdart/rxdart.dart';
import 'package:sharezone/util/api/course_gateway.dart';
import 'package:sharezone_common/api_errors.dart';
import 'package:sharezone_common/course_validators.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

class CourseEditPageBloc extends BlocBase with CourseValidators {
final _subjectSubject = BehaviorSubject<String>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// SPDX-License-Identifier: EUPL-1.2

import 'package:analytics/analytics.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

const groupPage = "group-page";
const schoolClassPage = "school-class-page";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:sharezone/groups/src/pages/course/create/src/models/course_templ
import 'package:sharezone/util/string_utils.dart';
import 'package:sharezone_common/api_errors.dart';
import 'package:sharezone_common/course_validators.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_common/validators.dart';

import '../gateway/course_create_gateway.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import 'package:sharezone/util/api.dart';
import 'package:sharezone/util/string_utils.dart';
import 'package:sharezone_common/api_errors.dart';
import 'package:sharezone_common/course_validators.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_common/validators.dart';

class SchoolClassCourseCreateBloc extends BlocBase with CourseValidators {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import 'package:sharezone/groups/src/widgets/sharecode_text.dart';
import 'package:sharezone/report/report_icon.dart';
import 'package:sharezone/report/report_item.dart';
import 'package:sharezone/widgets/avatar_card.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

import 'school_class_details/school_class_course_list.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'package:sharezone/groups/group_permission.dart';
import 'package:sharezone/groups/src/pages/school_class/my_school_class_bloc.dart';
import 'package:sharezone/groups/src/widgets/member_list.dart';
import 'package:sharezone/main/application_bloc.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

Future<void> showSchoolClassMemberOptionsSheet({
required BuildContext context,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/groups/src/widgets/group_share.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:group_domain_models/group_domain_models.dart';
import 'package:share/share.dart';
import 'package:sharezone/onboarding/group_onboarding/logic/group_onboarding_bloc.dart';
import 'package:sharezone/onboarding/group_onboarding/logic/signed_up_bloc.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:platform_check/platform_check.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

Expand Down
2 changes: 1 addition & 1 deletion app/lib/groups/src/widgets/sharecode_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:platform_check/platform_check.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

Expand Down
2 changes: 1 addition & 1 deletion app/lib/homework/shared/homework_list_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import 'package:flutter/material.dart';
import 'package:sharezone/homework/shared/animated_staggered_scroll_view.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

/// A List of homeworks with a leading title.
///
Expand Down
2 changes: 1 addition & 1 deletion app/lib/markdown/markdown_analytics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import 'package:analytics/analytics.dart';
import 'package:bloc_base/bloc_base.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

class MarkdownAnalytics extends BlocBase {
final Analytics _analytics;
Expand Down
2 changes: 1 addition & 1 deletion app/lib/navigation/drawer/tiles/drawer_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:build_context/build_context.dart';
import 'package:flutter/material.dart';
import 'package:sharezone/navigation/logic/navigation_bloc.dart';
import 'package:sharezone/navigation/models/navigation_item.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

import '../drawer_controller.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// SPDX-License-Identifier: EUPL-1.2

import 'package:analytics/analytics.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

class GroupOnboardingAnalytics {
final Analytics _analytics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import 'package:sharezone/onboarding/group_onboarding/logic/group_onboarding_blo
import 'package:sharezone/onboarding/group_onboarding/pages/create_courses.dart';
import 'package:sharezone/onboarding/group_onboarding/pages/group_onboarding_page_template.dart';
import 'package:sharezone/onboarding/sign_up/sign_up_page.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';
import 'package:user/user.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:sharezone/onboarding/group_onboarding/logic/group_onboarding_bloc.dart';
import 'package:sharezone/onboarding/group_onboarding/widgets/title.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

class GroupOnboardingPageTemplate extends StatelessWidget {
Expand Down
2 changes: 1 addition & 1 deletion app/lib/report/page/report_page_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:rxdart/rxdart.dart';
import 'package:sharezone/report/report_factory.dart';
import 'package:sharezone/report/report_item.dart' as ui;
import 'package:sharezone_common/api_errors.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';

import '../report.dart';
import '../report_gateway.dart';
Expand Down
2 changes: 1 addition & 1 deletion app/lib/settings/src/subpages/about/widgets/team.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// SPDX-License-Identifier: EUPL-1.2

import 'package:flutter/material.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';
import 'about_section.dart';
import 'social_media_button.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import 'package:sharezone/settings/src/subpages/my_profile/change_state.dart';
import 'package:sharezone/settings/src/subpages/my_profile/my_profile_bloc.dart';
import 'package:sharezone/widgets/material/list_tile_with_description.dart';
import 'package:sharezone_common/api_errors.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
import 'package:url_launcher_extended/url_launcher_extended.dart';
Expand Down
2 changes: 1 addition & 1 deletion app/lib/submissions/homework_create_submission_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:sharezone/filesharing/dialog/attach_file.dart';
import 'package:sharezone/filesharing/widgets/cloud_file_icon.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:platform_check/platform_check.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';

Expand Down
2 changes: 1 addition & 1 deletion app/lib/timetable/src/edit_time.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart' hide TimePickerEntryMode;
import 'package:interval_time_picker/interval_time_picker.dart';
import 'package:sharezone/settings/src/subpages/timetable/time_picker_settings_cache.dart';
import 'package:sharezone_common/helper_functions.dart';
import 'package:helper_functions/helper_functions.dart';
import 'package:platform_check/platform_check.dart';
import 'package:sharezone_widgets/sharezone_widgets.dart';
import 'package:time/time.dart';
Expand Down
7 changes: 7 additions & 0 deletions app/pubspec.lock

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

2 changes: 2 additions & 0 deletions app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ dependencies:
path: ../lib/hausaufgabenheft_logik
holidays:
path: ../lib/holidays
helper_functions:
path: ../lib/helper_functions
http: ^1.1.2
# Used so that we can select a minute interval (only either XX:00 or XX:30)
# for the homework reminder time picker.
Expand Down
7 changes: 7 additions & 0 deletions lib/abgabe/abgabe_client_lib/pubspec.lock

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

Loading

0 comments on commit 575da42

Please sign in to comment.