This commit is contained in:
marcin.jedynski 2018-11-21 08:46:06 +01:00
commit 2b4e2d3b99
6 changed files with 11 additions and 11 deletions

View File

@ -138,6 +138,7 @@ public abstract class BaseActivity
if (!isTutor) { if (!isTutor) {
navigationView.findViewById(R.id.nav_profile).setVisibility(View.GONE); navigationView.findViewById(R.id.nav_profile).setVisibility(View.GONE);
drawerNavigationView.getMenu().setGroupVisible(R.id.drawer_group_tutor, false);
} }
} }
@ -275,14 +276,12 @@ public abstract class BaseActivity
RxSearchObservable.fromView(searchView) RxSearchObservable.fromView(searchView)
.map(String::toLowerCase) .map(String::toLowerCase)
.filter(t -> !t.trim().isEmpty())
.debounce(300, TimeUnit.MILLISECONDS) .debounce(300, TimeUnit.MILLISECONDS)
.distinctUntilChanged() .distinctUntilChanged()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(this::executeSearch); .subscribe(this::executeSearch);
return true; return true;
} }

View File

@ -182,12 +182,10 @@ public class LoginActivity extends AppCompatActivity {
Claim userId = jwt.getClaim("nameid"); Claim userId = jwt.getClaim("nameid");
Claim role = jwt.getClaim("http://schemas.microsoft.com/ws/2008/06/identity/claims/role"); Claim role = jwt.getClaim("http://schemas.microsoft.com/ws/2008/06/identity/claims/role");
if(Objects.requireNonNull(role.asString()).equals("Student")){ if(!Objects.requireNonNull(role.asString()).equals("Student")){
PrefUtils.storeIsTutor(getApplicationContext(), false); PrefUtils.storeIsTutor(getApplicationContext(), true);
} }
Log.e("LOGOWANIE",role.asString());
PrefUtils.storeIsLoggedIn(getApplicationContext(), true); PrefUtils.storeIsLoggedIn(getApplicationContext(), true);
PrefUtils.storeApiKey(getApplicationContext(), token); PrefUtils.storeApiKey(getApplicationContext(), token);
PrefUtils.storeUserId(getApplicationContext(), userId.asString()); PrefUtils.storeUserId(getApplicationContext(), userId.asString());

View File

@ -595,7 +595,7 @@ public class MapActivity extends BaseActivity
private void getUserFromApi(String userNameToSearch) { private void getUserFromApi(String userNameToSearch) {
disposable.add( disposable.add(
userService.apiUsersGet() userService.getAllTutors()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.map(tutors -> Stream.of(tutors).filter(t -> .map(tutors -> Stream.of(tutors).filter(t ->

View File

@ -103,7 +103,8 @@ public class SharingFragment extends PreferenceFragment {
locationLevelMapping.put(0, SharingLevel.PRESENCE.toString()); locationLevelMapping.put(0, SharingLevel.PRESENCE.toString());
locationLevelMapping.put(1, SharingLevel.APPROXIMATED.toString()); locationLevelMapping.put(1, SharingLevel.APPROXIMATED.toString());
locationLevelMapping.put(2, SharingLevel.EXACT.toString()); locationLevelMapping.put(2, SharingLevel.EXACT.toString());
locationLevelMapping.put(2, SharingLevel.MANUAL.toString()); locationLevelMapping.put(3, SharingLevel.MANUAL.toString());
statusMapping = new HashMap<Integer, String>(); statusMapping = new HashMap<Integer, String>();
statusMapping.put(0,"available"); statusMapping.put(0,"available");

View File

@ -9,7 +9,6 @@ import android.support.v7.app.AlertDialog;
import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -170,7 +169,7 @@ public class UsersListFragment extends Fragment {
private void fetchAllTutors() { private void fetchAllTutors() {
disposable.add( disposable.add(
userService.apiUsersGet() userService.getAllTutors()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.map(tutors -> { .map(tutors -> {

View File

@ -27,6 +27,9 @@ public interface UserService {
@GET("api/users") @GET("api/users")
Single <List<User>> apiUsersGet(); Single <List<User>> apiUsersGet();
@GET("api/users/tutors")
Single <List<User>> getAllTutors();
@POST("api/users") @POST("api/users")
Completable createUser(@Body User user); Completable createUser(@Body User user);