Skip to content

Commit

Permalink
Merge pull request #64 from tortamque:develop
Browse files Browse the repository at this point in the history
Release 1.0
  • Loading branch information
tortamque authored Dec 22, 2023
2 parents 371a7db + 4252f60 commit cc3dda5
Show file tree
Hide file tree
Showing 154 changed files with 7,758 additions and 91 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

# Firebase-related
android/app/google-services.json
lib/firebase_options.dart

# Generated files
*.g.dart
111 changes: 87 additions & 24 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,91 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

analyzer:
exclude:
- "build/**"
- "**/*.g.dart"
- "**/*.gr.dart"
- "**/*.config.dart"
- "**/*.freezed.dart"
- "**/generated/**"
errors:
unused_element: error
unused_import: error
unused_local_variable: error
dead_code: error

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
- unnecessary_late
- null_check_on_nullable_type_parameter
- use_super_parameters
- always_use_package_imports
- avoid_returning_null_for_future
- avoid_slow_async_io
- avoid_type_to_string
- cancel_subscriptions
- close_sinks
- literal_only_boolean_expressions
- no_adjacent_strings_in_list
- test_types_in_equals
- throw_in_finally
- unnecessary_statements
- always_declare_return_types
- avoid_bool_literals_in_conditional_expressions
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
- avoid_final_parameters
- avoid_multiple_declarations_per_line
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_returning_null
- avoid_returning_this
- avoid_setters_without_getters
- avoid_types_on_closure_parameters
- avoid_unused_constructor_parameters
- avoid_void_async
- deprecated_consistency
- directives_ordering
- do_not_use_environment
- eol_at_end_of_file
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_private_types_in_public_api
- no_default_cases
- no_leading_underscores_for_library_prefixes
- no_leading_underscores_for_local_identifiers
- no_runtimeType_toString
- noop_primitive_operations
- omit_local_variable_types
- parameter_assignments
- prefer_asserts_in_initializer_lists
- prefer_constructors_over_static_methods
- prefer_expression_function_bodies
- prefer_if_elements_to_conditional_expressions
- prefer_interpolation_to_compose_strings
- prefer_null_aware_method_calls
- prefer_single_quotes
- require_trailing_commas
- sized_box_shrink_expand
- sort_child_properties_last
- sort_constructors_first
- sort_unnamed_constructors_first
- tighten_type_of_initializing_formals
- type_annotate_public_apis
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_constructor_name
- unnecessary_null_aware_assignments
- unnecessary_parenthesis
- unnecessary_raw_strings
- use_decorated_box
- use_if_null_to_convert_nulls_to_bools
- use_is_even_rather_than_modulo
- use_named_constants
- use_setters_to_change_properties
- use_string_buffers
- use_test_throws_matchers
- use_to_and_as_if_applicable
- depend_on_referenced_packages
- secure_pubspec_urls
27 changes: 18 additions & 9 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -12,6 +6,11 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
Expand All @@ -22,9 +21,14 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace "com.example.poetlum"
compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 34
ndkVersion flutter.ndkVersion

