mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
Merge branch '1999-bluetooth-killed-activity-fix' into 'master'
Reset plugin assignments when starting AddNearbyContactIntroFragment Closes #1999 See merge request briar/briar!1434
This commit is contained in:
@@ -95,6 +95,9 @@ public class AddNearbyContactIntroFragment extends BaseFragment {
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
// Permissions may have been granted manually while we were stopped
|
// Permissions may have been granted manually while we were stopped
|
||||||
permissionManager.resetPermissions();
|
permissionManager.resetPermissions();
|
||||||
|
// Reset plugins in case they were assigned when we weren't signed-in
|
||||||
|
viewModel.resetPlugins();
|
||||||
|
// Scroll down in case the screen is small, so the button is visible
|
||||||
scrollView.post(() -> scrollView.fullScroll(FOCUS_DOWN));
|
scrollView.post(() -> scrollView.fullScroll(FOCUS_DOWN));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -148,8 +148,8 @@ class AddNearbyContactViewModel extends AndroidViewModel
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private final BluetoothAdapter bt;
|
private final BluetoothAdapter bt;
|
||||||
@Nullable
|
@Nullable // UiThread
|
||||||
private final Plugin wifiPlugin, bluetoothPlugin;
|
private Plugin wifiPlugin, bluetoothPlugin;
|
||||||
|
|
||||||
// UiThread
|
// UiThread
|
||||||
private BluetoothDecision bluetoothDecision = BluetoothDecision.UNKNOWN;
|
private BluetoothDecision bluetoothDecision = BluetoothDecision.UNKNOWN;
|
||||||
@@ -210,6 +210,17 @@ class AddNearbyContactViewModel extends AndroidViewModel
|
|||||||
stopListening();
|
stopListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When this activity gets killed and re-created while the user is not
|
||||||
|
* signed-in (can happen when a permission is denied which terminates app),
|
||||||
|
* the plugins will be null, so we need to re-assign them after sign-in.
|
||||||
|
*/
|
||||||
|
@UiThread
|
||||||
|
void resetPlugins() {
|
||||||
|
wifiPlugin = pluginManager.getPlugin(LanTcpConstants.ID);
|
||||||
|
bluetoothPlugin = pluginManager.getPlugin(BluetoothConstants.ID);
|
||||||
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
void onContinueClicked() {
|
void onContinueClicked() {
|
||||||
if (bluetoothDecision == REFUSED) {
|
if (bluetoothDecision == REFUSED) {
|
||||||
|
|||||||
Reference in New Issue
Block a user