Improve how we use Core.checkForUpdate() feature
This commit is contained in:
parent
cd06eb3746
commit
9ec269c85f
4 changed files with 23 additions and 2 deletions
|
@ -366,6 +366,14 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
|||
ActivityCompat.requestPermissions(
|
||||
this, permissions, PERMISSIONS_READ_EXTERNAL_STORAGE_DEVICE_RINGTONE);
|
||||
}
|
||||
} else {
|
||||
if (getResources().getBoolean(R.bool.check_for_update_when_app_starts)) {
|
||||
String url = LinphonePreferences.instance().getCheckReleaseUrl();
|
||||
if (url != null && !url.isEmpty()) {
|
||||
LinphoneManager.getLcIfManagerNotDestroyedOrNull()
|
||||
.checkForUpdate(BuildConfig.VERSION_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (checkPermission(Manifest.permission.READ_CONTACTS)) {
|
||||
|
@ -609,6 +617,16 @@ public class LinphoneActivity extends LinphoneGenericActivity
|
|||
@Override
|
||||
public void onRequestPermissionsResult(
|
||||
int requestCode, String[] permissions, int[] grantResults) {
|
||||
|
||||
// If permission was asked we wait here for the results so dialogs won't conflict
|
||||
if (getResources().getBoolean(R.bool.check_for_update_when_app_starts)) {
|
||||
String url = LinphonePreferences.instance().getCheckReleaseUrl();
|
||||
if (url != null && !url.isEmpty()) {
|
||||
LinphoneManager.getLcIfManagerNotDestroyedOrNull()
|
||||
.checkForUpdate(BuildConfig.VERSION_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
if (permissions.length <= 0) return;
|
||||
|
||||
int readContactsI = -1;
|
||||
|
|
|
@ -739,8 +739,6 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
+ getString(R.string.linphone_sdk_branch)
|
||||
+ ")");
|
||||
|
||||
mCore.checkForUpdate(androidVersion);
|
||||
|
||||
// mCore.setChatDatabasePath(mChatDatabaseFile);
|
||||
mCore.setCallLogsDatabasePath(mCallLogDatabaseFile);
|
||||
mCore.setFriendsDatabasePath(mFriendsDatabaseFile);
|
||||
|
|
|
@ -958,6 +958,10 @@ public class LinphonePreferences {
|
|||
getConfig().setBool("app", "show_service_notification", enable);
|
||||
}
|
||||
|
||||
public String getCheckReleaseUrl() {
|
||||
return getConfig().getString("misc", "version_check_url_root", null);
|
||||
}
|
||||
|
||||
public boolean isOverlayEnabled() {
|
||||
return getConfig().getBool("app", "display_overlay", false);
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@
|
|||
<!-- Others Parameters-->
|
||||
<bool name="enable_call_notification">true</bool>
|
||||
<bool name="kill_service_with_task_manager">true</bool>
|
||||
<bool name="check_for_update_when_app_starts">true</bool>
|
||||
<integer name="notification_ms_on">1000</integer>
|
||||
<integer name="notification_ms_off">7000</integer>
|
||||
|
||||
|
|
Loading…
Reference in a new issue