Skip to content

Commit d44ec11

Browse files
committed
beta-redis-deployed-syncfusion
1 parent 3fe381f commit d44ec11

File tree

6 files changed

+108
-66
lines changed

6 files changed

+108
-66
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,27 @@ jobs:
2121
with:
2222
channel: 'stable'
2323

24+
# Cache Flutter dependencies
25+
- name: Cache Flutter packages
26+
uses: actions/cache@v3
27+
with:
28+
path: |
29+
~/.pub-cache
30+
key: flutter-packages-${{ runner.os }}-${{ hashFiles('pubspec.yaml') }}
31+
restore-keys: |
32+
flutter-packages-${{ runner.os }}-
33+
34+
# Cache Gradle dependencies
35+
- name: Cache Gradle
36+
uses: actions/cache@v3
37+
with:
38+
path: |
39+
~/.gradle/caches
40+
~/.gradle/wrapper
41+
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
42+
restore-keys: |
43+
gradle-${{ runner.os }}-
44+
2445
- name: Setup Keystore
2546
run: |
2647
echo "${{ secrets.KEYSTORE }}" | base64 --decode >android/app/mykey.jks
@@ -39,15 +60,16 @@ jobs:
3960
uses: ncipollo/release-action@v1
4061
with:
4162
artifacts: "build/app/outputs/apk/release/*"
42-
tag: v2.0.9
63+
tag: v2.0.9.1
4364
token: ${{ secrets.TOKEN }}
44-
name: "beta-v2.0.9"
65+
name: "beta-v2.0.9.1"
4566
body: |
46-
## What's New in v2.0.9
67+
## What's New in v2.0.9.1
4768
69+
- **Redis Cloud Implementation and Fetching in Beta Phase**
4870
- **Structure of Redis added to Clean Architecture
4971
- **Added Redis-base to support syncfusion**
5072
- **Fixed Performance and Responsiveness Issues by Improvised BLoC Structure.
5173
- **New Feature**: Implemented Syncfusion and Redis for low latency.
52-
74+
5375
### Known Issues are Resolved - Looking for vulnerabilities before Redis Full-Integration.

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<a href="https://github.com/ARYPROGRAMMER/Mindful-App/actions">
55
<img src="https://github.com/travisjeffery/timecop/workflows/CI/badge.svg" alt="Build Status"/>
66
</a>
7-
<img src="https://img.shields.io/badge/version-2.0.9-red" alt="Version"/>
7+
<img src="https://img.shields.io/badge/version-2.0.9.1-green" alt="Version"/>
88
</p>
99

1010
<p align="center">
@@ -17,8 +17,9 @@
1717

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

20-
## What's New in v2.0.9
20+
## What's New in v2.0.9.1 (Beta Trial Phase for Redis)
2121

22+
- **Redis Cloud Implementation and Fetching in Beta Phase**
2223
- **Structure of Redis added to Clean Architecture
2324
- **Added Redis-base to support syncfusion**
2425
- **Fixed Performance and Responsiveness Issues by Improvised BLoC Structure.

lib/features/meditation/data/model/mood_data_model.dart

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ class MoodDataModel extends MoodData {
1919
focus: focus
2020
);
2121

22-
factory MoodDataModel.fromJson(json) {
23-
final data = jsonDecode(json);
22+
factory MoodDataModel.fromJson(Map<String, dynamic> json) {
2423
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'],
24+
happy: json['happy'].toString(),
25+
sad: json['sad'].toString(),
26+
neutral: json['neutral'].toString(),
27+
calm: json['calm'].toString(),
28+
relax: json['relax'].toString(),
29+
focus: json['focus'].toString()
3130
);
3231
}
3332
}

