Change time seconds to milliseconds to match with Android timestamp
This commit is contained in:
parent
8d741c7fe3
commit
26e4ca0131
6 changed files with 27 additions and 13 deletions
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<!-- Phone numbers -->
|
<!-- Phone numbers -->
|
||||||
<bool name="use_phone_number_validation">true</bool><!-- Use phone number for validation -->
|
<bool name="use_phone_number_validation">true</bool><!-- Use phone number for validation -->
|
||||||
<integer name="popup_time_interval">86400</integer><!-- Time between two inapp notifications in seconds -->
|
<integer name="popup_time_interval">86400000</integer><!-- Time between two inapp notifications in milliseconds -->
|
||||||
|
|
||||||
<!-- Assistant -->
|
<!-- Assistant -->
|
||||||
<bool name="assistant_allow_username">true</bool> <!-- Allow to use an username instead of the phone number for account creation -->
|
<bool name="assistant_allow_username">true</bool> <!-- Allow to use an username instead of the phone number for account creation -->
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<!-- Inapp -->
|
<!-- Inapp -->
|
||||||
<bool name="enable_in_app_purchase">false</bool>
|
<bool name="enable_in_app_purchase">false</bool>
|
||||||
<integer name="days_notification_shown">5</integer><!-- Notification shown before end of trial version in days -->
|
<integer name="days_notification_shown">5</integer><!-- Notification shown before end of trial version in days -->
|
||||||
<integer name="time_between_inapp_notification">86400</integer><!-- Time between two inapp notifications in seconds -->
|
<integer name="time_between_inapp_notification">86400000</integer><!-- Time between two inapp notifications in milliseconds -->
|
||||||
<bool name="hide_username_in_inapp">true</bool>
|
<bool name="hide_username_in_inapp">true</bool>
|
||||||
|
|
||||||
<!-- Push notification settings -->
|
<!-- Push notification settings -->
|
||||||
|
|
|
@ -262,6 +262,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
||||||
Intent assistant = new Intent();
|
Intent assistant = new Intent();
|
||||||
assistant.setClass(LinphoneActivity.instance(), AssistantActivity.class);
|
assistant.setClass(LinphoneActivity.instance(), AssistantActivity.class);
|
||||||
assistant.putExtra("LinkPhoneNumber", true);
|
assistant.putExtra("LinkPhoneNumber", true);
|
||||||
|
assistant.putExtra("FromPref", true);
|
||||||
startActivity(assistant);
|
startActivity(assistant);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,9 +230,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
|
|
||||||
if(getResources().getBoolean(R.bool.use_phone_number_validation)) {
|
if(getResources().getBoolean(R.bool.use_phone_number_validation)) {
|
||||||
if (state.equals(RegistrationState.RegistrationOk)) {
|
if (state.equals(RegistrationState.RegistrationOk)) {
|
||||||
if (LinphonePreferences.instance().getLinkPopupTime() == null || (LinphonePreferences.instance().getLinkPopupTime() != null)) {
|
LinphoneManager.getInstance().isAccountWithAlias();
|
||||||
LinphoneManager.getInstance().isAccountWithAlias();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1743,7 +1741,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
|
|
||||||
public void displayInappNotification(String date) {
|
public void displayInappNotification(String date) {
|
||||||
Timestamp now = new Timestamp(new Date().getTime());
|
Timestamp now = new Timestamp(new Date().getTime());
|
||||||
if (LinphonePreferences.instance().getInappPopupTime() != null && Long.parseLong(LinphonePreferences.instance().getInappPopupTime()) < now.getTime()) {
|
if (LinphonePreferences.instance().getInappPopupTime() != null && Long.parseLong(LinphonePreferences.instance().getInappPopupTime()) > now.getTime()) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
long newDate = now.getTime() + getResources().getInteger(R.integer.time_between_inapp_notification);
|
long newDate = now.getTime() + getResources().getInteger(R.integer.time_between_inapp_notification);
|
||||||
|
|
|
@ -37,6 +37,7 @@ import java.util.List;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
import org.linphone.assistant.AssistantActivity;
|
||||||
import org.linphone.core.CallDirection;
|
import org.linphone.core.CallDirection;
|
||||||
import org.linphone.core.LinphoneAccountCreator;
|
import org.linphone.core.LinphoneAccountCreator;
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
|
@ -1451,9 +1452,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
|
|
||||||
public void isAccountWithAlias(){
|
public void isAccountWithAlias(){
|
||||||
if(LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
if(LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||||
Timestamp now = new Timestamp(new Date().getTime());
|
long now = new Timestamp(new Date().getTime()).getTime();
|
||||||
if (LinphonePreferences.instance().getLinkPopupTime() == null
|
if (LinphonePreferences.instance().getLinkPopupTime() == null
|
||||||
|| Long.parseLong(LinphonePreferences.instance().getLinkPopupTime()) > now.getTime()) {
|
|| Long.parseLong(LinphonePreferences.instance().getLinkPopupTime()) < now) {
|
||||||
accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()));
|
accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()));
|
||||||
accountCreator.isAccountUsed();
|
accountCreator.isAccountUsed();
|
||||||
}
|
}
|
||||||
|
@ -1463,8 +1464,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
}
|
}
|
||||||
|
|
||||||
private void askLinkWithPhoneNumber(){
|
private void askLinkWithPhoneNumber(){
|
||||||
Timestamp now = new Timestamp(new Date().getTime());
|
long now = new Timestamp(new Date().getTime()).getTime();
|
||||||
long newDate = now.getTime() + LinphoneActivity.instance().getResources().getInteger(R.integer.popup_time_interval);
|
long future = new Timestamp(LinphoneActivity.instance().getResources().getInteger(R.integer.popup_time_interval)).getTime();
|
||||||
|
long newDate = now + future;
|
||||||
|
|
||||||
LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate));
|
LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate));
|
||||||
|
|
||||||
|
@ -1477,7 +1479,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
delete.setOnClickListener(new View.OnClickListener() {
|
delete.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
LinphoneManager.getInstance().displayLinkPhoneNumber();
|
Intent assistant = new Intent();
|
||||||
|
assistant.setClass(LinphoneActivity.instance(), AssistantActivity.class);
|
||||||
|
assistant.putExtra("LinkPhoneNumber", true);
|
||||||
|
assistant.putExtra("LinkPhoneNumberAsk", true);
|
||||||
|
mServiceContext.startActivity(assistant);
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -83,7 +83,7 @@ private static AssistantActivity instance;
|
||||||
private AssistantFragmentsEnum firstFragment;
|
private AssistantFragmentsEnum firstFragment;
|
||||||
private Fragment fragment;
|
private Fragment fragment;
|
||||||
private LinphonePreferences mPrefs;
|
private LinphonePreferences mPrefs;
|
||||||
private boolean accountCreated = false, newAccount = false, isLink = false;
|
private boolean accountCreated = false, newAccount = false, isLink = false, fromPref = false;
|
||||||
private LinphoneCoreListenerBase mListener;
|
private LinphoneCoreListenerBase mListener;
|
||||||
private LinphoneAddress address;
|
private LinphoneAddress address;
|
||||||
private StatusFragment status;
|
private StatusFragment status;
|
||||||
|
@ -112,6 +112,8 @@ private static AssistantActivity instance;
|
||||||
|
|
||||||
if (getIntent().getBooleanExtra("LinkPhoneNumber",false)) {
|
if (getIntent().getBooleanExtra("LinkPhoneNumber",false)) {
|
||||||
isLink = true;
|
isLink = true;
|
||||||
|
if (getIntent().getBooleanExtra("FromPref",false))
|
||||||
|
fromPref = true;
|
||||||
displayCreateAccount();
|
displayCreateAccount();
|
||||||
} else {
|
} else {
|
||||||
firstFragment = getResources().getBoolean(R.bool.assistant_use_linphone_login_as_first_fragment) ? AssistantFragmentsEnum.LINPHONE_LOGIN : AssistantFragmentsEnum.WELCOME;
|
firstFragment = getResources().getBoolean(R.bool.assistant_use_linphone_login_as_first_fragment) ? AssistantFragmentsEnum.LINPHONE_LOGIN : AssistantFragmentsEnum.WELCOME;
|
||||||
|
@ -400,6 +402,7 @@ private static AssistantActivity instance;
|
||||||
fragment = new CreateAccountFragment();
|
fragment = new CreateAccountFragment();
|
||||||
Bundle extra = new Bundle();
|
Bundle extra = new Bundle();
|
||||||
extra.putBoolean("LinkPhoneNumber", isLink);
|
extra.putBoolean("LinkPhoneNumber", isLink);
|
||||||
|
extra.putBoolean("LinkFromPref", fromPref);
|
||||||
fragment.setArguments(extra);
|
fragment.setArguments(extra);
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
currentFragment = AssistantFragmentsEnum.CREATE_ACCOUNT;
|
currentFragment = AssistantFragmentsEnum.CREATE_ACCOUNT;
|
||||||
|
|
|
@ -39,6 +39,7 @@ import android.accounts.AccountManager;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
@ -302,7 +303,12 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
||||||
}
|
}
|
||||||
|
|
||||||
case R.id.assistant_skip: {
|
case R.id.assistant_skip: {
|
||||||
AssistantActivity.instance().success();
|
if (getArguments().getBoolean("LinkFromPref")) {
|
||||||
|
startActivity(new Intent().setClass(AssistantActivity.instance(), LinphoneActivity.class));
|
||||||
|
AssistantActivity.instance().finish();
|
||||||
|
} else {
|
||||||
|
AssistantActivity.instance().success();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue