// Path: app/src/main/java/com/oklab/gitjourney/activities/AuthenticationActivity.java
// public class AuthenticationActivity extends AppCompatActivity {
//     private EditText passwordText;
//     private EditText loginText;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_authentication);
//         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//         setSupportActionBar(toolbar);
//         if (getSupportActionBar() != null) {
//             getSupportActionBar().setDisplayShowTitleEnabled(false);
//         }
//         passwordText = (EditText) findViewById(R.id.user_password);
//         loginText = (EditText) findViewById(R.id.user_id);
//         Button button = (Button) findViewById(R.id.buttonSignIn);
//         button.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View view) {
//                 String login = loginText.getText().toString();
//                 String password = passwordText.getText().toString();
//                 if (login == null || login.isEmpty() || password == null || password.isEmpty()) {
//                     Toast.makeText(getApplicationContext(), getBaseContext().getString(R.string.empty_login_password), Toast.LENGTH_SHORT).show();
//                 } else {
//                     new AuthenticationAsyncTask(AuthenticationActivity.this).execute(login, password);
//                 }
//             }
//         });
//     }
// }
// 
// Path: app/src/main/java/com/oklab/gitjourney/data/UserSessionData.java
// public class UserSessionData {
// 
//     private final String id;
//     private final String credentials;
//     private final String token;
//     private final String login;
// 
// 
//     public UserSessionData(String id, String credentials, String token, String login) {
//         this.id = id;
//         this.credentials = credentials;
//         this.token = token;
//         this.login = login;
//     }
// 
//     public static UserSessionData createUserSessionDataFromString(String data) {
//         if (data == null || data.isEmpty()) {
//             return null;
//         }
//         String[] array = data.split(";");
//         return new UserSessionData(array[0], array[1], array[2], array[3]);
//     }
// 
//     public String getLogin() {
//         return login;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public String getCredentials() {
//         return credentials;
//     }
// 
//     public String getToken() {
//         return token;
//     }
// 
//     @Override
//     public String toString() {
//         return id + ";" + credentials + ";" + token + ";" + login;
//     }
// }
// 
// Path: app/src/main/java/com/oklab/gitjourney/utils/Utils.java
// public final class Utils {
//     public static final String SHARED_PREF_NAME = "com.ok.lab.GitJourney";
//     public static final String DMY_DATE_FORMAT_PATTERN = "dd-MM-yyyy";
//     private static final int REQUEST_EXTERNAL_STORAGE = 1;
//     private static String[] PERMISSIONS_STORAGE = {
//             Manifest.permission.READ_EXTERNAL_STORAGE,
//             Manifest.permission.WRITE_EXTERNAL_STORAGE
//     };
// 
//     private Utils() {
// 
//     }
// 
//     public static void verifyStoragePermissions(Activity activity) {
//         // Check if we have write permission
//         int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
//         Log.e("TAG", "verifyStoragePermissions");
//         if (permission != PackageManager.PERMISSION_GRANTED) {
//             // We don't have permission so prompt the user
//             ActivityCompat.requestPermissions(
//                     activity,
//                     PERMISSIONS_STORAGE,
//                     REQUEST_EXTERNAL_STORAGE
//             );
//         }
//     }
// 
//     public static DateFormat createDateFormatterWithTimeZone(Context context, String pattern) {
//         SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
//         boolean timeZone = sharedPref.getBoolean("timezone_switch", true);
//         SimpleDateFormat formatter = new SimpleDateFormat(pattern, Locale.getDefault());
//         if (timeZone) {
//             formatter.setTimeZone(TimeZone.getDefault());
//         } else {
//             String customTimeZone = sharedPref.getString("timezone_list", TimeZone.getDefault().getID());
//             formatter.setTimeZone(TimeZone.getTimeZone(customTimeZone));
//         }
//         return formatter;
//     }
// 
//     public static String getStackTrace(Exception e) {
//         StringWriter writer = new StringWriter();
//         PrintWriter printer = new PrintWriter(writer);
//         e.printStackTrace(printer);
//         printer.close();
//         return writer.toString();
//     }
// }


