Skip to content

Commit

Permalink
Merge pull request #15 from CemTitor/trunk
Browse files Browse the repository at this point in the history
feat: ActivityTracker name replaced with Pedometer and homepage UI updated
  • Loading branch information
kzawadi authored Jul 26, 2022
2 parents 54b0933 + 03c4fbd commit 1b918bb
Show file tree
Hide file tree
Showing 31 changed files with 425 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import 'package:bloc_concurrency/bloc_concurrency.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';
import 'package:pedometer/pedometer.dart';
import 'package:private_fit/domain/activity_tracker/use_cases/get_fetched_step_use_case.dart';
import 'package:private_fit/domain/activity_tracker/use_cases/pedestrian_status_use_case.dart';
import 'package:private_fit/domain/activity_tracker/use_cases/steps_count_stream_use_case.dart';
import 'package:private_fit/domain/pedometer/use_cases/get_fetched_step_use_case.dart';
import 'package:private_fit/domain/pedometer/use_cases/pedestrian_status_use_case.dart';
import 'package:private_fit/domain/pedometer/use_cases/steps_count_stream_use_case.dart';

part 'pedometer_bloc.freezed.dart';
part 'pedometer_event.dart';
Expand Down
16 changes: 0 additions & 16 deletions lib/domain/activity_tracker/activity_tracker_failures.dart

This file was deleted.

15 changes: 0 additions & 15 deletions lib/domain/activity_tracker/i_activity_tracker_facade.dart

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 11 additions & 0 deletions lib/domain/pedometer/i_pedometer_facade.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:dartz/dartz.dart';
import 'package:pedometer/pedometer.dart';
import 'package:private_fit/domain/pedometer/pedometer_failures.dart';

abstract class IPedometerFacade {
Future<Either<PedometerFailures, Unit>> justPlaceHolder();
Future<void> initPedometer();

Stream<StepCount> get stepCountStream;
Stream<PedestrianStatus> get pedestrianStatusStream;
}
16 changes: 16 additions & 0 deletions lib/domain/pedometer/pedometer_failures.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:freezed_annotation/freezed_annotation.dart';

part 'pedometer_failures.freezed.dart';

@freezed
class PedometerFailures with _$PedometerFailures {
const factory PedometerFailures.internetNotFound() = _InternetNotFound;
const factory PedometerFailures.failedToGetPermissions() =
_FailedToGetCameraPermissions;
const factory PedometerFailures.internetError() = _InternetError;
const factory PedometerFailures.userCancelled() = _UserCancelled;
const factory PedometerFailures.codeInvalid() = _codeInvalid;
const factory PedometerFailures.onPedestrianStatusError() =
_onPedestrianStatusError;
const factory PedometerFailures.onStepCountError() = _onStepCountError;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target

part of 'activity_tracker_failures.dart';
part of 'pedometer_failures.dart';

// **************************************************************************
// FreezedGenerator
Expand All @@ -15,7 +15,7 @@ final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');

/// @nodoc
mixin _$ActivityTrackerFailures {
mixin _$PedometerFailures {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() internetNotFound,
Expand Down Expand Up @@ -91,20 +91,20 @@ mixin _$ActivityTrackerFailures {
}

/// @nodoc
abstract class $ActivityTrackerFailuresCopyWith<$Res> {
factory $ActivityTrackerFailuresCopyWith(ActivityTrackerFailures value,
$Res Function(ActivityTrackerFailures) then) =
_$ActivityTrackerFailuresCopyWithImpl<$Res>;
abstract class $PedometerFailuresCopyWith<$Res> {
factory $PedometerFailuresCopyWith(
PedometerFailures value, $Res Function(PedometerFailures) then) =
_$PedometerFailuresCopyWithImpl<$Res>;
}

/// @nodoc
class _$ActivityTrackerFailuresCopyWithImpl<$Res>
implements $ActivityTrackerFailuresCopyWith<$Res> {
_$ActivityTrackerFailuresCopyWithImpl(this._value, this._then);
class _$PedometerFailuresCopyWithImpl<$Res>
implements $PedometerFailuresCopyWith<$Res> {
_$PedometerFailuresCopyWithImpl(this._value, this._then);

final ActivityTrackerFailures _value;
final PedometerFailures _value;
// ignore: unused_field
final $Res Function(ActivityTrackerFailures) _then;
final $Res Function(PedometerFailures) _then;
}

/// @nodoc
Expand All @@ -116,7 +116,7 @@ abstract class _$$_InternetNotFoundCopyWith<$Res> {

/// @nodoc
class __$$_InternetNotFoundCopyWithImpl<$Res>
extends _$ActivityTrackerFailuresCopyWithImpl<$Res>
extends _$PedometerFailuresCopyWithImpl<$Res>
implements _$$_InternetNotFoundCopyWith<$Res> {
__$$_InternetNotFoundCopyWithImpl(
_$_InternetNotFound _value, $Res Function(_$_InternetNotFound) _then)
Expand All @@ -133,7 +133,7 @@ class _$_InternetNotFound implements _InternetNotFound {

@override
String toString() {
return 'ActivityTrackerFailures.internetNotFound()';
return 'PedometerFailures.internetNotFound()';
}

@override
Expand Down Expand Up @@ -242,7 +242,7 @@ class _$_InternetNotFound implements _InternetNotFound {
}
}

abstract class _InternetNotFound implements ActivityTrackerFailures {
abstract class _InternetNotFound implements PedometerFailures {
const factory _InternetNotFound() = _$_InternetNotFound;
}

Expand All @@ -256,7 +256,7 @@ abstract class _$$_FailedToGetCameraPermissionsCopyWith<$Res> {

/// @nodoc
class __$$_FailedToGetCameraPermissionsCopyWithImpl<$Res>
extends _$ActivityTrackerFailuresCopyWithImpl<$Res>
extends _$PedometerFailuresCopyWithImpl<$Res>
implements _$$_FailedToGetCameraPermissionsCopyWith<$Res> {
__$$_FailedToGetCameraPermissionsCopyWithImpl(
_$_FailedToGetCameraPermissions _value,
Expand All @@ -275,7 +275,7 @@ class _$_FailedToGetCameraPermissions implements _FailedToGetCameraPermissions {

@override
String toString() {
return 'ActivityTrackerFailures.failedToGetPermissions()';
return 'PedometerFailures.failedToGetPermissions()';
}

@override
Expand Down Expand Up @@ -385,8 +385,7 @@ class _$_FailedToGetCameraPermissions implements _FailedToGetCameraPermissions {
}
}

abstract class _FailedToGetCameraPermissions
implements ActivityTrackerFailures {
abstract class _FailedToGetCameraPermissions implements PedometerFailures {
const factory _FailedToGetCameraPermissions() =
_$_FailedToGetCameraPermissions;
}
Expand All @@ -400,7 +399,7 @@ abstract class _$$_InternetErrorCopyWith<$Res> {

/// @nodoc
class __$$_InternetErrorCopyWithImpl<$Res>
extends _$ActivityTrackerFailuresCopyWithImpl<$Res>
extends _$PedometerFailuresCopyWithImpl<$Res>
implements _$$_InternetErrorCopyWith<$Res> {
__$$_InternetErrorCopyWithImpl(
_$_InternetError _value, $Res Function(_$_InternetError) _then)
Expand All @@ -417,7 +416,7 @@ class _$_InternetError implements _InternetError {

@override
String toString() {
return 'ActivityTrackerFailures.internetError()';
return 'PedometerFailures.internetError()';
}

@override
Expand Down Expand Up @@ -526,7 +525,7 @@ class _$_InternetError implements _InternetError {
}
}

abstract class _InternetError implements ActivityTrackerFailures {
abstract class _InternetError implements PedometerFailures {
const factory _InternetError() = _$_InternetError;
}

Expand All @@ -539,7 +538,7 @@ abstract class _$$_UserCancelledCopyWith<$Res> {

/// @nodoc
class __$$_UserCancelledCopyWithImpl<$Res>
extends _$ActivityTrackerFailuresCopyWithImpl<$Res>
extends _$PedometerFailuresCopyWithImpl<$Res>
implements _$$_UserCancelledCopyWith<$Res> {
__$$_UserCancelledCopyWithImpl(
_$_UserCancelled _value, $Res Function(_$_UserCancelled) _then)
Expand All @@ -556,7 +555,7 @@ class _$_UserCancelled implements _UserCancelled {

@override
String toString() {
return 'ActivityTrackerFailures.userCancelled()';
return 'PedometerFailures.userCancelled()';
}

@override
Expand Down Expand Up @@ -665,7 +664,7 @@ class _$_UserCancelled implements _UserCancelled {
}
}

abstract class _UserCancelled implements ActivityTrackerFailures {
abstract class _UserCancelled implements PedometerFailures {
const factory _UserCancelled() = _$_UserCancelled;
}

Expand All @@ -678,7 +677,7 @@ abstract class _$$_codeInvalidCopyWith<$Res> {

/// @nodoc
class __$$_codeInvalidCopyWithImpl<$Res>
extends _$ActivityTrackerFailuresCopyWithImpl<$Res>
extends _$PedometerFailuresCopyWithImpl<$Res>
implements _$$_codeInvalidCopyWith<$Res> {
__$$_codeInvalidCopyWithImpl(
_$_codeInvalid _value, $Res Function(_$_codeInvalid) _then)
Expand All @@ -695,7 +694,7 @@ class _$_codeInvalid implements _codeInvalid {

@override
String toString() {
return 'ActivityTrackerFailures.codeInvalid()';
return 'PedometerFailures.codeInvalid()';
}

@override
Expand Down Expand Up @@ -804,7 +803,7 @@ class _$_codeInvalid implements _codeInvalid {
}
}

abstract class _codeInvalid implements ActivityTrackerFailures {
abstract class _codeInvalid implements PedometerFailures {
const factory _codeInvalid() = _$_codeInvalid;
}

Expand All @@ -817,7 +816,7 @@ abstract class _$$_onPedestrianStatusErrorCopyWith<$Res> {

/// @nodoc
class __$$_onPedestrianStatusErrorCopyWithImpl<$Res>
extends _$ActivityTrackerFailuresCopyWithImpl<$Res>
extends _$PedometerFailuresCopyWithImpl<$Res>
implements _$$_onPedestrianStatusErrorCopyWith<$Res> {
__$$_onPedestrianStatusErrorCopyWithImpl(_$_onPedestrianStatusError _value,
$Res Function(_$_onPedestrianStatusError) _then)
Expand All @@ -835,7 +834,7 @@ class _$_onPedestrianStatusError implements _onPedestrianStatusError {

@override
String toString() {
return 'ActivityTrackerFailures.onPedestrianStatusError()';
return 'PedometerFailures.onPedestrianStatusError()';
}

@override
Expand Down Expand Up @@ -945,7 +944,7 @@ class _$_onPedestrianStatusError implements _onPedestrianStatusError {
}
}

abstract class _onPedestrianStatusError implements ActivityTrackerFailures {
abstract class _onPedestrianStatusError implements PedometerFailures {
const factory _onPedestrianStatusError() = _$_onPedestrianStatusError;
}

Expand All @@ -958,7 +957,7 @@ abstract class _$$_onStepCountErrorCopyWith<$Res> {

/// @nodoc
class __$$_onStepCountErrorCopyWithImpl<$Res>
extends _$ActivityTrackerFailuresCopyWithImpl<$Res>
extends _$PedometerFailuresCopyWithImpl<$Res>
implements _$$_onStepCountErrorCopyWith<$Res> {
__$$_onStepCountErrorCopyWithImpl(
_$_onStepCountError _value, $Res Function(_$_onStepCountError) _then)
Expand All @@ -975,7 +974,7 @@ class _$_onStepCountError implements _onStepCountError {

@override
String toString() {
return 'ActivityTrackerFailures.onStepCountError()';
return 'PedometerFailures.onStepCountError()';
}

@override
Expand Down Expand Up @@ -1084,6 +1083,6 @@ class _$_onStepCountError implements _onStepCountError {
}
}

abstract class _onStepCountError implements ActivityTrackerFailures {
abstract class _onStepCountError implements PedometerFailures {
const factory _onStepCountError() = _$_onStepCountError;
}
11 changes: 11 additions & 0 deletions lib/domain/pedometer/use_cases/get_fetched_step_use_case.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:injectable/injectable.dart';
import 'package:private_fit/domain/pedometer/i_pedometer_facade.dart';

@lazySingleton
class InitPedometerUseCase {
InitPedometerUseCase(this._iPedometerFacade);

final IPedometerFacade _iPedometerFacade;

Future<void> call() => _iPedometerFacade.initPedometer();
}
12 changes: 12 additions & 0 deletions lib/domain/pedometer/use_cases/pedestrian_status_use_case.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:injectable/injectable.dart';
import 'package:pedometer/pedometer.dart';
import 'package:private_fit/domain/pedometer/i_pedometer_facade.dart';

@lazySingleton
class PedestrianStatusUseCase {
PedestrianStatusUseCase(this._PedometerFacade);

final IPedometerFacade _PedometerFacade;

Stream<PedestrianStatus> call() => _PedometerFacade.pedestrianStatusStream;
}
13 changes: 13 additions & 0 deletions lib/domain/pedometer/use_cases/steps_count_stream_use_case.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import 'package:injectable/injectable.dart';
import 'package:pedometer/pedometer.dart';
import 'package:private_fit/domain/pedometer/i_pedometer_facade.dart';

@lazySingleton
class StepsCountStreamUseCase {
StepsCountStreamUseCase(this._PedometerFacade);

final IPedometerFacade _PedometerFacade;

Stream<StepCount> get scs => _PedometerFacade.stepCountStream;
// Stream<StepCount> call() => _PedometerFacade.stepCountStream;
}
Loading

0 comments on commit 1b918bb

Please sign in to comment.