Skip to content

Commit

Permalink
Update V1.30
Browse files Browse the repository at this point in the history
  • Loading branch information
woheller69 committed Nov 11, 2023
1 parent 43a0702 commit 55b3aa2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "org.woheller69.gptassist"
minSdk 21
targetSdk 33
versionCode 120
versionName "1.20"
versionCode 130
versionName "1.30"
}

buildTypes {
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/java/org/woheller69/gptassist/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ protected void onResume() {
if (restricted) {
restrictedButton.setImageDrawable(getDrawable(R.drawable.restricted));
Toast.makeText(context,R.string.urls_restricted,Toast.LENGTH_SHORT).show();
chatWebSettings.setUserAgentString(WebSettings.getDefaultUserAgent(this));
}
else {
restrictedButton.setImageDrawable(getDrawable(R.drawable.unrestricted));
Toast.makeText(context,R.string.all_urls,Toast.LENGTH_SHORT).show();
chatWebSettings.setUserAgentString(modUserAgent());
}
chatWebView.reload();
});
Expand Down Expand Up @@ -341,4 +343,19 @@ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMen
}
}
}

public String modUserAgent(){

String newPrefix = "Mozilla/5.0 (X11; Linux "+ System.getProperty("os.arch") +")";

String newUserAgent=WebSettings.getDefaultUserAgent(context);
String prefix = newUserAgent.substring(0, newUserAgent.indexOf(")") + 1);
try {
newUserAgent=newUserAgent.replace(prefix,newPrefix);
} catch (Exception e) {
e.printStackTrace();
}
return newUserAgent;
}

}
3 changes: 3 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/130.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Add hidable option to switch on/off restricted mode
(default:on swipe down/up on screen to show/hide)
Show built-in avatar in restricted mode

0 comments on commit 55b3aa2

Please sign in to comment.