Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Linux desktop platform #163

Closed
EchoEllet opened this issue Oct 31, 2023 · 13 comments · Fixed by #180
Closed

Add support for Linux desktop platform #163

EchoEllet opened this issue Oct 31, 2023 · 13 comments · Fixed by #180
Assignees
Labels
✨ feature New feature

Comments

@EchoEllet
Copy link
Contributor

Proposal

Hi, currently this plugin doesn't have support for Linux, if the maintainers of this repository are interested in adding support for Linux I can do that soon but I need to know if they are interested first

Usually, we do things in Linux in the command line for better support for all distros and it already maintained by open source community

but to execute the commands there are two places

  1. Either by checking if the platform is Linux and then executing them in dart code directly without having to use method channel (I prefer this way)
  2. Execute the commands in the method channel in the native plugin

Both will get the job done but I need to know which way the maintainers of this repository prefer to use

once I get a response I will start working on this as soon as I can

Use case

Linux support

@EchoEllet EchoEllet added ✨ feature New feature 👀 in triage This issue or pull request is in triage labels Oct 31, 2023
@natsuk4ze
Copy link
Owner

Thank you for your contribution @freshtechtips 🤝

Currently, I am reluctant to add Linux to the support of this plugin.
The reason is the lack of maintainers who are knowledgeable about Linux and capable of ongoing maintenance.

If we do support Linux, we will not add any code or dependencies on the Dart side. Instead, we believe that everything should be handled on the native side.

@EchoEllet
Copy link
Contributor Author

EchoEllet commented Nov 1, 2023

Thank you for your contribution @freshtechtips 🤝

Currently, I am reluctant to add Linux to the support of this plugin.
The reason is the lack of maintainers who are knowledgeable about Linux and capable of ongoing maintenance.

If we do support Linux, we will not add any code or dependencies on the Dart side. Instead, we believe that everything should be handled on the native side.

Thank you for the reply, I understand your concern, but the most efficient way to add support for linux is to use the command line as the dependencies on Linux in the command lind is already maintained for you for different distros

By the command line, I mean Linux dependencies like wget, which is a command or executable can be used in the command line in Linux and that is how things works in Linux this is why I did it this why, moving the logic to native side is not necessary as we will not use anything on the native side and it just make the process slower

If you mean I did add packages

The meta package most of it is already part of flutter, but I can remove it if you want

parh package I can remove it and create a solution from acratch

It's really unnecessary to make a call using a method channel and then use the command line in native code

I can test the code on different distros

@EchoEllet
Copy link
Contributor Author

Thank you for your contribution @freshtechtips 🤝

Currently, I am reluctant to add Linux to the support of this plugin.
The reason is the lack of maintainers who are knowledgeable about Linux and capable of ongoing maintenance.

If we do support Linux, we will not add any code or dependencies on the Dart side. Instead, we believe that everything should be handled on the native side.

If you want to test the code

You can use something like VirtualBox

Install any distro and test gal on it in any flutter project

You can also check the pull request code and tell me if there is anything spesefic to Linux that you don't know just in case so I explain it and why we did it this way

@natsuk4ze
Copy link
Owner

I understand that you are not adding native code. @freshtechtips

  1. do not add new dependencies to pubspec.yaml.
  2. putting the Linux folder at the top level, like darwin and android.
  3. a detailed description of how you plan to design and implement it.

Are these three possible for you?

However, adding a new platform means semi-permanent support, and we believe that we should be very cautious, especially in a project like this plugin, which is small and has few contributors.

The main problem is that I have absolutely no knowledge of Linux 😅

Therefore, please understand that the review process can take quite some time and may result in rejection.

@EchoEllet
Copy link
Contributor Author

I understand that you are not adding native code. @freshtechtips

  1. do not add new dependencies to pubspec.yaml.
  2. putting the Linux folder at the top level, like darwin and android.
  3. a detailed description of how you plan to design and implement it.

Are these three possible for you?

However, adding a new platform means semi-permanent support, and we believe that we should be very cautious, especially in a project like this plugin, which is small and has few contributors.

The main problem is that I have absolutely no knowledge of Linux 😅

Therefore, please understand that the review process can take quite some time and may result in rejection.

The first and last are possible, the second, it's just implementation for linux but in dart since we are executing commands in the command line in dart code so it's impossible to move that to different place but don't worry the linux folder is just a name I can rename it or delete it and put the dart file directly

