Skip to content

[Clipboard] setData and getData implementations added #76

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

Merged

Conversation

pkosko
Copy link

@pkosko pkosko commented Apr 27, 2021

Clipboard.getData, Clipboard.setData implementation part of https://github.sec.samsung.net/f-project/home/issues/35
This PR adds naive implementation using no platform specific APIs to share system clipboard. Because of internal issues of CBHM API, which causes not deterministic behaviour of API flow and missing native support on non-mobile profiles I decided to provide simple implementation for only sharing some clipboard data inside application.

As Clipboard.hasStrings() API is not described in docs https://api.flutter.dev/flutter/services/Clipboard-class.html, I removed part for handling such message.

[Before] Clipboard.setData and Clipboard.getData features were not implemented

[After] Naive implementation of clipboard shared only inside Flutter application
and only via Clipboard API. Such decision was done because of supporting partial
functionality on all profiles. CBHM API is supported only on mobile and currently
it is not possible to support it in other way.

Dart code below is able to set/get internal clipboard data:

      ClipboardData cd = ClipboardData(text: 'some text');
      Clipboard.setData(cd);

      Future<ClipboardData?> d = Clipboard.getData(Clipboard.kTextPlain);
      void dataCallback(ClipboardData? d) {
        if (d != null) {
          String? text = d.text;
          if(text != null) {
            print("Clipboard data $text");
          }
        }
      }
      d.then(dataCallback);

@pkosko pkosko requested review from rwalczyna and pwasowski2 April 27, 2021 09:54
and also removed code for hasStrings, as this API is not present in documentation.

[Before] Clipboard.setData and Clipboard.getData feature was not implemented

[After] Naive implementation of clipboard shared only inside Flutter application
and only via Clipboard API. Such decision was done because of supporting partial
functionality on all profiles. CBHM API is supported only on mobile and currently
it is not possible to support it in other way.

Dart code below is able to set/get internal clipboard data:
      ClipboardData cd = ClipboardData(text: 'some text');
      Clipboard.setData(cd);

      Future<ClipboardData?> d = Clipboard.getData(Clipboard.kTextPlain);
      void dataCallback(ClipboardData? d) {
        if (d != null) {
          String? text = d.text;
          if(text != null) {
            print("Clipboard data $text");
          }
        }
      }
      d.then(dataCallback);
@pkosko pkosko force-pushed the clipboard_getData_v2 branch from d960717 to 9d4d636 Compare April 27, 2021 10:52
@pkosko pkosko marked this pull request as ready for review April 27, 2021 11:56
* Removed unnecessary mutex
* Cleaned temporary logs
@pkosko pkosko requested a review from rwalczyna April 29, 2021 11:35
@rwalczyna
Copy link

Please rebase.

@swift-kim swift-kim merged commit af68221 into flutter-tizen:flutter-2.0.1-tizen May 11, 2021
@pkosko pkosko mentioned this pull request May 12, 2021
12 tasks
swift-kim pushed a commit that referenced this pull request Jun 7, 2021
* [Clipboard] setData and getData implementations added

and also removed code for hasStrings, as this API is not present in documentation.

[Before] Clipboard.setData and Clipboard.getData feature was not implemented

[After] Naive implementation of clipboard shared only inside Flutter application
and only via Clipboard API. Such decision was done because of supporting partial
functionality on all profiles. CBHM API is supported only on mobile and currently
it is not possible to support it in other way.

Dart code below is able to set/get internal clipboard data:
      ClipboardData cd = ClipboardData(text: 'some text');
      Clipboard.setData(cd);

      Future<ClipboardData?> d = Clipboard.getData(Clipboard.kTextPlain);
      void dataCallback(ClipboardData? d) {
        if (d != null) {
          String? text = d.text;
          if(text != null) {
            print("Clipboard data $text");
          }
        }
      }
      d.then(dataCallback);

* [Clipboard] Fixes after review

* Removed unnecessary mutex
* Cleaned temporary logs
swift-kim pushed a commit that referenced this pull request Sep 27, 2021
* [Clipboard] setData and getData implementations added

and also removed code for hasStrings, as this API is not present in documentation.

