Skip to content

Commit

Permalink
chore: dart format .
Browse files Browse the repository at this point in the history
  • Loading branch information
phanatagama committed Sep 14, 2023
1 parent 17b5894 commit 6488de3
Show file tree
Hide file tree
Showing 42 changed files with 1,879 additions and 573 deletions.
985 changes: 985 additions & 0 deletions coverage/lcov.info

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions lib/app/data/datasources/shalat_remote_data_source.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart';
import 'package:suji/app/data/model/shalat_time_response.dart';
Expand All @@ -7,20 +6,21 @@ import 'package:suji/core/utils/exception.dart';
import 'package:suji/core/values/constant.dart';

abstract class ShalatRemoteDataSource {
Future<ShalatTimeResponse> getShalatTime(DateTime dateTime,Position position);
Future<ShalatTimeResponse> getShalatTime(
DateTime dateTime, Position position);
}

class ShalatRemoteDataSourceImpl extends GetConnect
implements ShalatRemoteDataSource {

@override
void onInit() {
httpClient.baseUrl = ApiConfig.shalatBaseURL;
httpClient.defaultContentType = 'application/json';
}

@override
Future<ShalatTimeResponse> getShalatTime(DateTime dateTime, Position position) async {
Future<ShalatTimeResponse> getShalatTime(
DateTime dateTime, Position position) async {
final endPoint =
'${ApiConfig.shalatCalendarEndpoint}${dateTime.year}/${dateTime.month}?shafaq=general&method=15&latitude=${position.latitude}&longitude=${position.longitude}';
try {
Expand Down
2 changes: 1 addition & 1 deletion lib/app/data/datasources/surah_remote_data_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SurahRemoteDataSourceImpl extends GetConnect
return errorHandler(response);
}
} catch (e) {
Log.e('[SurahRemoteDataSource][getAllSurah]', e.toString());
Log.e('[SurahRemoteDataSource][getAllSurah]', e.toString());
throw ServerException(e.toString());
}
}
Expand Down
12 changes: 7 additions & 5 deletions lib/app/data/model/daily_pray_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ class DataDailyPrayResponse {
List<dynamic>.from(dataDailyPray.map((x) => x.toJson())),
};

List<DailyPray> toEntity() => dataDailyPray.map((e) => DailyPray(
title: e.title,
arabic: e.arabic,
latin: e.latin,
translation: e.translation)).toList();
List<DailyPray> toEntity() => dataDailyPray
.map((e) => DailyPray(
title: e.title,
arabic: e.arabic,
latin: e.latin,
translation: e.translation))
.toList();
}

class DataDailyPrayElement {
Expand Down
16 changes: 9 additions & 7 deletions lib/app/data/repository/shalat_repository_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ class ShalatRepositoryImpl implements ShalatRepository {
ShalatRepositoryImpl(
{required this.shalatRemoteDataSource,
required this.shalatLocalDataSource,
required this.connectivity
});
required this.connectivity});

