feat: Enable macOS build
This commit is contained in:
parent
27e6b324c0
commit
f98f87db8e
35 changed files with 1590 additions and 68 deletions
|
|
@ -5,6 +5,7 @@ import 'package:famedlysdk/famedlysdk.dart';
|
|||
import 'package:famedlysdk/encryption.dart';
|
||||
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||
import 'package:fluffychat/utils/firebase_controller.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:localstorage/localstorage.dart';
|
||||
|
|
@ -78,7 +79,7 @@ class MatrixState extends State<Matrix> {
|
|||
var initLoginState = client.onLoginStateChanged.stream.first;
|
||||
client.database = await getDatabase(client);
|
||||
client.connect();
|
||||
if (await initLoginState == LoginState.logged && !kIsWeb) {
|
||||
if (await initLoginState == LoginState.logged && PlatformInfos.isMobile) {
|
||||
await FirebaseController.setupFirebase(
|
||||
this,
|
||||
widget.clientName,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
|
|
@ -201,10 +202,10 @@ class Store {
|
|||
|
||||
Store()
|
||||
: storage = LocalStorage('LocalStorage'),
|
||||
secureStorage = kIsWeb ? null : FlutterSecureStorage();
|
||||
secureStorage = PlatformInfos.isMobile ? FlutterSecureStorage() : null;
|
||||
|
||||
Future<dynamic> getItem(String key) async {
|
||||
if (kIsWeb) {
|
||||
if (!PlatformInfos.isMobile) {
|
||||
await storage.ready;
|
||||
try {
|
||||
return await storage.getItem(key);
|
||||
|
|
@ -220,7 +221,7 @@ class Store {
|
|||
}
|
||||
|
||||
Future<void> setItem(String key, String value) async {
|
||||
if (kIsWeb) {
|
||||
if (!PlatformInfos.isMobile) {
|
||||
await storage.ready;
|
||||
return await storage.setItem(key, value);
|
||||
}
|
||||
|
|
@ -232,7 +233,7 @@ class Store {
|
|||
}
|
||||
|
||||
Future<Map<String, dynamic>> getAllItems() async {
|
||||
if (kIsWeb) {
|
||||
if (!PlatformInfos.isMobile) {
|
||||
try {
|
||||
final rawStorage = await getLocalstorage('LocalStorage');
|
||||
return json.decode(rawStorage);
|
||||
|
|
|
|||
9
lib/utils/platform_infos.dart
Normal file
9
lib/utils/platform_infos.dart
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
abstract class PlatformInfos {
|
||||
static bool get isWeb => kIsWeb;
|
||||
static bool get isMobile => !kIsWeb && (Platform.isAndroid || Platform.isIOS);
|
||||
static bool get usesTouchscreen => !isMobile;
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import 'package:fluffychat/components/connection_status_header.dart';
|
|||
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||
import 'package:fluffychat/components/list_items/presence_list_item.dart';
|
||||
import 'package:fluffychat/components/list_items/public_room_list_item.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
|
||||
|
|
@ -160,7 +161,7 @@ class _ChatListState extends State<ChatList> {
|
|||
}
|
||||
|
||||
void _initReceiveSharingIntent() {
|
||||
if (kIsWeb) return;
|
||||
if (!PlatformInfos.isMobile) return;
|
||||
|
||||
// For sharing images coming from outside the app while the app is in the memory
|
||||
_intentFileStreamSubscription = ReceiveSharingIntent.getMediaStream()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue