Skip to content

Commit

Permalink
Merge pull request #71 from arafaysaleem/release
Browse files Browse the repository at this point in the history
Release - 7/08/2021
  • Loading branch information
arafaysaleem authored Aug 7, 2021
2 parents 33045c4 + ea958e0 commit 094bad5
Show file tree
Hide file tree
Showing 50 changed files with 734 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/PR-open-test-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
path: "./coverage/lcov.info"
min_coverage: 4.5
exclude: "**/*.freezed.dart **/*.g.dart **/*.gr.dart **/constants.dart **/custom_theme.dart **/assets_helper.dart"
exclude: "**/*.freezed.dart **/*.g.dart **/*.gr.dart **/*.mocks.dart **/constants.dart **/custom_theme.dart **/assets_helper.dart"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2.0.2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ app.*.map.json
*.g.dart
*.freezed.dart
*.gr.dart
*.mocks.dart

#keystore
*.jks
2 changes: 1 addition & 1 deletion Prototype/Theater class code.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Hall {
required this.name,
});

factory Hall.fromJson(Map<String, dynamic> json) {
factory Hall.fromJson(JSON json) {
return Hall(
numRows: json["num_rows"] as int,
numCols: json["num_cols"] as int,
Expand Down
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ analyzer:
- "**/*.freezed.dart"
- "**/*.g.dart"
- "**/*.gr.dart"
- "**/*.mocks.dart"
errors:
missing_required_param: error
missing_return: error
Expand Down
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ignore:
- '**/*.gr.dart'
- '**/*.g.dart'
- '**/*.freezed.dart'
- "**/*.mocks.dart"
- '**/constants.dart'
- '**/custom_theme.dart'
- '**/assets_helper.dart'
Expand Down
2 changes: 1 addition & 1 deletion coverage_helper_script.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ echo "/// *** GENERATED FILE - ANY CHANGES WOULD BE OBSOLETE ON NEXT GENERATION
echo "// Helper file to make coverage work for all dart files\n" > $file
echo "// ignore_for_file: unused_import" >> $file
packageName="$(cat pubspec.yaml| grep '^name: ' | awk '{print $2}')"
find lib '!' -path '*generated*/*' '!' -name '*.g.dart' '!' -name '*.freezed.dart' '!' -name '*.gr.dart' '!' -name '*.part.dart' -name '*.dart' | cut -c4- | awk -v package="$packageName" '{printf "import '\''package:%s%s'\'';\n", package, $1}' >> $file
find lib '!' -path '*generated*/*' '!' -name '*.g.dart' '!' -name '*.freezed.dart' '!' -name '*.gr.dart' '!' -name '*.part.dart' '!' -name '*.mocks.dart' -name '*.dart' | cut -c4- | awk -v package="$packageName" '{printf "import '\''package:%s%s'\'';\n", package, $1}' >> $file
echo "\nvoid main(){}" >> $file
2 changes: 2 additions & 0 deletions lib/helper/typedefs.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
typedef JSON = Map<String, dynamic>;
typedef QueryParams = Map<String, String>;
2 changes: 1 addition & 1 deletion lib/helper/utils/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,5 @@ class Constants {
/// The error message for invalid credit card expiry input.
static const invalidCreditCardExpiryError = 'Please enter a valid expiry date';

static T? toNull<T>(dynamic _) => null;
static T? toNull<T>(Object? _) => null;
}
36 changes: 36 additions & 0 deletions lib/helper/utils/exception_constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// ignore_for_file: constant_identifier_names
import 'package:flutter/foundation.dart';

/// A utility class that holds constants for our custom exception names.
/// This class has no constructor and all variables are `static`.
@immutable
class ExceptionConstants {
const ExceptionConstants._();

/// The name of the exception for an expired bearer token.
static const String TokenExpiredException = 'TokenExpiredException';

/// The name of the exception for a prematurely cancelled request.
static const String CancelException = 'CancelException';

/// The name of the exception for a failed connection attempt.
static const String ConnectTimeoutException = 'ConnectTimeoutException';

/// The name of the exception for failing to send a request.
static const String SendTimeoutException = 'SendTimeoutException';

/// The name of the exception for failing to receive a response.
static const String ReceiveTimeoutException = 'ReceiveTimeoutException';

/// The name of the exception for no internet connectivity.
static const String SocketException = 'SocketException';

/// A better name for the socket exception.
static const String FetchDataException = 'FetchDataException';

/// The name of the exception for an incorrect parameter in a request/response.
static const String FormatException = 'FormatException';

/// The name of the exception for an unknown type of failure.
static const String UnrecognizedException = 'UnrecognizedException';
}
7 changes: 4 additions & 3 deletions lib/models/booking_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';

import '../enums/booking_status_enum.dart';
import '../helper/utils/constants.dart';
import '../helper/typedefs.dart';

part 'booking_model.freezed.dart';

Expand All @@ -24,7 +25,7 @@ class BookingModel with _$BookingModel {
required DateTime bookingDatetime,
}) = _BookingModel;

Map<String, dynamic> toUpdateJson({
JSON toUpdateJson({
int? userId,
int? showId,
String? seatRow,
Expand All @@ -39,7 +40,7 @@ class BookingModel with _$BookingModel {
seatNumber == null &&
price == null &&
bookingStatus == null &&
bookingDatetime == null) return const <String, dynamic>{};
bookingDatetime == null) return const <String, Object>{};
return copyWith(
userId: userId,
showId: showId ?? this.showId,
Expand All @@ -51,6 +52,6 @@ class BookingModel with _$BookingModel {
).toJson();
}

factory BookingModel.fromJson(Map<String, dynamic> json) =>
factory BookingModel.fromJson(JSON json) =>
_$BookingModelFromJson(json);
}
3 changes: 2 additions & 1 deletion lib/models/genre_model.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import '../helper/typedefs.dart';

part 'genre_model.freezed.dart';

Expand All @@ -12,6 +13,6 @@ class GenreModel with _$GenreModel {
required String genre,
}) = _GenreModel;

factory GenreModel.fromJson(Map<String, dynamic> json) =>
factory GenreModel.fromJson(JSON json) =>
_$GenreModelFromJson(json);
}
7 changes: 4 additions & 3 deletions lib/models/movie_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';

import '../enums/movie_type_enum.dart';
import '../helper/utils/constants.dart';
import '../helper/typedefs.dart';
import 'genre_model.dart';

part 'movie_model.freezed.dart';
Expand Down Expand Up @@ -42,7 +43,7 @@ class MovieModel with _$MovieModel {
);
}

Map<String, dynamic> toUpdateJson({
JSON toUpdateJson({
int? year,
String? title,
String? summary,
Expand All @@ -58,7 +59,7 @@ class MovieModel with _$MovieModel {
posterUrl == null &&
rating == null &&
movieType == null
) return const <String, dynamic>{};
) return const <String, Object>{};
return copyWith(
movieId: movieId,
year: year ?? this.year,
Expand All @@ -71,7 +72,7 @@ class MovieModel with _$MovieModel {
).toJson();
}

factory MovieModel.fromJson(Map<String, dynamic> json) =>
factory MovieModel.fromJson(JSON json) =>
_$MovieModelFromJson(json);

late final List<String> genreNames =
Expand Down
7 changes: 4 additions & 3 deletions lib/models/movie_role_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';

//Enums
import '../enums/role_type_enum.dart';
import '../helper/typedefs.dart';

//Models
import 'role_model.dart';
Expand All @@ -20,11 +21,11 @@ class MovieRoleModel with _$MovieRoleModel {
required RoleType roleType,
}) = _MovieRoleModel;

factory MovieRoleModel.fromJson(Map<String, dynamic> json) =>
factory MovieRoleModel.fromJson(JSON json) =>
_$MovieRoleModelFromJson(json);

Map<String, dynamic> toCustomJson() {
return <String, dynamic>{
JSON toCustomJson() {
return <String, Object>{
'role_id': role.roleId,
'role_type': roleType.toJson,
};
Expand Down
7 changes: 4 additions & 3 deletions lib/models/payment_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';

import '../enums/payment_method_enum.dart';
import '../helper/utils/constants.dart';
import '../helper/typedefs.dart';

part 'payment_model.freezed.dart';

Expand All @@ -23,7 +24,7 @@ class PaymentModel with _$PaymentModel {
required List<int>? bookings,
}) = _PaymentModel;

Map<String, dynamic> toUpdateJson({
JSON toUpdateJson({
int? userId,
int? showId,
double? amount,
Expand All @@ -34,7 +35,7 @@ class PaymentModel with _$PaymentModel {
showId == null &&
amount == null &&
paymentMethod == null &&
paymentDatetime == null) return const <String, dynamic>{};
paymentDatetime == null) return const <String, Object>{};
return copyWith(
paymentId: paymentId,
showId: showId ?? this.showId,
Expand All @@ -44,6 +45,6 @@ class PaymentModel with _$PaymentModel {
).toJson();
}

factory PaymentModel.fromJson(Map<String, dynamic> json) =>
factory PaymentModel.fromJson(JSON json) =>
_$PaymentModelFromJson(json);
}
4 changes: 3 additions & 1 deletion lib/models/role_model.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:freezed_annotation/freezed_annotation.dart';

import '../helper/typedefs.dart';

part 'role_model.freezed.dart';
part 'role_model.g.dart';

Expand All @@ -14,6 +16,6 @@ class RoleModel with _$RoleModel {
required String pictureUrl,
}) = _RoleModel;

factory RoleModel.fromJson(Map<String, dynamic> json) =>
factory RoleModel.fromJson(JSON json) =>
_$RoleModelFromJson(json);
}
4 changes: 3 additions & 1 deletion lib/models/seat_model.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:freezed_annotation/freezed_annotation.dart';

import '../helper/typedefs.dart';

part 'seat_model.freezed.dart';
part 'seat_model.g.dart';

Expand All @@ -11,5 +13,5 @@ class SeatModel with _$SeatModel {
required int seatNumber,
}) = _SeatModel;

factory SeatModel.fromJson(Map<String, dynamic> json) => _$SeatModelFromJson(json);
factory SeatModel.fromJson(JSON json) => _$SeatModelFromJson(json);
}
3 changes: 2 additions & 1 deletion lib/models/show_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:clock/clock.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

import 'show_time_model.dart';
import '../helper/typedefs.dart';

part 'show_model.freezed.dart';
part 'show_model.g.dart';
Expand All @@ -25,6 +26,6 @@ class ShowModel with _$ShowModel {
);
}

factory ShowModel.fromJson(Map<String, dynamic> json) =>
factory ShowModel.fromJson(JSON json) =>
_$ShowModelFromJson(json);
}
3 changes: 2 additions & 1 deletion lib/models/show_time_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:clock/clock.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

import '../helper/utils/constants.dart';
import '../helper/typedefs.dart';
import '../enums/show_status_enum.dart';
import '../enums/show_type_enum.dart';

Expand Down Expand Up @@ -34,6 +35,6 @@ class ShowTimeModel with _$ShowTimeModel {
);
}

factory ShowTimeModel.fromJson(Map<String, dynamic> json) =>
factory ShowTimeModel.fromJson(JSON json) =>
_$ShowTimeModelFromJson(json);
}
7 changes: 4 additions & 3 deletions lib/models/theater_model.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:freezed_annotation/freezed_annotation.dart';

import '../helper/utils/constants.dart';
import '../helper/typedefs.dart';
import '../enums/theater_type_enum.dart';
import 'seat_model.dart';

Expand All @@ -23,7 +24,7 @@ class TheaterModel with _$TheaterModel {
required List<SeatModel> blocked,
}) = _TheaterModel;

Map<String, dynamic> toUpdateJson({
JSON toUpdateJson({
String? theaterName,
int? numOfRows,
int? seatsPerRow,
Expand All @@ -37,7 +38,7 @@ class TheaterModel with _$TheaterModel {
theaterType == null &&
missing == null &&
blocked == null
) return const <String, dynamic>{};
) return const <String, Object>{};
return copyWith(
theaterId: theaterId,
numOfRows: numOfRows ?? this.numOfRows,
Expand All @@ -48,6 +49,6 @@ class TheaterModel with _$TheaterModel {
).toJson();
}

factory TheaterModel.fromJson(Map<String, dynamic> json) =>
factory TheaterModel.fromJson(JSON json) =>
_$TheaterModelFromJson(json);
}
3 changes: 2 additions & 1 deletion lib/models/user_booking_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';

import 'booking_model.dart';
import 'user_booking_show_model.dart';
import '../helper/typedefs.dart';

part 'user_booking_model.freezed.dart';
part 'user_booking_model.g.dart';
Expand All @@ -16,5 +17,5 @@ class UserBookingModel with _$UserBookingModel {
required List<BookingModel> bookings,
}) = _UserBookingModel;

factory UserBookingModel.fromJson(Map<String, dynamic> json) => _$UserBookingModelFromJson(json);
factory UserBookingModel.fromJson(JSON json) => _$UserBookingModelFromJson(json);
}
4 changes: 3 additions & 1 deletion lib/models/user_booking_show_model.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:freezed_annotation/freezed_annotation.dart';

import '../helper/typedefs.dart';
import '../enums/show_type_enum.dart';

part 'user_booking_show_model.freezed.dart';
Expand All @@ -13,5 +15,5 @@ class UserBookingShowModel with _$UserBookingShowModel {
required DateTime showDatetime,
}) = _UserBookingShowModel;

factory UserBookingShowModel.fromJson(Map<String, dynamic> json) => _$UserBookingShowModelFromJson(json);
factory UserBookingShowModel.fromJson(JSON json) => _$UserBookingShowModelFromJson(json);
}
3 changes: 2 additions & 1 deletion lib/models/user_model.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:freezed_annotation/freezed_annotation.dart';

import '../helper/typedefs.dart';
import '../enums/user_role_enum.dart';

part 'user_model.freezed.dart';
Expand All @@ -18,6 +19,6 @@ class UserModel with _$UserModel {
required UserRole role,
}) = _UserModel;

factory UserModel.fromJson(Map<String, dynamic> json) =>
factory UserModel.fromJson(JSON json) =>
_$UserModelFromJson(json);
}
Loading

0 comments on commit 094bad5

Please sign in to comment.