Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: "Test"
run: flutter test
- name: "Upload Failure Screenshots"
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: golden-failures
Expand Down Expand Up @@ -198,7 +198,7 @@ jobs:
done
exit 1
- name: "Store .dmg artifact"
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: notifi-dmg
path: notifi.dmg
Expand Down Expand Up @@ -312,7 +312,7 @@ jobs:
fi

- name: "Store .aab artifact"
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: notifi-aab
path: notifi.aab
Expand Down Expand Up @@ -365,7 +365,7 @@ jobs:
fi

- name: "Store .snap artifact"
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: notifi-snap
path: notifi.snap
Expand All @@ -381,17 +381,17 @@ jobs:
needs: [ checks, macos, android, snap, ios, version ]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
name: "Download notifi-aab"
id: download-aab
with:
name: notifi-aab
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
name: "Download notifi-snap"
id: download-snap
with:
name: notifi-snap
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
name: "Download notifi-dmg"
id: download-dmg
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: "Test"
run: flutter test
- name: "Upload Failure Screenshots"
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: golden-failures
Expand Down
1 change: 1 addition & 0 deletions backend
Submodule backend added at 633982
46 changes: 27 additions & 19 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ import 'package:provider/provider.dart';
import 'package:provider/single_child_widget.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:sqflite/sqflite.dart';

Future<void> main() => mainImpl();

Future<void> mainImpl({bool integration: false}) async {
Future<void> mainImpl({bool integration = false}) async {
WidgetsFlutterBinding.ensureInitialized();

final SharedPreferences sp = await SharedPreferences.getInstance();
Expand Down Expand Up @@ -67,7 +66,7 @@ Future<void> mainImpl({bool integration: false}) async {
DBProvider('notifications.db', fillWithNotifications: integration);
final List<NotificationUI> notifications = await db.getAll();

FlutterLocalNotificationsPlugin pushNotifications = null;
FlutterLocalNotificationsPlugin? pushNotifications;
if (!integration) {
pushNotifications = await initPushNotifications();
}
Expand All @@ -88,24 +87,35 @@ Future<void> mainImpl({bool integration: false}) async {
Provider.of<TableNotifier>(context, listen: false),
canBadge: canBadge),
update: (BuildContext context, TableNotifier tableNotifier,
Notifications user) =>
user..setTableNotifier(tableNotifier),
Notifications? n) {
final Notifications notificationsInstance = n ??
Notifications(notifications, db,
Provider.of<TableNotifier>(context, listen: false),
canBadge: canBadge);
notificationsInstance.setTableNotifier(tableNotifier);
return notificationsInstance;
},
),
ChangeNotifierProxyProvider<Notifications, User>(
create: (BuildContext context) => User(
Provider.of<Notifications>(context, listen: false),
pushNotifications),
update:
(BuildContext context, Notifications notifications, User user) =>
user..setNotifications(notifications),
(BuildContext context, Notifications notifications, User? user) {
final User userInstance = user ??
User(Provider.of<Notifications>(context, listen: false),
pushNotifications);
userInstance.setNotifications(notifications);
return userInstance;
},
),
],
child: const MyApp(),
));
}

class MyApp extends StatefulWidget {
const MyApp({Key key}) : super(key: key);
const MyApp({Key? key}) : super(key: key);

@override
_MyAppState createState() => _MyAppState();
Expand Down Expand Up @@ -135,7 +145,6 @@ class _MyAppState extends State<MyApp> {
focusColor: MyColour.transparent,
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
backgroundColor: MyColour.transparent,
appBarTheme: const AppBarTheme(
iconTheme: IconThemeData(
color: MyColour.darkGrey,
Expand All @@ -149,24 +158,18 @@ class _MyAppState extends State<MyApp> {
size: 22,
),
scrollbarTheme: ScrollbarThemeData(
thickness: MaterialStateProperty.all(4.0),
showTrackOnHover: false,
thickness: WidgetStateProperty.all(4.0),
),
textTheme: getTextTheme(),
buttonTheme: const ButtonThemeData(
highlightColor: Colors.transparent,
splashColor: Colors.transparent),
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
overlayColor: MaterialStateProperty.all(Colors.transparent),
overlayColor: WidgetStateProperty.all(Colors.transparent),
splashFactory: NoSplash.splashFactory,
)),
indicatorColor: MyColour.offOffGrey,
colorScheme: ColorScheme.fromSwatch(
primarySwatch: Colors.grey,
accentColor: MyColour.red,
),
dialogTheme: DialogTheme(
dialogTheme: DialogThemeData(
elevation: 0,
shape: Border.all(width: 0, color: MyColour.offOffGrey),
contentTextStyle: const TextStyle(
Expand All @@ -178,7 +181,12 @@ class _MyAppState extends State<MyApp> {
fontFamily: 'Inconsolata',
color: MyColour.black,
fontWeight: FontWeight.w900,
fontSize: 30))),
fontSize: 30)),
colorScheme: ColorScheme.fromSwatch(
primarySwatch: Colors.grey,
accentColor: MyColour.red,
).copyWith(surface: MyColour.transparent),
tabBarTheme: TabBarThemeData(indicatorColor: MyColour.offOffGrey)),
routes: <String, Widget Function(BuildContext)>{
'/': (BuildContext context) => HomeScreen(),
'/settings': (BuildContext context) => const SettingsScreen(),
Expand Down
10 changes: 5 additions & 5 deletions lib/notifications/db_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import 'package:sqflite/sqflite.dart';
import 'package:uuid/uuid.dart';

class DBProvider {
DBProvider(this.dbPath, {this.fillWithNotifications: false});
DBProvider(this.dbPath, {this.fillWithNotifications = false});

final String _table = 'notifications';
final String dbPath;
Database _db;
Database? _db;
bool fillWithNotifications;

Future<Database> initDB() async {
if (_db != null) {
return _db;
return _db!;
}

Directory dir;
Expand Down Expand Up @@ -52,7 +52,7 @@ class DBProvider {
if (fillWithNotifications) {
await _insertDummyNotifications();
}
return _db;
return _db!;
}

Future<int> store(NotificationUI notification) async {
Expand Down Expand Up @@ -83,7 +83,7 @@ class DBProvider {
return db.rawDelete('DELETE FROM $_table');
}

Future<int> markRead(int id, {bool isRead}) async {
Future<int> markRead(int id, {required bool isRead}) async {
if (isTest) return -1;
int read = 0;
if (isRead) read = 1;
Expand Down
Loading
Loading