db: FINALLY ADD A DATABASE
This commit is contained in:
@@ -14,30 +14,45 @@ import 'ui/pages/settings/licenses.dart';
|
||||
import 'ui/pages/settings/about.dart';
|
||||
import 'ui/constants.dart';
|
||||
import 'repositories/roster.dart';
|
||||
import 'repositories/roster.dart';
|
||||
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import "repositories/conversation.dart";
|
||||
import "redux/conversation/reducers.dart";
|
||||
import "redux/conversation/actions.dart";
|
||||
import "redux/conversations/middlewares.dart";
|
||||
import "redux/state.dart";
|
||||
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import "package:isar/isar.dart";
|
||||
|
||||
import "isar.g.dart";
|
||||
|
||||
// TODO: Replace all single quotes with double quotes
|
||||
// TODO: Replace all Column(children: [ Padding(), Padding, ...]) with a
|
||||
// Padding(padding: ..., child: Column(children: [ ... ]))
|
||||
// TODO: Theme the switches
|
||||
// TODO: Find a better way to do this
|
||||
void main() {
|
||||
GetIt.I.registerSingleton<RosterRepository>(RosterRepository());
|
||||
|
||||
runApp(MyApp());
|
||||
void main() async {
|
||||
final isar = await openIsar();
|
||||
runApp(MyApp(isar: isar));
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
final Store<MoxxyState> store = Store(moxxyReducer,
|
||||
initialState: MoxxyState.initialState());
|
||||
final Store<MoxxyState> store = Store(
|
||||
moxxyReducer,
|
||||
initialState: MoxxyState.initialState(),
|
||||
middleware: [
|
||||
conversationsMiddleware
|
||||
]
|
||||
);
|
||||
final Isar isar;
|
||||
|
||||
MyApp({ required this.isar }) {
|
||||
GetIt.I.registerSingleton<RosterRepository>(RosterRepository());
|
||||
GetIt.I.registerSingleton<DatabaseRepository>(DatabaseRepository(isar: isar, store: this.store));
|
||||
GetIt.I.get<DatabaseRepository>().loadConversations();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StoreProvider(
|
||||
|
||||
Reference in New Issue
Block a user