// Path: src/org/kde/kdeconnect/UserInterface/DeviceSettingsAlertDialogFragment.java
// public class DeviceSettingsAlertDialogFragment extends AlertDialogFragment {
//     private static final String KEY_PLUGIN_KEY = "PluginKey";
//     private static final String KEY_DEVICE_ID = "DeviceId";
// 
//     private String pluginKey;
//     private String deviceId;
// 
//     public DeviceSettingsAlertDialogFragment() {}
// 
//     @Override
//     public void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
// 
//         Bundle args = getArguments();
// 
//         if (args == null || !args.containsKey(KEY_PLUGIN_KEY)) {
//             throw new RuntimeException("You must call Builder.setPluginKey() to set the plugin");
//         }
//         if (!args.containsKey(KEY_DEVICE_ID)) {
//             throw new RuntimeException("You must call Builder.setDeviceId() to set the device");
//         }
// 
//         pluginKey = args.getString(KEY_PLUGIN_KEY);
//         deviceId = args.getString(KEY_DEVICE_ID);
// 
//         setCallback(new Callback() {
//             @Override
//             public void onPositiveButtonClicked() {
//                 Intent intent = new Intent(requireActivity(), PluginSettingsActivity.class);
// 
//                 intent.putExtra(PluginSettingsActivity.EXTRA_DEVICE_ID, deviceId);
//                 intent.putExtra(PluginSettingsActivity.EXTRA_PLUGIN_KEY, pluginKey);
//                 requireActivity().startActivity(intent);
//             }
//         });
//     }
// 
//     public static class Builder extends AbstractBuilder<DeviceSettingsAlertDialogFragment.Builder, DeviceSettingsAlertDialogFragment> {
//         @Override
//         public DeviceSettingsAlertDialogFragment.Builder getThis() {
//             return this;
//         }
// 
//         public DeviceSettingsAlertDialogFragment.Builder setPluginKey(String pluginKey) {
//             args.putString(KEY_PLUGIN_KEY, pluginKey);
//             return getThis();
//         }
// 
//         public DeviceSettingsAlertDialogFragment.Builder setDeviceId(String deviceId) {
//             args.putString(KEY_DEVICE_ID, deviceId);
//             return getThis();
//         }
// 
//         @Override
//         protected DeviceSettingsAlertDialogFragment createFragment() {
//             return new DeviceSettingsAlertDialogFragment();
//         }
//     }
// }


import android.app.Activity;
import android.content.ContentResolver;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.util.Log;
import androidx.annotation.NonNull;
import org.json.JSONException;
import org.json.JSONObject;
import org.kde.kdeconnect.NetworkPacket;
import org.kde.kdeconnect.Plugins.Plugin;
import org.kde.kdeconnect.Plugins.PluginFactory;
import org.kde.kdeconnect.UserInterface.AlertDialogFragment;
import org.kde.kdeconnect.UserInterface.DeviceSettingsAlertDialogFragment;
import org.kde.kdeconnect.UserInterface.PluginSettingsFragment;
import org.kde.kdeconnect_tp.R;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
        return context.getResources().getString(R.string.pref_plugin_sftp_desc);
    }

    @Override
    public boolean onCreate() {
        try {
            server.init(context, device);

            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
                return SftpSettingsFragment.getStorageInfoList(context, this).size() != 0;
            }

            return true;
        } catch (Exception e) {
            Log.e("SFTP", "Exception in server.init()", e);
            return false;
        }
    }

    @Override
    public boolean checkOptionalPermissions() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            return SftpSettingsFragment.getStorageInfoList(context, this).size() != 0;
        }

        return true;
    }

    @Override
    public AlertDialogFragment getOptionalPermissionExplanationDialog() {
// Path: src/org/kde/kdeconnect/UserInterface/DeviceSettingsAlertDialogFragment.java
// public class DeviceSettingsAlertDialogFragment extends AlertDialogFragment {
//     private static final String KEY_PLUGIN_KEY = "PluginKey";
//     private static final String KEY_DEVICE_ID = "DeviceId";
// 
//     private String pluginKey;
//     private String deviceId;
// 
//     public DeviceSettingsAlertDialogFragment() {}
// 
//     @Override
//     public void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
// 
//         Bundle args = getArguments();
// 
//         if (args == null || !args.containsKey(KEY_PLUGIN_KEY)) {
//             throw new RuntimeException("You must call Builder.setPluginKey() to set the plugin");
//         }
//         if (!args.containsKey(KEY_DEVICE_ID)) {
//             throw new RuntimeException("You must call Builder.setDeviceId() to set the device");
//         }
// 
//         pluginKey = args.getString(KEY_PLUGIN_KEY);
//         deviceId = args.getString(KEY_DEVICE_ID);
// 
//         setCallback(new Callback() {
//             @Override
//             public void onPositiveButtonClicked() {
//                 Intent intent = new Intent(requireActivity(), PluginSettingsActivity.class);
// 
//                 intent.putExtra(PluginSettingsActivity.EXTRA_DEVICE_ID, deviceId);
//                 intent.putExtra(PluginSettingsActivity.EXTRA_PLUGIN_KEY, pluginKey);
//                 requireActivity().startActivity(intent);
//             }
//         });
//     }
// 
//     public static class Builder extends AbstractBuilder<DeviceSettingsAlertDialogFragment.Builder, DeviceSettingsAlertDialogFragment> {
//         @Override
//         public DeviceSettingsAlertDialogFragment.Builder getThis() {
//             return this;
//         }
// 
//         public DeviceSettingsAlertDialogFragment.Builder setPluginKey(String pluginKey) {
//             args.putString(KEY_PLUGIN_KEY, pluginKey);
//             return getThis();
//         }
// 
//         public DeviceSettingsAlertDialogFragment.Builder setDeviceId(String deviceId) {
//             args.putString(KEY_DEVICE_ID, deviceId);
//             return getThis();
//         }
// 
//         @Override
//         protected DeviceSettingsAlertDialogFragment createFragment() {
//             return new DeviceSettingsAlertDialogFragment();
//         }
//     }
// }


// Path: src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpPlugin.java
import android.app.Activity;
import android.content.ContentResolver;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.util.Log;
import androidx.annotation.NonNull;
import org.json.JSONException;
import org.json.JSONObject;
import org.kde.kdeconnect.NetworkPacket;
import org.kde.kdeconnect.Plugins.Plugin;
import org.kde.kdeconnect.Plugins.PluginFactory;
import org.kde.kdeconnect.UserInterface.AlertDialogFragment;
import org.kde.kdeconnect.UserInterface.DeviceSettingsAlertDialogFragment;
import org.kde.kdeconnect.UserInterface.PluginSettingsFragment;
import org.kde.kdeconnect_tp.R;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;

        return context.getResources().getString(R.string.pref_plugin_sftp_desc);
    }

    @Override
    public boolean onCreate() {
        try {
            server.init(context, device);

            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
                return SftpSettingsFragment.getStorageInfoList(context, this).size() != 0;
            }

            return true;
        } catch (Exception e) {
            Log.e("SFTP", "Exception in server.init()", e);
            return false;
        }
    }

    @Override
    public boolean checkOptionalPermissions() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            return SftpSettingsFragment.getStorageInfoList(context, this).size() != 0;
        }

        return true;
    }

    @Override
    public AlertDialogFragment getOptionalPermissionExplanationDialog() {
        return new DeviceSettingsAlertDialogFragment.Builder()