Skip to content

Commit

Permalink
Merge pull request #13 from maxisme/develop
Browse files Browse the repository at this point in the history
Fix CI logic & add logging view
  • Loading branch information
maxisme authored Apr 2, 2021
2 parents 98d9a6f + 8a9c53e commit e36eca7
Show file tree
Hide file tree
Showing 15 changed files with 240 additions and 97 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,24 @@ jobs:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.VERSION }}
deploy: ${{ steps.version.outputs.SHOULD_DEPLOY }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- id: bump_version
if: ${{ !github.event.issue.pull_request && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') }}
if: ${{ github.ref == 'refs/heads/master' || (!github.event.issue.pull_request && github.ref == 'refs/heads/develop') }}
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCHES: .*
RELEASE_BRANCHES: master
DRY_RUN: true
- id: version
name: Create Version
run: |
if [ -n "${{ steps.bump_version.outputs.new_tag }}" ]
then
echo ::set-output name=SHOULD_DEPLOY::true
echo ::set-output name=VERSION::${{ steps.bump_version.outputs.new_tag }}
else
echo ::set-output name=SHOULD_DEPLOY::false
echo ::set-output name=VERSION::ci-$GITHUB_RUN_ID
fi
Expand Down Expand Up @@ -84,12 +81,11 @@ jobs:
with:
name: notifi-dmg
path: dmg/
retention-days: 1
if-no-files-found: error

deploy:
name: "Deploy"
if: ${{ needs.version.outputs.deploy == true }}
if: ${{ github.ref == 'refs/heads/master' || (!github.event.issue.pull_request && github.ref == 'refs/heads/develop') }}
runs-on: macos-latest
needs: [ checks, build, version ]
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ app.*.symbols
# Obfuscation related
app.*.map.json
/test/failures/
/flog.db
21 changes: 11 additions & 10 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ analyzer:
linter:
rules:
always_put_required_named_parameters_first: true
avoid_classes_with_only_static_members: true
sort_constructors_first: true
prefer_single_quotes: true
prefer_double_quotes: false
public_member_api_docs: false
always_specify_types: true
lines_longer_than_80_chars: true
always_use_package_imports: true
avoid_classes_with_only_static_members: true
avoid_print: true
avoid_redundant_argument_values: true
avoid_relative_lib_imports: true
avoid_slow_async_io: true
close_sinks: true
lines_longer_than_80_chars: true
literal_only_boolean_expressions: true
prefer_void_to_null: true
no_logic_in_create_state: true
avoid_redundant_argument_values: true
avoid_print: false
prefer_double_quotes: false
prefer_foreach: true
prefer_is_empty: true
prefer_is_empty: true
prefer_single_quotes: true
prefer_void_to_null: true
public_member_api_docs: false
sort_constructors_first: true
3 changes: 1 addition & 2 deletions lib/local_notifications.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter_local_notifications/flutter_local_notifications.dart';

import 'notifications/notification.dart';
import 'package:notifi/notifications/notification.dart';

Future<FlutterLocalNotificationsPlugin> initPushNotifications() async {
final FlutterLocalNotificationsPlugin localNotifications =
Expand Down
3 changes: 1 addition & 2 deletions lib/notifications/db_provider.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import 'dart:async';

import 'package:notifi/notifications/notification.dart';
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';

// import 'package:sqlite3/sqlite3.dart';

import 'notification.dart';

class DBProvider {
DBProvider(this.dbPath);

Expand Down
2 changes: 1 addition & 1 deletion lib/notifications/notifis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Notifications extends ChangeNotifier {
try {
id = await db.store(notification);
} catch (e) {
print('Problem storing notification in db: $e');
L.e('Problem storing notification in db: $e');
return -1;
}

Expand Down
40 changes: 6 additions & 34 deletions lib/screens/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:notifi/notifications/notifications_table.dart';
import 'package:notifi/notifications/notifis.dart';
import 'package:notifi/pallete.dart';
import 'package:notifi/user.dart';
import 'package:notifi/utils.dart';
import 'package:provider/provider.dart';

class HomeScreen extends StatelessWidget {
Expand Down Expand Up @@ -93,7 +94,11 @@ class HomeScreen extends StatelessWidget {
Provider.of<Notifications>(context, listen: false).readAll();
} else if (index == 1) {
// DELETE ALL EVENT
_deleteAllNotificationsDialogue(context);
showAlert(context, 'Delete All',
'All notifications will be irretrievable', onOkPressed: () {
Provider.of<Notifications>(context, listen: false).deleteAll();
Navigator.pop(context);
});
}
},
// ignore: prefer_const_literals_to_create_immutables
Expand All @@ -116,39 +121,6 @@ class HomeScreen extends StatelessWidget {
));
}

Future<void> _deleteAllNotificationsDialogue(BuildContext context) async {
return showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Delete All'),
content: const Text('All notifications will be irretrievable'),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text(
'Cancel',
style: TextStyle(color: MyColour.grey),
),
),
TextButton(
onPressed: () {
Provider.of<Notifications>(context, listen: false)
.deleteAll();
Navigator.pop(context);
},
child: const Text(
'Ok',
style: TextStyle(color: MyColour.black),
)),
],
);
},
);
}

// var waitErr;
// setError(bool err) {
// this.waitErr = err;
Expand Down
26 changes: 26 additions & 0 deletions lib/screens/logs.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:notifi/utils.dart';

class LogsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
toolbarHeight: 80,
title: const Text('Logs'),
),
body: Container(
padding: const EdgeInsets.only(left: 10.0, right: 10.0),
child: FutureBuilder<ListView>(
future: L.logListView(),
// ignore: always_specify_types
builder: (BuildContext context, AsyncSnapshot f) {
if (f.connectionState != ConnectionState.done) {
return const Center(child: CircularProgressIndicator());
}
return f.data;
}),
));
}
}
12 changes: 10 additions & 2 deletions lib/screens/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:http/http.dart' as http;
import 'package:launch_at_login/launch_at_login.dart';
import 'package:notifi/notifications/notifications_table.dart';
import 'package:notifi/pallete.dart';
import 'package:notifi/screens/logs.dart';
import 'package:notifi/user.dart';
import 'package:notifi/utils.dart';
import 'package:package_info/package_info.dart';
Expand Down Expand Up @@ -53,7 +54,7 @@ class SettingsScreenState extends State<SettingsScreen> {
if (value.statusCode == 200) {
_remoteVersion.value = value.body;
} else {
print('problem getting /version');
L.e('Problem getting /version from notifi.it');
}
});

Expand Down Expand Up @@ -135,6 +136,13 @@ class SettingsScreenState extends State<SettingsScreen> {
SettingOption('About...', onTapCallback: () {
launch('https://notifi.it');
}),
SettingOption('Logs...', onTapCallback: () {
Navigator.push(
context,
MaterialPageRoute<StatelessWidget>(
builder: (BuildContext context) => LogsScreen()),
);
}),
if (Platform.isMacOS)
SettingOption(
'Quit notifi',
Expand Down Expand Up @@ -237,7 +245,7 @@ class SettingsScreenState extends State<SettingsScreen> {
.requestNewUser();
if (!gotUser) {
// TODO show error
print('Unable to fetch new user!');
L.i('Unable to fetch new user!');
}
},
child: const Text(
Expand Down
Loading

0 comments on commit e36eca7

Please sign in to comment.