package com.kaviz.heal.Activities;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebViewClient;
import android.widget.Toast;

import com.kaviz.heal.R;
import com.kaviz.heal.databinding.ActivityChatRobotBinding;

public class ChatRobotActivity extends AppCompatActivity {

    ActivityChatRobotBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityChatRobotBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        if (getSupportActionBar() != null) {

            getSupportActionBar().setTitle(getResources().getString(R.string.robot_solutions));

        }

        try {

            binding.webView.getSettings().setJavaScriptEnabled(true);
            binding.webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
            binding.webView.setWebViewClient(new WebViewClient());

            binding.webView.getSettings().setSaveFormData(true);
            binding.webView.getSettings().setSupportZoom(false);
            binding.webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
            binding.webView.getSettings().setPluginState(WebSettings.PluginState.ON);
            binding.webView.loadUrl("https://medibot-api.herokuapp.com/api/v1.0/?csrfmiddlewaretoken=uHTimuDB9kf1ljFD8cAMEEU514jWpWZBE85lzchmsUpE2P3n093p9I0HuTPjZjCL");

        } catch (Exception e) {

            Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();

        }

    }
}