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

Share to twitter only #899

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions mobile/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="finance.get10101.app">

<uses-permission android:name="android.permission.INTERNET" />
Expand Down Expand Up @@ -30,6 +31,19 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<!-- Used by social_share package -->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.com.shekarmudaliyar.social_share"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>

<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
Expand Down
4 changes: 4 additions & 0 deletions mobile/android/app/src/main/res/xml/filepaths.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<cache-path name="image" path="/"/>
</paths>
2 changes: 1 addition & 1 deletion mobile/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
4 changes: 4 additions & 0 deletions mobile/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>13.0</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>twitter</string>
</array>
</dict>
</plist>
16 changes: 12 additions & 4 deletions mobile/lib/features/trade/trade_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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")),
));
Expand All @@ -392,9 +394,15 @@ class TradeScreen extends StatelessWidget {
return body;
}

Future<void> shareText(PositionAction action) async {
Future<void> 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);
}
}
}
8 changes: 8 additions & 0 deletions mobile/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions mobile/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down