Compare commits
2 Commits
3cbc1a59a7
...
a8c4988790
Author | SHA1 | Date | |
---|---|---|---|
a8c4988790
|
|||
28dd204b1a
|
@@ -9,12 +9,17 @@ AppDatabase constructDb() {
|
||||
DatabaseConnection connectOnWeb() {
|
||||
return DatabaseConnection.delayed(
|
||||
Future(() async {
|
||||
final result = await WasmDatabase.open(
|
||||
databaseName: 'solar_network_data',
|
||||
sqlite3Uri: Uri.parse('sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('drift_worker.dart.js'),
|
||||
);
|
||||
return result.resolvedExecutor;
|
||||
try {
|
||||
final result = await WasmDatabase.open(
|
||||
databaseName: 'solar_network_data',
|
||||
sqlite3Uri: Uri.parse('sqlite3.wasm'),
|
||||
driftWorkerUri: Uri.parse('drift_worker.dart.js'),
|
||||
);
|
||||
return result.resolvedExecutor;
|
||||
} catch (e) {
|
||||
print('Failed to open WASM database: $e');
|
||||
rethrow;
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
@@ -312,7 +312,7 @@ class ServerStateNotifier extends StateNotifier<ServerState> {
|
||||
: super(ServerState(status: 'Server not started'));
|
||||
|
||||
Future<void> start() async {
|
||||
if (!Platform.isAndroid && !Platform.isIOS && !kIsWeb) {
|
||||
if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) {
|
||||
try {
|
||||
await server.start();
|
||||
state = state.copyWith(status: 'Server running');
|
||||
|
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -11,6 +12,10 @@ import 'notify.universal.dart' as universal_notify;
|
||||
|
||||
// Platform-specific delegation
|
||||
Future<void> initializeLocalNotifications() async {
|
||||
if (kIsWeb) {
|
||||
// No local notifications on web
|
||||
return;
|
||||
}
|
||||
if (Platform.isWindows) {
|
||||
return windows_notify.initializeLocalNotifications();
|
||||
} else {
|
||||
@@ -18,10 +23,14 @@ Future<void> initializeLocalNotifications() async {
|
||||
}
|
||||
}
|
||||
|
||||
StreamSubscription setupNotificationListener(
|
||||
StreamSubscription? setupNotificationListener(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
) {
|
||||
if (kIsWeb) {
|
||||
// No notification listener on web
|
||||
return null;
|
||||
}
|
||||
if (Platform.isWindows) {
|
||||
return windows_notify.setupNotificationListener(context, ref);
|
||||
} else {
|
||||
@@ -33,6 +42,10 @@ Future<void> subscribePushNotification(
|
||||
Dio apiClient, {
|
||||
bool detailedErrors = false,
|
||||
}) async {
|
||||
if (kIsWeb) {
|
||||
// No push notification subscription on web
|
||||
return;
|
||||
}
|
||||
if (Platform.isWindows) {
|
||||
return windows_notify.subscribePushNotification(
|
||||
apiClient,
|
||||
|
@@ -13,6 +13,7 @@ import 'package:island/screens/creators/publishers_form.dart';
|
||||
import 'package:island/screens/posts/compose.dart';
|
||||
import 'package:island/services/compose_storage_db.dart';
|
||||
import 'package:island/widgets/content/cloud_files.dart';
|
||||
import 'package:island/widgets/content/sheet.dart';
|
||||
import 'package:island/widgets/post/compose_attachments.dart';
|
||||
import 'package:island/widgets/post/compose_form_fields.dart';
|
||||
import 'package:island/widgets/post/compose_info_banner.dart';
|
||||
@@ -261,45 +262,12 @@ class PostComposeCard extends HookConsumerWidget {
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useRootNavigator: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder:
|
||||
(context) => DraggableScrollableSheet(
|
||||
initialChildSize: 0.7,
|
||||
maxChildSize: 0.9,
|
||||
minChildSize: 0.5,
|
||||
builder:
|
||||
(context, scrollController) => Container(
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
Theme.of(context).scaffoldBackgroundColor,
|
||||
borderRadius: const BorderRadius.vertical(
|
||||
top: Radius.circular(16),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 40,
|
||||
height: 4,
|
||||
margin: const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
Theme.of(context).colorScheme.outline,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
controller: scrollController,
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: PostItem(item: post),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
(context) => SheetScaffold(
|
||||
titleText: 'Post Preview',
|
||||
child: SingleChildScrollView(
|
||||
child: PostItem(item: post),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@@ -57,14 +57,14 @@ class ComposeInfoBanner extends StatelessWidget {
|
||||
context,
|
||||
effectiveRepliedPost,
|
||||
Symbols.reply,
|
||||
'postReplyingTo',
|
||||
'postReplyingTo'.tr(),
|
||||
),
|
||||
if (effectiveForwardedPost != null)
|
||||
_buildReferenceBanner(
|
||||
context,
|
||||
effectiveForwardedPost,
|
||||
Symbols.forward,
|
||||
'postForwardingTo',
|
||||
'postForwardingTo'.tr(),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -76,7 +76,7 @@ class ComposeInfoBanner extends StatelessWidget {
|
||||
context,
|
||||
effectiveRepliedPost,
|
||||
Symbols.reply,
|
||||
'postReplyingTo',
|
||||
'postReplyingTo'.tr(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class ComposeInfoBanner extends StatelessWidget {
|
||||
context,
|
||||
effectiveForwardedPost,
|
||||
Symbols.forward,
|
||||
'postForwardingTo',
|
||||
'postForwardingTo'.tr(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -248,6 +248,8 @@
|
||||
src="https://unpkg.com/sweetalert@2.1.2/dist/sweetalert.min.js"
|
||||
async=""
|
||||
></script>
|
||||
<!-- Drift WASM -->
|
||||
<script src="drift_worker.dart.js"></script>
|
||||
<!-- Sign in with Apple -->
|
||||
<script
|
||||
type="text/javascript"
|
||||
|
Reference in New Issue
Block a user