Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkisDev committed Jan 25, 2024
2 parents c4e904f + 420c933 commit 733dc86
Show file tree
Hide file tree
Showing 20 changed files with 2,064 additions and 1,207 deletions.
3 changes: 1 addition & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion rootProject.ext.compileSdkVersion
ndkVersion flutter.ndkVersion
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
20 changes: 18 additions & 2 deletions lib/app/data/models/alarm_model.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:convert';

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:cloud_firestore/cloud_firestore.dart' as firestore;

import 'package:isar/isar.dart';
import 'package:ultimate_alarm_clock/app/data/models/user_model.dart';
Expand Down Expand Up @@ -43,11 +43,15 @@ class AlarmModel {
late String label;
late bool isOneTime;
late int snoozeDuration;
late int gradient;
late String ringtoneName;
late String note;
late bool deleteAfterGoesOff;
late bool showMotivationalQuote;
late bool isTimer;
late double volMax;
late double volMin;

@ignore
Map? offsetDetails;

Expand Down Expand Up @@ -84,15 +88,18 @@ class AlarmModel {
required this.label,
required this.isOneTime,
required this.snoozeDuration,
required this.gradient,
required this.ringtoneName,
required this.note,
required this.deleteAfterGoesOff,
required this.showMotivationalQuote,
required this.isTimer,
required this.volMax,
required this.volMin,
});

AlarmModel.fromDocumentSnapshot({
required DocumentSnapshot documentSnapshot,
required firestore.DocumentSnapshot documentSnapshot,
required UserModel? user,
}) {
// Making sure the alarms work with the offsets
Expand All @@ -114,6 +121,7 @@ class AlarmModel {
minutesSinceMidnight = documentSnapshot['minutesSinceMidnight'];
}
snoozeDuration = documentSnapshot['snoozeDuration'];
gradient = documentSnapshot['gradient'];
label = documentSnapshot['label'];
isOneTime = documentSnapshot['isOneTime'];
firestoreId = documentSnapshot.id;
Expand Down Expand Up @@ -147,11 +155,14 @@ class AlarmModel {
deleteAfterGoesOff = documentSnapshot['deleteAfterGoesOff'];
showMotivationalQuote = documentSnapshot['showMotivationalQuote'];
isTimer = documentSnapshot['isTimer'];
volMax = documentSnapshot['volMax'];
volMin = documentSnapshot['volMin'];
}

AlarmModel.fromMap(Map<String, dynamic> alarmData) {
// Making sure the alarms work with the offsets
snoozeDuration = alarmData['snoozeDuration'];
gradient = alarmData['gradient'];
isSharedAlarmEnabled = alarmData['isSharedAlarmEnabled'];
minutesSinceMidnight = alarmData['minutesSinceMidnight'];
alarmTime = alarmData['alarmTime'];
Expand Down Expand Up @@ -190,6 +201,8 @@ class AlarmModel {
deleteAfterGoesOff = alarmData['deleteAfterGoesOff'];
showMotivationalQuote = alarmData['showMotivationalQuote'];
isTimer = alarmData['isTimer'];
volMin = alarmData['volMin'];
volMax = alarmData['volMax'];
}

AlarmModel.fromJson(String alarmData, UserModel? user) {
Expand Down Expand Up @@ -233,11 +246,14 @@ class AlarmModel {
'isPedometerEnabled': alarmRecord.isPedometerEnabled,
'numberOfSteps': alarmRecord.numberOfSteps,
'snoozeDuration': alarmRecord.snoozeDuration,
'gradient': alarmRecord.gradient,
'ringtoneName': alarmRecord.ringtoneName,
'note': alarmRecord.note,
'deleteAfterGoesOff': alarmRecord.deleteAfterGoesOff,
'showMotivationalQuote': alarmRecord.showMotivationalQuote,
'isTimer': alarmRecord.isTimer,
'volMin': alarmRecord.volMin,
'volMax': alarmRecord.volMax,
};

if (alarmRecord.isSharedAlarmEnabled) {
Expand Down
Loading

0 comments on commit 733dc86

Please sign in to comment.