Compare commits

...

4 Commits
0.5 ... main

Author SHA1 Message Date
zoe eff72ee74e add post deletion 2022-10-03 00:17:36 +02:00
zoe 6c1e8fca85 build for android 2022-10-02 09:55:02 +02:00
zoe 76e29ce7f5 make search button say search 2022-10-02 09:21:45 +02:00
zoe 25cf6e770e Update 'README.md' 2022-10-01 20:20:03 +00:00
7 changed files with 47 additions and 6 deletions

View File

@ -12,6 +12,6 @@ the best (soon)(i promise) fedi client for gotosocial and mastodon
- [x] content warnings
- [x] viewing profiles
- [x] viewing posts with full context
- [ ] search
- [ ] posting media attachments
- [ ] chat
- [x] search
- [x] posting media attachments
- [x] chat

1
android/app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1 @@
-keep class androidx.lifecycle.DefaultLifecycleObserver

View File

@ -103,3 +103,21 @@ Future<int> makeFullInteraction(
}
return await makeInteractionFromUrl(id, posturl, type);
}
Future<int> deletePost(PostModel model) async {
final identity = global.settings!.identities[model.identity]!;
final headers = {
...identity.getAuthHeaders(),
...global.defaultHeaders,
};
final uri = Uri(
scheme: "https",
host: identity.instanceUrl,
path: "/api/v1/statuses/${model.id}",
);
final response = await http.delete(uri, headers: headers);
return response.statusCode;
}

View File

@ -89,6 +89,9 @@
"unread": "unread",
"expand": "expand",
"requested-to-follow": "has requested to follow:",
"follow-requests": "follow requests"
"follow-requests": "follow requests",
"post-deleted": "post deleted",
"delete-this": "delete this",
"deletion-failed": "deletion failed"
}

View File

@ -68,7 +68,7 @@ class _MainScaffoldState extends State<MainScaffold> {
NavigationDestination(
icon: const Icon(Icons.forum), label: "timeline".i18n()),
NavigationDestination(
icon: const Icon(Icons.search), label: "chat".i18n()),
icon: const Icon(Icons.search), label: "search".i18n()),
NavigationDestination(
icon: Icon((unreadNotifs >= 1)
? Icons.notifications_active

View File

@ -18,7 +18,6 @@ class NameDisplay extends StatelessWidget {
String newtext = content;
newtext = newtext
.replaceAll("~", r"\~")
.replaceAll("_", r"\_")
.replaceAll("*", r"\*")
.replaceAll("[", r"\[")
.replaceAll("]", r"\]")

View File

@ -6,6 +6,7 @@ import 'package:loris/dialogues/full_post_view.dart';
import 'package:loris/partials/interaction_button.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:clipboard/clipboard.dart';
import 'package:loris/global.dart' as global;
void popupPostOptions(context, PostModel model) {
showModalBottomSheet(
@ -93,6 +94,7 @@ class _PostOptionsState extends State<PostOptions> {
"show-in-browser".i18n(),
),
),
widget.model.visibility.boostable
? InteractionButton(
model: widget.model,
@ -105,6 +107,24 @@ class _PostOptionsState extends State<PostOptions> {
type: InteractionType.favorite,
extended: true,
),
if ("${widget.model.account.acct}@${global.settings!.identities[widget.model.identity]!.instanceUrl}" ==
widget.model.identity)
TextButton.icon(
onPressed: () async {
final result = await deletePost(widget.model);
if (result == 200) {
// ignore: use_build_context_synchronously
Navigator.of(context).pop();
// ignore: use_build_context_synchronously
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("post-deleted".i18n())));
}
// ignore: use_build_context_synchronously
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("deletion-failed".i18n())));
},
icon: const Icon(Icons.delete),
label: Text("delete-this".i18n())),
const SizedBox(
height: 24,
),