mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-23 04:09:52 +00:00
Change ip api url
This commit is contained in:
@@ -41,7 +41,7 @@ public interface FoodApiToken {
|
||||
|
||||
FoodApiToken apiService = new Retrofit.Builder()
|
||||
.client(client)
|
||||
.baseUrl("http://10.0.2.2:8080/api/").addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.baseUrl("http://192.168.1.183:8080/api/").addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build()
|
||||
.create(FoodApiToken.class);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
// Check if user is signed in (non-null) and update UI accordingly.
|
||||
user = mAuth.getCurrentUser();
|
||||
if(user != null){
|
||||
if(user != null && Common.CURRENT_USER == null){
|
||||
user.getIdToken(true)
|
||||
.addOnCompleteListener(new OnCompleteListener<GetTokenResult>() {
|
||||
@Override
|
||||
@@ -96,10 +96,12 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
bottomNavigation();
|
||||
}
|
||||
|
||||
private void initComponent() {
|
||||
bottomNavigationView = findViewById(R.id.bottom_nav);
|
||||
viewPager2 = findViewById(R.id.viewPager);
|
||||
}
|
||||
|
||||
private void bottomNavigation() {
|
||||
viewPagerAdapter = new ViewPagerAdapter(this);
|
||||
viewPager2.setAdapter(viewPagerAdapter);
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.capstone.foodify.API.FoodApi;
|
||||
import com.capstone.foodify.API.FoodApiToken;
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.Model.User;
|
||||
import com.capstone.foodify.R;
|
||||
@@ -168,6 +169,23 @@ public class SignInActivity extends AppCompatActivity {
|
||||
if(task.isSuccessful()){
|
||||
Common.TOKEN = task.getResult().getToken();
|
||||
|
||||
//Get user from database
|
||||
FoodApiToken.apiService.getUserFromEmail(user.getEmail()).enqueue(new Callback<User>() {
|
||||
@Override
|
||||
public void onResponse(Call<User> call, Response<User> response) {
|
||||
User userData = response.body();
|
||||
if(userData != null){
|
||||
Common.CURRENT_USER = userData;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<User> call, Throwable t) {
|
||||
System.out.println("ERROR: " + t);
|
||||
Common.showErrorServerNotification(SignInActivity.this);
|
||||
}
|
||||
});
|
||||
|
||||
//Dismiss progress bar
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class HomeFragment extends Fragment {
|
||||
menuAdapter = new MenuAdapter(getContext());
|
||||
recyclerView_restaurant = view.findViewById(R.id.recycler_view_restaurant);
|
||||
shopAdapter = new ShopAdapter(getContext());
|
||||
progressLayout = view.findViewById(R.id.progress_layout);
|
||||
progressLayout = getActivity().findViewById(R.id.progress_layout);
|
||||
|
||||
|
||||
if(listFood.isEmpty() || recentFood.isEmpty()){
|
||||
|
||||
Reference in New Issue
Block a user