Watch
1
0
Fork
You've already forked nexus
0
forked from Nexus/nexus

Compare commits

...
Sign in to create a new pull request.
6 changed files with 39 additions and 28 deletions

2
gomuks

@ -1 +1 @@
Subproject commit 9444dd293664c300c6e710bb6cddcd9c6cab365d Subproject commit 0e06c7b74f96d3e29a8101893ca1921d13a90573

View file

@ -2,6 +2,7 @@ import "dart:ffi";
import "dart:io"; import "dart:io";
import "dart:isolate"; import "dart:isolate";
import "dart:math"; import "dart:math";
import "package:fast_immutable_collections/fast_immutable_collections.dart"; import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:ffi/ffi.dart"; import "package:ffi/ffi.dart";
import "package:flutter/foundation.dart"; import "package:flutter/foundation.dart";
@ -261,8 +262,13 @@ class ClientController extends AsyncNotifier<int> {
Future<Paginate> paginate(PaginateRequest request) async => Future<Paginate> paginate(PaginateRequest request) async =>
.fromJson(await _sendCommand("paginate", request.toJson())); .fromJson(await _sendCommand("paginate", request.toJson()));
Future<ProfileResponse> getProfile(String userId) async => Future<ProfileResponse> getProfile(String userId) async {
.fromJson(await _sendCommand("get_profile", {"user_id": userId})); try {
return .fromJson(await _sendCommand("get_profile", {"user_id": userId}));
} catch (_) {
return ProfileResponse(profile: .new(id: userId));
}
}
Future<void> reportEvent(ReportRequest request) => Future<void> reportEvent(ReportRequest request) =>
_sendCommand("report_event", request.toJson()); _sendCommand("report_event", request.toJson());

View file

@ -9,7 +9,7 @@ part "profile_response.g.dart";
@JsonSerializable() @JsonSerializable()
class const ProfileResponse({ class const ProfileResponse({
@JsonKey(fromJson: Profile.fromJson) required final Profile profile, @JsonKey(fromJson: Profile.fromJson) required final Profile profile,
required final Bio? bio, final Bio? bio,
}) with _$ProfileResponse { }) with _$ProfileResponse {
Map<String, Object?> toJson() => _$ProfileResponseToJson(this); Map<String, Object?> toJson() => _$ProfileResponseToJson(this);

View file

@ -31,9 +31,15 @@ class const UrlPreview(final Uri link, {super.key}) extends ConsumerWidget {
Text( Text(
preview.title!, preview.title!,
style: Theme.of(context).textTheme.titleLarge, style: Theme.of(context).textTheme.titleLarge,
maxLines: 3,
overflow: .ellipsis,
), ),
if (preview.description != null) ...[ if (preview.description != null) ...[
Text(preview.description!), Text(
preview.description!,
maxLines: 20,
overflow: .ellipsis,
),
SizedBox(height: 4), SizedBox(height: 4),
], ],
if (preview.imageUrl != null) if (preview.imageUrl != null)

View file

@ -200,36 +200,35 @@ final class const UserBottomSheet(
), ),
if (ref.watch( if (ref.watch(
PowerLevelController.provider( PowerLevelController.provider(
.membershipAction( .membershipAction(
action: .kick, action: .kick,
roomId: roomId!, roomId: roomId!,
targetUser: userId, targetUser: userId,
), ),
), ),
) && ))
member.status == .join ||
member.status == .invite)
Padding( Padding(
padding: .only(top: 4), padding: .only(top: 4),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
spacing: 8, spacing: 8,
children: [ children: [
M3EButton.icon( if (member.status == .join || member.status == .invite)
onPressed: () => showMembershipDialog(.kick), M3EButton.icon(
shape: .square, onPressed: () => showMembershipDialog(.kick),
icon: Icon(Icons.sports_martial_arts), shape: .square,
label: Text("Kick"), icon: Icon(Icons.sports_martial_arts),
decoration: .new( label: Text("Kick"),
backgroundColor: WidgetStatePropertyAll( decoration: .new(
theme.colorScheme.error, backgroundColor: WidgetStatePropertyAll(
), theme.colorScheme.error,
foregroundColor: WidgetStatePropertyAll( ),
theme.colorScheme.onError, foregroundColor: WidgetStatePropertyAll(
theme.colorScheme.onError,
),
), ),
), ),
),
M3EButton.icon( M3EButton.icon(
onPressed: () => showMembershipDialog(.ban), onPressed: () => showMembershipDialog(.ban),

View file

@ -17,7 +17,7 @@ buildGoModule (
src = "${src}/gomuks"; src = "${src}/gomuks";
vendorHash = "sha256-C03ss88QAnmZu+XxoHhc1M/261xFl8hR/pzLbU37Qe8="; vendorHash = "sha256-9CS/lAVT8gLWACLomwcEa8YNlAXvBOskPPx4zERg0wQ=";
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild