mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-22 13:05:31 +03:00
Fix issues with db & permissions
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
601f8fa2a4
commit
b1722f81b3
3 changed files with 60 additions and 48 deletions
|
@ -12,8 +12,8 @@ android {
|
|||
targetSdkVersion 27
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
versionCode 19
|
||||
versionName "1.0.9"
|
||||
versionCode 20
|
||||
versionName "1.0.10"
|
||||
|
||||
// Enabling multidex support.
|
||||
multiDexEnabled true
|
||||
|
|
|
@ -493,8 +493,13 @@ public class CallActivity extends AppCompatActivity {
|
|||
pipVideoView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
|
||||
}
|
||||
|
||||
@AfterPermissionGranted(100)
|
||||
private void checkPermissions() {
|
||||
EffortlessPermissions.requestPermissions(this, R.string.nc_permissions,
|
||||
100, PERMISSIONS_CALL);
|
||||
}
|
||||
|
||||
@AfterPermissionGranted(100)
|
||||
private void onPermissionsGranted() {
|
||||
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CALL)) {
|
||||
if (!videoOn) {
|
||||
onCameraClick();
|
||||
|
@ -517,58 +522,57 @@ public class CallActivity extends AppCompatActivity {
|
|||
}
|
||||
} else if (EffortlessPermissions.somePermissionPermanentlyDenied(this,
|
||||
PERMISSIONS_CALL)) {
|
||||
checkIfSomeAreApproved();
|
||||
}
|
||||
}
|
||||
|
||||
if (cameraEnumerator.getDeviceNames().length == 0) {
|
||||
cameraControlButton.setVisibility(View.GONE);
|
||||
private void checkIfSomeAreApproved() {
|
||||
if (cameraEnumerator.getDeviceNames().length == 0) {
|
||||
cameraControlButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (cameraSwitchButton != null && cameraEnumerator.getDeviceNames().length > 1) {
|
||||
cameraSwitchButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CAMERA)) {
|
||||
if (!videoOn) {
|
||||
onCameraClick();
|
||||
}
|
||||
|
||||
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CAMERA)) {
|
||||
if (!videoOn) {
|
||||
onCameraClick();
|
||||
}
|
||||
|
||||
if (cameraSwitchButton != null && cameraEnumerator.getDeviceNames().length > 1) {
|
||||
cameraSwitchButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if (!EffortlessPermissions.hasPermissions(this, PERMISSIONS_CAMERA)) {
|
||||
cameraControlButton.setImageResource(R.drawable.ic_videocam_off_white_24px);
|
||||
if (cameraSwitchButton != null) {
|
||||
cameraSwitchButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
cameraControlButton.setVisibility(View.GONE);
|
||||
} else if (!EffortlessPermissions.hasPermissions(this, PERMISSIONS_CAMERA)) {
|
||||
cameraControlButton.setImageResource(R.drawable.ic_videocam_off_white_24px);
|
||||
if (cameraSwitchButton != null) {
|
||||
cameraSwitchButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_MICROPHONE)) {
|
||||
if (!audioOn) {
|
||||
onMicrophoneClick();
|
||||
}
|
||||
} else if (!EffortlessPermissions.hasPermissions(this, PERMISSIONS_MICROPHONE)) {
|
||||
microphoneControlButton.setImageResource(R.drawable.ic_mic_off_white_24px);
|
||||
}
|
||||
cameraControlButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (!inCall) {
|
||||
startCall();
|
||||
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_MICROPHONE)) {
|
||||
if (!audioOn) {
|
||||
onMicrophoneClick();
|
||||
}
|
||||
} else if (!EffortlessPermissions.hasPermissions(this, PERMISSIONS_MICROPHONE)) {
|
||||
microphoneControlButton.setImageResource(R.drawable.ic_mic_off_white_24px);
|
||||
}
|
||||
|
||||
} else {
|
||||
EffortlessPermissions.requestPermissions(this, R.string.nc_permissions,
|
||||
100, PERMISSIONS_CALL);
|
||||
if (!inCall) {
|
||||
startCall();
|
||||
}
|
||||
}
|
||||
|
||||
@AfterPermissionDenied(100)
|
||||
private void onPermissionsDenied() {
|
||||
if (cameraSwitchButton != null) {
|
||||
if (cameraEnumerator.getDeviceNames().length == 0) {
|
||||
cameraControlButton.setVisibility(View.GONE);
|
||||
} else if (cameraEnumerator.getDeviceNames().length == 1) {
|
||||
cameraSwitchButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (cameraEnumerator.getDeviceNames().length == 0) {
|
||||
cameraControlButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (!inCall) {
|
||||
startCall();
|
||||
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CAMERA) ||
|
||||
EffortlessPermissions.hasPermissions(this, PERMISSIONS_MICROPHONE)) {
|
||||
checkIfSomeAreApproved();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,15 +104,23 @@ public final class MainActivity extends AppCompatActivity implements ActionBarPr
|
|||
hasDb = false;
|
||||
}
|
||||
|
||||
if (!router.hasRootController() && hasDb && userUtils.anyUserExists()) {
|
||||
sqlCipherDatabaseSource.close();
|
||||
router.setRoot(RouterTransaction.with(new MagicBottomNavigationController())
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler()));
|
||||
} else if (!router.hasRootController()) {
|
||||
router.setRoot(RouterTransaction.with(new ServerSelectionController())
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler()));
|
||||
if (!router.hasRootController()) {
|
||||
if (hasDb) {
|
||||
if (userUtils.anyUserExists()) {
|
||||
router.setRoot(RouterTransaction.with(new MagicBottomNavigationController())
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler()));
|
||||
} else {
|
||||
router.setRoot(RouterTransaction.with(new ServerSelectionController())
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler()));
|
||||
}
|
||||
} else {
|
||||
router.setRoot(RouterTransaction.with(new ServerSelectionController())
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler()));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue