mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +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();
|
||||
// Permissions may have been granted manually while we were stopped
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@@ -148,8 +148,8 @@ class AddNearbyContactViewModel extends AndroidViewModel
|
||||
|
||||
@Nullable
|
||||
private final BluetoothAdapter bt;
|
||||
@Nullable
|
||||
private final Plugin wifiPlugin, bluetoothPlugin;
|
||||
@Nullable // UiThread
|
||||
private Plugin wifiPlugin, bluetoothPlugin;
|
||||
|
||||
// UiThread
|
||||
private BluetoothDecision bluetoothDecision = BluetoothDecision.UNKNOWN;
|
||||
@@ -210,6 +210,17 @@ class AddNearbyContactViewModel extends AndroidViewModel
|
||||
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
|
||||
void onContinueClicked() {
|
||||
if (bluetoothDecision == REFUSED) {
|
||||
|
||||
Reference in New Issue
Block a user