diff --git a/res/values-FR/strings.xml b/res/values-FR/strings.xml index 6e59dea36..0febe59b4 100644 --- a/res/values-FR/strings.xml +++ b/res/values-FR/strings.xml @@ -241,13 +241,13 @@ - Assistant aux comptes + Assistant de configuration des comptes Cet assistant va vous aider à configurer un compte SIP pour vos appels. Créer un compte linphone.org J\'ai déjà un compte linphone.org J\'ai déjà un compte SIP Entrez votre nom d\'utilisateur et votre mot de passe linphone.org - Entrez votre nom d\'utilisateur et votre mot de passe linphone.org + Entrez votre nom d\'utilisateur, votre mot de passe et le domaine de votre compte SIP Appliquer nom d\'utilisateur mot de passe diff --git a/res/values/non_localizable_custom.xml b/res/values/non_localizable_custom.xml index 8a40f9c35..b6527cdd0 100644 --- a/res/values/non_localizable_custom.xml +++ b/res/values/non_localizable_custom.xml @@ -2,7 +2,8 @@ true - 622464153529 + 175894229314 + sip.linphone.org https://www.linphone.org/wizard.php diff --git a/res/values/non_localizable_strings.xml b/res/values/non_localizable_strings.xml index 3e298eea6..ab91ae2b2 100644 --- a/res/values/non_localizable_strings.xml +++ b/res/values/non_localizable_strings.xml @@ -85,5 +85,6 @@ zrtp push_reg_id_key + push_sender_id_key pref_push_notification_key diff --git a/res/values/strings.xml b/res/values/strings.xml index 16dc68c6e..a603286b3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -297,6 +297,7 @@ I already have a linphone.org account I already have a SIP account Enter your linphone.org username and password + Enter your SIP account username, password and domain Apply username password diff --git a/src/org/linphone/compatibility/ApiEightPlus.java b/src/org/linphone/compatibility/ApiEightPlus.java index 08252ea1e..56a95b9f1 100644 --- a/src/org/linphone/compatibility/ApiEightPlus.java +++ b/src/org/linphone/compatibility/ApiEightPlus.java @@ -40,15 +40,23 @@ public class ApiEightPlus { } public static void initPushNotificationService(Context context) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + // Starting the push notification service GCMRegistrar.checkDevice(context); GCMRegistrar.checkManifest(context); final String regId = GCMRegistrar.getRegistrationId(context); - if (regId.equals("")) { - GCMRegistrar.register(context, context.getString(R.string.push_sender_id)); + String newPushSenderID = context.getString(R.string.push_sender_id); + String currentPushSenderID = prefs.getString(context.getString(R.string.push_sender_id_key), null); + if (regId.equals("") || currentPushSenderID == null || !currentPushSenderID.equals(newPushSenderID)) { + GCMRegistrar.register(context, newPushSenderID); + + Log.d("Push Notification : storing current sender id = " + newPushSenderID); + SharedPreferences.Editor editor = prefs.edit(); + editor.putString(context.getString(R.string.push_sender_id_key), newPushSenderID); + editor.commit(); } else { - Log.e("Push Notification : already registered with id = " + regId); - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + Log.d("Push Notification : already registered with id = " + regId); SharedPreferences.Editor editor = prefs.edit(); editor.putString(context.getString(R.string.push_reg_id_key), regId); editor.commit(); diff --git a/tests/src/org/linphone/test/AccountsTest.java b/tests/src/org/linphone/test/AccountsTest.java index dbff0c1f7..e5385a488 100644 --- a/tests/src/org/linphone/test/AccountsTest.java +++ b/tests/src/org/linphone/test/AccountsTest.java @@ -6,6 +6,7 @@ import org.linphone.LinphoneActivity; import org.linphone.R; import org.linphone.setup.SetupActivity; +import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.test.ActivityInstrumentationTestCase2; @@ -31,20 +32,22 @@ public class AccountsTest extends } public void testConfigureExistingAccount() { + Context context = getActivity(); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0); solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class); solo.clickOnView(solo.getView(R.id.settings)); - solo.clickOnText("Account Setup Assistant"); + solo.clickOnText(context.getString(R.string.setup_title)); solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class); solo.clickOnView(solo.getView(R.id.setup_next)); - solo.clickOnText("I already have a linphone.org account"); + solo.clickOnText(context.getString(R.string.setup_login_linphone)); solo.enterText((EditText) solo.getView(R.id.setup_username), "wizard15"); solo.enterText((EditText) solo.getView(R.id.setup_password), "wizard15"); - solo.clickOnText("Apply"); + solo.clickOnText(context.getString(R.string.setup_apply)); solo.waitForActivity("LinphoneActivity", 2000); Assert.assertTrue(solo.searchText("wizard15@sip.linphone.org")); @@ -54,6 +57,8 @@ public class AccountsTest extends } public void testDeleteConfiguredAccount() { + Context context = getActivity(); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0); @@ -70,7 +75,7 @@ public class AccountsTest extends list.setSelection(7); } }); - solo.clickOnText("Delete this account"); + solo.clickOnText(context.getString(R.string.pref_delete_account)); int nbAccountsAfter = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0); Assert.assertEquals(nbAccountsBefore - 1, nbAccountsAfter); diff --git a/tests/src/org/linphone/test/PushNotificationTest.java b/tests/src/org/linphone/test/PushNotificationTest.java index 62c4d63fc..b05ca6f18 100644 --- a/tests/src/org/linphone/test/PushNotificationTest.java +++ b/tests/src/org/linphone/test/PushNotificationTest.java @@ -25,6 +25,7 @@ import org.apache.http.params.HttpProtocolParams; import org.apache.http.protocol.HTTP; import org.linphone.LinphoneActivity; import org.linphone.R; +import org.linphone.core.Log; import android.content.SharedPreferences; import android.preference.PreferenceManager; @@ -73,16 +74,19 @@ public class PushNotificationTest extends HttpClient httpClient = createHttpClient(); HttpPost httpPost = new HttpPost("https://android.googleapis.com/gcm/send"); httpPost.setHeader("Content-type", "application/x-www-form-urlencoded;charset=UTF-8"); - httpPost.setHeader("Authorization", "key=AIzaSyDbCO1_KgFhkig_aaTutxx0jEHIib0i8C0"); + httpPost.setHeader("Authorization", "key=AIzaSyBJAhCVeeqIErwTfYwy-t83_EwvZlCFo9I"); // Test API +// httpPost.setHeader("Authorization", "key=AIzaSyDbCO1_KgFhkig_aaTutxx0jEHIib0i8C0"); List nameValuePairs = new ArrayList(2); nameValuePairs.add(new BasicNameValuePair("data.test", "TEST")); nameValuePairs.add(new BasicNameValuePair("registration_id", regId)); try { httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); - httpClient.execute(httpPost, new BasicResponseHandler()); + String result = httpClient.execute(httpPost, new BasicResponseHandler()); + Log.d("TEST Http POST result: " + result); } catch (Exception e) { e.printStackTrace(); + new junit.framework.TestFailure(this, e.getCause()); } // Can be true if a previous notification worked and log hasn't been cleared since...