From f453d03c0c3a7a0f0e2027418fd8354c856a2e6a Mon Sep 17 00:00:00 2001 From: Luke Aschenbrenner Date: Tue, 11 Apr 2023 21:01:27 -0500 Subject: [PATCH] Hotfix: fixed server permissions not initializing on first start and app crash due to theming errors --- .../txtnet/txtnetbrowser/MainBrowserScreen.java | 3 ++- .../txtnetbrowser/server/ServerDisplay.java | 2 +- .../txtnet/txtnetbrowser/server/SmsSocket.java | 12 +++++++----- .../main/res/layout/activity_server_picker.xml | 7 +++---- app/src/main/res/values/strings.xml | 1 + app/src/main/res/values/style.xml | 16 +++++++++++++++- build.gradle | 10 +++++----- 7 files changed, 34 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/txtnet/txtnetbrowser/MainBrowserScreen.java b/app/src/main/java/com/txtnet/txtnetbrowser/MainBrowserScreen.java index 4756a57..9c2a328 100644 --- a/app/src/main/java/com/txtnet/txtnetbrowser/MainBrowserScreen.java +++ b/app/src/main/java/com/txtnet/txtnetbrowser/MainBrowserScreen.java @@ -78,7 +78,8 @@ public class MainBrowserScreen extends AppCompatActivity { * TODO: In phone number selector, make a FrameLayout with the textview, ping button, and checkmark icon (maybe the checkmark or x icon pushes the textview to the right?) * * TODO Before alpha launch: - * - Edit readme with new news sites + * - Add a CDMA network compatibility mode to remove all Greek symbols. How to communicate this? + * -- make a database of CDMA-only numbers and use an initial request text: "TxtNet vXXX charset basic"/"TxtNet vXXX charset full" * */ diff --git a/app/src/main/java/com/txtnet/txtnetbrowser/server/ServerDisplay.java b/app/src/main/java/com/txtnet/txtnetbrowser/server/ServerDisplay.java index a4f387c..ed82e6b 100644 --- a/app/src/main/java/com/txtnet/txtnetbrowser/server/ServerDisplay.java +++ b/app/src/main/java/com/txtnet/txtnetbrowser/server/ServerDisplay.java @@ -139,7 +139,7 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean b) { Shizuku.requestPermission(31); } }else{ - //grantPermissions(); + grantPermissions(); //we should only run this once, or whenever we detect that the values were not set! } diff --git a/app/src/main/java/com/txtnet/txtnetbrowser/server/SmsSocket.java b/app/src/main/java/com/txtnet/txtnetbrowser/server/SmsSocket.java index db7ae40..a45e84c 100644 --- a/app/src/main/java/com/txtnet/txtnetbrowser/server/SmsSocket.java +++ b/app/src/main/java/com/txtnet/txtnetbrowser/server/SmsSocket.java @@ -150,11 +150,6 @@ public void sendHTML(String html){ int howManyTextsToExpect = (smsQueue.size()); - if(howManyTextsToExpect > MAX_SMS_PER_REQUEST){ - Log.w(TAG, "Request made with SMS count > MAX_SMS_PER_REQUEST"); - return; - } - SmsManager sms = SmsManager.getDefault(); String outputNumber = ""; @@ -163,6 +158,13 @@ public void sendHTML(String html){ } outputNumber += phoneNumber.getNationalNumber(); + if(howManyTextsToExpect > MAX_SMS_PER_REQUEST){ + Log.w(TAG, "Request made with SMS count > MAX_SMS_PER_REQUEST"); + sms.sendTextMessage(outputNumber, null, service.getString(R.string.request_sms_outgoing_exceeded_error), null, null); + return; + } + + sms.sendTextMessage(outputNumber, null, howManyTextsToExpect + " Process starting", null, null); try { Thread.sleep(1000); diff --git a/app/src/main/res/layout/activity_server_picker.xml b/app/src/main/res/layout/activity_server_picker.xml index 4d91434..19a8493 100644 --- a/app/src/main/res/layout/activity_server_picker.xml +++ b/app/src/main/res/layout/activity_server_picker.xml @@ -12,12 +12,10 @@ android:layout_width="match_parent" android:layout_height="@dimen/app_bar_height" android:fitsSystemWindows="true" - android:theme="@style/Theme.TxtNetBrowser.AppBarOverlay" + android:theme="@style/AppTheme.NoActionBarWhiteText" > - + > + Restart App + Error: Request Exceeded Max SMS Limit \ No newline at end of file diff --git a/app/src/main/res/values/style.xml b/app/src/main/res/values/style.xml index e0111d7..9f59937 100644 --- a/app/src/main/res/values/style.xml +++ b/app/src/main/res/values/style.xml @@ -1,6 +1,6 @@ - + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index d870991..d192986 100644 --- a/build.gradle +++ b/build.gradle @@ -4,16 +4,16 @@ buildscript { google() mavenCentral() } - + ext.kotlin_version = '1.6.0' } plugins { id 'com.android.application' version '7.3.0' apply false id 'com.android.library' version '7.3.0' apply false - id 'org.jetbrains.kotlin.android' version '1.8.10' apply false + id 'org.jetbrains.kotlin.android' version '1.8.0' apply false } -task clean(type: Delete) { - delete rootProject.buildDir -} +//task clean(type: Delete) { +// delete rootProject.buildDir +//}