@override
Future<Either<Failure, Shalat>> getShalatTime(DateTime dateTime, Position position) async {
Future<Either<Failure, Shalat>> getShalatTime(
DateTime dateTime, Position position) async {
try {
final result = await shalatLocalDataSource.getShalatTime(dateTime, position);
final result =
await shalatLocalDataSource.getShalatTime(dateTime, position);
if (result == null) {
final data = await fetchShalatTime(dateTime, position);
await shalatLocalDataSource.insertOrUpdateShalat(data);
Expand All @@ -44,12 +45,13 @@ class ShalatRepositoryImpl implements ShalatRepository {
}
}


Future<List<Shalat>> fetchShalatTime(DateTime dateTime, Position position) async {
Future<List<Shalat>> fetchShalatTime(
DateTime dateTime, Position position) async {
final hasConnected = await connectivity.checkConnectivity();
if (hasConnected == ConnectivityResult.mobile ||
hasConnected == ConnectivityResult.wifi) {
final result = await shalatRemoteDataSource.getShalatTime(dateTime, position);
final result =
await shalatRemoteDataSource.getShalatTime(dateTime, position);
return result.toEntity();
} else {
throw const SocketException(AppString.socketException);
Expand Down
3 changes: 2 additions & 1 deletion lib/app/data/services/background_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class BackgroundService extends GetxService {
final notificationService = NotificationService();
await notificationService.showNotification(flutterLocalNotificationsPlugin);

final ShalatLocalDataSource dataSource = ShalatLocalDataSourceImpl(databaseHelper: DatabaseHelper());
final ShalatLocalDataSource dataSource =
ShalatLocalDataSourceImpl(databaseHelper: DatabaseHelper());
final shalatTime = await dataSource.getShalatTimeByDate(DateTime.now());
if (shalatTime != null) {
await AndroidAlarmManager.oneShotAt(
Expand Down
2 changes: 1 addition & 1 deletion lib/app/data/services/location_service.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart';

class LocationService extends GetxService{
class LocationService extends GetxService {
static LocationService? _instance;

LocationService._internal() {
Expand Down
2 changes: 1 addition & 1 deletion lib/app/data/services/notification_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class NotificationService {
vibrationPattern[1] = 1000;
vibrationPattern[2] = 5000;
vibrationPattern[3] = 2000;
final androidPlatformChannelSpecifics = AndroidNotificationDetails(
final androidPlatformChannelSpecifics = AndroidNotificationDetails(
_channelId, _channelName,
channelDescription: _channelDesc,
importance: Importance.max,
Expand Down
16 changes: 8 additions & 8 deletions lib/app/domain/entities/asmaul_husna.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ part 'asmaul_husna.freezed.dart';

@freezed
class AsmaulHusna with _$AsmaulHusna {
const AsmaulHusna._();
factory AsmaulHusna({
required String arabic,
required String index,
required String latin,
required String translationEn,
required String translationId,
}) = _AsmaulHusna;
const AsmaulHusna._();
factory AsmaulHusna({
required String arabic,
required String index,
required String latin,
required String translationEn,
required String translationId,
}) = _AsmaulHusna;
}
19 changes: 9 additions & 10 deletions lib/app/domain/entities/daily_pray.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import 'package:freezed_annotation/freezed_annotation.dart';

part 'daily_pray.freezed.dart';

@freezed
class DailyPray with _$DailyPray{
class DailyPray with _$DailyPray {
const DailyPray._();
factory DailyPray(
{
required String title,
required String arabic,
required String latin,
required String translation,
}
) = _DailyPray;
}
factory DailyPray({
required String title,
required String arabic,
required String latin,
required String translation,
}) = _DailyPray;
}
3 changes: 2 additions & 1 deletion lib/app/domain/repository/shalat_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ import 'package:suji/app/domain/entities/shalat.dart';
import 'package:suji/core/utils/failure.dart';

abstract class ShalatRepository {
Future<Either<Failure, Shalat>> getShalatTime(DateTime dateTime, Position position);
Future<Either<Failure, Shalat>> getShalatTime(
DateTime dateTime, Position position);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import 'package:suji/core/utils/failure.dart';
class GetAyahBySurahNumberUsecase {
final SurahRepository surahRepository;
GetAyahBySurahNumberUsecase({required this.surahRepository});
Future<Either<Failure, List<SurahDetail>>> invoke(
int surahNumber) {
Future<Either<Failure, List<SurahDetail>>> invoke(int surahNumber) {
return surahRepository.getAyahBySurahNumber(surahNumber);
}
}
2 changes: 1 addition & 1 deletion lib/app/domain/usescases/get_shalat_time_usecase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:suji/core/utils/failure.dart';
class GetShalatTimeUsecase {
final ShalatRepository shalatRepository;
GetShalatTimeUsecase({required this.shalatRepository});

Future<Either<Failure, Shalat>> invoke(DateTime dateTime, Position position) {
return shalatRepository.getShalatTime(dateTime, position);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class AsmaulHusnaBinding implements Bindings {
void dependencies() {
Get.lazyPut<AsmaulHusnaController>(() => AsmaulHusnaController(
getAsmaulHusnaUsecase: Get.find<GetAsmaulHusnaUsecase>()));
Get.lazyPut(() => GetAsmaulHusnaUsecase(surahRepository: Get.find<SurahRepository>()));
Get.lazyPut(() =>
GetAsmaulHusnaUsecase(surahRepository: Get.find<SurahRepository>()));
}
}
Loading

0 comments on commit 6488de3

Please sign in to comment.