Some changes for PN + fix tests and FR trad
This commit is contained in:
parent
9d934f7b33
commit
e0b6780f4f
7 changed files with 33 additions and 13 deletions
|
@ -241,13 +241,13 @@
|
|||
<string name="content_description_message_status"></string>
|
||||
<string name="content_description_mark"></string>
|
||||
|
||||
<string name="setup_title">Assistant aux comptes</string>
|
||||
<string name="setup_title">Assistant de configuration des comptes</string>
|
||||
<string name="setup_welcome">Cet assistant va vous aider à configurer un compte SIP pour vos appels.</string>
|
||||
<string name="setup_create_account">Créer un compte linphone.org</string>
|
||||
<string name="setup_login_linphone">J\'ai déjà un compte linphone.org</string>
|
||||
<string name="setup_login_generic">J\'ai déjà un compte SIP</string>
|
||||
<string name="setup_linphone_account_hint">Entrez votre nom d\'utilisateur et votre mot de passe linphone.org</string>
|
||||
<string name="setup_general_account_hint">Entrez votre nom d\'utilisateur et votre mot de passe linphone.org</string>
|
||||
<string name="setup_general_account_hint">Entrez votre nom d\'utilisateur, votre mot de passe et le domaine de votre compte SIP</string>
|
||||
<string name="setup_apply">Appliquer</string>
|
||||
<string name="setup_username_hint">nom d\'utilisateur</string>
|
||||
<string name="setup_password_hint">mot de passe</string>
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<resources>
|
||||
<!-- Push notification settings -->
|
||||
<bool name="enable_push_id">true</bool>
|
||||
<string name="push_sender_id">622464153529</string>
|
||||
<string name="push_sender_id">175894229314</string> <!-- Test API -->
|
||||
<!--<string name="push_sender_id">622464153529</string>-->
|
||||
|
||||
<string name="default_domain">sip.linphone.org</string>
|
||||
<string name="wizard_url">https://www.linphone.org/wizard.php</string>
|
||||
|
|
|
@ -85,5 +85,6 @@
|
|||
<string name="pref_media_encryption_key_zrtp">zrtp</string>
|
||||
|
||||
<string name="push_reg_id_key">push_reg_id_key</string>
|
||||
<string name="push_sender_id_key">push_sender_id_key</string>
|
||||
<string name="pref_push_notification_key">pref_push_notification_key</string>
|
||||
</resources>
|
||||
|
|
|
@ -297,6 +297,7 @@
|
|||
<string name="setup_login_linphone">I already have a linphone.org account</string>
|
||||
<string name="setup_login_generic">I already have a SIP account</string>
|
||||
<string name="setup_linphone_account_hint">Enter your linphone.org username and password</string>
|
||||
<string name="setup_general_account_hint">Enter your SIP account username, password and domain</string>
|
||||
<string name="setup_apply">Apply</string>
|
||||
<string name="setup_username_hint">username</string>
|
||||
<string name="setup_password_hint">password</string>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(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...
|
||||
|
|
Loading…
Reference in a new issue