Implemented firebase and onesignal

This commit is contained in:
Abdullah Alassaf
2024-05-23 17:09:10 +03:00
parent f7db91f212
commit cda41ecf74
17 changed files with 312 additions and 64 deletions

View File

@ -1,5 +1,9 @@
plugins { plugins {
id "com.android.application" id "com.android.application"
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
// END: FlutterFire Configuration
id "kotlin-android" id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin" id "dev.flutter.flutter-gradle-plugin"
} }
@ -23,7 +27,7 @@ if (flutterVersionName == null) {
} }
android { android {
namespace "com.example.syncrow_app" namespace "com.example.syncrow_application"
compileSdkVersion 34 compileSdkVersion 34
ndkVersion flutter.ndkVersion ndkVersion flutter.ndkVersion
@ -42,7 +46,7 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.syncrow_app" applicationId "com.example.syncrow_application"
// You can update the following values to match your application needs. // You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 21 minSdkVersion 21

View File

@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "427332280600",
"project_id": "test2-8a3d2",
"storage_bucket": "test2-8a3d2.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:427332280600:android:bb6047adeeb80fb00c7e6d",
"android_client_info": {
"package_name": "com.example.syncrow_application"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyA5qOErxdm0zJmoHIB0TixfebYEsNRpwV0"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

View File

@ -1,4 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<application <application
android:label="syncrow_app" android:label="syncrow_app"
android:name="${applicationName}" android:name="${applicationName}"

View File

@ -1,4 +1,4 @@
package com.example.syncrow_app package com.example.syncrow_application
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity

View File

@ -24,6 +24,10 @@ pluginManagement {
plugins { plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false id "com.android.application" version "7.3.0" apply false
// START: FlutterFire Configuration
id "com.google.gms.google-services" version "4.3.15" apply false
id "com.google.firebase.crashlytics" version "2.8.1" apply false
// END: FlutterFire Configuration
} }
include ":app" include ":app"

1
firebase.json Normal file
View File

@ -0,0 +1 @@
{"flutter":{"platforms":{"android":{"default":{"projectId":"test2-8a3d2","appId":"1:427332280600:android:bb6047adeeb80fb00c7e6d","fileOutput":"android/app/google-services.json"}},"ios":{"default":{"projectId":"test2-8a3d2","appId":"1:427332280600:ios:373a65cce55a3af40c7e6d","uploadDebugSymbols":true,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"dart":{"lib/firebase_options.dart":{"projectId":"test2-8a3d2","configurations":{"android":"1:427332280600:android:bb6047adeeb80fb00c7e6d","ios":"1:427332280600:ios:373a65cce55a3af40c7e6d","web":"1:427332280600:web:ad50516a87a35a1a0c7e6d"}}}}}}

View File

@ -12,6 +12,7 @@
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
611C662010675536F855E5CA /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 490AAF90B8FBFCC5BA996845 /* Pods_RunnerTests.framework */; }; 611C662010675536F855E5CA /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 490AAF90B8FBFCC5BA996845 /* Pods_RunnerTests.framework */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
8BB48ED4ACF8DB5A4F5DB78C /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 90790D9750E58AEFF7247821 /* GoogleService-Info.plist */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
@ -53,6 +54,7 @@
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
90790D9750E58AEFF7247821 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
949637473C534E1F68B19CC0 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; }; 949637473C534E1F68B19CC0 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
@ -137,6 +139,7 @@
331C8082294A63A400263BE5 /* RunnerTests */, 331C8082294A63A400263BE5 /* RunnerTests */,
2F70EB4341A83C900EB253DC /* Pods */, 2F70EB4341A83C900EB253DC /* Pods */,
876D3217A8BBDAF41961161F /* Frameworks */, 876D3217A8BBDAF41961161F /* Frameworks */,
90790D9750E58AEFF7247821 /* GoogleService-Info.plist */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
}; };
@ -198,6 +201,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
315A05630CF83C532DBBCBF2 /* [CP] Embed Pods Frameworks */, 315A05630CF83C532DBBCBF2 /* [CP] Embed Pods Frameworks */,
0D61909C49A20C9AA28568EA /* FlutterFire: "flutterfire upload-crashlytics-symbols" */,
); );
buildRules = ( buildRules = (
); );
@ -263,12 +267,31 @@
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
8BB48ED4ACF8DB5A4F5DB78C /* GoogleService-Info.plist in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
0D61909C49A20C9AA28568EA /* FlutterFire: "flutterfire upload-crashlytics-symbols" */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "FlutterFire: \"flutterfire upload-crashlytics-symbols\"";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\n#!/bin/bash\nPATH=${PATH}:$FLUTTER_ROOT/bin:$HOME/.pub-cache/bin\nflutterfire upload-crashlytics-symbols --upload-symbols-script-path=$PODS_ROOT/FirebaseCrashlytics/upload-symbols --platform=ios --apple-project-path=${SRCROOT} --env-platform-name=${PLATFORM_NAME} --env-configuration=${CONFIGURATION} --env-project-dir=${PROJECT_DIR} --env-built-products-dir=${BUILT_PRODUCTS_DIR} --env-dwarf-dsym-folder-path=${DWARF_DSYM_FOLDER_PATH} --env-dwarf-dsym-file-name=${DWARF_DSYM_FILE_NAME} --env-infoplist-path=${INFOPLIST_PATH} --default-config=default\n";
};
315A05630CF83C532DBBCBF2 /* [CP] Embed Pods Frameworks */ = { 315A05630CF83C532DBBCBF2 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>API_KEY</key>
<string>AIzaSyABnpH6yo2RRjtkp4PlvtK84hKwRm2DhBw</string>
<key>GCM_SENDER_ID</key>
<string>427332280600</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.example.syncrowApp</string>
<key>PROJECT_ID</key>
<string>test2-8a3d2</string>
<key>STORAGE_BUCKET</key>
<string>test2-8a3d2.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:427332280600:ios:373a65cce55a3af40c7e6d</string>
</dict>
</plist>

View File

@ -1,8 +1,14 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:onesignal_flutter/onesignal_flutter.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:syncrow_app/features/app_layout/model/space_model.dart'; import 'package:syncrow_app/features/app_layout/model/space_model.dart';
import 'package:syncrow_app/features/app_layout/view/widgets/app_bar_home_dropdown.dart'; import 'package:syncrow_app/features/app_layout/view/widgets/app_bar_home_dropdown.dart';
import 'package:syncrow_app/features/auth/model/user_model.dart';
import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart'; import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart'; import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/model/device_model.dart';
@ -23,6 +29,7 @@ part 'home_state.dart';
class HomeCubit extends Cubit<HomeState> { class HomeCubit extends Cubit<HomeState> {
HomeCubit._() : super(HomeInitial()) { HomeCubit._() : super(HomeInitial()) {
checkIfNotificationPermissionGranted();
if (selectedSpace == null) { if (selectedSpace == null) {
fetchUnitsByUserId().then((value) { fetchUnitsByUserId().then((value) {
if (selectedSpace != null) { if (selectedSpace != null) {
@ -52,6 +59,9 @@ class HomeCubit extends Cubit<HomeState> {
selectedSpace = null; selectedSpace = null;
selectedRoom = null; selectedRoom = null;
pageIndex = 0; pageIndex = 0;
OneSignal.User.pushSubscription.removeObserver((stateChanges) => oneSignalSubscriptionObserver);
OneSignal.Notifications.removePermissionObserver((permission) => oneSignalPermissionObserver);
OneSignal.Notifications.removeClickListener((event) => oneSignalClickListenerObserver);
return super.close(); return super.close();
} }
@ -69,11 +79,67 @@ class HomeCubit extends Cubit<HomeState> {
var duration = const Duration(milliseconds: 300); var duration = const Duration(milliseconds: 300);
void oneSignalPermissionObserver;
void oneSignalSubscriptionObserver;
void oneSignalClickListenerObserver;
// selectSpace(SpaceModel space) async { // selectSpace(SpaceModel space) async {
// selectedSpace = space; // selectedSpace = space;
// emit(SpaceSelected(space)); // emit(SpaceSelected(space));
// } // }
checkIfNotificationPermissionGranted() async {
try {
OneSignal.initialize('762350c9-1e5d-4d95-a648-16d4dc8a25e1');
//Show native push notification dialog
if (Platform.isIOS) {
await OneSignal.Notifications.permissionNative();
} else {
await OneSignal.Notifications.requestPermission(true);
}
if (await Permission.notification.isGranted == false) {
return;
}
var userUuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ?? '';
if (userUuid.isNotEmpty) {
await OneSignal.login(userUuid);
}
//Enable push notifications
await OneSignal.User.pushSubscription.optIn();
//this function will be called once a user is subscribed
oneSignalSubscriptionObserver = OneSignal.User.pushSubscription.addObserver((state) async {
if (state.current.optedIn) {
await _sendSubscriptionId();
}
});
// Send the player id when a user allows notifications
oneSignalPermissionObserver = OneSignal.Notifications.addPermissionObserver((state) async {
await _sendSubscriptionId();
});
//check if the player id is sent, if not send it again
await _sendSubscriptionId();
oneSignalClickListenerObserver = OneSignal.Notifications.addClickListener((event) async {
//Once the user clicks on the notification
});
} catch (err) {
debugPrint("******* Error");
debugPrint(err.toString());
rethrow;
}
}
_sendSubscriptionId() async {
String? subscriptionId = OneSignal.User.pushSubscription.id ?? '';
//TODO send the subscription id to BE
}
changeSelectedSpace(SpaceModel space) { changeSelectedSpace(SpaceModel space) {
selectedSpace = space; selectedSpace = space;
emitSafe(SpaceSelected(space)); emitSafe(SpaceSelected(space));

View File

@ -1,5 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/devices/bloc/ceiling_bloc/ceiling_sensor_bloc.dart'; import 'package:syncrow_app/features/devices/bloc/ceiling_bloc/ceiling_sensor_bloc.dart';
@ -157,21 +159,24 @@ class CeilingSensorInterface extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
DefaultContainer( DefaultContainer(
padding: padding: const EdgeInsets.symmetric(
const EdgeInsets.symmetric(vertical: 20, horizontal: 15), vertical: 20,
),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Column( Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const BodySmall(text: 'Sports Para'), const Flexible(child: BodySmall(text: 'Sports Para')),
BodyLarge( Flexible(
child: BodyLarge(
text: '0', text: '0',
style: context.bodyLarge.copyWith( style: context.bodyLarge.copyWith(
fontWeight: FontsManager.bold, fontWeight: FontsManager.bold,
), ),
), ),
),
], ],
), ),
Padding( Padding(
@ -185,13 +190,20 @@ class CeilingSensorInterface extends StatelessWidget {
Column( Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const BodySmall(text: 'Detection Range'), const Flexible(
BodyLarge( child: BodySmall(
text: 'Detection Range',
textOverflow: TextOverflow.ellipsis,
)),
Flexible(
child: BodyLarge(
text: '0.0M', text: '0.0M',
textOverflow: TextOverflow.ellipsis,
style: context.bodyLarge.copyWith( style: context.bodyLarge.copyWith(
fontWeight: FontsManager.bold, fontWeight: FontsManager.bold,
), ),
), ),
),
], ],
), ),
Padding( Padding(
@ -205,13 +217,20 @@ class CeilingSensorInterface extends StatelessWidget {
Column( Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const BodySmall(text: 'Movement'), const Flexible(
BodyLarge( child: BodySmall(
text: 'Movement',
textOverflow: TextOverflow.ellipsis,
)),
Flexible(
child: BodyLarge(
text: 'none', text: 'none',
textOverflow: TextOverflow.ellipsis,
style: context.bodyLarge.copyWith( style: context.bodyLarge.copyWith(
fontWeight: FontsManager.bold, fontWeight: FontsManager.bold,
), ),
), ),
),
], ],
), ),
], ],

View File

@ -4,8 +4,8 @@ import 'package:syncrow_app/utils/context_extension.dart';
import 'custom_text_widget.dart'; import 'custom_text_widget.dart';
class BodyLarge extends StatelessWidget { class BodyLarge extends StatelessWidget {
const BodyLarge({ const BodyLarge(
required this.text, {required this.text,
super.key, super.key,
this.textAlign, this.textAlign,
this.style, this.style,
@ -13,7 +13,7 @@ class BodyLarge extends StatelessWidget {
this.fontWeight, this.fontWeight,
this.fontColor, this.fontColor,
this.fontSize, this.fontSize,
}); this.textOverflow});
final String text; final String text;
final TextAlign? textAlign; final TextAlign? textAlign;
@ -28,6 +28,8 @@ class BodyLarge extends StatelessWidget {
final double? fontSize; final double? fontSize;
final TextOverflow? textOverflow;
@override @override
Widget build(BuildContext context) => CustomText( Widget build(BuildContext context) => CustomText(
text, text,
@ -38,6 +40,6 @@ class BodyLarge extends StatelessWidget {
fontWeight: fontWeight, fontWeight: fontWeight,
color: fontColor, color: fontColor,
fontSize: fontSize, fontSize: fontSize,
), overflow: textOverflow),
); );
} }

View File

@ -11,6 +11,7 @@ class BodySmall extends StatelessWidget {
this.fontSize, this.fontSize,
this.fontWeight, this.fontWeight,
this.textAlign, this.textAlign,
this.textOverflow,
}); });
final String text; final String text;
@ -22,6 +23,7 @@ class BodySmall extends StatelessWidget {
final FontWeight? fontWeight; final FontWeight? fontWeight;
final TextAlign? textAlign; final TextAlign? textAlign;
final TextOverflow? textOverflow;
@override @override
Widget build(BuildContext context) => CustomText( Widget build(BuildContext context) => CustomText(
@ -31,5 +33,6 @@ class BodySmall extends StatelessWidget {
fontSize: fontSize, fontSize: fontSize,
fontWeight: fontWeight, fontWeight: fontWeight,
textAlign: textAlign, textAlign: textAlign,
textOverflow: textOverflow,
); );
} }

View File

@ -9,6 +9,7 @@ class CustomText extends StatelessWidget {
this.minLines, this.minLines,
this.maxLines, this.maxLines,
this.textDirection, this.textDirection,
this.textOverflow,
this.fontSize, this.fontSize,
this.fontColor, this.fontColor,
this.fontWeight}); this.fontWeight});
@ -20,6 +21,7 @@ class CustomText extends StatelessWidget {
final int? minLines; final int? minLines;
final int? maxLines; final int? maxLines;
final TextDirection? textDirection; final TextDirection? textDirection;
final TextOverflow? textOverflow;
final double? fontSize; final double? fontSize;
final Color? fontColor; final Color? fontColor;
@ -36,6 +38,7 @@ class CustomText extends StatelessWidget {
textAlign: textAlign, textAlign: textAlign,
// onTap: onTap, // onTap: onTap,
// minLines: minLines, // minLines: minLines,
overflow: textOverflow,
maxLines: maxLines, maxLines: maxLines,
textDirection: textDirection, textDirection: textDirection,
); );

View File

@ -1,5 +1,5 @@
// File generated by FlutterFire CLI. // File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members // ignore_for_file: type=lint
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart' import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform; show defaultTargetPlatform, kIsWeb, TargetPlatform;
@ -17,10 +17,7 @@ import 'package:flutter/foundation.dart'
class DefaultFirebaseOptions { class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform { static FirebaseOptions get currentPlatform {
if (kIsWeb) { if (kIsWeb) {
throw UnsupportedError( return web;
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
} }
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android: case TargetPlatform.android:
@ -50,30 +47,30 @@ class DefaultFirebaseOptions {
} }
static const FirebaseOptions android = FirebaseOptions( static const FirebaseOptions android = FirebaseOptions(
apiKey: '', apiKey: 'AIzaSyA5qOErxdm0zJmoHIB0TixfebYEsNRpwV0',
//'AIzaSyDXEMzUFunmu9RX9bbzwKldLDgxhPXyCyg', appId: '1:427332280600:android:bb6047adeeb80fb00c7e6d',
appId: '', messagingSenderId: '427332280600',
//'1:922241269489:android:2b51e077ee59a8da5d7350', projectId: 'test2-8a3d2',
messagingSenderId: '', storageBucket: 'test2-8a3d2.appspot.com',
//'922241269489',
projectId: '',
// 'realkeyper-v3',
storageBucket: '', // 'realkeyper-v3.appspot.com',
); );
static const FirebaseOptions ios = FirebaseOptions( static const FirebaseOptions ios = FirebaseOptions(
apiKey: '', apiKey: 'AIzaSyABnpH6yo2RRjtkp4PlvtK84hKwRm2DhBw',
//'AIzaSyD2r7wkhuYKTRH-FM-6PVNfzqE865ASYys', appId: '1:427332280600:ios:373a65cce55a3af40c7e6d',
appId: '', messagingSenderId: '427332280600',
//'1:922241269489:ios:9a43e191466515c65d7350', projectId: 'test2-8a3d2',
messagingSenderId: '', storageBucket: 'test2-8a3d2.appspot.com',
//'922241269489', iosBundleId: 'com.example.syncrowApp',
projectId: '',
//'realkeyper-v3',
storageBucket: '',
//'realkeyper-v3.appspot.com',
iosClientId: '',
//'922241269489-01hod7jlea19gg983v0b1nfmp7ce6p0v.apps.googleusercontent.com',
iosBundleId: '', //'com.realkeyper.investorapp2',
); );
static const FirebaseOptions web = FirebaseOptions(
apiKey: 'AIzaSyCVEvKsJYzhWDFM-9Od68FE0nPpP933st0',
appId: '1:427332280600:web:ad50516a87a35a1a0c7e6d',
messagingSenderId: '427332280600',
projectId: 'test2-8a3d2',
authDomain: 'test2-8a3d2.firebaseapp.com',
storageBucket: 'test2-8a3d2.appspot.com',
measurementId: 'G-Z1RTTTV5H9',
);
} }

View File

@ -1,7 +1,8 @@
import 'dart:async'; import 'dart:async';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/firebase_options.dart';
import 'package:syncrow_app/services/locator.dart'; import 'package:syncrow_app/services/locator.dart';
import 'package:syncrow_app/utils/bloc_observer.dart'; import 'package:syncrow_app/utils/bloc_observer.dart';
import 'package:syncrow_app/utils/helpers/localization_helpers.dart'; import 'package:syncrow_app/utils/helpers/localization_helpers.dart';
@ -32,6 +33,11 @@ void main() {
//to initialize the locator //to initialize the locator
initialSetup(); initialSetup();
await Firebase.initializeApp(
name: 'test2',
options: DefaultFirebaseOptions.currentPlatform,
);
//final SharedPreferences prefs = await SharedPreferences.getInstance(); //final SharedPreferences prefs = await SharedPreferences.getInstance();
//to save the locale in the shared preferences //to save the locale in the shared preferences

View File

@ -477,6 +477,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
onesignal_flutter:
dependency: "direct main"
description:
name: onesignal_flutter
sha256: f3940387d6c7033a9c341aa0548f24d98217fce9182f9ad80bf2554b9dd3dc1a
url: "https://pub.dev"
source: hosted
version: "5.2.0"
path: path:
dependency: transitive dependency: transitive
description: description:
@ -541,6 +549,54 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
sha256: "18bf33f7fefbd812f37e72091a15575e72d5318854877e0e4035a24ac1113ecb"
url: "https://pub.dev"
source: hosted
version: "11.3.1"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
sha256: "8bb852cd759488893805c3161d0b2b5db55db52f773dbb014420b304055ba2c5"
url: "https://pub.dev"
source: hosted
version: "12.0.6"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
sha256: e9ad66020b89ff1b63908f247c2c6f931c6e62699b756ef8b3c4569350cd8662
url: "https://pub.dev"
source: hosted
version: "9.4.4"
permission_handler_html:
dependency: transitive
description:
name: permission_handler_html
sha256: "54bf176b90f6eddd4ece307e2c06cf977fb3973719c35a93b85cc7093eb6070d"
url: "https://pub.dev"
source: hosted
version: "0.1.1"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
sha256: "48d4fcf201a1dad93ee869ab0d4101d084f49136ec82a8a06ed9cfeacab9fd20"
url: "https://pub.dev"
source: hosted
version: "4.2.1"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
url: "https://pub.dev"
source: hosted
version: "0.2.1"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:

View File

@ -38,6 +38,8 @@ dependencies:
smooth_page_indicator: ^1.1.0 smooth_page_indicator: ^1.1.0
html: ^0.15.4 html: ^0.15.4
equatable: ^2.0.5 equatable: ^2.0.5
onesignal_flutter: ^5.2.0
permission_handler: ^11.3.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: