mirror of
https://github.com/nostrlabs-io/zap-stream-flutter.git
synced 2025-06-15 03:46:33 +00:00
chore: ios build
This commit is contained in:
@ -59,11 +59,11 @@ class DefaultFirebaseOptions {
|
||||
|
||||
static const FirebaseOptions ios = FirebaseOptions(
|
||||
apiKey: 'AIzaSyByygErXpki6Q7NXOXTHbRgg3-Tw-KCVO0',
|
||||
appId: '1:953923151748:ios:30ec9a230e55fe139e9fd1',
|
||||
appId: '1:953923151748:ios:aef9c54f556258d39e9fd1',
|
||||
messagingSenderId: '953923151748',
|
||||
projectId: 'nostrlabs',
|
||||
storageBucket: 'nostrlabs.firebasestorage.app',
|
||||
iosBundleId: 'io.nostrlabs.zapStreamFlutter',
|
||||
iosBundleId: 'io.nostrlabs.zap-stream',
|
||||
);
|
||||
|
||||
static const FirebaseOptions macos = FirebaseOptions(
|
||||
@ -83,4 +83,5 @@ class DefaultFirebaseOptions {
|
||||
authDomain: 'nostrlabs.firebaseapp.com',
|
||||
storageBucket: 'nostrlabs.firebasestorage.app',
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -12,6 +12,7 @@ import 'package:ndk/ndk.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:zap_stream_flutter/const.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:zap_stream_flutter/firebase_options.dart';
|
||||
import 'package:zap_stream_flutter/utils.dart';
|
||||
|
||||
class Notepush {
|
||||
@ -136,7 +137,7 @@ Notepush? getNotificationService() {
|
||||
}
|
||||
|
||||
Future<void> setupNotifications() async {
|
||||
await Firebase.initializeApp();
|
||||
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
||||
|
||||
final signer = ndk.accounts.getLoggedAccount()?.signer;
|
||||
if (signer != null) {
|
||||
@ -173,17 +174,25 @@ Future<void> setupNotifications() async {
|
||||
developer.log("Failed to process push notification\n ${e.toString()}");
|
||||
}
|
||||
});
|
||||
|
||||
await fbase.requestPermission(provisional: true);
|
||||
await fbase.setAutoInitEnabled(true);
|
||||
await fbase.setForegroundNotificationPresentationOptions(
|
||||
alert: true,
|
||||
badge: true,
|
||||
sound: true,
|
||||
);
|
||||
await fbase.requestPermission(provisional: true);
|
||||
|
||||
if (Platform.isIOS) {
|
||||
final apnsToken = await FirebaseMessaging.instance.getAPNSToken();
|
||||
if (apnsToken == null) {
|
||||
throw "APNS token not availble";
|
||||
}
|
||||
}
|
||||
await localNotifications.initialize(
|
||||
InitializationSettings(
|
||||
android: AndroidInitializationSettings("@mipmap/ic_launcher"),
|
||||
iOS: DarwinInitializationSettings()
|
||||
),
|
||||
);
|
||||
fbase.onTokenRefresh.listen((token) async {
|
||||
@ -192,12 +201,6 @@ Future<void> setupNotifications() async {
|
||||
await pusher.setNotificationSettings(token, [30_311]);
|
||||
});
|
||||
|
||||
if (Platform.isIOS) {
|
||||
final apnsToken = await FirebaseMessaging.instance.getAPNSToken();
|
||||
if (apnsToken == null) {
|
||||
throw "APNS token not availble";
|
||||
}
|
||||
}
|
||||
final fcmToken = await FirebaseMessaging.instance.getToken();
|
||||
if (fcmToken == null) {
|
||||
throw "Push token is null";
|
||||
|
Reference in New Issue
Block a user