import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.util.Log;
import com.oklab.gitjourney.R;
import com.oklab.gitjourney.activities.AuthenticationActivity;
import com.oklab.gitjourney.data.UserSessionData;
import com.oklab.gitjourney.utils.Utils;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
            connect.setRequestProperty("Authorization", authentication);
            connect.connect();
            int responseCode = connect.getResponseCode();

            Log.v(TAG, "responseCode = " + responseCode);
            if (responseCode == 204) {
                return true;
            }
        } catch (IOException e) {
            Log.v(TAG, "", e);
        }
        return false;
    }

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        SharedPreferences prefs = activity.getSharedPreferences(Utils.SHARED_PREF_NAME, 0);
        String sessionDataStr = prefs.getString("userSessionData", null);
        currentSessionData = UserSessionData.createUserSessionDataFromString(sessionDataStr);
    }

    @Override
    protected void onPostExecute(Boolean result) {
        super.onPostExecute(result);
        SharedPreferences prefs = activity.getSharedPreferences(Utils.SHARED_PREF_NAME, 0);
        SharedPreferences.Editor e = prefs.edit();
        e.remove("userSessionData");
        e.apply();
        Intent intent = new Intent(activity, AuthenticationActivity.class);
// Path: app/src/main/java/com/oklab/gitjourney/activities/AuthenticationActivity.java
// public class AuthenticationActivity extends AppCompatActivity {
//     private EditText passwordText;
//     private EditText loginText;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_authentication);
//         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//         setSupportActionBar(toolbar);
//         if (getSupportActionBar() != null) {
//             getSupportActionBar().setDisplayShowTitleEnabled(false);
//         }
//         passwordText = (EditText) findViewById(R.id.user_password);
//         loginText = (EditText) findViewById(R.id.user_id);
//         Button button = (Button) findViewById(R.id.buttonSignIn);
//         button.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View view) {
//                 String login = loginText.getText().toString();
//                 String password = passwordText.getText().toString();
//                 if (login == null || login.isEmpty() || password == null || password.isEmpty()) {
//                     Toast.makeText(getApplicationContext(), getBaseContext().getString(R.string.empty_login_password), Toast.LENGTH_SHORT).show();
//                 } else {
//                     new AuthenticationAsyncTask(AuthenticationActivity.this).execute(login, password);
//                 }
//             }
//         });
//     }
// }
// 
// Path: app/src/main/java/com/oklab/gitjourney/data/UserSessionData.java
// public class UserSessionData {
// 
//     private final String id;
//     private final String credentials;
//     private final String token;
//     private final String login;
// 
// 
//     public UserSessionData(String id, String credentials, String token, String login) {
//         this.id = id;
//         this.credentials = credentials;
//         this.token = token;
//         this.login = login;
//     }
// 
//     public static UserSessionData createUserSessionDataFromString(String data) {
//         if (data == null || data.isEmpty()) {
//             return null;
//         }
//         String[] array = data.split(";");
//         return new UserSessionData(array[0], array[1], array[2], array[3]);
//     }
// 
//     public String getLogin() {
//         return login;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public String getCredentials() {
//         return credentials;
//     }
// 
//     public String getToken() {
//         return token;
//     }
// 
//     @Override
//     public String toString() {
//         return id + ";" + credentials + ";" + token + ";" + login;
//     }
// }
// 
// Path: app/src/main/java/com/oklab/gitjourney/utils/Utils.java
// public final class Utils {
//     public static final String SHARED_PREF_NAME = "com.ok.lab.GitJourney";
//     public static final String DMY_DATE_FORMAT_PATTERN = "dd-MM-yyyy";
//     private static final int REQUEST_EXTERNAL_STORAGE = 1;
//     private static String[] PERMISSIONS_STORAGE = {
//             Manifest.permission.READ_EXTERNAL_STORAGE,
//             Manifest.permission.WRITE_EXTERNAL_STORAGE
//     };
// 
//     private Utils() {
// 
//     }
// 
//     public static void verifyStoragePermissions(Activity activity) {
//         // Check if we have write permission
//         int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
//         Log.e("TAG", "verifyStoragePermissions");
//         if (permission != PackageManager.PERMISSION_GRANTED) {
//             // We don't have permission so prompt the user
//             ActivityCompat.requestPermissions(
//                     activity,
//                     PERMISSIONS_STORAGE,
//                     REQUEST_EXTERNAL_STORAGE
//             );
//         }
//     }
// 
//     public static DateFormat createDateFormatterWithTimeZone(Context context, String pattern) {
//         SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
//         boolean timeZone = sharedPref.getBoolean("timezone_switch", true);
//         SimpleDateFormat formatter = new SimpleDateFormat(pattern, Locale.getDefault());
//         if (timeZone) {
//             formatter.setTimeZone(TimeZone.getDefault());
//         } else {
//             String customTimeZone = sharedPref.getString("timezone_list", TimeZone.getDefault().getID());
//             formatter.setTimeZone(TimeZone.getTimeZone(customTimeZone));
//         }
//         return formatter;
//     }
// 
//     public static String getStackTrace(Exception e) {
//         StringWriter writer = new StringWriter();
//         PrintWriter printer = new PrintWriter(writer);
//         e.printStackTrace(printer);
//         printer.close();
//         return writer.toString();
//     }
// }


// Path: app/src/main/java/com/oklab/gitjourney/asynctasks/DeleteUserAuthorizationAsyncTask.java
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.util.Log;
import com.oklab.gitjourney.R;
import com.oklab.gitjourney.activities.AuthenticationActivity;
import com.oklab.gitjourney.data.UserSessionData;
import com.oklab.gitjourney.utils.Utils;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

            connect.setRequestProperty("Authorization", authentication);
            connect.connect();
            int responseCode = connect.getResponseCode();

            Log.v(TAG, "responseCode = " + responseCode);
            if (responseCode == 204) {
                return true;
            }
        } catch (IOException e) {
            Log.v(TAG, "", e);
        }
        return false;
    }

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        SharedPreferences prefs = activity.getSharedPreferences(Utils.SHARED_PREF_NAME, 0);
        String sessionDataStr = prefs.getString("userSessionData", null);
        currentSessionData = UserSessionData.createUserSessionDataFromString(sessionDataStr);
    }

    @Override
    protected void onPostExecute(Boolean result) {
        super.onPostExecute(result);
        SharedPreferences prefs = activity.getSharedPreferences(Utils.SHARED_PREF_NAME, 0);
        SharedPreferences.Editor e = prefs.edit();
        e.remove("userSessionData");
        e.apply();
        Intent intent = new Intent(activity, AuthenticationActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);