compileOptions {
Expand All @@ -45,10 +49,11 @@ android {
applicationId "com.example.poetlum"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
minSdkVersion 22
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}

buildTypes {
Expand All @@ -64,4 +69,8 @@ flutter {
source '../..'
}

dependencies {}
dependencies {
implementation platform('com.google.firebase:firebase-bom:32.4.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.android.installreferrer:installreferrer:2.2'
}
5 changes: 3 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="poetlum"
android:label="Poetlum"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/launcher_icon">
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions android/app/src/main/res/mipmap-anydpi-v26/launcher_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#ecfafc</color>
</resources>
5 changes: 3 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions lib/config/theme/app_theme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:flutter/material.dart';

ThemeData theme(Color color) => ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: color),
useMaterial3: true,
);
4 changes: 4 additions & 0 deletions lib/core/constants/animation_constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import 'package:flutter/material.dart';

const Curve animationCurve = Curves.easeOutSine;
const Duration animationDuration = Duration(milliseconds: 500);
8 changes: 8 additions & 0 deletions lib/core/constants/navigator_constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const String authWrapperPageConstant = '/auth_wrapper';
const String registerPageConstant = '/register';
const String loginPageConstant = '/login';
const String screensWrapperPageConstant = '/screen_wrapper';
const String poemViewPageConstant = '/poem_view';
const String writePoemPageConstant = '/write_poem';
const String savedCollectionViewConstant = '/saved_collection_view';
const String savedPoemViewConstant = '/saved_poem_view';
2 changes: 2 additions & 0 deletions lib/core/constants/poems_constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const String poemApiBaseUrl = 'https://poetrydb.org/';
const int defaultPoemsCount = 50;
1 change: 1 addition & 0 deletions lib/core/constants/shared_preferences_constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const String savedColorConstant = 'saved_color';
123 changes: 123 additions & 0 deletions lib/core/dependency_injection.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import 'package:dio/dio.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:get_it/get_it.dart';
import 'package:poetlum/core/shared/data/repository/user_repository_impl.dart';
import 'package:poetlum/core/shared/domain/repository/user_repository.dart';
import 'package:poetlum/core/shared/presentation/bloc/credentials/credentials_bloc.dart';
import 'package:poetlum/features/authorization/data/data_sources/remote/firebase_service.dart';
import 'package:poetlum/features/authorization/data/repository/auth_repository_impl.dart';
import 'package:poetlum/features/authorization/data/repository/firebase_repository_impl.dart';
import 'package:poetlum/features/authorization/domain/repository/auth_repository.dart';
import 'package:poetlum/features/authorization/domain/repository/firebase_repository.dart';
import 'package:poetlum/features/authorization/domain/usecases/login/login_user_usecase.dart';
import 'package:poetlum/features/authorization/domain/usecases/register/register_user_usecase.dart';
import 'package:poetlum/features/authorization/presentation/bloc/authorization/auth_cubit.dart';
import 'package:poetlum/features/authorization/presentation/bloc/validation/validation_cubit.dart';
import 'package:poetlum/features/authorization/presentation/bloc/validation/validators.dart';
import 'package:poetlum/features/poems_feed/data/data_sources/remote/poem_api_service.dart';
import 'package:poetlum/features/poems_feed/data/repository/poem_repository_impl.dart';
import 'package:poetlum/features/poems_feed/domain/repository/poem_repository.dart';
import 'package:poetlum/features/poems_feed/domain/usecases/get_poems_usecase.dart';
import 'package:poetlum/features/poems_feed/presentation/bloc/poem/remote/remote_poem_bloc.dart';
import 'package:poetlum/features/saved_poems/data/data_sources/remote/firebase_api_service.dart';
import 'package:poetlum/features/saved_poems/data/repository/firebase_db_repository_impl.dart';
import 'package:poetlum/features/saved_poems/domain/repository/firebase_db_repository.dart';
import 'package:poetlum/features/saved_poems/domain/usecases/create_new_collection/create_new_collection_usecase.dart';
import 'package:poetlum/features/saved_poems/domain/usecases/delete_collection/delete_collection_usecase.dart';
import 'package:poetlum/features/saved_poems/domain/usecases/delete_poem/delete_poem_usecase.dart';
import 'package:poetlum/features/saved_poems/domain/usecases/delete_poem_from_collection/delete_poem_from_collection_usecase.dart';
import 'package:poetlum/features/saved_poems/domain/usecases/get_poems_in_collection/get_poems_in_collection_usecase.dart';
import 'package:poetlum/features/saved_poems/domain/usecases/get_user_collections/get_user_collections_usecase.dart';
import 'package:poetlum/features/saved_poems/domain/usecases/get_user_poems/get_user_poems_usecase.dart';
import 'package:poetlum/features/saved_poems/domain/usecases/is_collection_exists/is_collection_exists_usecase.dart';
import 'package:poetlum/features/saved_poems/domain/usecases/is_poem_exists/is_poem_exists_usecase.dart';
import 'package:poetlum/features/saved_poems/domain/usecases/is_poem_exists_by_name/is_poem_exists_by_name_usecase.dart';
import 'package:poetlum/features/saved_poems/domain/usecases/save_poem/save_poem_usecase.dart';
import 'package:poetlum/features/saved_poems/domain/usecases/update_poems_in_collection/update_poems_in_collection_usecase.dart';
import 'package:poetlum/features/saved_poems/presentation/bloc/firebase_database/firebase_database_cubit.dart';
import 'package:poetlum/features/theme_change/data/data_sources/local/shared_preferences_service.dart';
import 'package:poetlum/features/theme_change/data/repository/shared_preferences_repository_impl.dart';
import 'package:poetlum/features/theme_change/domain/repository/shared_preferences_repository.dart';
import 'package:poetlum/features/theme_change/domain/usecases/get_color/get_color_usecase.dart';
import 'package:poetlum/features/theme_change/domain/usecases/save_color/save_color_usecase.dart';
import 'package:poetlum/features/theme_change/presentation/bloc/change_theme_cubit.dart';

GetIt getIt = GetIt.instance;

void initializeDependencies() {
if(!GetIt.instance.isRegistered<Dio>()){
getIt
// Dio
..registerSingleton<Dio>(Dio())

// API Service
..registerSingleton<PoemApiService>(PoemApiService(getIt()))
..registerSingleton<FirebaseService>(FirebaseServiceImpl())
..registerSingleton<FirebaseDatabaseService>(FirebaseDatabaseServiceImpl())
..registerSingleton<SharedPreferencesService>(SharedPreferencesServiceImpl())

// Repository
..registerSingleton<AuthenticationRepository>(AuthenticationRepositoryImpl())
..registerSingleton<PoemRepository>(PoemRepositoryImpl(getIt()))
..registerSingleton<FirebaseRepository>(FirebaseRepositoryImpl(getIt()))
..registerSingleton<FirebaseDatabaseRepository>(FirebaseDatabaseRepositoryImpl(getIt()))
..registerSingleton<SharedPreferencesRepository>(SharedPreferencesRepositoryImpl(getIt()))
..registerSingleton<UserRepository>(UserRepositoryImpl(FirebaseAuth.instance))

// Usecase
..registerSingleton<GetInitialPoemsUseCase>(GetInitialPoemsUseCase(getIt()))
..registerSingleton<GetPoemsUseCase>(GetPoemsUseCase(getIt()))
..registerSingleton<RegisterUserUseCase>(RegisterUserUseCase(getIt()))
..registerSingleton<LoginUserUseCase>(LoginUserUseCase(getIt()))
..registerSingleton<GetUserPoemsUseCase>(GetUserPoemsUseCase(getIt()))
..registerSingleton<GetUserCollectionsUseCase>(GetUserCollectionsUseCase(getIt()))
..registerSingleton<SavePoemUseCase>(SavePoemUseCase(getIt()))
..registerSingleton<DeletePoemUseCase>(DeletePoemUseCase(getIt()))
..registerSingleton<IsPoemExistsUseCase>(IsPoemExistsUseCase(getIt()))
..registerSingleton<IsPoemExistsByNameUseCase>(IsPoemExistsByNameUseCase(getIt()))
..registerSingleton<CreateNewCollectionUseCase>(CreateNewCollectionUseCase(getIt()))
..registerSingleton<DeleteCollectionUseCase>(DeleteCollectionUseCase(getIt()))
..registerSingleton<DeletePoemFromCollectionUseCase>(DeletePoemFromCollectionUseCase(getIt()))
..registerSingleton<UpdatePoemsInCollectionUseCase>(UpdatePoemsInCollectionUseCase(getIt()))
..registerSingleton<GetPoemsInCollectionUseCase>(GetPoemsInCollectionUseCase(getIt()))
..registerSingleton<IsCollectionExistsUseCase>(IsCollectionExistsUseCase(getIt()))
..registerSingleton<SaveColorUseCase>(SaveColorUseCase(getIt()))
..registerSingleton<GetColorUseCase>(GetColorUseCase(getIt()))

// Validators
..registerLazySingleton<UsernameValidator>(() => UsernameValidator())
..registerLazySingleton<LocalEmailValidator>(() => LocalEmailValidator())
..registerLazySingleton<PasswordValidator>(() => PasswordValidator())

// Bloc
..registerFactory<RemotePoemBloc>(() => RemotePoemBloc(getIt(), getIt()))
..registerFactory<AuthCubit>(() => AuthCubit(getIt(), getIt()))
..registerFactory<CredentialsCubit>(() => CredentialsCubit())
..registerFactory<ThemeCubit>(() => ThemeCubit(getIt(), getIt()))
..registerFactory<FirebaseDatabaseCubit>(
() => FirebaseDatabaseCubit(
getIt(),
getIt(),
getIt(),
getIt(),
getIt(),
getIt(),
getIt(),
getIt(),
getIt(),
getIt(),
getIt(),
getIt(),
),
)
..registerFactory<RegisterFormValidationCubit>(() => RegisterFormValidationCubit(
usernameValidator: getIt<UsernameValidator>(),
emailValidator: getIt<LocalEmailValidator>(),
passwordValidator: getIt<PasswordValidator>(),
),)
..registerFactory<LoginFormValidationCubit>(() => LoginFormValidationCubit(
emailValidator: getIt<LocalEmailValidator>(),
passwordValidator: getIt<PasswordValidator>(),
),);
}
}
Loading

0 comments on commit cc3dda5

Please sign in to comment.