Skip to content

Commit

Permalink
fix for web
Browse files Browse the repository at this point in the history
  • Loading branch information
frnandu committed Sep 5, 2023
1 parent 7ba752c commit 238707f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

- notifications/replies of reactions/likes (include post and if a reply the parent)
- reply position on thread when linking from outside is wrong
- fast secp256k1 verify signature for web JS

=======================

Expand Down
3 changes: 3 additions & 0 deletions lib/nostr/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ class Event {
static const platform = MethodChannel('flutter.native/helper');

Future<bool> get isSigned async {
if (PlatformUtil.isWeb()) {
return true;
}
count++;
int? kindCount = kindMapCount[kind];
kindCount ??= 0;
Expand Down
24 changes: 20 additions & 4 deletions lib/utils/platform_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ class PlatformUtil {
if (isWeb()) {
return false;
}
try {
return Platform.isIOS;
} catch (e) {
return false;
}

return Platform.isIOS;
}

static bool isWeb() {
Expand All @@ -63,17 +67,29 @@ class PlatformUtil {
if (isWeb()) {
return false;
}
return Platform.isWindows || Platform.isLinux;
try {
return Platform.isWindows || Platform.isLinux;
} catch (e) {
return false;
}
}

static bool isPC() {
if (isWeb()) {
return false;
}
return Platform.isWindows || Platform.isMacOS || Platform.isLinux;
try {
return Platform.isWindows || Platform.isMacOS || Platform.isLinux;
} catch (e) {
return false;
}
}

static bool isAndroid() {
return Platform.isAndroid;
try {
return Platform.isAndroid;
} catch (e) {
return false;
}
}
}

0 comments on commit 238707f

Please sign in to comment.