mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 04:49:21 +00:00
Create specific client for Flutter Web
This commit is contained in:
parent
4a905174bf
commit
e474725965
@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:comunic/constants.dart';
|
||||
import 'package:comunic/utils/flutter_utils.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
@ -38,6 +39,11 @@ abstract class BaseSerializationHelper<T extends SerializableElement> {
|
||||
Future<void> _loadCache() async {
|
||||
if (_cache != null) return;
|
||||
|
||||
if (isWeb) {
|
||||
_cache = [];
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final file = await _getFilePath();
|
||||
|
||||
@ -55,6 +61,8 @@ abstract class BaseSerializationHelper<T extends SerializableElement> {
|
||||
|
||||
/// Save the cache to the persistent memory
|
||||
Future<void> _saveCache() async {
|
||||
if (isWeb) return;
|
||||
|
||||
final file = await _getFilePath();
|
||||
await file.writeAsString(jsonEncode(
|
||||
_cache.map((e) => e.toJson()).toList().cast<Map<String, dynamic>>()));
|
||||
|
@ -2,6 +2,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:comunic/main.dart';
|
||||
import 'package:comunic/models/config.dart';
|
||||
import 'package:comunic/utils/flutter_utils.dart';
|
||||
|
||||
/// Dev (internal) build configuration for the project
|
||||
///
|
||||
@ -23,7 +24,7 @@ void main() {
|
||||
apiServerName: "192.168.1.9:3000",
|
||||
apiServerUri: "/",
|
||||
apiServerSecure: false,
|
||||
clientName: "ComunicFlutter",
|
||||
clientName: isWeb ? "FlutterWeb" : "ComunicFlutter",
|
||||
));
|
||||
|
||||
HttpOverrides.global = new MyHttpOverride();
|
||||
|
Loading…
Reference in New Issue
Block a user