diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ebe3899d..d82c3bc7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Change the share button after opening to only share to Twitter + ## [1.1.0] - 2023-07-27 - Charge funding transaction on-chain fees upon receiving and inbound JIT Channel diff --git a/mobile/android/app/src/main/AndroidManifest.xml b/mobile/android/app/src/main/AndroidManifest.xml index 309b9963a..d710c648d 100644 --- a/mobile/android/app/src/main/AndroidManifest.xml +++ b/mobile/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,5 @@ @@ -30,6 +31,19 @@ + + + + + + + + + diff --git a/mobile/android/build.gradle b/mobile/android/build.gradle index 83ae22004..3cdaac958 100644 --- a/mobile/android/build.gradle +++ b/mobile/android/build.gradle @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/mobile/ios/Flutter/AppFrameworkInfo.plist b/mobile/ios/Flutter/AppFrameworkInfo.plist index 5429d7b05..7e0e2e4dc 100644 --- a/mobile/ios/Flutter/AppFrameworkInfo.plist +++ b/mobile/ios/Flutter/AppFrameworkInfo.plist @@ -22,5 +22,9 @@ 1.0 MinimumOSVersion 13.0 + LSApplicationQueriesSchemes + + twitter + diff --git a/mobile/lib/features/trade/trade_screen.dart b/mobile/lib/features/trade/trade_screen.dart index 42c89e5ed..6a2156798 100644 --- a/mobile/lib/features/trade/trade_screen.dart +++ b/mobile/lib/features/trade/trade_screen.dart @@ -22,6 +22,8 @@ import 'package:go_router/go_router.dart'; import 'package:provider/provider.dart'; import 'package:get_10101/util/constants.dart'; import 'package:share_plus/share_plus.dart'; +import 'package:social_share/social_share.dart'; +import 'dart:io' show Platform; import 'order_submission_status_dialog.dart'; @@ -383,7 +385,7 @@ class TradeScreen extends StatelessWidget { padding: const EdgeInsets.only(top: 20, left: 10, right: 10, bottom: 5), child: ElevatedButton( onPressed: () async { - await shareText(pendingOrder.positionAction); + await shareTweet(pendingOrder.positionAction); }, child: const Text("Share on Twitter")), )); @@ -392,9 +394,15 @@ class TradeScreen extends StatelessWidget { return body; } - Future shareText(PositionAction action) async { + Future shareTweet(PositionAction action) async { String actionStr = action == PositionAction.open ? "opened" : "closed"; - await Share.share( - "Just $actionStr a #selfcustodial position using #DLC with @get10101 🚀. The future of decentralised finance starts now! #Bitcoin"); + String shareText = + "Just $actionStr a #selfcustodial position using #DLC with @get10101 🚀. The future of decentralised finance starts now! #Bitcoin"; + + if (Platform.isAndroid || Platform.isIOS) { + await SocialShare.shareTwitter(shareText); + } else { + await Share.share(shareText); + } } } diff --git a/mobile/pubspec.lock b/mobile/pubspec.lock index c538b9f33..517d130d6 100644 --- a/mobile/pubspec.lock +++ b/mobile/pubspec.lock @@ -893,6 +893,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + social_share: + dependency: "direct main" + description: + name: social_share + sha256: eb19a0f6f5a29c7bb71e5bb1991145eb52472184363b6e2da70695befd8be041 + url: "https://pub.dev" + source: hosted + version: "2.3.1" source_gen: dependency: transitive description: diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml index 69807e7c0..393f25cee 100644 --- a/mobile/pubspec.yaml +++ b/mobile/pubspec.yaml @@ -32,6 +32,7 @@ dependencies: package_info_plus: ^4.0.2 uuid: ^3.0.7 confetti: ^0.7.0 + social_share: ^2.3.1 test: ^1.24.1 dev_dependencies: flutter_launcher_icons: ^0.13.1