Skip to content

Commit

Permalink
Merge pull request #36 from halfmoon-mind/develop
Browse files Browse the repository at this point in the history
chore: build 1.0.0+5
  • Loading branch information
halfmoon-mind authored Jan 12, 2024
2 parents 969a985 + f67cc16 commit b44aa87
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ SPEC CHECKSUMS:
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sqlite3: 6e2d4a4879854d0ec86b476bf3c3e30870bac273
sqlite3_flutter_libs: eb769059df0356dc52ddda040f09cacc9391a7cf
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b

PODFILE CHECKSUM: 3f3697c847c52bb2f1c7146b71ef2faef67d110f

Expand Down
1 change: 0 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:nightary/main_app.dart';
import 'package:nightary/utilities/app_routes.dart';
Expand Down
36 changes: 20 additions & 16 deletions lib/providers/sleep_record_local_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ class SleepRecordLocalProvider extends GetConnect {
httpClient
..baseUrl = "https://nightary.dcs-hyungjoon.com/"
..timeout = const Duration(seconds: 60)
..addRequestModifier<dynamic>((request) {
LogSystem.logger.d("Request: ${request.method} ${request.url}");
..addRequestModifier<dynamic>((request) {
LogSystem.logger.d("Request: ${request.method} ${request.url}");

return request;
})
..addResponseModifier((request, response) {
if(response.status.hasError){
LogSystem.logger.e("Response: ${response.statusCode} ${response.statusCode} ${response.statusText}");
} else {
LogSystem.logger.d("Response: ${response.statusCode} ${response.body}");
}
return request;
})
..addResponseModifier((request, response) {
if (response.status.hasError) {
LogSystem.logger.e(
"Response: ${response.statusCode} ${response.statusCode} ${response.statusText}");
} else {
LogSystem.logger
.d("Response: ${response.statusCode} ${response.body}");
}

return response;
});
return response;
});
}

Future<SleepRecordData?> findRecentOne() async {
try {
Expand All @@ -41,7 +44,6 @@ class SleepRecordLocalProvider extends GetConnect {

Future<List<int>> saveAll(List<SleepRecordCompanion> entities) async {
return await _sleepRecordDao.saveAll(entities);

}

Future<List<SleepRecordData>> readSleepRecordsLimit(int limitCnt) async {
Expand All @@ -51,7 +53,8 @@ class SleepRecordLocalProvider extends GetConnect {
return sleepRecords;
}

Future<List<DateTimeRange>> getPredictedSleepByLastTwentySleeps(String endpoint, final requestBody) async {
Future<List<DateTimeRange>> getPredictedSleepByLastTwentySleeps(
String endpoint, final requestBody) async {
final response =
await post(endpoint, requestBody, contentType: "application/json");
final data = response.body as Map<String, dynamic>;
Expand All @@ -65,8 +68,9 @@ class SleepRecordLocalProvider extends GetConnect {
}
return predictedSleep;
}

Future<List<String>> getAnalysisSleepByLastTwentySleeps(endpoint, final requestBody) async{

Future<List<String>> getAnalysisSleepByLastTwentySleeps(
endpoint, final requestBody) async {
final Response response =
await post(endpoint, requestBody, contentType: "application/json");
print(response.body);
Expand Down
11 changes: 7 additions & 4 deletions lib/repositories/sleep_record_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,11 @@ class SleepRecordRepository extends GetxService {
"liabilities": liabilities
};
}

Future<List<DateTimeRange>> getPredictedSleepByLastTwentySleeps() async {
// 최근 20개의 수면 기록을 가져온다.
List<SleepRecordData> sleepRecords =
await _provider.readSleepRecordsLimit(20);
await _sleepRecordProvider.readSleepRecordsLimit(20);
String endpoint = "analyze/predict/";
final startSleepDateList = [];
final endSleepDateList = [];
Expand All @@ -245,13 +246,14 @@ class SleepRecordRepository extends GetxService {
"startSleepDate": startSleepDateList,
"endSleepDate": endSleepDateList
};
return await _provider.getPredictedSleepByLastTwentySleeps(endpoint, requestBody);
return await _sleepRecordProvider.getPredictedSleepByLastTwentySleeps(
endpoint, requestBody);
}

Future<List<String>> getAnalysisSleepByLastTwentySleeps() async {
// 최근 20개의 수면 기록을 가져온다.
List<SleepRecordData> sleepRecords =
await _provider.readSleepRecordsLimit(20);
await _sleepRecordProvider.readSleepRecordsLimit(20);
String endpoint = "analyze/analyze/";
final startSleepDateList = [];
final endSleepDateList = [];
Expand All @@ -263,7 +265,8 @@ class SleepRecordRepository extends GetxService {
"startSleepDate": startSleepDateList,
"endSleepDate": endSleepDateList
};
return await _provider.getAnalysisSleepByLastTwentySleeps(endpoint, requestBody);
return await _sleepRecordProvider.getAnalysisSleepByLastTwentySleeps(
endpoint, requestBody);
}
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: nightary
description: Sleep and Liver Care Management Application
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+4
version: 1.0.0+5

environment:
sdk: '>=3.1.3 <4.0.0'
Expand Down

0 comments on commit b44aa87

Please sign in to comment.