lib/features/meditation/data/sources/meditation_remote_source.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class MeditationRemoteDataSourceImpl implements MeditaionRemoteDataSource {
4646
@override
4747
Future<MoodDataModel> getmoodData(String username)async{
4848
final response = await client.get(Uri.parse(
49-
'http://192.168.29.6:6000/user/$username'
49+
'https://mindful-app-47s6.onrender.com/user/$username'
5050
));
5151

5252
if (response.statusCode==200){

lib/features/meditation/presentation/pages/meditation_page.dart

Lines changed: 62 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import 'package:mental_health/features/auth/domain/entities/auth/googleapisignin
99
import 'package:mental_health/features/meditation/presentation/bloc/dailyQuote/daily_quote_bloc.dart';
1010
import 'package:mental_health/features/meditation/presentation/bloc/dailyQuote/daily_quote_event.dart';
1111
import 'package:mental_health/features/meditation/presentation/bloc/dailyQuote/daily_quote_state.dart';
12+
import 'package:mental_health/features/meditation/presentation/bloc/mood_data/mood_data_bloc.dart';
13+
import 'package:mental_health/features/meditation/presentation/bloc/mood_data/mood_data_state.dart';
1214
import 'package:mental_health/features/meditation/presentation/bloc/mood_message/mood_message_bloc.dart';
1315
import 'package:mental_health/features/meditation/presentation/bloc/mood_message/mood_message_event.dart';
1416
import 'package:mental_health/features/meditation/presentation/bloc/mood_message/mood_message_state.dart';
@@ -42,54 +44,6 @@ class _MeditationPageState extends State<MeditationPage> {
4244
TooltipBehavior(enable: true, format: 'point.x : point.y%');
4345
__tooltipBehavior = _tooltipBehavior;
4446

45-
__chartData = <ChartSampleData>[
46-
ChartSampleData(
47-
x: 'Mon', y: 16, secondSeriesYValue: 8, thirdSeriesYValue: 13),
48-
ChartSampleData(
49-
x: 'Tue', y: 8, secondSeriesYValue: 10, thirdSeriesYValue: 7),
50-
ChartSampleData(
51-
x: 'Wed', y: 12, secondSeriesYValue: 10, thirdSeriesYValue: 5),
52-
ChartSampleData(
53-
x: 'Thurs', y: 4, secondSeriesYValue: 8, thirdSeriesYValue: 14),
54-
ChartSampleData(
55-
x: 'Fri', y: 8, secondSeriesYValue: 5, thirdSeriesYValue: 4),
56-
ChartSampleData(
57-
x: 'Sat', y: 3, secondSeriesYValue: 3, thirdSeriesYValue: 6),
58-
];
59-
60-
dataSources = <ChartSampleData>[
61-
ChartSampleData(
62-
x: 'Happy',
63-
y: 62.70,
64-
text: '10%',
65-
pointColor: const Color.fromRGBO(69, 186, 161, 1.0)),
66-
ChartSampleData(
67-
x: 'Neutral',
68-
y: 29.20,
69-
text: '10%',
70-
pointColor: const Color.fromRGBO(230, 135, 111, 1.0)),
71-
ChartSampleData(
72-
x: 'Sad',
73-
y: 85.20,
74-
text: '100%',
75-
pointColor: const Color.fromRGBO(145, 132, 202, 1.0)),
76-
ChartSampleData(
77-
x: 'Calm',
78-
y: 85.20,
79-
text: '100%',
80-
pointColor: const Color.fromRGBO(145, 132, 202, 1.0)),
81-
ChartSampleData(
82-
x: 'Relax',
83-
y: 85.20,
84-
text: '100%',
85-
pointColor: const Color.fromRGBO(145, 132, 202, 1.0)),
86-
ChartSampleData(
87-
x: 'Focus',
88-
y: 45.70,
89-
text: '100%',
90-
pointColor: const Color.fromRGBO(235, 96, 143, 1.0))
91-
];
92-
9347
_annotationSources = <CircularChartAnnotation>[
9448
CircularChartAnnotation(
9549
widget: ClipRRect(
@@ -800,7 +754,65 @@ class _MeditationPageState extends State<MeditationPage> {
800754
textAlign: TextAlign.center,
801755
),
802756
//graph
803-
_buildColumnChart()
757+
BlocBuilder<MoodDataBloc,MoodDataState>(builder: (context,state){
758+
if (state is MoodDataLoaded){
759+
__chartData = <ChartSampleData>[
760+
ChartSampleData(x: 'Mon', y: num.parse(state.moodDatainfo.happy), secondSeriesYValue: num.parse(state.moodDatainfo.neutral), thirdSeriesYValue: num.parse(state.moodDatainfo.calm)),
761+
ChartSampleData(x: 'Tue', y: num.parse(state.moodDatainfo.happy), secondSeriesYValue: num.parse(state.moodDatainfo.neutral), thirdSeriesYValue: num.parse(state.moodDatainfo.calm)),
762+
ChartSampleData(x: 'Wed', y: num.parse(state.moodDatainfo.happy), secondSeriesYValue: num.parse(state.moodDatainfo.neutral), thirdSeriesYValue: num.parse(state.moodDatainfo.calm)),
763+
ChartSampleData(x: 'Thurs', y: num.parse(state.moodDatainfo.happy), secondSeriesYValue: num.parse(state.moodDatainfo.neutral), thirdSeriesYValue: num.parse(state.moodDatainfo.calm)),
764+
ChartSampleData(x: 'Fri', y: num.parse(state.moodDatainfo.happy), secondSeriesYValue: num.parse(state.moodDatainfo.neutral), thirdSeriesYValue: num.parse(state.moodDatainfo.calm)),
765+
ChartSampleData(x: 'Sat', y: num.parse(state.moodDatainfo.happy), secondSeriesYValue: num.parse(state.moodDatainfo.neutral), thirdSeriesYValue: num.parse(state.moodDatainfo.calm)),
766+
ChartSampleData(x: 'Sun', y: num.parse(state.moodDatainfo.happy), secondSeriesYValue: num.parse(state.moodDatainfo.neutral), thirdSeriesYValue: num.parse(state.moodDatainfo.calm)),
767+
768+
];
769+
770+
num total = num.parse(state.moodDatainfo.happy)+num.parse(state.moodDatainfo.neutral)+num.parse(state.moodDatainfo.sad)+num.parse(state.moodDatainfo.calm)+num.parse(state.moodDatainfo.relax)+num.parse(state.moodDatainfo.focus);
771+
dataSources = <ChartSampleData>[
772+
ChartSampleData(
773+
x: 'Happy',
774+
y: num.parse(state.moodDatainfo.happy)/total,
775+
text: '10%',
776+
pointColor: const Color.fromRGBO(69, 186, 161, 1.0)),
777+
ChartSampleData(
778+
x: 'Neutral',
779+
y: num.parse(state.moodDatainfo.neutral)/total,
780+
text: '10%',
781+
pointColor: const Color.fromRGBO(230, 135, 111, 1.0)),
782+
ChartSampleData(
783+
x: 'Sad',
784+
y:num.parse(state.moodDatainfo.sad)/total,
785+
text: '100%',
786+
pointColor: const Color.fromRGBO(145, 132, 202, 1.0)),
787+
ChartSampleData(
788+
x: 'Calm',
789+
y: num.parse(state.moodDatainfo.calm)/total,
790+
text: '100%',
791+
pointColor: const Color.fromRGBO(145, 132, 202, 1.0)),
792+
ChartSampleData(
793+
x: 'Relax',
794+
y: num.parse(state.moodDatainfo.relax)/total,
795+
text: '100%',
796+
pointColor: const Color.fromRGBO(145, 132, 202, 1.0)),
797+
ChartSampleData(
798+
x: 'Focus',
799+
y: num.parse(state.moodDatainfo.focus)/total,
800+
text: '100%',
801+
pointColor: const Color.fromRGBO(235, 96, 143, 1.0))
802+
];
803+
return _buildColumnChart();
804+
}
805+
if (state is MoodDataLoading){
806+
return const Text("loading");
807+
}
808+
809+
if (state is MoodDataError){
810+
return Text(state.message);
811+
}
812+
return Container();
813+
814+
})
815+
804816
],
805817
),
806818
),
@@ -852,6 +864,7 @@ class _MeditationPageState extends State<MeditationPage> {
852864
return Container();
853865
},
854866
),
867+
855868
],
856869
),
857870
),

