Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"cmake.sourceDirectory": "E:/ultimate_alarm_clock/linux"
"cmake.sourceDirectory": "E:/ultimate_alarm_clock/linux",
"dart.flutterSdkPath": ".fvm/versions/stable"
}
38 changes: 14 additions & 24 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,11 +13,6 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '4'
Expand All @@ -21,42 +23,33 @@ if (flutterVersionName == null) {
flutterVersionName = '0.2.1'
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
compileSdkVersion 34
namespace "com.ccextractor.ultimate_alarm_clock"
compileSdkVersion 36
ndkVersion flutter.ndkVersion

defaultConfig {
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.

applicationId "com.ccextractor.ultimate_alarm_clock"
minSdkVersion 24
targetSdkVersion 34 // Updated to latest targetSdkVersion
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}



compileOptions {
sourceCompatibility JavaVersion.VERSION_17 // Updated to Java 17
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '17' // Updated to Java 17
jvmTarget = '17'
}

sourceSets {
Expand Down Expand Up @@ -93,12 +86,9 @@ flutter {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.7.10"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10"
implementation platform('com.google.firebase:firebase-bom:32.0.0') // Updated Firebase BOM to latest
implementation platform('com.google.firebase:firebase-bom:32.0.0')
implementation 'com.google.firebase:protolite-well-known-types:18.0.0'
implementation("com.android.volley:volley:1.2.1")
implementation("com.google.code.gson:gson:2.10.1")
implementation("androidx.multidex:multidex:2.0.1")
}
}
26 changes: 9 additions & 17 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,41 @@
{
"project_info": {
"project_number": "127901953489",
"project_id": "uac2-7d0f9",
"storage_bucket": "uac2-7d0f9.appspot.com"
"project_number": "328022847331",
"project_id": "ultimatealarmclock-347b3",
"storage_bucket": "ultimatealarmclock-347b3.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:127901953489:android:1c0dea09b93c2b573fc4f0",
"mobilesdk_app_id": "1:328022847331:android:f6e78e62da91ec02e1ad56",
"android_client_info": {
"package_name": "com.ccextractor.ultimate_alarm_clock"
}
},
"oauth_client": [
{
"client_id": "127901953489-132kstrs7vl5j5jnubjktu0qodgcn9ml.apps.googleusercontent.com",
"client_id": "328022847331-rs7m47c1tbvnnqfm5hujiulcrkodcjhi.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.ccextractor.ultimate_alarm_clock",
"certificate_hash": "30bf4033c248d9a3ecccbe3615c8baec5f4ed31a"
"certificate_hash": "c52855838a9c765ae85423232a4e6814b711b676"
}
},
{
"client_id": "127901953489-hgjdtpa0jo2gdrh5vl3s0km66g81v66o.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.ccextractor.ultimate_alarm_clock",
"certificate_hash": "5463a1d268da62e33b869a41760d31cd5ffc1e5d"
}
},
{
"client_id": "127901953489-lnsmj324f5eutudkjvaidotj99bq1l47.apps.googleusercontent.com",
"client_id": "328022847331-47c00hrduomdh7iukssa0ddf43r2k6h6.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCEaWUdYF_PnGFu0uJL8Zl_BlT8knDVeHg"
"current_key": "AIzaSyAF6lUiZIrBYS7knK5gH5cqHpj_cHuv_Jw"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "127901953489-lnsmj324f5eutudkjvaidotj99bq1l47.apps.googleusercontent.com",
"client_id": "328022847331-47c00hrduomdh7iukssa0ddf43r2k6h6.apps.googleusercontent.com",
"client_type": 3
}
]
Expand Down
30 changes: 13 additions & 17 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
buildscript {
ext.kotlin_version = '1.7.10'
ext {
compileSdkVersion = 34
targetSdkVersion = 34
appCompatVersion = "1.6.1"
}
allprojects {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.15'
}
}

allprojects {
repositories {
google()
mavenCentral()
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}

rootProject.buildDir = '../build'

subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}

subprojects {
project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
delete rootProject.buildDir
}
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
32 changes: 24 additions & 8 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.7.2" apply false
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
id "com.google.gms.google-services" version "4.3.15" apply false
}


include ":app"
18 changes: 16 additions & 2 deletions lib/app/data/providers/firestore_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,25 @@ class FirestoreDb {
}
}

static Future<void> addUser(UserModel userModel) async {
static Future<void> addUser(UserModel userModel) async {
try {
// Use email as document ID instead of Google ID
final DocumentReference docRef = _usersCollection.doc(userModel.email);
final user = await docRef.get();
if (!user.exists) await docRef.set(userModel.toJson());

if (!user.exists) {
await docRef.set(userModel.toJson());
print('User added to Firestore: ${userModel.email}');
} else {
// Update existing user data
await docRef.update(userModel.toJson());
print('User updated in Firestore: ${userModel.email}');
}
} catch (e) {
print('Error adding user to Firestore: $e');
rethrow; // Important: let the caller handle the error
}
}

static addAlarm(UserModel? user, AlarmModel alarmRecord) async {
final sql = await FirestoreDb().getSQLiteDatabase();
Expand Down
Loading