Skip to content

Commit 78ed57d

Browse files
committed
use legacy screen for older webviewer versions and update to latest AIS-catcher
1 parent 4eece84 commit 78ed57d

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

app/src/main/java/com/jvdegithub/aiscatcher/MainActivity.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import android.content.Intent;
2727
import android.content.IntentFilter;
2828
import android.content.SharedPreferences;
29+
import android.content.pm.PackageInfo;
2930
import android.content.pm.PackageManager;
3031

3132
import android.content.res.Configuration;
@@ -54,6 +55,7 @@
5455
import androidx.fragment.app.Fragment;
5556
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
5657
import androidx.preference.PreferenceManager;
58+
import androidx.webkit.WebViewCompat;
5759

5860
import com.google.android.material.bottomnavigation.BottomNavigationView;
5961
import com.jvdegithub.aiscatcher.databinding.ActivityMainBinding;
@@ -113,7 +115,7 @@ protected void onCreate(Bundle savedInstanceState) {
113115
FrameLayout fragmentContainer = findViewById(R.id.fragment_container);
114116

115117
int currentApiVersion = android.os.Build.VERSION.SDK_INT;
116-
legacyVersion = currentApiVersion < android.os.Build.VERSION_CODES.N;
118+
legacyVersion = shouldUseLegacyMode();
117119

118120
Fragment fragment;
119121

@@ -441,4 +443,30 @@ public void onUpdate () {
441443
public void onSourceChange () {
442444
updateUIonSource();
443445
}
446+
447+
private boolean shouldUseLegacyMode() {
448+
// Original API level check
449+
int currentApiVersion = android.os.Build.VERSION.SDK_INT;
450+
if (currentApiVersion < android.os.Build.VERSION_CODES.N) {
451+
return true;
452+
}
453+
454+
// Check WebView version for ES2022+ support
455+
try {
456+
PackageInfo webViewPackage = WebViewCompat.getCurrentWebViewPackage(this);
457+
if (webViewPackage != null) {
458+
String version = webViewPackage.versionName;
459+
// Chrome 66 and below don't support ES2022
460+
// Extract major version number and check
461+
if (version != null && version.startsWith("66.")) {
462+
return true; // Force legacy for old WebView
463+
}
464+
}
465+
} catch (Exception e) {
466+
// If we can't determine WebView version, play it safe
467+
return true;
468+
}
469+
470+
return false;
471+
}
444472
}

app/src/main/jni/AIS-catcher

Submodule AIS-catcher updated 124 files

app/src/main/jni/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ add_library( # Sets the name of the library.
4545
./airspyhf/libairspyhf/src/airspyhf.c
4646
./airspyhf/libairspyhf/src/iqbalancer.c
4747

48-
./AIS-catcher/Application/Receiver.cpp ./AIS-catcher/Application/Config.cpp ./AIS-catcher/Ships/DB.cpp ./AIS-catcher/Ships/Ships.cpp ./AIS-catcher/DBMS/PostgreSQL.cpp
48+
./AIS-catcher/Application/Receiver.cpp ./AIS-catcher/Application/WebDB.cpp ./AIS-catcher/Application/Config.cpp ./AIS-catcher/Tracking/DB.cpp ./AIS-catcher/Tracking/Ships.cpp ./AIS-catcher/DBMS/PostgreSQL.cpp
4949
./AIS-catcher/Device/AIRSPYHF.cpp ./AIS-catcher/Device/FileWAV.cpp ./AIS-catcher/Device/RTLSDR.cpp ./AIS-catcher/Device/SDRPLAY.cpp ./AIS-catcher/DSP/Demod.cpp ./AIS-catcher/DSP/Model.cpp
5050
./AIS-catcher/Library/AIS.cpp ./AIS-catcher/Library/JSONAIS.cpp ./AIS-catcher/Library/Keys.cpp ./AIS-catcher/IO/HTTPClient.cpp
5151
./AIS-catcher/Device/FileRAW.cpp ./AIS-catcher/Device/HACKRF.cpp ./AIS-catcher/Device/UDP.cpp ./AIS-catcher/Device/RTLTCP.cpp
5252
./AIS-catcher/Device/ZMQ.cpp ./AIS-catcher/Device/SoapySDR.cpp ./AIS-catcher/Device/SpyServer.cpp ./AIS-catcher/Library/Message.cpp ./AIS-catcher/Library/NMEA.cpp
5353
./AIS-catcher/Library/Utilities.cpp ./AIS-catcher/Library/TCP.cpp ./AIS-catcher/JSON/JSON.cpp ./AIS-catcher/IO/Network.cpp ./AIS-catcher/IO/HTTPServer.cpp
54-
./AIS-catcher/JSON/StringBuilder.cpp ./AIS-catcher/JSON/Parser.cpp ./AIS-catcher/Device/AIRSPY.cpp ./AIS-catcher/Device/Serial.cpp
54+
./AIS-catcher/JSON/StringBuilder.cpp ./AIS-catcher/JSON/Parser.cpp ./AIS-catcher/Device/AIRSPY.cpp ./AIS-catcher/Device/Serial.cpp ./AIS-catcher/Library/ADSB.cpp
5555
./AIS-catcher/DSP/DSP.cpp ./AIS-catcher/Application/WebViewer.cpp ./AIS-catcher/Application/Prometheus.cpp ./AIS-catcher/Protocol/Protocol.cpp ./AIS-catcher/Library/Logger.cpp
5656

5757
JNI/AIScatcherNDK.cpp)
@@ -61,7 +61,7 @@ include_directories(
6161
./rtl-sdr/include
6262
./airspyone_host/libairspy/src
6363
./airspyhf/libairspyhf/src
64-
./AIS-catcher ./AIS-catcher/Application ./AIS-catcher/IO ./AIS-catcher/Library ./AIS-catcher/Ships ./AIS-catcher/DBMS ./AIS-catcher/DSP ./AIS-catcher/Device ./AIS-catcher/Protocol)
64+
./AIS-catcher ./AIS-catcher/Application ./AIS-catcher/IO ./AIS-catcher/Library ./AIS-catcher/Tracking ./AIS-catcher/DBMS ./AIS-catcher/DSP ./AIS-catcher/Device ./AIS-catcher/Protocol)
6565

6666
add_definitions(-DHASRTLSDR -DHASRTLSDR_BIASTEE -DHASRTL_ANDROID -DHASAIRSPY -DHASAIRSPY_ANDROID -D HASAIRSPYHF -DHASAIRSPYHF_ANDROID -DHASRTLSDR_TUNERBW)
6767

app/src/main/jni/JNI/AIScatcherNDK.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <sstream>
2525

2626
const int TIME_CONSTRAINT = 120;
27+
bool communityFeed = false;
2728

2829
#define LOG_TAG "AIS-catcher JNI"
2930

0 commit comments

Comments
 (0)