R
R
raycheel2014-09-14 14:16:59
Android
raycheel, 2014-09-14 14:16:59

How to implement data output?

When developing the application, a not entirely clear situation arose.
There is a list (album) with music (which can be listened to), it is necessary to show the entire list of music even to an unauthorized user, the first 2 songs can be listened to by everyone, and in other cases:
1) If the user is not authorized, then you need to log in to listen
2) If the music after entering is paid, then we show the buy button
3) If the user is authorized and the album is purchased - you can listen
4) If the user is authorized and the music is free - you can listen
5) If the user is authorized, but did not buy the album - you can not listen
I.e. I understand that everything can be done with conditions, it turns out to be a rather cumbersome mess from if-else, how to implement it differently? Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2014-10-02
@iru

if (пользователь не авторизован?){
для прослушивания нужно войти
}
if(музыка после входа является платной?){
показываем кнопку купить
}
if(пользователь авторизован и альбом куплен?){
можно слушать
}else{
нельзя слушать
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question