mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-18 03:39:00 +00:00
Merge pull request #309 from HabitRPG/validate-presence-of-user-before-notify
Fix #277 - Validate Presence of user before notify
This commit is contained in:
commit
4738245d4c
1 changed files with 15 additions and 5 deletions
|
|
@ -591,13 +591,23 @@ public class MainActivity extends AppCompatActivity implements HabitRPGUserCallb
|
|||
@Override
|
||||
public void onTaskDataReceived(TaskDirectionData data, Task task) {
|
||||
if (task.type.equals("reward")) {
|
||||
|
||||
showSnackbar(task.getText() + " successfully purchased!");
|
||||
|
||||
} else {
|
||||
notifyUser(data.getExp(), data.getHp(), data.getGp(), data.getLvl(), data.getDelta());
|
||||
if (data.get_tmp() != null) {
|
||||
if (data.get_tmp().getDrop() != null) {
|
||||
this.showSnackbar(data.get_tmp().getDrop().getDialog(), MainActivity.SnackbarDisplayType.DROP);
|
||||
}
|
||||
|
||||
if(user != null){
|
||||
notifyUser(data.getExp(), data.getHp(), data.getGp(), data.getLvl(), data.getDelta());
|
||||
}
|
||||
|
||||
showSnackBarForDataReceived(data);
|
||||
}
|
||||
}
|
||||
|
||||
private void showSnackBarForDataReceived(TaskDirectionData data) {
|
||||
if (data.get_tmp() != null) {
|
||||
if (data.get_tmp().getDrop() != null) {
|
||||
this.showSnackbar(data.get_tmp().getDrop().getDialog(), SnackbarDisplayType.DROP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue