Compare commits

..

5 Commits

Author SHA1 Message Date
LittleSheep
8e0c0c6054 🚀 Launch 3.1.0+122 2025-08-10 04:16:58 +08:00
LittleSheep
f3d1183076 🐛 Fix android update 2025-08-10 04:16:53 +08:00
LittleSheep
a9f7f0cce0 🐛 Fix bugs, ah bugs ha ha, bugs 2025-08-10 04:04:31 +08:00
LittleSheep
f2943f8411 🐛 Fix iOS notify delegate wrong path 2025-08-10 03:30:57 +08:00
LittleSheep
808e7dcffa Option to boost github assets download 2025-08-10 03:25:57 +08:00
5 changed files with 66 additions and 25 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@@ -34,7 +34,7 @@ class NotifyDelegate: UIResponder, UNUserNotificationCenterDelegate {
} }
let serverUrl = UserDefaults.standard.getServerUrl() let serverUrl = UserDefaults.standard.getServerUrl()
let url = "\(serverUrl)/chat/\(metadata["room_id"] ?? "")/messages" let url = "\(serverUrl)/sphere/chat/\(metadata["room_id"] ?? "")/messages"
let parameters: [String: Any?] = [ let parameters: [String: Any?] = [
"content": textResponse.userText, "content": textResponse.userText,

View File

@@ -339,7 +339,7 @@ class ChatRoomScreen extends HookConsumerWidget {
} }
await apiClient.post( await apiClient.post(
'/chat/${chatRoom.value!.id}/members/me', '/sphere/chat/${chatRoom.value!.id}/members/me',
); );
ref.invalidate(chatroomIdentityProvider(id)); ref.invalidate(chatroomIdentityProvider(id));
} catch (err) { } catch (err) {
@@ -929,7 +929,7 @@ class ChatRoomScreen extends HookConsumerWidget {
if (attachment.isOnCloud) { if (attachment.isOnCloud) {
final client = ref.watch(apiClientProvider); final client = ref.watch(apiClientProvider);
await client.delete( await client.delete(
'/files/${attachment.data.id}', '/drive/files/${attachment.data.id}',
); );
} }
final clone = List.of(attachments.value); final clone = List.of(attachments.value);

View File

@@ -7,6 +7,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_app_update/azhon_app_update.dart'; import 'package:flutter_app_update/azhon_app_update.dart';
import 'package:flutter_app_update/update_model.dart'; import 'package:flutter_app_update/update_model.dart';
import 'package:island/widgets/content/markdown.dart';
import 'package:material_symbols_icons/symbols.dart'; import 'package:material_symbols_icons/symbols.dart';
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
import 'package:collection/collection.dart'; // Added for firstWhereOrNull import 'package:collection/collection.dart'; // Added for firstWhereOrNull
@@ -89,7 +90,7 @@ class _ParsedVersion implements Comparable<_ParsedVersion> {
} }
class UpdateService { class UpdateService {
UpdateService({Dio? dio}) UpdateService({Dio? dio, this.useProxy = false})
: _dio = : _dio =
dio ?? dio ??
Dio( Dio(
@@ -105,6 +106,9 @@ class UpdateService {
); );
final Dio _dio; final Dio _dio;
final bool useProxy;
static const _proxyBaseUrl = 'https://ghfast.top/';
static const _releasesLatestApi = static const _releasesLatestApi =
'https://api.github.com/repos/solsynth/solian/releases/latest'; 'https://api.github.com/repos/solsynth/solian/releases/latest';
@@ -188,6 +192,7 @@ class UpdateService {
} }
}, },
androidUpdateUrl: androidUpdateUrl, androidUpdateUrl: androidUpdateUrl,
useProxy: useProxy, // Pass the useProxy flag
); );
}, },
); );
@@ -218,10 +223,15 @@ class UpdateService {
/// Fetch the latest release info from GitHub. /// Fetch the latest release info from GitHub.
/// Public so other screens (e.g., About) can manually trigger update checks. /// Public so other screens (e.g., About) can manually trigger update checks.
Future<GithubReleaseInfo?> fetchLatestRelease() async { Future<GithubReleaseInfo?> fetchLatestRelease() async {
final apiEndpoint =
useProxy
? '$_proxyBaseUrl${Uri.encodeComponent(_releasesLatestApi)}'
: _releasesLatestApi;
log( log(
'[Update] Fetching latest release from GitHub API: $_releasesLatestApi', '[Update] Fetching latest release from GitHub API: $apiEndpoint (Proxy: $useProxy)',
); );
final resp = await _dio.get(_releasesLatestApi); final resp = await _dio.get(apiEndpoint);
if (resp.statusCode != 200) { if (resp.statusCode != 200) {
log( log(
'[Update] Failed to fetch latest release. Status code: ${resp.statusCode}', '[Update] Failed to fetch latest release. Status code: ${resp.statusCode}',
@@ -262,22 +272,40 @@ class UpdateService {
} }
} }
class _UpdateSheet extends StatelessWidget { class _UpdateSheet extends StatefulWidget {
const _UpdateSheet({ const _UpdateSheet({
required this.release, required this.release,
required this.onOpen, required this.onOpen,
this.androidUpdateUrl, // Made nullable this.androidUpdateUrl,
this.useProxy = false,
}); });
final String? androidUpdateUrl; // Changed to nullable final String? androidUpdateUrl;
final bool useProxy;
final GithubReleaseInfo release; final GithubReleaseInfo release;
final VoidCallback onOpen; final VoidCallback onOpen;
Future<void> installUpdate(String url) async { @override
State<_UpdateSheet> createState() => _UpdateSheetState();
}
class _UpdateSheetState extends State<_UpdateSheet> {
late bool _useProxy;
@override
void initState() {
super.initState();
_useProxy = widget.useProxy;
}
Future<void> _installUpdate(String url) async {
final downloadUrl =
_useProxy ? 'https://ghfast.top/${Uri.encodeComponent(url)}' : url;
UpdateModel model = UpdateModel( UpdateModel model = UpdateModel(
url, downloadUrl,
"solian-update-${release.tagName}.apk", "solian-update-${widget.release.tagName}.apk",
"ic_launcher", "launcher_icon",
'https://apps.apple.com/us/app/solian/id6499032345', 'https://apps.apple.com/us/app/solian/id6499032345',
); );
AzhonAppUpdate.update(model); AzhonAppUpdate.update(model);
@@ -298,8 +326,11 @@ class _UpdateSheet extends StatelessWidget {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(release.name, style: theme.textTheme.titleMedium).bold(), Text(
Text(release.tagName).fontSize(12), widget.release.name,
style: theme.textTheme.titleMedium,
).bold(),
Text(widget.release.tagName).fontSize(12),
], ],
).padding(vertical: 16, horizontal: 16), ).padding(vertical: 16, horizontal: 16),
const Divider(height: 1), const Divider(height: 1),
@@ -309,14 +340,24 @@ class _UpdateSheet extends StatelessWidget {
horizontal: 16, horizontal: 16,
vertical: 16, vertical: 16,
), ),
child: SelectableText( child: MarkdownTextContent(
release.body.isEmpty content:
? 'No changelog provided.' widget.release.body.isEmpty
: release.body, ? 'No changelog provided.'
style: theme.textTheme.bodyMedium, : widget.release.body,
), ),
), ),
), ),
if (!kIsWeb && Platform.isAndroid)
SwitchListTile(
title: const Text('Use GitHub Proxy for Download'),
value: _useProxy,
onChanged: (value) {
setState(() {
_useProxy = value;
});
},
).padding(horizontal: 8),
Column( Column(
children: [ children: [
Row( Row(
@@ -324,12 +365,12 @@ class _UpdateSheet extends StatelessWidget {
children: [ children: [
if (!kIsWeb && if (!kIsWeb &&
Platform.isAndroid && Platform.isAndroid &&
androidUpdateUrl != null) widget.androidUpdateUrl != null)
Expanded( Expanded(
child: FilledButton.icon( child: FilledButton.icon(
onPressed: () { onPressed: () {
log(androidUpdateUrl!); log(widget.androidUpdateUrl!);
installUpdate(androidUpdateUrl!); _installUpdate(widget.androidUpdateUrl!);
}, },
icon: const Icon(Symbols.update), icon: const Icon(Symbols.update),
label: const Text('Install update'), label: const Text('Install update'),
@@ -337,7 +378,7 @@ class _UpdateSheet extends StatelessWidget {
), ),
Expanded( Expanded(
child: FilledButton.icon( child: FilledButton.icon(
onPressed: onOpen, onPressed: widget.onOpen,
icon: const Icon(Icons.open_in_new), icon: const Icon(Icons.open_in_new),
label: const Text('Open release page'), label: const Text('Open release page'),
), ),

View File

@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 3.1.0+121 version: 3.1.0+122
environment: environment:
sdk: ^3.7.2 sdk: ^3.7.2