Skip to content

Commit

Permalink
🔃 Merge pull request #36 from catoverse/feed_service_api
Browse files Browse the repository at this point in the history
Feed service api
  • Loading branch information
amanxnanda authored Nov 12, 2021
2 parents 8f9ea37 + 624db51 commit 10909d5
Show file tree
Hide file tree
Showing 38 changed files with 377 additions and 677 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ analyzer:
- lib/core/models/app_models.g.dart
- test/helpers/test_helpers.mocks.dart
- test/helpers/test_helpers.dart
- lib/ui/invite/invite_view.form.dart
errors:
todo: warning

Expand Down
2 changes: 2 additions & 0 deletions lib/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:feed/core/services/life_cycle_service.dart';
import 'package:feed/core/services/message_queue_service.dart';
import 'package:feed/core/services/notification_service.dart';
import 'package:feed/core/services/share_service.dart';
import 'package:feed/core/services/update_service.dart';
import 'package:feed/core/services/url_service.dart';
import 'package:feed/core/services/video_manager_service.dart';
import 'package:feed/feedplayer/controller.dart';
Expand Down Expand Up @@ -87,6 +88,7 @@ import 'injection.dart';
presolveUsing: VideoManagerService.getInstance,
),
LazySingleton(classType: Connectivity),
LazySingleton(classType: AppUpdateService),
LazySingleton(
classType: ConnectivityServiceImpl, asType: ConnectivityService),

Expand Down
2 changes: 2 additions & 0 deletions lib/app/app.locator.dart

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

7 changes: 3 additions & 4 deletions lib/app/app.logger.dart

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

1 change: 1 addition & 0 deletions lib/app/app.router.dart

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

1 change: 1 addition & 0 deletions lib/core/constants/assets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class Assets {
static const onboardingImage1 = "assets/images/onboarding1.png";
static const onboardingImage2 = "assets/images/onboarding2.png";
static const onboardingImage3 = "assets/images/onboarding3.png";
static const appIcon = 'assets/images/app_icon.png';
static const topicSocialImage = "assets/images/social.png";
static const topicCareerImage = "assets/images/career.png";
static const topicEmotionalImage = "assets/images/emotional.png";
Expand Down
9 changes: 6 additions & 3 deletions lib/core/constants/strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const String onboardingItemSubtitle3 =
"Play games with friends to practice,\nimplement and improve upon what you learn";
const String confirmExitTitle = "Are you sure to exit?";
const String confirmExitDescription = "👋 Bye!";
const kNotificationPermissionsTitle = 'A new idea a day to expand your horizons';
const kNotificationPermissionDescription = 'Trun on notifications to get highly curated video recommendations on your selected topics';
const kNotificationPermissionsTitle =
'A new idea a day to expand your horizons';
const kNotificationPermissionDescription =
'Trun on notifications to get highly curated video recommendations on your selected topics';
const kTextCopiedToClipboardMessage = 'Text copied to clipboard';

const kPlayStoreUrl =
"https://play.google.com/store/apps/details?id=cato.tv.app";
2 changes: 1 addition & 1 deletion lib/core/exceptions/api_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class GraphQLException implements Exception {

@override
String toString() {
return 'ApiException: $message';
return 'GraphQLException: $message';
}
}

Expand Down
43 changes: 31 additions & 12 deletions lib/core/models/app_models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,49 @@ class Video with _$Video {
@HiveField(3) @JsonKey(name: "title") required String title,
@HiveField(4) @JsonKey(name: 'available') bool? available,
@HiveField(5) @JsonKey(name: "video_url") required String videoUrl,
@HiveField(6) @JsonKey(name: "topic") required Topic topic,
@HiveField(6) @JsonKey(name: "topics") required List<Topic> topics,
@HiveField(7) @JsonKey(name: "start_timestamp") int? startTimestamp,
@HiveField(8) @JsonKey(name: "end_timestamp") int? endTimestamp,
@HiveField(9) @JsonKey(name: "thumbnail_url") String? thumbnailUrl,
@HiveField(10) @JsonKey(name: "channel_name") String? channelName,
@HiveField(11) @JsonKey(name: "channel_avatar_url") String? channelAvatarUrl,
@HiveField(11)
@JsonKey(name: "channel_avatar_url")
String? channelAvatarUrl,
@HiveField(12) @Default(false) bool bookmarked,
}) = _Video;

factory Video.fromJson(Map<String, dynamic> json) => _$VideoFromJson(json);
}

@freezed
class Failure with _$Failure {
const factory Failure.error(Error error) = _GenericError;
const factory Failure.exception(Exception exception) = _RaisedException;
const factory Failure.message(String message) = _FailureMessage;
class Failure {
final Error? error;

final Exception? exception;

final String? message;

const Failure.error(Error e)
: error = e,
message = null,
exception = null;

const Failure.exception(Exception e)
: error = null,
message = null,
exception = e;

const Failure.message(String m)
: error = null,
message = m,
exception = null;

@override
String toString() {
return this.map(
error: (e) => e.error.toString(),
exception: (e) => e.exception.toString(),
message: (e) => e.message,
);
return error == null
? exception == null
? message!
: exception.toString()
: error.toString();
}
}

Expand Down
Loading

0 comments on commit 10909d5

Please sign in to comment.