Share

This commit is contained in:
LittleSheep 2024-07-27 02:11:59 +08:00
parent f08c9903b4
commit 102df2ef1c
11 changed files with 75 additions and 8 deletions

View File

@ -143,6 +143,8 @@ PODS:
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.32.0)
- share_plus (0.0.1):
- Flutter
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
@ -176,6 +178,7 @@ DEPENDENCIES:
- protocol_handler_ios (from `.symlinks/plugins/protocol_handler_ios/ios`)
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- volume_controller (from `.symlinks/plugins/volume_controller/ios`)
@ -240,6 +243,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/screen_brightness_ios/ios"
sentry_flutter:
:path: ".symlinks/plugins/sentry_flutter/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/darwin"
url_launcher_ios:
@ -283,6 +288,7 @@ SPEC CHECKSUMS:
SDWebImage: 066c47b573f408f18caa467d71deace7c0f8280d
Sentry: 96ae1dcdf01a644bc3a3b1dc279cecaf48a833fb
sentry_flutter: f1d86adcb93a959bc47a40d8d55059bdf7569bc5
share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

View File

@ -6,6 +6,7 @@ import 'package:solian/providers/content/channel.dart';
import 'package:solian/providers/relation.dart';
import 'package:solian/providers/websocket.dart';
import 'package:solian/services.dart';
import 'package:solian/widgets/sized_container.dart';
class BootstrapperShell extends StatefulWidget {
final Widget child;
@ -129,12 +130,16 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
child: CircularProgressIndicator(strokeWidth: 3),
),
const SizedBox(height: 12),
Text(
_subtitle ??
'${_periods[_periodCursor].label.tr} (${_periodCursor + 1}/${_periods.length})',
style: TextStyle(
fontSize: 13,
color: _unFocusColor,
CenteredContainer(
maxWidth: 280,
child: Text(
_subtitle ??
'${_periods[_periodCursor].label.tr} (${_periodCursor + 1}/${_periods.length})',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 13,
color: _unFocusColor,
),
),
),
],

View File

