1
mirror of https://github.com/m2049r/xmrwallet synced 2025-09-03 08:23:04 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
m2049r
a3c0ca7ebe bump version 2024-11-05 08:46:32 +01:00
m2049r
c9132d7d97 more permission checks 2024-11-05 08:42:14 +01:00
m2049r
758b042680 fix some crashing if bluetooth pemissions are not given (#965)
* show error instead of crashing

* ignore if fragement is no longer

* bump version
2024-11-03 16:19:35 +01:00
3 changed files with 18 additions and 12 deletions

View File

@@ -8,8 +8,8 @@ android {
compileSdk 35
minSdkVersion 21
targetSdkVersion 35
versionCode 4102
versionName "4.1.2 'Exolix'"
versionCode 4104
versionName "4.1.4 'Exolix'"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {

View File

@@ -1411,7 +1411,7 @@ public class LoginActivity extends BaseActivity
Timber.d("onDeviceConnected: %s", connectedDeviceName);
try {
SidekickConnectFragment f = (SidekickConnectFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_container);
assert f != null;
if (f == null) return;
f.allowClick();
} catch (ClassCastException ex) {
// ignore it

View File

@@ -27,6 +27,7 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -75,12 +76,13 @@ public class SidekickConnectFragment extends Fragment
@Override
public void onPause() {
Timber.d("onPause()");
if (ActivityCompat.checkSelfPermission(requireContext(), android.Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED)
throw new IllegalStateException("Bluetooth permission not granted");
if (bluetoothAdapter.isDiscovering()) {
bluetoothAdapter.cancelDiscovery();
if (ActivityCompat.checkSelfPermission(requireContext(), android.Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(requireContext(), "Bluetooth permission not granted", Toast.LENGTH_LONG).show();
} else {
if (bluetoothAdapter.isDiscovering()) {
bluetoothAdapter.cancelDiscovery();
}
}
// the the activity we are connected? why? it can ask the bluetoothservice...
super.onPause();
}
@@ -116,8 +118,10 @@ public class SidekickConnectFragment extends Fragment
private void populateList() {
List<BluetoothInfo> items = new ArrayList<>();
if (ActivityCompat.checkSelfPermission(requireContext(), android.Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED)
throw new IllegalStateException("Bluetooth permission not granted");
if (ActivityCompat.checkSelfPermission(requireContext(), android.Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(requireContext(), "Bluetooth permission not granted", Toast.LENGTH_LONG).show();
return;
}
for (BluetoothDevice device : bluetoothAdapter.getBondedDevices()) {
final int deviceCLass = device.getBluetoothClass().getDeviceClass();
switch (deviceCLass) {
@@ -158,8 +162,10 @@ public class SidekickConnectFragment extends Fragment
// Make sure we're not doing discovery anymore
if (bluetoothAdapter != null) {
if (ActivityCompat.checkSelfPermission(requireContext(), android.Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED)
throw new IllegalStateException("Bluetooth permission not granted");
if (ActivityCompat.checkSelfPermission(requireContext(), android.Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(requireContext(), "Bluetooth permission not granted", Toast.LENGTH_LONG).show();
return;
}
bluetoothAdapter.cancelDiscovery();
}
}