Compare commits
	
		
			2 Commits
		
	
	
		
			7508a54907
			...
			6d0f62016a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 6d0f62016a | |||
| 7e0faba5db | 
| @@ -37,7 +37,6 @@ import 'package:flutter_web_plugins/url_strategy.dart' show usePathUrlStrategy; | ||||
| import 'package:surface/widgets/dialog.dart'; | ||||
| import 'package:surface/widgets/version_label.dart'; | ||||
|  | ||||
|  | ||||
| void main() async { | ||||
|   WidgetsFlutterBinding.ensureInitialized(); | ||||
|   await EasyLocalization.ensureInitialized(); | ||||
| @@ -94,7 +93,7 @@ class SolianApp extends StatelessWidget { | ||||
|             Provider(create: (ctx) => HomeWidgetProvider(ctx)), | ||||
|  | ||||
|             // Data layer | ||||
|             Provider(create: (_) => SnNetworkProvider()), | ||||
|             Provider(create: (ctx) => SnNetworkProvider(ctx)), | ||||
|             Provider(create: (ctx) => UserDirectoryProvider(ctx)), | ||||
|             Provider(create: (ctx) => SnAttachmentProvider(ctx)), | ||||
|             Provider(create: (ctx) => SnPostContentProvider(ctx)), | ||||
| @@ -206,7 +205,10 @@ class _AppSplashScreenState extends State<_AppSplashScreen> { | ||||
|             mainAxisAlignment: MainAxisAlignment.center, | ||||
|             mainAxisSize: MainAxisSize.min, | ||||
|             children: [ | ||||
|               Image.asset("assets/icon/icon.png", width: 64, height: 64), | ||||
|               if (MediaQuery.of(context).platformBrightness == Brightness.dark) | ||||
|                 Image.asset("assets/icon/icon-dark.png", width: 64, height: 64) | ||||
|               else | ||||
|                 Image.asset("assets/icon/icon.png", width: 64, height: 64), | ||||
|               const Gap(6), | ||||
|               LinearProgressIndicator( | ||||
|                 backgroundColor: Theme.of(context).colorScheme.surfaceContainer, | ||||
|   | ||||
| @@ -6,9 +6,12 @@ import 'dart:io'; | ||||
| import 'package:dio/dio.dart'; | ||||
| import 'package:dio_smart_retry/dio_smart_retry.dart'; | ||||
| import 'package:flutter/foundation.dart'; | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:package_info_plus/package_info_plus.dart'; | ||||
| import 'package:device_info_plus/device_info_plus.dart'; | ||||
| import 'package:provider/provider.dart'; | ||||
| import 'package:shared_preferences/shared_preferences.dart'; | ||||
| import 'package:surface/providers/widget.dart'; | ||||
| import 'package:synchronized/synchronized.dart'; | ||||
|  | ||||
| const kAtkStoreKey = 'nex_user_atk'; | ||||
| @@ -26,10 +29,13 @@ class SnNetworkProvider { | ||||
|   late final Dio client; | ||||
|  | ||||
|   late final SharedPreferences _prefs; | ||||
|   late final HomeWidgetProvider _home; | ||||
|  | ||||
|   String? _userAgent; | ||||
|  | ||||
|   SnNetworkProvider() { | ||||
|   SnNetworkProvider(BuildContext context) { | ||||
|     _home = context.read<HomeWidgetProvider>(); | ||||
|  | ||||
|     client = Dio(); | ||||
|  | ||||
|     client.interceptors.add(RetryInterceptor( | ||||
| @@ -63,6 +69,8 @@ class SnNetworkProvider { | ||||
|     SharedPreferences.getInstance().then((prefs) { | ||||
|       _prefs = prefs; | ||||
|       client.options.baseUrl = _prefs.getString(kNetworkServerStoreKey) ?? kNetworkServerDefault; | ||||
|       if (!context.mounted) return; | ||||
|       _home.saveWidgetData("server_url", client.options.baseUrl); | ||||
|     }); | ||||
|   } | ||||
|  | ||||
| @@ -190,5 +198,6 @@ class SnNetworkProvider { | ||||
|  | ||||
|   void setBaseUrl(String url) { | ||||
|     client.options.baseUrl = url; | ||||
|     _home.saveWidgetData("server_url", client.options.baseUrl); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -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 | ||||
| # 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. | ||||
| version: 2.0.1+30 | ||||
| version: 2.1.1+31 | ||||
|  | ||||
| environment: | ||||
|   sdk: ^3.5.4 | ||||
| @@ -138,6 +138,7 @@ flutter: | ||||
|   # To add assets to your application, add an assets section, like this: | ||||
|   assets: | ||||
|     - assets/icon/icon.png | ||||
|     - assets/icon/icon-dark.png | ||||
|     - assets/icon/icon-light-radius.png | ||||
|     - assets/translations/ | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user