Skip to content

Commit dd25af3

Browse files
committed
Fix Android Build and Update Dependencies
1 parent 4dd8506 commit dd25af3

File tree

25 files changed

+2277
-253
lines changed

25 files changed

+2277
-253
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*.swp
66
.DS_Store
77
.atom/
8+
.build/
89
.buildlog/
910
.history
1011
.svn/
12+
.swiftpm/
1113
migrate_working_dir/
1214

1315
# IntelliJ related

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"cmake.sourceDirectory": "E:/ultimate_alarm_clock/linux"
2+
"cmake.sourceDirectory": "E:/ultimate_alarm_clock/linux",
3+
"dart.flutterSdkPath": ".fvm/versions/stable"
34
}

android/app/build.gradle

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
id "com.google.gms.google-services"
6+
}
7+
18
def localProperties = new Properties()
29
def localPropertiesFile = rootProject.file('local.properties')
310
if (localPropertiesFile.exists()) {
@@ -6,11 +13,6 @@ if (localPropertiesFile.exists()) {
613
}
714
}
815

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
1416
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1517
if (flutterVersionCode == null) {
1618
flutterVersionCode = '4'
@@ -21,42 +23,33 @@ if (flutterVersionName == null) {
2123
flutterVersionName = '0.2.1'
2224
}
2325

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'com.google.gms.google-services'
26-
apply plugin: 'kotlin-android'
27-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
28-
2926
def keystoreProperties = new Properties()
3027
def keystorePropertiesFile = rootProject.file('key.properties')
3128
if (keystorePropertiesFile.exists()) {
3229
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
3330
}
3431

3532
android {
36-
compileSdkVersion 34
33+
namespace "com.ccextractor.ultimate_alarm_clock"
34+
compileSdkVersion 36
3735
ndkVersion flutter.ndkVersion
3836

3937
defaultConfig {
40-
// You can update the following values to match your application needs.
41-
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
42-
4338
applicationId "com.ccextractor.ultimate_alarm_clock"
4439
minSdkVersion 24
45-
targetSdkVersion 34 // Updated to latest targetSdkVersion
40+
targetSdkVersion 34
4641
versionCode flutterVersionCode.toInteger()
4742
versionName flutterVersionName
4843
multiDexEnabled true
4944
}
5045

51-
52-
5346
compileOptions {
54-
sourceCompatibility JavaVersion.VERSION_17 // Updated to Java 17
47+
sourceCompatibility JavaVersion.VERSION_17
5548
targetCompatibility JavaVersion.VERSION_17
5649
}
5750

5851
kotlinOptions {
59-
jvmTarget = '17' // Updated to Java 17
52+
jvmTarget = '17'
6053
}
6154

6255
sourceSets {
@@ -93,12 +86,9 @@ flutter {
9386
}
9487

9588
dependencies {
96-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
97-
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.7.10"
98-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10"
99-
implementation platform('com.google.firebase:firebase-bom:32.0.0') // Updated Firebase BOM to latest
89+
implementation platform('com.google.firebase:firebase-bom:32.0.0')
10090
implementation 'com.google.firebase:protolite-well-known-types:18.0.0'
10191
implementation("com.android.volley:volley:1.2.1")
10292
implementation("com.google.code.gson:gson:2.10.1")
10393
implementation("androidx.multidex:multidex:2.0.1")
104-
}
94+
}

android/app/google-services.json

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,41 @@
11
{
22
"project_info": {
3-
"project_number": "127901953489",
4-
"project_id": "uac2-7d0f9",
5-
"storage_bucket": "uac2-7d0f9.appspot.com"
3+
"project_number": "328022847331",
4+
"project_id": "ultimatealarmclock-347b3",
5+
"storage_bucket": "ultimatealarmclock-347b3.firebasestorage.app"
66
},
77
"client": [
88
{
99
"client_info": {
10-
"mobilesdk_app_id": "1:127901953489:android:1c0dea09b93c2b573fc4f0",
10+
"mobilesdk_app_id": "1:328022847331:android:f6e78e62da91ec02e1ad56",
1111
"android_client_info": {
1212
"package_name": "com.ccextractor.ultimate_alarm_clock"
1313
}
1414
},
1515
"oauth_client": [
1616
{
17-
"client_id": "127901953489-132kstrs7vl5j5jnubjktu0qodgcn9ml.apps.googleusercontent.com",
17+
"client_id": "328022847331-rs7m47c1tbvnnqfm5hujiulcrkodcjhi.apps.googleusercontent.com",
1818
"client_type": 1,
1919
"android_info": {
2020
"package_name": "com.ccextractor.ultimate_alarm_clock",
21-
"certificate_hash": "30bf4033c248d9a3ecccbe3615c8baec5f4ed31a"
21+
"certificate_hash": "c52855838a9c765ae85423232a4e6814b711b676"
2222
}
2323
},
2424
{
25-
"client_id": "127901953489-hgjdtpa0jo2gdrh5vl3s0km66g81v66o.apps.googleusercontent.com",
26-
"client_type": 1,
27-
"android_info": {
28-
"package_name": "com.ccextractor.ultimate_alarm_clock",
29-
"certificate_hash": "5463a1d268da62e33b869a41760d31cd5ffc1e5d"
30-
}
31-
},
32-
{
33-
"client_id": "127901953489-lnsmj324f5eutudkjvaidotj99bq1l47.apps.googleusercontent.com",
25+
"client_id": "328022847331-47c00hrduomdh7iukssa0ddf43r2k6h6.apps.googleusercontent.com",
3426
"client_type": 3
3527
}
3628
],
3729
"api_key": [
3830
{
39-
"current_key": "AIzaSyCEaWUdYF_PnGFu0uJL8Zl_BlT8knDVeHg"
31+
"current_key": "AIzaSyAF6lUiZIrBYS7knK5gH5cqHpj_cHuv_Jw"
4032
}
4133
],
4234
"services": {
4335
"appinvite_service": {
4436
"other_platform_oauth_client": [
4537
{
46-
"client_id": "127901953489-lnsmj324f5eutudkjvaidotj99bq1l47.apps.googleusercontent.com",
38+
"client_id": "328022847331-47c00hrduomdh7iukssa0ddf43r2k6h6.apps.googleusercontent.com",
4739
"client_type": 3
4840
}
4941
]

android/build.gradle

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
1-
buildscript {
2-
ext.kotlin_version = '1.7.10'
3-
ext {
4-
compileSdkVersion = 34
5-
targetSdkVersion = 34
6-
appCompatVersion = "1.6.1"
7-
}
1+
allprojects {
82
repositories {
93
google()
104
mavenCentral()
115
}
12-
dependencies {
13-
classpath 'com.android.tools.build:gradle:7.3.0'
14-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15-
classpath 'com.google.gms:google-services:4.3.15'
16-
}
176
}
187

19-
allprojects {
20-
repositories {
21-
google()
22-
mavenCentral()
8+
subprojects {
9+
afterEvaluate { project ->
10+
if (project.hasProperty('android')) {
11+
project.android {
12+
if (namespace == null) {
13+
namespace project.group
14+
}
15+
}
16+
}
2317
}
2418
}
2519

2620
rootProject.buildDir = '../build'
21+
2722
subprojects {
2823
project.buildDir = "${rootProject.buildDir}/${project.name}"
2924
}
25+
3026
subprojects {
3127
project.evaluationDependsOn(':app')
3228
}
3329

3430
tasks.register("clean", Delete) {
3531
delete rootProject.buildDir
36-
}
32+
}

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

android/settings.gradle

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
511

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
818

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "8.7.2" apply false
22+
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
23+
id "com.google.gms.google-services" version "4.3.15" apply false
24+
}
25+
26+
27+
include ":app"

lib/app/data/providers/firestore_provider.dart

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,25 @@ class FirestoreDb {
108108
}
109109
}
110110

111-
static Future<void> addUser(UserModel userModel) async {
112-
final DocumentReference docRef = _usersCollection.doc(userModel.email);
111+
static Future<void> addUser(UserModel userModel) async {
112+
try {
113+
// Use Google ID as document ID instead of email
114+
final DocumentReference docRef = _usersCollection.doc(userModel.id);
113115
final user = await docRef.get();
114-
if (!user.exists) await docRef.set(userModel.toJson());
116+
117+
if (!user.exists) {
118+
await docRef.set(userModel.toJson());
119+
print('User added to Firestore: ${userModel.email}');
120+
} else {
121+
// Update existing user data
122+
await docRef.update(userModel.toJson());
123+
print('User updated in Firestore: ${userModel.email}');
124+
}
125+
} catch (e) {
126+
print('Error adding user to Firestore: $e');
127+
rethrow; // Important: let the caller handle the error
115128
}
129+
}
116130

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

0 commit comments

Comments
 (0)