2021-02-07 17:18:38 +01:00
|
|
|
import 'package:famedlysdk/famedlysdk.dart';
|
|
|
|
import 'package:famedlysdk/encryption.dart';
|
2021-04-12 18:33:43 +02:00
|
|
|
import 'package:matrix_api_lite/fake_matrix_api.dart';
|
2021-02-07 17:18:38 +01:00
|
|
|
import 'platform_infos.dart';
|
|
|
|
import 'famedlysdk_store.dart';
|
|
|
|
|
|
|
|
class FluffyClient extends Client {
|
2021-04-12 18:33:43 +02:00
|
|
|
static FluffyClient _instance;
|
2021-02-07 17:18:38 +01:00
|
|
|
|
|
|
|
/// The ID of the currently active room, if there is one. May be null or emtpy
|
|
|
|
String activeRoomId;
|
|
|
|
|
2021-04-12 18:33:43 +02:00
|
|
|
factory FluffyClient({testMode = false}) {
|
|
|
|
_instance ??= FluffyClient._internal(testMode: testMode);
|
2021-02-07 17:18:38 +01:00
|
|
|
return _instance;
|
|
|
|
}
|
|
|
|
|
2021-04-12 18:33:43 +02:00
|
|
|
FluffyClient._internal({testMode = false})
|
2021-02-07 17:18:38 +01:00
|
|
|
: super(
|
2021-04-12 18:33:43 +02:00
|
|
|
testMode ? 'FluffyChat Widget Tests' : PlatformInfos.clientName,
|
|
|
|
httpClient: testMode ? FakeMatrixApi() : null,
|
2021-02-07 17:18:38 +01:00
|
|
|
enableE2eeRecovery: true,
|
|
|
|
verificationMethods: {
|
|
|
|
KeyVerificationMethod.numbers,
|
|
|
|
if (PlatformInfos.isMobile || PlatformInfos.isLinux)
|
|
|
|
KeyVerificationMethod.emoji,
|
|
|
|
},
|
|
|
|
importantStateEvents: <String>{
|
|
|
|
'im.ponies.room_emotes', // we want emotes to work properly
|
|
|
|
},
|
2021-04-12 18:33:43 +02:00
|
|
|
databaseBuilder: testMode ? null : getDatabase,
|
2021-02-07 17:18:38 +01:00
|
|
|
supportedLoginTypes: {
|
|
|
|
AuthenticationTypes.password,
|
2021-02-24 09:49:12 +01:00
|
|
|
if (PlatformInfos.isMobile || PlatformInfos.isWeb)
|
|
|
|
AuthenticationTypes.sso
|
2021-02-07 17:18:38 +01:00
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|