[Before] Clipboard.setData and Clipboard.getData feature was not implemented

[After] Naive implementation of clipboard shared only inside Flutter application
and only via Clipboard API. Such decision was done because of supporting partial
functionality on all profiles. CBHM API is supported only on mobile and currently
it is not possible to support it in other way.

Dart code below is able to set/get internal clipboard data:
      ClipboardData cd = ClipboardData(text: 'some text');
      Clipboard.setData(cd);

      Future<ClipboardData?> d = Clipboard.getData(Clipboard.kTextPlain);
      void dataCallback(ClipboardData? d) {
        if (d != null) {
          String? text = d.text;
          if(text != null) {
            print("Clipboard data $text");
          }
        }
      }
      d.then(dataCallback);

* [Clipboard] Fixes after review

* Removed unnecessary mutex
* Cleaned temporary logs
swift-kim pushed a commit that referenced this pull request Nov 14, 2021
* [Clipboard] setData and getData implementations added

and also removed code for hasStrings, as this API is not present in documentation.

[Before] Clipboard.setData and Clipboard.getData feature was not implemented

[After] Naive implementation of clipboard shared only inside Flutter application
and only via Clipboard API. Such decision was done because of supporting partial
functionality on all profiles. CBHM API is supported only on mobile and currently
it is not possible to support it in other way.

Dart code below is able to set/get internal clipboard data:
      ClipboardData cd = ClipboardData(text: 'some text');
      Clipboard.setData(cd);

      Future<ClipboardData?> d = Clipboard.getData(Clipboard.kTextPlain);
      void dataCallback(ClipboardData? d) {
        if (d != null) {
          String? text = d.text;
          if(text != null) {
            print("Clipboard data $text");
          }
        }
      }
      d.then(dataCallback);

* [Clipboard] Fixes after review

* Removed unnecessary mutex
* Cleaned temporary logs
swift-kim pushed a commit that referenced this pull request Dec 9, 2021
* [Clipboard] setData and getData implementations added

and also removed code for hasStrings, as this API is not present in documentation.

[Before] Clipboard.setData and Clipboard.getData feature was not implemented

[After] Naive implementation of clipboard shared only inside Flutter application
and only via Clipboard API. Such decision was done because of supporting partial
functionality on all profiles. CBHM API is supported only on mobile and currently
it is not possible to support it in other way.

Dart code below is able to set/get internal clipboard data:
      ClipboardData cd = ClipboardData(text: 'some text');
      Clipboard.setData(cd);

      Future<ClipboardData?> d = Clipboard.getData(Clipboard.kTextPlain);
      void dataCallback(ClipboardData? d) {
        if (d != null) {
          String? text = d.text;
          if(text != null) {
            print("Clipboard data $text");
          }
        }
      }
      d.then(dataCallback);

* [Clipboard] Fixes after review

* Removed unnecessary mutex
* Cleaned temporary logs
swift-kim pushed a commit that referenced this pull request Dec 17, 2021
and also removed code for hasStrings, as this API is not present in documentation.

[Before] Clipboard.setData and Clipboard.getData feature was not implemented

[After] Naive implementation of clipboard shared only inside Flutter application
and only via Clipboard API. Such decision was done because of supporting partial
functionality on all profiles. CBHM API is supported only on mobile and currently
it is not possible to support it in other way.

Dart code below is able to set/get internal clipboard data:
      ClipboardData cd = ClipboardData(text: 'some text');
      Clipboard.setData(cd);

      Future<ClipboardData?> d = Clipboard.getData(Clipboard.kTextPlain);
      void dataCallback(ClipboardData? d) {
        if (d != null) {
          String? text = d.text;
          if(text != null) {
            print("Clipboard data $text");
          }
        }
      }
      d.then(dataCallback);
swift-kim pushed a commit that referenced this pull request Feb 7, 2022
and also removed code for hasStrings, as this API is not present in documentation.

[Before] Clipboard.setData and Clipboard.getData feature was not implemented

[After] Naive implementation of clipboard shared only inside Flutter application
and only via Clipboard API. Such decision was done because of supporting partial
functionality on all profiles. CBHM API is supported only on mobile and currently
it is not possible to support it in other way.

