Skip to content

Commit

Permalink
Hotfix: fixed server permissions not initializing on first start and …
Browse files Browse the repository at this point in the history
…app crash due to theming errors
  • Loading branch information
lukehasawii committed Apr 12, 2023
1 parent fa9655c commit f453d03
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
*
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!

}
Expand Down
12 changes: 7 additions & 5 deletions app/src/main/java/com/txtnet/txtnetbrowser/server/SmsSocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand All @@ -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);
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/res/layout/activity_server_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
>

<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
Expand All @@ -27,7 +25,8 @@
app:title="Select a phone number"
app:expandedTitleTextAppearance="@style/TextAppearance.Material3.ActionBar.Title"
app:collapsedTitleTextAppearance="@style/TextAppearance.Material3.ActionBar.Title"
>
><!-- style="@style/Widget.MaterialComponents.Toolbar.Primary" -->


<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,5 @@
Once both commands have been run, click the button below to continue.
</string>
<string name="shizuku_incompatible_continue">Restart App</string>
<string name="request_sms_outgoing_exceeded_error">Error: Request Exceeded Max SMS Limit</string>
</resources>
16 changes: 15 additions & 1 deletion app/src/main/res/values/style.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme.NoActionBar" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowFullscreen">false</item>
Expand All @@ -14,4 +14,18 @@
<!-- Customize your theme here. -->
</style>

<style name="AppTheme.NoActionBarWhiteText" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowFullscreen">false</item>
<item name="android:textColorHint">@color/secondary_hint</item>
<item name="android:textColor">@color/white</item>
<item name="android:titleTextStyle">@style/Theme.MyAppTheme.ActionBar.TitleTextStyle</item>
<item name="colorOnSurface">@color/white</item>
</style>

<style name="Theme.MyAppTheme.ActionBar.TitleTextStyle" parent="@style/TextAppearance.MaterialComponents.Headline1">
<item name="android:textColor">#FFFFFF</item>
</style>

</resources>
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
//}

0 comments on commit f453d03

Please sign in to comment.