@EchoEllet
Copy link
Contributor Author

I understand that you are not adding native code. @freshtechtips

  1. do not add new dependencies to pubspec.yaml.
  2. putting the Linux folder at the top level, like darwin and android.
  3. a detailed description of how you plan to design and implement it.

Are these three possible for you?

However, adding a new platform means semi-permanent support, and we believe that we should be very cautious, especially in a project like this plugin, which is small and has few contributors.

The main problem is that I have absolutely no knowledge of Linux 😅

Therefore, please understand that the review process can take quite some time and may result in rejection.

platform

The details are simple, Linux doesn't have a specific framework to do things on the system since it has many distros and some of them work a little bit differently, unlike Darwin or Apple ecosystem

So we have to use the terminal and run commands in the dart code directly,
There is no album in Linux but there are Pictures and Videos in the home directory

So we create a new album in the pictures or videos if the developer wants to put the image or video in an album if he doesn't want that then we will use the temp directory instead, notice that we are always using Unix commands like cp, rm, wget to make sure 100% the code will work on any distros and has nothing to do with dart code

we are using the dart:io only in one case in putImageBytes we will get the new location and write the file easily, Linux we have access to the pictures and photos just like Linux but it is hard to say since there are sandbox-like flatpack that will make the security even better than macOS, unfortunately, we can't handle that case but don't worry as soon we trying to access the pictures or album it will request permission directly easily

The reason why the pull request in draft state since I'm planning on test the plugin on different Linux distros and I will today, I will also trying to support more features as much as I can, I will make sure to fix the bugs that if there are any and then I will make it ready to be merged or rejected

I think it's better if we move the conversation to the pull request but it doesn't make difference to me

@natsuk4ze
Copy link
Owner

I think it's better if we move the conversation to the pull request

OK

@natsuk4ze
Copy link
Owner

We might investigate whether we must always write native code.

https://docs.flutter.dev/packages-and-plugins/developing-packages#dart-only-platform-implementations

One thing for sure, we want to avoid as much as possible adding code just for a specific platform under the lib.

@EchoEllet
Copy link
Contributor Author

We might investigate whether we must always write native code.

https://docs.flutter.dev/packages-and-plugins/developing-packages#dart-only-platform-implementations

One thing for sure, we want to avoid as much as possible adding code just for a specific platform under the lib.

Good idea!! We just need to take the implementation from the previous PR and test it and that's all

@EchoEllet
Copy link
Contributor Author

We might investigate whether we must always write native code.

https://docs.flutter.dev/packages-and-plugins/developing-packages#dart-only-platform-implementations

One thing for sure, we want to avoid as much as possible adding code just for a specific platform under the lib.

The platform interface, I don't think we have a separate package for that

We need something like

gal_platform_interface

Before we can continue

@natsuk4ze
Copy link
Owner

Since this is a small plugin, it would appear that splitting the package into separate packages for each platform would only make maintenance more difficult.

I am investigating how to organize the code for the Linux platform into a linux folder as well as the other platforms.

I understand that this is possible with native code, but if it could be done with Dart it would be ideal.

My concern is that Dart may not be able to handle the detailed Linux specifications.
For example, error handling, permissions, etc.

@EchoEllet
Copy link
Contributor Author

Since this is a small plugin, it would appear that splitting the package into separate packages for each platform would only make maintenance more difficult.

I am investigating how to organize the code for the Linux platform into a Linux folder as well as the other platforms.

I understand that this is possible with native code, but if it could be done with Dart it would be ideal.

My concern is that Dart may not be able to handle the detailed Linux specifications. For example, error handling, permissions, etc.

Don't worry, dart is not able to handle Linux Linux specifications but we can still use the command line which is more efficient, we just needs dart:io and that's all

@EchoEllet
Copy link
Contributor Author

Since this is a small plugin, it would appear that splitting the package into separate packages for each platform would only make maintenance more difficult.

I am investigating how to organize the code for the Linux platform into a linux folder as well as the other platforms.

I understand that this is possible with native code, but if it could be done with Dart it would be ideal.

My concern is that Dart may not be able to handle the detailed Linux specifications. For example, error handling, permissions, etc.

Let's keep the comments in the PR so we can track things easily, or if you can, let's chat in private

@natsuk4ze natsuk4ze removed the 👀 in triage This issue or pull request is in triage label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature New feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants