Upload files to "Source Code Mobile"
This commit is contained in:
parent
3b0eed3e1f
commit
0086e6272b
|
|
@ -0,0 +1,93 @@
|
||||||
|
// File generated by FlutterFire CLI.
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
|
||||||
|
import 'package:flutter/foundation.dart'
|
||||||
|
show defaultTargetPlatform, kIsWeb, TargetPlatform;
|
||||||
|
|
||||||
|
/// Default [FirebaseOptions] for use with your Firebase apps.
|
||||||
|
///
|
||||||
|
/// Example:
|
||||||
|
/// ```dart
|
||||||
|
/// import 'firebase_options.dart';
|
||||||
|
/// // ...
|
||||||
|
/// await Firebase.initializeApp(
|
||||||
|
/// options: DefaultFirebaseOptions.currentPlatform,
|
||||||
|
/// );
|
||||||
|
/// ```
|
||||||
|
class DefaultFirebaseOptions {
|
||||||
|
static FirebaseOptions get currentPlatform {
|
||||||
|
if (kIsWeb) {
|
||||||
|
return web;
|
||||||
|
}
|
||||||
|
switch (defaultTargetPlatform) {
|
||||||
|
case TargetPlatform.android:
|
||||||
|
return android;
|
||||||
|
case TargetPlatform.iOS:
|
||||||
|
return ios;
|
||||||
|
case TargetPlatform.macOS:
|
||||||
|
return macos;
|
||||||
|
case TargetPlatform.windows:
|
||||||
|
return windows;
|
||||||
|
case TargetPlatform.linux:
|
||||||
|
throw UnsupportedError(
|
||||||
|
'DefaultFirebaseOptions have not been configured for linux - '
|
||||||
|
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
throw UnsupportedError(
|
||||||
|
'DefaultFirebaseOptions are not supported for this platform.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const FirebaseOptions web = FirebaseOptions(
|
||||||
|
apiKey: 'AIzaSyBRdbKz1e5ePTXSoBJ6S78JE6gVeltN7xQ',
|
||||||
|
appId: '1:134616562278:web:70c16a6898bfab883e8ba7',
|
||||||
|
messagingSenderId: '134616562278',
|
||||||
|
projectId: 'sensor-iot-45bb6',
|
||||||
|
authDomain: 'sensor-iot-45bb6.firebaseapp.com',
|
||||||
|
databaseURL: 'https://sensor-iot-45bb6-default-rtdb.firebaseio.com',
|
||||||
|
storageBucket: 'sensor-iot-45bb6.firebasestorage.app',
|
||||||
|
measurementId: 'G-06DB4EBYRF',
|
||||||
|
);
|
||||||
|
|
||||||
|
static const FirebaseOptions android = FirebaseOptions(
|
||||||
|
apiKey: 'AIzaSyANA0Sj8y2FQr9XXFAgprbqGNT0TIXxRfY',
|
||||||
|
appId: '1:134616562278:android:ab2242e1f84360e33e8ba7',
|
||||||
|
messagingSenderId: '134616562278',
|
||||||
|
projectId: 'sensor-iot-45bb6',
|
||||||
|
databaseURL: 'https://sensor-iot-45bb6-default-rtdb.firebaseio.com',
|
||||||
|
storageBucket: 'sensor-iot-45bb6.firebasestorage.app',
|
||||||
|
);
|
||||||
|
|
||||||
|
static const FirebaseOptions ios = FirebaseOptions(
|
||||||
|
apiKey: 'AIzaSyBpbklFAF_561MxlzWI2N1mydn5bEoHrOs',
|
||||||
|
appId: '1:134616562278:ios:60228758aa7649993e8ba7',
|
||||||
|
messagingSenderId: '134616562278',
|
||||||
|
projectId: 'sensor-iot-45bb6',
|
||||||
|
databaseURL: 'https://sensor-iot-45bb6-default-rtdb.firebaseio.com',
|
||||||
|
storageBucket: 'sensor-iot-45bb6.firebasestorage.app',
|
||||||
|
iosBundleId: 'com.example.mobileTaApps',
|
||||||
|
);
|
||||||
|
|
||||||
|
static const FirebaseOptions macos = FirebaseOptions(
|
||||||
|
apiKey: 'AIzaSyBpbklFAF_561MxlzWI2N1mydn5bEoHrOs',
|
||||||
|
appId: '1:134616562278:ios:60228758aa7649993e8ba7',
|
||||||
|
messagingSenderId: '134616562278',
|
||||||
|
projectId: 'sensor-iot-45bb6',
|
||||||
|
databaseURL: 'https://sensor-iot-45bb6-default-rtdb.firebaseio.com',
|
||||||
|
storageBucket: 'sensor-iot-45bb6.firebasestorage.app',
|
||||||
|
iosBundleId: 'com.example.mobileTaApps',
|
||||||
|
);
|
||||||
|
|
||||||
|
static const FirebaseOptions windows = FirebaseOptions(
|
||||||
|
apiKey: 'AIzaSyBRdbKz1e5ePTXSoBJ6S78JE6gVeltN7xQ',
|
||||||
|
appId: '1:134616562278:web:0f1713abd3800e313e8ba7',
|
||||||
|
messagingSenderId: '134616562278',
|
||||||
|
projectId: 'sensor-iot-45bb6',
|
||||||
|
authDomain: 'sensor-iot-45bb6.firebaseapp.com',
|
||||||
|
databaseURL: 'https://sensor-iot-45bb6-default-rtdb.firebaseio.com',
|
||||||
|
storageBucket: 'sensor-iot-45bb6.firebasestorage.app',
|
||||||
|
measurementId: 'G-84ZG3GDT47',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
import 'package:firebase_database/firebase_database.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import 'providers/auth_provider.dart';
|
||||||
|
import 'providers/sensor_provider.dart';
|
||||||
|
import 'providers/ac_provider.dart';
|
||||||
|
import 'providers/ac_config_provider.dart';
|
||||||
|
import 'providers/ac_setup_provider.dart';
|
||||||
|
import 'providers/history_provider.dart';
|
||||||
|
import 'providers/notification_provider.dart';
|
||||||
|
import 'providers/ir_provider.dart';
|
||||||
|
import 'services/notification_service.dart';
|
||||||
|
import 'core/app_theme.dart';
|
||||||
|
|
||||||
|
import 'screens/login_page.dart';
|
||||||
|
import 'firebase_options.dart';
|
||||||
|
|
||||||
|
void main() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
||||||
|
|
||||||
|
// setPersistenceEnabled hanya untuk mobile/desktop, tidak untuk web
|
||||||
|
if (!kIsWeb) {
|
||||||
|
FirebaseDatabase.instance.setPersistenceEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inisialisasi layanan notifikasi lokal (push notification OS)
|
||||||
|
await NotificationService.initialize();
|
||||||
|
|
||||||
|
// Test write ke database tanpa memblokir startup utama
|
||||||
|
FirebaseDatabase.instance
|
||||||
|
.ref('test')
|
||||||
|
.set({'message': 'Flutter Connected', 'time': DateTime.now().toString()})
|
||||||
|
.catchError((e) {
|
||||||
|
debugPrint('Firebase write error: $e');
|
||||||
|
});
|
||||||
|
|
||||||
|
runApp(const AirQuality());
|
||||||
|
}
|
||||||
|
|
||||||
|
class AirQuality extends StatelessWidget {
|
||||||
|
const AirQuality({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MultiProvider(
|
||||||
|
providers: [
|
||||||
|
ChangeNotifierProvider(create: (_) => AuthProvider()),
|
||||||
|
ChangeNotifierProvider(create: (_) => SensorProvider()),
|
||||||
|
ChangeNotifierProvider(create: (_) => ACProvider()),
|
||||||
|
ChangeNotifierProvider(create: (_) => ACConfigProvider()),
|
||||||
|
ChangeNotifierProvider(create: (_) => ACSetupProvider()),
|
||||||
|
ChangeNotifierProvider(create: (_) => HistoryProvider()),
|
||||||
|
ChangeNotifierProvider(create: (_) => NotificationProvider()),
|
||||||
|
ChangeNotifierProvider(create: (_) => IrProvider()),
|
||||||
|
],
|
||||||
|
child: MaterialApp(
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
|
title: 'Smart Air Quality',
|
||||||
|
theme: AppTheme.darkTheme,
|
||||||
|
home: const LoginPage(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue