Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

await native methods #599

Merged
merged 2 commits into from
May 30, 2022
Merged
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
2 changes: 2 additions & 0 deletions lib/database/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ extension SaveUserLaunchInfo on UserDatastore {
final timeZoneOffset = now.timeZoneOffset;

return _database.userRawReference().set({
// shortcut property for backend
"lastLoginAt": now,
"stats": {
"lastLoginAt": now,
"beginVersion": beginVersion,
Expand Down
13 changes: 10 additions & 3 deletions lib/native/channel.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/services.dart';
import 'package:pilll/error_log.dart';
import 'package:pilll/native/legacy.dart';
import 'package:pilll/native/pill.dart';

Expand All @@ -7,10 +8,16 @@ definedChannel() {
methodChannel.setMethodCallHandler((MethodCall call) async {
switch (call.method) {
case 'recordPill':
return recordPill();
await recordPill();
return;
case "salvagedOldStartTakenDate":
return salvagedOldStartTakenDate(call.arguments)
.catchError((error) => print(error));
try {
await salvagedOldStartTakenDate(call.arguments);
} catch (error, stack) {
errorLogger.recordError(error, stack);
print(error);
}
return;
default:
break;
}
Expand Down