Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Fixes #232
Browse files Browse the repository at this point in the history
  • Loading branch information
Amab committed Jan 21, 2017
1 parent fe2be20 commit 5ac786c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions SWADroid/src/main/java/es/ugr/swad/swadroid/SWADMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ protected void onResume() {
}

//If today is the user birthday, show birthday message
if((Login.getLoggedUser() != null)
if((Login.getLoggedUser() != null) && (Login.getLoggedUser().getUserBirthday() != null)
&& DateTimeUtils.isBirthday(Login.getLoggedUser().getUserBirthday())) {

showBirthdayMessage();
Expand Down Expand Up @@ -292,7 +292,9 @@ private void upgradeApp(int lastVersion, int currentVersion) throws NoSuchAlgori
Preferences.upgradeCredentials();

Preferences.setSyncTime(String.valueOf(Constants.DEFAULT_SYNC_TIME));
} else if(lastVersion < 57) {
}

if(lastVersion < 57) {
//Reconfigure automatic synchronization
SyncUtils.removePeriodicSync(Constants.AUTHORITY, Bundle.EMPTY, this);
if(!Preferences.getSyncTime().equals("0") && Preferences.isSyncEnabled()) {
Expand Down
4 changes: 3 additions & 1 deletion SWADroid/src/main/java/es/ugr/swad/swadroid/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import java.util.Hashtable;
import java.util.Locale;

import es.ugr.swad.swadroid.Constants;

/**
* User data.
*
Expand Down Expand Up @@ -256,7 +258,7 @@ public Calendar getUserBirthday() {
* @param userBirthday User birthday.
*/
private void setUserBirthday(String userBirthday) throws ParseException {
if((userBirthday != null) && !userBirthday.equals("00000000")) {
if((userBirthday != null) && !userBirthday.equals(Constants.NULL_VALUE) && !userBirthday.equals("00000000")) {
this.userBirthday = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ private void refreshScreen() {
hideSwipeProgress();

//If today is the user birthday, show birthday message
if((Login.getLoggedUser() != null)
if((Login.getLoggedUser() != null) && (Login.getLoggedUser().getUserBirthday() != null)
&& DateTimeUtils.isBirthday(Login.getLoggedUser().getUserBirthday())) {
mBirthdayTextView.setText(getString(R.string.birthdayMsg).replace(
Constants.USERNAME_TEMPLATE, Login.getLoggedUser().getUserFirstname()));
Expand Down Expand Up @@ -475,7 +475,7 @@ protected void requestService() throws Exception {
*/
@Override
protected void connect() {
Toast.makeText(this, R.string.notificationsProgressDescription, Toast.LENGTH_SHORT).show();
//Toast.makeText(this, R.string.notificationsProgressDescription, Toast.LENGTH_SHORT).show();

startConnection();
}
Expand Down

0 comments on commit 5ac786c

Please sign in to comment.