Skip to content

Commit ab08862

Browse files
committed
redis-implemented-and-bug-fixes
1 parent 88171ca commit ab08862

File tree

20 files changed

+218
-96
lines changed

20 files changed

+218
-96
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ jobs:
3939
uses: ncipollo/release-action@v1
4040
with:
4141
artifacts: "build/app/outputs/apk/release/*"
42-
tag: v2.0.8
42+
tag: v2.0.9
4343
token: ${{ secrets.TOKEN }}
44-
name: "stable-v2.0.8"
44+
name: "beta-v2.0.9"
4545
body: |
46-
## What's New in v2.0.8
46+
## What's New in v2.0.9
4747
48+
- **Structure of Redis added to Clean Architecture
4849
- **Added Redis-base to support syncfusion**
49-
- **Fixed Performance and Responsiveness Issues and Improved UI.
50-
- **New Feature**: Implemented Syncfusion.
50+
- **Fixed Performance and Responsiveness Issues by Improvised BLoC Structure.
51+
- **New Feature**: Implemented Syncfusion and Redis for low latency.
5152
52-
### Known Issues are Resolved.
53+
### Known Issues are Resolved - Looking for vulnerabilities before Redis Full-Integration.

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![Mindful-App](https://socialify.git.ci/ARYPROGRAMMER/Mindful-App/image?description=1&descriptionEditable=Mindful%20is%20a%20mental%20wellness%20app%20designed%20to%20support%20users%20in%20managing%20stress%20and%20anxiety&font=Source%20Code%20Pro&language=1&name=1&owner=1&pattern=Diagonal%20Stripes&stargazers=1&theme=Dark)
22

33
[![Build Status](https://github.com/travisjeffery/timecop/workflows/CI/badge.svg)](https://github.com/ARYPROGRAMMER/Mindful-App/actions)
4-
![version](https://img.shields.io/badge/version-2.0.8-red)
4+
![version](https://img.shields.io/badge/version-2.0.9-red)
55

66
<p align="center">
77
<img src="https://img.shields.io/badge/firebase-ffca28?style=for-the-badge&logo=firebase&logoColor=black"/>
@@ -12,13 +12,14 @@
1212

1313
**APP STATUS** : ALL CORE FUNCTIONALITIES WORKING (Deployed NodeJs & Postgresql on Render)
1414

15-
## What's New in v2.0.8
15+
## What's New in v2.0.9
1616

17+
- **Structure of Redis added to Clean Architecture
1718
- **Added Redis-base to support syncfusion**
18-
- **Fixed Performance and Responsiveness Issues and Improved UI.
19-
- **New Feature**: Implemented Syncfusion.
19+
- **Fixed Performance and Responsiveness Issues by Improvised BLoC Structure.
20+
- **New Feature**: Implemented Syncfusion and Redis for low latency.
2021
21-
### Known Issues are Resolved.
22+
### Known Issues are Resolved - Looking for vulnerabilities before Redis Full-Integration.
2223

2324
[DEMO LINK OF WORKING](https://vimeo.com/1016496824?share=copy)
2425

android/app/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ android {
4545
}
4646

4747
signingConfigs{
48+
debug{
49+
storeFile file(keystoreProperties['storeFile'])
50+
storePassword keystoreProperties['storePassword']
51+
keyAlias keystoreProperties['keyAlias']
52+
keyPassword keystoreProperties['keyPassword']
53+
}
4854
release{
4955
storeFile file(keystoreProperties['storeFile'])
5056
storePassword keystoreProperties['storePassword']
@@ -60,6 +66,7 @@ android {
6066
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
6167
// TODO: Add your own signing config for the release build.
6268
// Signing with the debug keys for now, so flutter run --release works.
69+
signingConfig signingConfigs.debug
6370
signingConfig signingConfigs.release
6471
}
6572
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import 'dart:convert';
2+
3+
import 'package:mental_health/features/meditation/domain/entities/mood_data.dart';
4+
5+
class MoodDataModel extends MoodData {
6+
MoodDataModel({
7+
required String happy,
8+
required String neutral,
9+
required String sad,
10+
required String calm,
11+
required String relax,
12+
required String focus,
13+
}) : super(
14+
happy: happy,
15+
neutral: neutral,
16+
sad: sad,
17+
calm: calm,
18+
relax: relax,
19+
focus: focus
20+
);
21+
22+
factory MoodDataModel.fromJson(json) {
23+
final data = jsonDecode(json);
24+
return MoodDataModel(
25+
happy: data['happy'],
26+
sad: data['sad'],
27+
neutral: data['neutral'],
28+
calm: data['calm'],
29+
relax: data['relax'],
30+
focus: data['focus'],
31+
);
32+
}
33+
}

lib/features/meditation/data/repositories/meditaion_repo_impl.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:mental_health/features/meditation/data/sources/meditation_remote_source.dart';
22
import 'package:mental_health/features/meditation/domain/entities/dailyQuotes.dart';
33
import 'package:mental_health/features/meditation/domain/entities/mood_msg.dart';
4+
import 'package:mental_health/features/meditation/domain/entities/mood_data.dart';
45
import 'package:mental_health/features/meditation/domain/repositories/meditation_repo.dart';
56

67
class MeditationRepoImpl implements MeditationRepository {
@@ -17,4 +18,8 @@ class MeditationRepoImpl implements MeditationRepository {
1718
Future<MoodMessage> getMoodMessage(String mood) async {
1819
return await remoteDataSource.getMoodMessage(mood);
1920
}
21+
@override
22+
Future<MoodData> getmoodData(String username) async {
23+
return await remoteDataSource.getmoodData(username);
24+
}
2025
}
Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import 'dart:convert';
2-
32
import 'package:http/http.dart' as http;
43
import 'package:mental_health/features/meditation/data/model/daily_quote_model.dart';
54
import 'package:mental_health/features/meditation/data/model/mood_msg_model.dart';
5+
import 'package:mental_health/features/meditation/data/model/mood_data_model.dart';
66

77
abstract class MeditaionRemoteDataSource {
88
Future<DailyQuoteModel> getDailyQuote();
99
Future<MoodMessageModel> getMoodMessage(String mood);
10+
Future<MoodDataModel> getmoodData(String username);
1011
}
1112

1213
class MeditationRemoteDataSourceImpl implements MeditaionRemoteDataSource {
@@ -16,18 +17,11 @@ class MeditationRemoteDataSourceImpl implements MeditaionRemoteDataSource {
1617
@override
1718
Future<DailyQuoteModel> getDailyQuote() async {
1819
final response = await client
19-
// .get(Uri.parse('http://10.0.3.218:6000/meditation/dailyQuotes'));
2020
.get(Uri.parse(
2121
'https://mindful-app-47s6.onrender.com/meditation/dailyQuotes'));
22-
// await client.get(Uri.parse('http://192.168.29.6:6000/songs/all')); for android real device
23-
// await client.get(Uri.parse('http;//10.0.2.2:6000/songs/all')); for avd
22+
2423
if (response.statusCode == 200) {
2524
final jsonResponse = json.decode(response.body);
26-
// List finalRes = [];
27-
//
28-
// for (int i = 0; i < jsonResponse.length; i++) {
29-
// finalRes.add(jsonResponse[i]['id']);
30-
// }
3125

3226
return DailyQuoteModel.fromJson(jsonResponse);
3327
} else {
@@ -38,22 +32,31 @@ class MeditationRemoteDataSourceImpl implements MeditaionRemoteDataSource {
3832
@override
3933
Future<MoodMessageModel> getMoodMessage(String mood) async {
4034
final response = await client
41-
// .get(Uri.parse('http://10.0.3.218:6000/meditation/myMood/$mood'));
4235
.get(Uri.parse(
4336
'https://mindful-app-47s6.onrender.com/meditation/myMood/$mood'));
44-
// await client.get(Uri.parse('http://192.168.29.6:6000/songs/all')); for android real device
45-
// await client.get(Uri.parse('http;//10.0.2.2:6000/songs/all')); for avd
4637
if (response.statusCode == 200) {
4738
final jsonResponse = json.decode(response.body);
48-
// List finalRes = [];
49-
//
50-
// for (int i = 0; i < jsonResponse.length; i++) {
51-
// finalRes.add(jsonResponse[i]['id']);
52-
// }
5339

5440
return MoodMessageModel.fromJson(jsonResponse);
5541
} else {
5642
throw Exception('Failed to load mood quotes');
5743
}
5844
}
45+
46+
@override
47+
Future<MoodDataModel> getmoodData(String username)async{
48+
final response = await client.get(Uri.parse(
49+
'http://192.168.29.6:6000/user/$username'
50+
));
51+
52+
if (response.statusCode==200){
53+
final jsonResponse = json.decode(response.body);
54+
return MoodDataModel.fromJson(jsonResponse);
55+
56+
}
57+
else {
58+
throw Exception("Failed to get data");
59+
60+
}
61+
}
5962
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class MoodData {
2+
final String happy;
3+
final String neutral;
4+
final String sad;
5+
final String calm;
6+
final String relax;
7+
final String focus;
8+
9+
MoodData({required this.happy, required this.neutral, required this.sad, required this.calm, required this.relax, required this.focus});
10+
11+
12+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import 'package:mental_health/features/meditation/domain/entities/dailyQuotes.dart';
2+
import 'package:mental_health/features/meditation/domain/entities/mood_data.dart';
23
import 'package:mental_health/features/meditation/domain/entities/mood_msg.dart';
34

45
abstract class MeditationRepository {
56
Future<DailyQuote> getDailyQuote();
67
Future<MoodMessage> getMoodMessage(String mood);
8+
Future<MoodData> getmoodData(String username);
79
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import 'package:mental_health/features/meditation/domain/entities/mood_data.dart';
2+
import 'package:mental_health/features/meditation/domain/repositories/meditation_repo.dart';
3+
4+
class GetMoodData {
5+
final MeditationRepository repository;
6+
7+
GetMoodData({required this.repository});
8+
9+
Future<MoodData> call(String username) async {
10+
return await repository.getmoodData(username);
11+
}
12+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import 'package:flutter_bloc/flutter_bloc.dart';
2+
import 'package:mental_health/features/meditation/domain/usecase/get_mood_data.dart';
3+
import 'package:mental_health/features/meditation/presentation/bloc/mood_data/mood_data_event.dart';
4+
import 'package:mental_health/features/meditation/presentation/bloc/mood_data/mood_data_state.dart';
5+
6+
class MoodDataBloc extends Bloc<MoodDataEvent, MoodDataState> {
7+
final GetMoodData getmoodData;
8+
9+
MoodDataBloc({required this.getmoodData})
10+
: super(MoodDataInitial()) {
11+
on<FetchMoodData>((event, emit) async {
12+
emit(MoodDataLoading());
13+
try {
14+
final moodDatainfo = await getmoodData(event.username);
15+
emit(MoodDataLoaded(moodDatainfo: moodDatainfo));
16+
} catch (e) {
17+
emit(MoodDataError(message: e.toString()));
18+
}
19+
});
20+
21+
}
22+
}

0 commit comments

Comments
 (0)