mirror of
https://github.com/rainloreley/shlink-manager.git
synced 2024-11-23 02:13:01 +01:00
added share sheet intent
This commit is contained in:
parent
591713a444
commit
4dcce26caf
|
@ -8,6 +8,7 @@
|
|||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="https" />
|
||||
</intent>
|
||||
|
||||
</queries>
|
||||
<application
|
||||
android:label="Shlink Manager"
|
||||
|
@ -33,17 +34,11 @@
|
|||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ProcessURLActivity"
|
||||
android:label="Shorten URL"
|
||||
android:exported="true"
|
||||
android:theme="@android:style/Theme.NoDisplay"
|
||||
tools:targetApi="cupcake">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PROCESS_TEXT" />
|
||||
<data android:mimeType="text/plain"/>
|
||||
<intent-filter
|
||||
android:label="Create Short URL">
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="text/*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ class ShortURL {
|
|||
domain = json["domain"],
|
||||
title = json["title"],
|
||||
crawlable = json["crawlable"];
|
||||
|
||||
/// Returns an empty class of [ShortURL]
|
||||
ShortURL.empty()
|
||||
: shortCode = "",
|
||||
shortUrl = "",
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_sharing_intent/flutter_sharing_intent.dart';
|
||||
import 'package:flutter_sharing_intent/model/sharing_file.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
import 'package:shlink_app/API/Classes/ShlinkStats/shlink_stats.dart';
|
||||
import 'package:shlink_app/API/server_manager.dart';
|
||||
import 'package:shlink_app/views/short_url_edit_view.dart';
|
||||
import 'package:shlink_app/views/url_list_view.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
import '../API/Classes/ShortURL/short_url.dart';
|
||||
import '../globals.dart' as globals;
|
||||
|
||||
|
@ -22,15 +27,33 @@ class _HomeViewState extends State<HomeView> {
|
|||
bool _qrCodeShown = false;
|
||||
String _qrUrl = "";
|
||||
|
||||
late StreamSubscription _intentDataStreamSubscription;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
initializeActionProcessText();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
loadAllData();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> initializeActionProcessText() async {
|
||||
_intentDataStreamSubscription = FlutterSharingIntent.instance
|
||||
.getMediaStream().listen(_handleIntentUrl);
|
||||
|
||||
FlutterSharingIntent.instance.getInitialSharing().then(_handleIntentUrl);
|
||||
}
|
||||
|
||||
Future<void> _handleIntentUrl(List<SharedFile> value) async {
|
||||
String inputUrlText = value.firstOrNull?.value ?? "";
|
||||
if (await canLaunchUrlString(inputUrlText)) {
|
||||
await Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) => ShortURLEditView(longUrl: inputUrlText)));
|
||||
await loadAllData();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> loadAllData() async {
|
||||
await loadShlinkStats();
|
||||
await loadRecentShortUrls();
|
||||
|
|
|
@ -7,9 +7,10 @@ import 'package:shlink_app/API/server_manager.dart';
|
|||
import '../globals.dart' as globals;
|
||||
|
||||
class ShortURLEditView extends StatefulWidget {
|
||||
const ShortURLEditView({super.key, this.shortUrl});
|
||||
const ShortURLEditView({super.key, this.shortUrl, this.longUrl});
|
||||
|
||||
final ShortURL? shortUrl;
|
||||
final String? longUrl;
|
||||
|
||||
@override
|
||||
State<ShortURLEditView> createState() => _ShortURLEditViewState();
|
||||
|
@ -43,6 +44,9 @@ class _ShortURLEditViewState extends State<ShortURLEditView>
|
|||
duration: const Duration(milliseconds: 500),
|
||||
);
|
||||
loadExistingUrl();
|
||||
if (widget.longUrl != null) {
|
||||
longUrlController.text = widget.longUrl!;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
|
85
pubspec.lock
85
pubspec.lock
|
@ -109,10 +109,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: dynamic_color
|
||||
sha256: a866f1f8947bfdaf674d7928e769eac7230388a2e7a2542824fad4bb5b87be3b
|
||||
sha256: eae98052fa6e2826bdac3dd2e921c6ce2903be15c6b7f8b6d8a5d49b5086298d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.6.9"
|
||||
version: "1.7.0"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -145,20 +145,19 @@ packages:
|
|||
flutter_launcher_icons:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
path: "."
|
||||
ref: "feat/monochrome-icons-support"
|
||||
resolved-ref: "1902eba83da89b0350a70672ac7c963cd995e017"
|
||||
url: "https://github.com/OutdatedGuy/flutter_launcher_icons.git"
|
||||
source: git
|
||||
name: flutter_launcher_icons
|
||||
sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.13.1"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7
|
||||
sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "3.0.2"
|
||||
flutter_process_text:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -171,10 +170,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_secure_storage
|
||||
sha256: "22dbf16f23a4bcf9d35e51be1c84ad5bb6f627750565edd70dab70f3ff5fff8f"
|
||||
sha256: ffdbb60130e4665d2af814a0267c481bcf522c41ae2e43caf69fa0146876d685
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.1.0"
|
||||
version: "9.0.0"
|
||||
flutter_secure_storage_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -211,10 +210,18 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: flutter_secure_storage_windows
|
||||
sha256: "38f9501c7cb6f38961ef0e1eacacee2b2d4715c63cc83fe56449c4d3d0b47255"
|
||||
sha256: "5809c66f9dd3b4b93b0a6e2e8561539405322ee767ac2f64d084e2ab5429d108"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "3.0.0"
|
||||
flutter_sharing_intent:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_sharing_intent
|
||||
sha256: "785ffc391822641457f930eb477c91c2f598a888f50b8fbb40d481ee01c7e719"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
|
@ -229,10 +236,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: http
|
||||
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
|
||||
sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.13.6"
|
||||
version: "1.1.0"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -245,18 +252,18 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: image
|
||||
sha256: "004a2e90ce080f8627b5a04aecb4cdfac87d2c3f3b520aa291260be5a32c033d"
|
||||
sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.4"
|
||||
version: "4.1.7"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: intl
|
||||
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
||||
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.18.1"
|
||||
version: "0.19.0"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -277,10 +284,10 @@ packages:
|
|||
dependency: "direct dev"
|
||||
description:
|
||||
name: license_generator
|
||||
sha256: "147605cac9b1ca9ab7f52ed235498927fe7a9edaef56d1b4687f22b9b03f6bad"
|
||||
sha256: "0b111c03cbccfa36a68a8738e3b2a54392a269673b5258d5fc6a83302d675a9e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
version: "2.0.0"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -337,6 +344,30 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.3"
|
||||
path_provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider
|
||||
sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
path_provider_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.2"
|
||||
path_provider_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_foundation
|
||||
sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -538,18 +569,18 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: e8f2efc804810c0f2f5b485f49e7942179f56eabcfe81dce3387fec4bb55876b
|
||||
sha256: c512655380d241a337521703af62d2c122bf7b77a46ff7dd750092aa9433499c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.9"
|
||||
version: "6.2.4"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f"
|
||||
sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.2.2"
|
||||
version: "6.3.0"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -578,10 +609,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_platform_interface
|
||||
sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f
|
||||
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.1"
|
||||
version: "2.3.2"
|
||||
url_launcher_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
13
pubspec.yaml
13
pubspec.yaml
|
@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||
version: 1.1.1+7
|
||||
|
||||
environment:
|
||||
sdk: ^2.19.0
|
||||
sdk: ^3.0.0
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
@ -31,22 +31,23 @@ dependencies:
|
|||
#
|
||||
|
||||
cupertino_icons: ^1.0.5
|
||||
http: ^0.13.6
|
||||
http: ^1.1.0
|
||||
flutter_process_text: ^1.1.2
|
||||
flutter_secure_storage: ^8.0.0
|
||||
flutter_secure_storage: ^9.0.0
|
||||
dartz: ^0.10.1
|
||||
qr_flutter: ^4.1.0
|
||||
tuple: ^2.0.2
|
||||
intl: ^0.18.1
|
||||
intl: ^0.19.0
|
||||
dynamic_color: ^1.6.6
|
||||
url_launcher: 6.1.9
|
||||
url_launcher: ^6.2.4
|
||||
package_info_plus: ^4.0.2
|
||||
shared_preferences: ^2.2.2
|
||||
flutter_sharing_intent: ^1.1.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
license_generator: ^1.0.5
|
||||
license_generator: ^2.0.0
|
||||
flutter_launcher_icons: ^0.13.1
|
||||
|
||||
flutter_lints: ^3.0.1
|
||||
|
|
Loading…
Reference in New Issue
Block a user