⬆️ Upgrade to support latest version of server
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_animate/flutter_animate.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:solian/providers/account.dart';
|
||||
import 'package:solian/providers/websocket.dart';
|
||||
import 'package:solian/providers/auth.dart';
|
||||
import 'package:solian/models/notification.dart' as notify;
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
@ -23,7 +23,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
|
||||
|
||||
setState(() => _isBusy = true);
|
||||
|
||||
final AccountProvider provider = Get.find();
|
||||
final WebSocketProvider provider = Get.find();
|
||||
|
||||
List<int> markList = List.empty(growable: true);
|
||||
for (final element in provider.notifications) {
|
||||
@ -32,8 +32,8 @@ class _NotificationScreenState extends State<NotificationScreen> {
|
||||
}
|
||||
|
||||
if (markList.isNotEmpty) {
|
||||
final client = auth.configureClient('passport');
|
||||
await client.put('/api/notifications/batch/read', {'messages': markList});
|
||||
final client = auth.configureClient('auth');
|
||||
await client.put('/notifications/batch/read', {'messages': markList});
|
||||
}
|
||||
|
||||
provider.notifications.clear();
|
||||
@ -45,7 +45,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
|
||||
final AuthProvider auth = Get.find();
|
||||
if (!await auth.isAuthorized) return;
|
||||
|
||||
final AccountProvider provider = Get.find();
|
||||
final WebSocketProvider provider = Get.find();
|
||||
|
||||
if (element.id <= 0) {
|
||||
provider.notifications.removeAt(index);
|
||||
@ -54,9 +54,9 @@ class _NotificationScreenState extends State<NotificationScreen> {
|
||||
|
||||
setState(() => _isBusy = true);
|
||||
|
||||
final client = auth.configureClient('passport');
|
||||
final client = auth.configureClient('auth');
|
||||
|
||||
await client.put('/api/notifications/${element.id}/read', {});
|
||||
await client.put('/notifications/${element.id}/read', {});
|
||||
|
||||
provider.notifications.removeAt(index);
|
||||
|
||||
@ -65,7 +65,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AccountProvider provider = Get.find();
|
||||
final WebSocketProvider provider = Get.find();
|
||||
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.85,
|
||||
@ -175,7 +175,7 @@ class NotificationButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AccountProvider provider = Get.find();
|
||||
final WebSocketProvider provider = Get.find();
|
||||
|
||||
final button = IconButton(
|
||||
icon: const Icon(Icons.notifications),
|
||||
|
@ -100,10 +100,10 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
|
||||
return;
|
||||
}
|
||||
|
||||
final client = auth.configureClient('passport');
|
||||
final client = auth.configureClient('auth');
|
||||
|
||||
final resp = await client.put(
|
||||
'/api/users/me/$position',
|
||||
'/users/me/$position',
|
||||
{'attachment': attachResp.body['id']},
|
||||
);
|
||||
if (resp.statusCode == 200) {
|
||||
@ -122,11 +122,11 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
|
||||
|
||||
setState(() => _isBusy = true);
|
||||
|
||||
final client = auth.configureClient('passport');
|
||||
final client = auth.configureClient('auth');
|
||||
|
||||
_birthday?.toIso8601String();
|
||||
final resp = await client.put(
|
||||
'/api/users/me',
|
||||
'/users/me',
|
||||
{
|
||||
'nick': _nicknameController.value.text,
|
||||
'description': _descriptionController.value.text,
|
||||
@ -189,7 +189,7 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
child: _banner != null
|
||||
? Image.network(
|
||||
'${ServiceFinder.services['paperclip']}/api/attachments/$_banner',
|
||||
ServiceFinder.buildUrl('files', '/attachments/$_banner'),
|
||||
fit: BoxFit.cover,
|
||||
loadingBuilder: (BuildContext context, Widget child,
|
||||
ImageChunkEvent? loadingProgress) {
|
||||
|
@ -84,9 +84,9 @@ class _ArticlePublishScreenState extends State<ArticlePublishScreen> {
|
||||
|
||||
Response resp;
|
||||
if (widget.edit != null) {
|
||||
resp = await client.put('/api/articles/${widget.edit!.id}', payload);
|
||||
resp = await client.put('/articles/${widget.edit!.id}', payload);
|
||||
} else {
|
||||
resp = await client.post('/api/articles', payload);
|
||||
resp = await client.post('/articles', payload);
|
||||
}
|
||||
if (resp.statusCode != 200) {
|
||||
context.showErrorDialog(resp.bodyString);
|
||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:protocol_handler/protocol_handler.dart';
|
||||
import 'package:solian/exts.dart';
|
||||
import 'package:solian/providers/account.dart';
|
||||
import 'package:solian/providers/websocket.dart';
|
||||
import 'package:solian/providers/auth.dart';
|
||||
import 'package:solian/services.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@ -30,15 +30,15 @@ class _SignInPopupState extends State<SignInPopup> with ProtocolListener {
|
||||
|
||||
setState(() => _isBusy = true);
|
||||
|
||||
final client = ServiceFinder.configureClient('passport');
|
||||
final lookupResp = await client.get('/api/users/lookup?probe=$username');
|
||||
final client = ServiceFinder.configureClient('auth');
|
||||
final lookupResp = await client.get('/users/lookup?probe=$username');
|
||||
if (lookupResp.statusCode != 200) {
|
||||
context.showErrorDialog(lookupResp.bodyString);
|
||||
setState(() => _isBusy = false);
|
||||
return;
|
||||
}
|
||||
|
||||
final resp = await client.post('/api/users/me/password-reset', {
|
||||
final resp = await client.post('/users/me/password-reset', {
|
||||
'user_id': lookupResp.body['id'],
|
||||
});
|
||||
if (resp.statusCode != 200) {
|
||||
@ -75,7 +75,7 @@ class _SignInPopupState extends State<SignInPopup> with ProtocolListener {
|
||||
onPressed: () {
|
||||
const redirect = 'solink://auth?status=done';
|
||||
launchUrlString(
|
||||
'${ServiceFinder.services['passport']}/mfa?redirect_uri=$redirect&ticketId=${e.ticketId}',
|
||||
ServiceFinder.buildUrl('passport', '/mfa?redirect_uri=$redirect&ticketId=${e.ticketId}'),
|
||||
mode: LaunchMode.inAppWebView,
|
||||
);
|
||||
Navigator.pop(context);
|
||||
@ -93,7 +93,7 @@ class _SignInPopupState extends State<SignInPopup> with ProtocolListener {
|
||||
setState(() => _isBusy = false);
|
||||
}
|
||||
|
||||
Get.find<AccountProvider>().registerPushNotifications();
|
||||
Get.find<WebSocketProvider>().registerPushNotifications();
|
||||
|
||||
Navigator.pop(context, true);
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ class _SignUpPopupState extends State<SignUpPopup> {
|
||||
nickname.isEmpty ||
|
||||
password.isEmpty) return;
|
||||
|
||||
final client = ServiceFinder.configureClient('passport');
|
||||
final client = ServiceFinder.configureClient('auth');
|
||||
|
||||
final resp = await client.post('/api/users', {
|
||||
final resp = await client.post('/users', {
|
||||
'name': username,
|
||||
'nick': nickname,
|
||||
'email': email,
|
||||
|
@ -11,9 +11,9 @@ import 'package:solian/models/channel.dart';
|
||||
import 'package:solian/models/event.dart';
|
||||
import 'package:solian/models/packet.dart';
|
||||
import 'package:solian/providers/auth.dart';
|
||||
import 'package:solian/providers/chat.dart';
|
||||
import 'package:solian/providers/content/call.dart';
|
||||
import 'package:solian/providers/content/channel.dart';
|
||||
import 'package:solian/providers/websocket.dart';
|
||||
import 'package:solian/router.dart';
|
||||
import 'package:solian/screens/channel/channel_detail.dart';
|
||||
import 'package:solian/theme.dart';
|
||||
@ -107,7 +107,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
}
|
||||
|
||||
void listenMessages() {
|
||||
final ChatProvider provider = Get.find();
|
||||
final WebSocketProvider provider = Get.find();
|
||||
_subscription = provider.stream.stream.listen((event) {
|
||||
switch (event.method) {
|
||||
case 'events.new':
|
||||
|
@ -82,7 +82,7 @@ class _ChannelDetailScreenState extends State<ChannelDetailScreen> {
|
||||
final client = auth.configureClient('messaging');
|
||||
|
||||
final resp = await client.put(
|
||||
'/api/channels/${widget.realm}/${widget.channel.alias}/members/me', {
|
||||
'/channels/${widget.realm}/${widget.channel.alias}/members/me', {
|
||||
'nick': null,
|
||||
'notify_level': _notifyLevel,
|
||||
});
|
||||
|
@ -90,9 +90,9 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
||||
|
||||
Response resp;
|
||||
if (widget.edit != null) {
|
||||
resp = await client.put('/api/posts/${widget.edit!.id}', payload);
|
||||
resp = await client.put('/posts/${widget.edit!.id}', payload);
|
||||
} else {
|
||||
resp = await client.post('/api/posts', payload);
|
||||
resp = await client.post('/posts', payload);
|
||||
}
|
||||
if (resp.statusCode != 200) {
|
||||
context.showErrorDialog(resp.bodyString);
|
||||
|
@ -43,7 +43,7 @@ class _RealmOrganizeScreenState extends State<RealmOrganizeScreen> {
|
||||
|
||||
setState(() => _isBusy = true);
|
||||
|
||||
final client = auth.configureClient('passport');
|
||||
final client = auth.configureClient('auth');
|
||||
|
||||
final payload = {
|
||||
'alias': _aliasController.value.text.toLowerCase(),
|
||||
@ -55,9 +55,9 @@ class _RealmOrganizeScreenState extends State<RealmOrganizeScreen> {
|
||||
|
||||
Response resp;
|
||||
if (widget.edit != null) {
|
||||
resp = await client.put('/api/realms/${widget.edit!.id}', payload);
|
||||
resp = await client.put('/realms/${widget.edit!.id}', payload);
|
||||
} else {
|
||||
resp = await client.post('/api/realms', payload);
|
||||
resp = await client.post('/realms', payload);
|
||||
}
|
||||
if (resp.statusCode != 200) {
|
||||
context.showErrorDialog(resp.bodyString);
|
||||
|
Reference in New Issue
Block a user