Skip to content

Commit

Permalink
Merge pull request #2 from naeem2000/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
naeem2000 authored Jan 9, 2024
2 parents 3d4fbf9 + f710551 commit 8e71108
Show file tree
Hide file tree
Showing 44 changed files with 22,272 additions and 1,361 deletions.
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# OSX
#
.DS_Store
.vscode

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
.cxx/
*.keystore
!debug.keystore

# node.js
#
node_modules
npm-debug.log
yarn-error.log

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle

# Ruby / CocoaPods
/ios/Pods/
/vendor/bundle/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# testing
/coverage
19 changes: 0 additions & 19 deletions App/Components/API/firebase.ts

This file was deleted.

84 changes: 42 additions & 42 deletions App/Components/OfflineNotice.tsx
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
import NetInfo from '@react-native-community/netinfo';
import React, {useState, useEffect} from 'react';
import {StyleSheet} from 'react-native';
import React, { useState, useEffect } from 'react';
import { StyleSheet } from 'react-native';
import Lottie from 'lottie-react-native';

export default function OfflineNotice() {
const [isConnected, setIsConnected] = useState<boolean>(false);
const [isConnected, setIsConnected] = useState<boolean>(false);

useEffect(() => {
NetInfo.addEventListener(handleConnectivityChange);
NetInfo.fetch().then((state: any) => {
setIsConnected(state.isConnected);
});
useEffect(() => {
NetInfo.addEventListener(handleConnectivityChange);
NetInfo.fetch().then((state: any) => {
setIsConnected(state.isConnected);
});

return () => {
NetInfo.addEventListener((state: any) => {
setIsConnected(state.isConnected);
});
};
}, [NetInfo]);
return () => {
NetInfo.addEventListener((state: any) => {
setIsConnected(state.isConnected);
});
};
}, [NetInfo]);

function handleConnectivityChange(state: any) {
if (state.isConnected) {
setIsConnected(true);
} else {
setIsConnected(false);
}
}
function handleConnectivityChange(state: any) {
if (state.isConnected) {
setIsConnected(true);
} else {
setIsConnected(false);
}
}

function MiniOfflineSign() {
return (
<Lottie
source={require('../Assets/142259-offline-dgaccel.json')}
autoPlay
loop
style={styles.offlineContainer}
/>
);
}
function MiniOfflineSign() {
return (
<Lottie
source={require('../Assets/142259-offline-dgaccel.json')}
autoPlay
loop
style={styles.offlineContainer}
/>
);
}

if (!isConnected) {
return <MiniOfflineSign />;
}
return null;
if (!isConnected) {
return <MiniOfflineSign />;
}
return null;
}

const styles = StyleSheet.create({
offlineContainer: {
position: 'absolute',
top: 32,
alignSelf: 'center',
height: 50,
zIndex: 999,
},
offlineContainer: {
position: 'absolute',
top: 32,
alignSelf: 'center',
height: 50,
zIndex: 999,
},
});
20 changes: 20 additions & 0 deletions App/Components/services/API/firebase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { getFirestore, Firestore } from 'firebase/firestore';
import { initializeApp, getApps } from 'firebase/app';
import { getAuth, Auth } from 'firebase/auth';
import { firebaseKeys } from '../constants';

const firebaseConfig = {
apiKey: firebaseKeys.apiKey,
authDomain: firebaseKeys.authDomain,
projectId: firebaseKeys.projectId,
storageBucket: firebaseKeys.storageBucket,
messagingSenderId: firebaseKeys.messagingSenderId,
appId: firebaseKeys.appId,
};

const app = !getApps().length ? initializeApp(firebaseConfig) : getApps()[0];

export const authGlobal: Auth = getAuth(app);
export const firestore: Firestore = getFirestore(app);

export const auth: Auth = getAuth(app);
8 changes: 8 additions & 0 deletions App/Components/services/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const firebaseKeys = {
apiKey: 'AIzaSyDHswY5ZZZQuqFSKXIUuhJO64KE4i8_wQM',
authDomain: 'cerebral-twist.firebaseapp.com',
projectId: 'cerebral-twist',
storageBucket: 'cerebral-twist.appspot.com',
messagingSenderId: '888534795197',
appId: '1:888534795197:web:f41aae1ea17fa4fc1f08d4',
};
Loading

0 comments on commit 8e71108

Please sign in to comment.