Added remote provisioning dialog when already configured

This commit is contained in:
Sylvain Berfini 2014-07-09 18:02:47 +02:00
parent 1e3ecb97c7
commit 75495815ef
6 changed files with 37 additions and 4 deletions

View file

@ -402,4 +402,6 @@
<string name="retry">Renvoyer</string> <string name="retry">Renvoyer</string>
<string name="remote_provisioning_failure">Erreur durant le téléchargement ou l\'application de la configuration distante...</string> <string name="remote_provisioning_failure">Erreur durant le téléchargement ou l\'application de la configuration distante...</string>
<string name="remote_provisioning_again_title">Remote provisioning</string>
<string name="remote_provisioning_again_message">Do you want to change the provisioning URI ?</string>
</resources> </resources>

View file

@ -453,4 +453,6 @@
<string name="retry">Retry</string> <string name="retry">Retry</string>
<string name="remote_provisioning_failure">Failed to download or apply remote provisioning profile...</string> <string name="remote_provisioning_failure">Failed to download or apply remote provisioning profile...</string>
<string name="remote_provisioning_again_title">Remote provisioning</string>
<string name="remote_provisioning_again_message">Do you want to change the provisioning URI ?</string>
</resources> </resources>

View file

@ -453,4 +453,6 @@
<string name="retry">Retry</string> <string name="retry">Retry</string>
<string name="remote_provisioning_failure">Failed to download or apply remote provisioning profile...</string> <string name="remote_provisioning_failure">Failed to download or apply remote provisioning profile...</string>
<string name="remote_provisioning_again_title">Remote provisioning</string>
<string name="remote_provisioning_again_message">Do you want to change the provisioning URI ?</string>
</resources> </resources>

View file

@ -250,9 +250,9 @@ public class LinphoneManager implements LinphoneCoreListener {
} }
public void changeStatusToOnline() { public void changeStatusToOnline() {
if (isInstanciated() && isPresenceModelActivitySet() && getLc().getPresenceModel().getActivity().getType() != PresenceActivityType.Online) { if (isInstanciated() && getLcIfManagerNotDestroyedOrNull() != null && isPresenceModelActivitySet() && getLc().getPresenceModel().getActivity().getType() != PresenceActivityType.Online) {
getLc().getPresenceModel().getActivity().setType(PresenceActivityType.Online); getLc().getPresenceModel().getActivity().setType(PresenceActivityType.Online);
} else if (isInstanciated() && !isPresenceModelActivitySet()) { } else if (isInstanciated() && getLcIfManagerNotDestroyedOrNull() != null && !isPresenceModelActivitySet()) {
PresenceModel model = LinphoneCoreFactoryImpl.instance().createPresenceModel(PresenceActivityType.Online, null); PresenceModel model = LinphoneCoreFactoryImpl.instance().createPresenceModel(PresenceActivityType.Online, null);
getLc().setPresenceModel(model); getLc().setPresenceModel(model);
} }

View file

@ -63,6 +63,9 @@ public class LinphonePreferences {
} }
private LinphoneCore getLc() { private LinphoneCore getLc() {
if (!LinphoneManager.isInstanciated())
return null;
return LinphoneManager.getLcIfManagerNotDestroyedOrNull(); return LinphoneManager.getLcIfManagerNotDestroyedOrNull();
} }

View file

@ -30,6 +30,8 @@ import org.linphone.core.LinphoneCore.RemoteProvisioningState;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -121,7 +123,12 @@ public class RemoteProvisioningActivity extends Activity implements LinphoneOnRe
} else { } else {
if (getResources().getBoolean(R.bool.display_confirmation_popup_after_first_configuration) if (getResources().getBoolean(R.bool.display_confirmation_popup_after_first_configuration)
&& !LinphonePreferences.instance().isFirstRemoteProvisioning()) { && !LinphonePreferences.instance().isFirstRemoteProvisioning()) {
// TODO: show confirmation popup mHandler.post(new Runnable() {
@Override
public void run() {
displayDialogConfirmation();
}
});
} else { } else {
setRemoteProvisioningAddressAndRestart(configUriParam); setRemoteProvisioningAddressAndRestart(configUriParam);
} }
@ -130,6 +137,23 @@ public class RemoteProvisioningActivity extends Activity implements LinphoneOnRe
}).start(); }).start();
} }
private void displayDialogConfirmation() {
new AlertDialog.Builder(RemoteProvisioningActivity.this)
.setTitle(getString(R.string.remote_provisioning_again_title))
.setMessage(getString(R.string.remote_provisioning_again_message))
.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
setRemoteProvisioningAddressAndRestart(configUriParam);
}
})
.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
goToLinphoneActivity();
}
})
.show();
}
private void setRemoteProvisioningAddressAndRestart(String configUri) { private void setRemoteProvisioningAddressAndRestart(String configUri) {
if (spinner != null) spinner.setVisibility(View.VISIBLE); if (spinner != null) spinner.setVisibility(View.VISIBLE);
@ -151,6 +175,6 @@ public class RemoteProvisioningActivity extends Activity implements LinphoneOnRe
private void goToLinphoneActivity() { private void goToLinphoneActivity() {
LinphoneService.instance().setActivityToLaunchOnIncomingReceived(LinphoneActivity.class); LinphoneService.instance().setActivityToLaunchOnIncomingReceived(LinphoneActivity.class);
finish(); // To prevent the user to come back to this page using back button finish(); // To prevent the user to come back to this page using back button
startActivity(new Intent().setClass(this, LinphoneActivity.class).setData(getIntent().getData())); startActivity(new Intent().setClass(this, LinphoneActivity.class));
} }
} }