Skip to content

Commit

Permalink
Don't send notifications in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nrubin29 committed Jan 20, 2022
1 parent 97c9c09 commit dbe278f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/lib/util/firebase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ class Firebase {

static final _client = Client();
static late Json _json;
static var _isDev = false;

static Future<void> setup() async {
_json = json.decode(await File('sa.json').readAsString());

assert(() {
_isDev = true;
return true;
}());
}

static String _jwt() {
Expand Down Expand Up @@ -47,6 +53,10 @@ class Firebase {

static Future<bool> sendNotification(
{required String title, required String body}) async {
if (_isDev) {
return true;
}

final token = await _fetchToken();

final response = await _client.post(
Expand Down

0 comments on commit dbe278f

Please sign in to comment.