@ -10,6 +10,7 @@ const messagesEnglish = {
'draft': 'Draft',
'draftSave': 'Save',
'draftBox': 'Draft Box',
'share': 'Share',
'feed': 'Feed',
'feedSearch': 'Search Feed',
'feedSearchWithTag': 'Searching with tag #@key',
@ -282,4 +283,6 @@ const messagesEnglish = {
'bsEstablishingConn': 'Establishing Connection',
'bsPreparingData': 'Preparing User Data',
'bsRegisteringPushNotify': 'Enabling Push Notifications',
'postShareContent': '@content\n\n@username on the Solar Network\nCheck it out: @link',
'postShareSubject': '@username posted a post on the Solar Network',
};

View File

@ -17,6 +17,7 @@ const simplifiedChineseMessages = {
'draft': '草稿',
'draftSave': '存为草稿',
'draftBox': '草稿箱',
'share': '分享',
'feed': '资讯',
'feedSearch': '搜索资讯',
'feedSearchWithTag': '检索带有 #@key 标签的资讯',
@ -261,4 +262,6 @@ const simplifiedChineseMessages = {
'bsEstablishingConn': '部署连接中',
'bsPreparingData': '正在准备用户资料',
'bsRegisteringPushNotify': '正在启用推送通知',
'postShareContent': '@content\n\n@username 在 Solar Network\n原帖地址:@link',
'postShareSubject': '@username 在 Solar Network 上发布了一篇帖子',
};

View File

@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart';
import 'package:share_plus/share_plus.dart';
import 'package:solian/exts.dart';
import 'package:solian/models/post.dart';
import 'package:solian/providers/auth.dart';
@ -66,6 +67,25 @@ class _PostActionState extends State<PostAction> {
Expanded(
child: ListView(
children: [
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
leading: const Icon(Icons.share),
title: Text('share'.tr),
onTap: () async {
await Share.share(
'postShareContent'.trParams({
'username': widget.item.author.nick,
'content': widget.item.body['text'],
'link':
'https://sn.solsynth.dev/posts/${widget.item.id}',
}),
subject: 'postShareSubject'.trParams({
'username': widget.item.author.nick,
}),
);
Navigator.pop(context);
},
),
if (!widget.noReact)
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
@ -109,7 +129,8 @@ class _PostActionState extends State<PostAction> {
: 'unpinPost'.tr,
),
onTap: () async {
final client = Get.find<AuthProvider>().configureClient('interactive');
final client = Get.find<AuthProvider>()
.configureClient('interactive');
await client.post('/posts/${widget.item.id}/pin', {});
Navigator.pop(context, true);
},

View File

@ -23,6 +23,7 @@ import path_provider_foundation
import protocol_handler_macos
import screen_brightness_macos
import sentry_flutter
import share_plus
import sqflite
import url_launcher_macos
import wakelock_plus
@ -46,6 +47,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ProtocolHandlerMacosPlugin.register(with: registry.registrar(forPlugin: "ProtocolHandlerMacosPlugin"))
ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin"))
SentryFlutterPlugin.register(with: registry.registrar(forPlugin: "SentryFlutterPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))

View File

@ -109,6 +109,8 @@ PODS:
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.32.0)
- share_plus (0.0.1):
- FlutterMacOS
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
@ -139,6 +141,7 @@ DEPENDENCIES:
- protocol_handler_macos (from `Flutter/ephemeral/.symlinks/plugins/protocol_handler_macos/macos`)
- screen_brightness_macos (from `Flutter/ephemeral/.symlinks/plugins/screen_brightness_macos/macos`)
- sentry_flutter (from `Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos`)
- share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
- wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`)
@ -198,6 +201,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/screen_brightness_macos/macos
sentry_flutter:
:path: Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos
share_plus:
:path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos
sqflite:
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin
url_launcher_macos:
@ -236,6 +241,7 @@ SPEC CHECKSUMS:
screen_brightness_macos: 2d6d3af2165592d9a55ffcd95b7550970e41ebda
Sentry: 96ae1dcdf01a644bc3a3b1dc279cecaf48a833fb
sentry_flutter: f1d86adcb93a959bc47a40d8d55059bdf7569bc5
share_plus: 36537c04ce0c3e3f5bd297ce4318b6d5ee5fd6cf
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399
wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269

View File

@ -1360,6 +1360,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.5.0"
share_plus:
dependency: "direct main"
description:
name: share_plus
sha256: ef3489a969683c4f3d0239010cc8b7a2a46543a8d139e111c06c558875083544
url: "https://pub.dev"
source: hosted
version: "9.0.0"
share_plus_platform_interface:
dependency: transitive
description:
name: share_plus_platform_interface
sha256: "0f9e4418835d1b2c3ae78fdb918251959106cefdbc4dd43526e182f80e82f6d4"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
shelf:
dependency: transitive
description:

View File

@ -2,7 +2,7 @@ name: solian
description: "The Solar Network App"
publish_to: "none"
version: 1.1.0+46
version: 1.1.0+47
environment:
sdk: ">=3.3.4 <4.0.0"
@ -55,6 +55,7 @@ dependencies:
badges: ^3.1.2
flutter_card_swiper: ^7.0.1
dismissible_page: ^1.0.2
share_plus: ^9.0.0
dev_dependencies:
flutter_test:

View File

@ -21,6 +21,7 @@
#include <protocol_handler_windows/protocol_handler_windows_plugin_c_api.h>
#include <screen_brightness_windows/screen_brightness_windows_plugin.h>
#include <sentry_flutter/sentry_flutter_plugin.h>
#include <share_plus/share_plus_windows_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
@ -54,6 +55,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("ScreenBrightnessWindowsPlugin"));
SentryFlutterPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SentryFlutterPlugin"));
SharePlusWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}

View File

@ -18,6 +18,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
protocol_handler_windows
screen_brightness_windows
sentry_flutter
share_plus
url_launcher_windows
)