lib/main.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,27 @@ class _MyAppState extends State<MyApp> {
5656
@override
5757
Widget build(BuildContext context) {
5858
final mybox = Hive.box('lastlogin');
59+
final idval;
60+
bool google = mybox.get('google').toString() == 'true';
61+
if (google) {
62+
idval = "${GoogleSignInApi.details()?.email}-google";
63+
}else{
64+
idval = FirebaseAuth.instance.currentUser?.email.toString();
65+
}
5966
return MultiBlocProvider(
6067
providers: [
6168
BlocProvider(create: (_) => NavBloc()),
6269
BlocProvider(create: (context) => di.sl<SongBloc>()..add(FetchSongs())),
6370
BlocProvider(create: (context) => di.sl<DailyQuoteBloc>()..add(FetchDailyQuote())),
6471
BlocProvider(create: (context) => di.sl<MoodMessageBloc>()),
65-
BlocProvider(create: (context) => di.sl<MoodDataBloc>()..add(FetchMoodData("[email protected]"))),
72+
BlocProvider(create: (context) => di.sl<MoodDataBloc>()..add(FetchMoodData(idval))),
6673
],
6774
child: MaterialApp(
6875
debugShowCheckedModeBanner: false,
6976
title: 'Mental Health',
7077
theme: AppTheme.lightTheme,
7178
home: (FirebaseAuth.instance.currentUser == null)
72-
? mybox.get('google').toString() == 'true'
79+
? google
7380
? const inPage()
7481
: const Onboarding()
7582
: HomePage(),

0 commit comments

Comments
 (0)