Merge branch 'ChristianPauly-master-patch-82433' into 'master'
Update SDK See merge request ChristianPauly/fluffychat-flutter!64
This commit is contained in:
commit
ad1fb98d59
|
@ -27,9 +27,10 @@ build_web:
|
||||||
- sudo apt update
|
- sudo apt update
|
||||||
- sudo apt install curl -y
|
- sudo apt install curl -y
|
||||||
- rm -r assets/js/package
|
- rm -r assets/js/package
|
||||||
- cd assets/js/ && curl -O 'https://janian.de/index.php/s/ZKpQi4xFkGWPMHQ/download' && cd ../../
|
- cd assets/js/ && curl -L 'https://gitlab.com/famedly/libraries/olm/-/jobs/artifacts/master/download?job=build_js' > olm.zip && cd ../../
|
||||||
- cd assets/js/ && mv download olm.tar.gz && cd ../../
|
- cd assets/js/ && unzip olm.zip && cd ../../
|
||||||
- cd assets/js/ && tar xaf olm.tar.gz && cd ../../
|
- cd assets/js/ && rm olm.zip && cd ../../
|
||||||
|
- cd assets/js/ && mv javascript package && cd ../../
|
||||||
- flutter pub get
|
- flutter pub get
|
||||||
- flutter clean
|
- flutter clean
|
||||||
- flutter build web --release --verbose --dart-define=FLUTTER_WEB_USE_SKIA=true
|
- flutter build web --release --verbose --dart-define=FLUTTER_WEB_USE_SKIA=true
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
// Dummy file
|
// Dummy file :-)
|
||||||
|
|
|
@ -74,7 +74,7 @@ class MatrixState extends State<Matrix> {
|
||||||
|
|
||||||
void _initWithStore() async {
|
void _initWithStore() async {
|
||||||
var initLoginState = client.onLoginStateChanged.stream.first;
|
var initLoginState = client.onLoginStateChanged.stream.first;
|
||||||
client.database = await getDatabase(client, store);
|
client.database = await getDatabase(client);
|
||||||
client.connect();
|
client.connect();
|
||||||
if (await initLoginState == LoginState.logged && !kIsWeb) {
|
if (await initLoginState == LoginState.logged && !kIsWeb) {
|
||||||
await FirebaseController.setupFirebase(
|
await FirebaseController.setupFirebase(
|
||||||
|
|
|
@ -11,25 +11,29 @@ import './database/shared.dart';
|
||||||
import 'package:olm/olm.dart' as olm; // needed for migration
|
import 'package:olm/olm.dart' as olm; // needed for migration
|
||||||
import 'package:random_string/random_string.dart';
|
import 'package:random_string/random_string.dart';
|
||||||
|
|
||||||
Future<Database> getDatabase(Client client, Store store) async {
|
Future<Database> getDatabase(Client client) async {
|
||||||
|
if (_db != null) return _db;
|
||||||
|
final store = Store();
|
||||||
var password = await store.getItem('database-password');
|
var password = await store.getItem('database-password');
|
||||||
var needMigration = false;
|
var needMigration = false;
|
||||||
if (password == null || password.isEmpty) {
|
if (password == null || password.isEmpty) {
|
||||||
needMigration = true;
|
needMigration = true;
|
||||||
password = randomString(255);
|
password = randomString(255);
|
||||||
}
|
}
|
||||||
final db = constructDb(
|
_db = constructDb(
|
||||||
logStatements: false,
|
logStatements: false,
|
||||||
filename: 'moor.sqlite',
|
filename: 'moor.sqlite',
|
||||||
password: password,
|
password: password,
|
||||||
);
|
);
|
||||||
if (needMigration) {
|
if (needMigration) {
|
||||||
await migrate(client.clientName, db, store);
|
await migrate(client.clientName, _db, store);
|
||||||
await store.setItem('database-password', password);
|
await store.setItem('database-password', password);
|
||||||
}
|
}
|
||||||
return db;
|
return _db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Database _db;
|
||||||
|
|
||||||
Future<void> migrate(String clientName, Database db, Store store) async {
|
Future<void> migrate(String clientName, Database db, Store store) async {
|
||||||
debugPrint('[Store] attempting old migration to moor...');
|
debugPrint('[Store] attempting old migration to moor...');
|
||||||
final oldKeys = await store.getAllItems();
|
final oldKeys = await store.getAllItems();
|
||||||
|
@ -147,7 +151,13 @@ Future<void> migrate(String clientName, Database db, Store store) async {
|
||||||
devices = List<String>.from(json.decode(devicesString));
|
devices = List<String>.from(json.decode(devicesString));
|
||||||
}
|
}
|
||||||
await db.storeOutboundGroupSession(
|
await db.storeOutboundGroupSession(
|
||||||
clientId, roomId, pickle, json.encode(devices));
|
clientId,
|
||||||
|
roomId,
|
||||||
|
pickle,
|
||||||
|
json.encode(devices),
|
||||||
|
DateTime.now(),
|
||||||
|
0,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// session_keys
|
// session_keys
|
||||||
final sessionKeysMatch =
|
final sessionKeysMatch =
|
||||||
|
|
|
@ -151,8 +151,7 @@ abstract class FirebaseController {
|
||||||
final platform = kIsWeb ? 'Web' : Platform.operatingSystem;
|
final platform = kIsWeb ? 'Web' : Platform.operatingSystem;
|
||||||
final clientName = 'FluffyChat $platform';
|
final clientName = 'FluffyChat $platform';
|
||||||
client = Client(clientName, debug: false);
|
client = Client(clientName, debug: false);
|
||||||
final store = Store();
|
client.database = await getDatabase(client);
|
||||||
client.database = await getDatabase(client, store);
|
|
||||||
client.connect();
|
client.connect();
|
||||||
await client.onLoginStateChanged.stream
|
await client.onLoginStateChanged.stream
|
||||||
.firstWhere((l) => l == LoginState.logged)
|
.firstWhere((l) => l == LoginState.logged)
|
||||||
|
|
31
pubspec.lock
31
pubspec.lock
|
@ -71,13 +71,6 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.3"
|
version: "1.1.3"
|
||||||
clock:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: clock
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.0.1"
|
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -136,19 +129,12 @@ packages:
|
||||||
url: "https://github.com/simolus3/moor.git"
|
url: "https://github.com/simolus3/moor.git"
|
||||||
source: git
|
source: git
|
||||||
version: "1.0.0"
|
version: "1.0.0"
|
||||||
fake_async:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: fake_async
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.1.0"
|
|
||||||
famedlysdk:
|
famedlysdk:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: bb690a22daab54a53a8df8e2dffb87da8a374bb1
|
ref: "359e03496ad72f125ae275788621ac4f42d99d01"
|
||||||
resolved-ref: bb690a22daab54a53a8df8e2dffb87da8a374bb1
|
resolved-ref: "359e03496ad72f125ae275788621ac4f42d99d01"
|
||||||
url: "https://gitlab.com/famedly/famedlysdk.git"
|
url: "https://gitlab.com/famedly/famedlysdk.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
@ -466,10 +452,10 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: "1.x.y"
|
ref: "1.x.y"
|
||||||
resolved-ref: "79868b06b3ea156f90b73abafb3bbf3ac4114cc6"
|
resolved-ref: f66975bd1b5cb1865eba5efe6e3a392aa5e396a5
|
||||||
url: "https://gitlab.com/famedly/libraries/dart-olm.git"
|
url: "https://gitlab.com/famedly/libraries/dart-olm.git"
|
||||||
source: git
|
source: git
|
||||||
version: "1.0.0"
|
version: "1.1.1"
|
||||||
open_file:
|
open_file:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -497,7 +483,7 @@ packages:
|
||||||
name: path
|
name: path
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.0"
|
version: "1.6.4"
|
||||||
path_drawing:
|
path_drawing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -575,6 +561,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.2"
|
version: "1.4.2"
|
||||||
|
quiver:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: quiver
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.3"
|
||||||
random_string:
|
random_string:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -27,7 +27,7 @@ dependencies:
|
||||||
famedlysdk:
|
famedlysdk:
|
||||||
git:
|
git:
|
||||||
url: https://gitlab.com/famedly/famedlysdk.git
|
url: https://gitlab.com/famedly/famedlysdk.git
|
||||||
ref: bb690a22daab54a53a8df8e2dffb87da8a374bb1
|
ref: 359e03496ad72f125ae275788621ac4f42d99d01
|
||||||
|
|
||||||
localstorage: ^3.0.1+4
|
localstorage: ^3.0.1+4
|
||||||
bubble: ^1.1.9+1
|
bubble: ^1.1.9+1
|
||||||
|
|
Loading…
Reference in a new issue