diff --git a/.gitignore b/.gitignore index 9cf01b5..1f03032 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ .vercel .DS_Store *-monitor +android/key.properties +.idea/ +*.keystore +android/app/google-services.json diff --git a/android/app/build.gradle b/android/app/build.gradle index efcc512..2326541 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -4,11 +4,26 @@ plugins { id 'com.google.firebase.crashlytics' } +def keyPropertiesFile = rootProject.file("key.properties") +def keyProperties = new Properties() +if (keyPropertiesFile.exists()) { + keyProperties.load(new FileInputStream(keyPropertiesFile)) +} + android { compileSdk 32 + signingConfigs { + release { + storeFile keyProperties.containsKey('storeFile') ? file(keyProperties['storeFile']) : null + storePassword keyProperties['storePassword'] + keyAlias keyProperties['keyAlias'] + keyPassword keyProperties['keyPassword'] + } + } + defaultConfig { - applicationId "com.vernu.sms" + applicationId "com.vernu.textbee" minSdk 24 targetSdk 32 versionCode 15 @@ -25,6 +40,7 @@ android { buildTypes { release { + signingConfig signingConfigs.release minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } diff --git a/android/app/google-services.json b/android/app/google-services.json deleted file mode 100644 index 1f97404..0000000 --- a/android/app/google-services.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "project_info": { - "project_number": "14326313838", - "project_id": "vernu-sms", - "storage_bucket": "vernu-sms.appspot.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:14326313838:android:4ea4380d88b057e9eb877f", - "android_client_info": { - "package_name": "com.vernu.sms" - } - }, - "oauth_client": [ - { - "client_id": "14326313838-0kmpefogqk8h5ntf2mth4e9cht9pbfai.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyDNZP2HeVPZ6_V9oq2UTYWmJ4FfenrRBIQ" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "14326313838-0kmpefogqk8h5ntf2mth4e9cht9pbfai.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - } - ], - "configuration_version": "1" -} \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 2f0e761..8801589 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -11,10 +11,13 @@ - + + + + + + + + + + + android:exported="true" + android:permission="android.permission.BROADCAST_SMS"> - + + + + + + + @@ -79,7 +101,13 @@ + + + + + + { -// AppDatabase appDatabase = AppDatabase.getInstance(context); -// appDatabase.localReceivedSMSDao().insertAll(localReceivedSMS); -// }); -// } + Log.d(TAG, "Assembled SMS DTO: " + receivedSMSDTO.toString()); + + ContentValues values = new ContentValues(); + values.put(Telephony.Sms.ADDRESS, receivedSMSDTO.getSender()); + values.put(Telephony.Sms.BODY, receivedSMSDTO.getMessage()); + values.put(Telephony.Sms.DATE, receivedSMSDTO.getReceivedAtInMillis()); + + Log.d(TAG, "Inserting SMS into Inbox..."); + context.getContentResolver().insert(Telephony.Sms.Inbox.CONTENT_URI, values); + Log.d(TAG, "SMS inserted into Inbox."); + + Log.d(TAG, "Enqueuing SMSReceivedWorker..."); + SMSReceivedWorker.enqueueWork(context, deviceId, apiKey, receivedSMSDTO); + Log.d(TAG, "SMSReceivedWorker enqueued."); + + } catch (Exception e) { + Log.e(TAG, "An error occurred in SMSBroadcastReceiver", e); + } finally { + Log.d(TAG, "********** SMSBroadcastReceiver END **********"); + } + } } \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 141ea29..2004ce7 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,8 +1,16 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + ext.kotlin_version = '1.6.0' + dependencies { + classpath 'com.google.gms:google-services:4.3.10' + } +} + + plugins { id 'com.android.application' version '7.1.2' apply false id 'com.android.library' version '7.1.2' apply false - id 'com.google.gms.google-services' version '4.3.10' apply true + id 'com.google.gms.google-services' version '4.3.10' apply false id 'com.google.firebase.crashlytics' version '2.9.9' apply false }