Dart code below is able to set/get internal clipboard data:
      ClipboardData cd = ClipboardData(text: 'some text');
      Clipboard.setData(cd);

      Future<ClipboardData?> d = Clipboard.getData(Clipboard.kTextPlain);
      void dataCallback(ClipboardData? d) {
        if (d != null) {
          String? text = d.text;
          if(text != null) {
            print("Clipboard data $text");
          }
        }
      }
      d.then(dataCallback);
swift-kim pushed a commit that referenced this pull request Feb 11, 2022
and also removed code for hasStrings, as this API is not present in documentation.

[Before] Clipboard.setData and Clipboard.getData feature was not implemented

[After] Naive implementation of clipboard shared only inside Flutter application
and only via Clipboard API. Such decision was done because of supporting partial
functionality on all profiles. CBHM API is supported only on mobile and currently
it is not possible to support it in other way.

Dart code below is able to set/get internal clipboard data:
      ClipboardData cd = ClipboardData(text: 'some text');
      Clipboard.setData(cd);

      Future<ClipboardData?> d = Clipboard.getData(Clipboard.kTextPlain);
      void dataCallback(ClipboardData? d) {
        if (d != null) {
          String? text = d.text;
          if(text != null) {
            print("Clipboard data $text");
          }
        }
      }
      d.then(dataCallback);
swift-kim pushed a commit that referenced this pull request May 12, 2022
and also removed code for hasStrings, as this API is not present in documentation.

[Before] Clipboard.setData and Clipboard.getData feature was not implemented

[After] Naive implementation of clipboard shared only inside Flutter application
and only via Clipboard API. Such decision was done because of supporting partial
functionality on all profiles. CBHM API is supported only on mobile and currently
it is not possible to support it in other way.

Dart code below is able to set/get internal clipboard data:
      ClipboardData cd = ClipboardData(text: 'some text');
      Clipboard.setData(cd);

      Future<ClipboardData?> d = Clipboard.getData(Clipboard.kTextPlain);
      void dataCallback(ClipboardData? d) {
        if (d != null) {
          String? text = d.text;
          if(text != null) {
            print("Clipboard data $text");
          }
        }
      }
      d.then(dataCallback);
swift-kim pushed a commit that referenced this pull request Aug 5, 2022
and also removed code for hasStrings, as this API is not present in documentation.

[Before] Clipboard.setData and Clipboard.getData feature was not implemented

[After] Naive implementation of clipboard shared only inside Flutter application
and only via Clipboard API. Such decision was done because of supporting partial
functionality on all profiles. CBHM API is supported only on mobile and currently
it is not possible to support it in other way.

Dart code below is able to set/get internal clipboard data:
      ClipboardData cd = ClipboardData(text: 'some text');
      Clipboard.setData(cd);

      Future<ClipboardData?> d = Clipboard.getData(Clipboard.kTextPlain);
      void dataCallback(ClipboardData? d) {
        if (d != null) {
          String? text = d.text;
          if(text != null) {
            print("Clipboard data $text");
          }
        }
      }
      d.then(dataCallback);
swift-kim pushed a commit that referenced this pull request Sep 1, 2022
swift-kim pushed a commit that referenced this pull request Sep 1, 2022
and also removed code for hasStrings, as this API is not present in documentation.

[Before] Clipboard.setData and Clipboard.getData feature was not implemented

[After] Naive implementation of clipboard shared only inside Flutter application
and only via Clipboard API. Such decision was done because of supporting partial
functionality on all profiles. CBHM API is supported only on mobile and currently
it is not possible to support it in other way.

Dart code below is able to set/get internal clipboard data:
      ClipboardData cd = ClipboardData(text: 'some text');
      Clipboard.setData(cd);

      Future<ClipboardData?> d = Clipboard.getData(Clipboard.kTextPlain);
      void dataCallback(ClipboardData? d) {
        if (d != null) {
          String? text = d.text;
          if(text != null) {
            print("Clipboard data $text");
          }
        }
      }
      d.then(dataCallback);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants