Skip to content

Commit

Permalink
Big changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ronickg committed Nov 22, 2021
1 parent 9646818 commit af6a4fa
Show file tree
Hide file tree
Showing 42 changed files with 1,224 additions and 325 deletions.
23 changes: 6 additions & 17 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { RecoilRoot } from 'recoil';
import { Notifications } from 'react-native-notifications';
// import * as Sentry from '@sentry/react-native';
import messaging from '@react-native-firebase/messaging';
import { saveObject } from './src/utils/Utils';
import ApplicationNavigator from './src/ApplicationNavigator';
import LoadingComponent from './src/components/LoadingComponent';
Expand All @@ -25,26 +26,14 @@ const App = () => {
useEffect(() => {
Notifications.registerRemoteNotifications();

// if (Platform.OS === 'ios') {
// Notifications.ios.checkPermissions().then((currentPermissions) => {
// console.log(`Badges enabled: ${!!currentPermissions.badge}`);
// console.log(`Sounds enabled: ${!!currentPermissions.sound}`);
// console.log(`Alerts enabled: ${!!currentPermissions.alert}`);
// console.log(`Car Play enabled: ${!!currentPermissions.carPlay}`);
// console.log(`Critical Alerts enabled: ${!!currentPermissions.criticalAlert}`);
// console.log(`Provisioanl enabled: ${!!currentPermissions.provisional}`);
// console.log(
// `Provides App Notification Settings enabled: ${!!currentPermissions.providesAppNotificationSettings}`
// );
// console.log(`Announcement enabled: ${!!currentPermissions.announcement}`);
// });
// }

Notifications.events().registerRemoteNotificationsRegistered((event) => {
saveObject('fcm', event.deviceToken);
// TODO: Send the token to my server so it could send back push notifications...
// console.log('Device Token Received', event.deviceToken);
});

// messaging()
// .subscribeToTopic('blocks')
// .then(() => console.log('Subscribed to topic!'));

Notifications.events().registerRemoteNotificationsRegistrationFailed((event) => {
console.error(event);
});
Expand Down
9 changes: 0 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"@sentry/react-native": "^3.2.3",
"art": "^0.10.3",
"axios": "^0.24.0",
"color": "^4.0.1",
"d3": "^7.1.1",
"d3-array": "^3.1.1",
"d3-scale": "^4.0.2",
Expand Down
23 changes: 23 additions & 0 deletions src/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,26 @@ export const updateFCMToken = (launcherID, token, FCMToken) =>
.catch((error) => {
console.log(error);
});

export const updateFarmerName = (launcherID, token, name) =>
fetch(`${REST_API}launcher/${launcherID}/`, {
method: 'PUT',
body: JSON.stringify({
name,
}),
headers: {
Accept: 'application/json',
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
})
.then((response) => {
if (response.ok) {
return response.json();
}
throw Error(response.statusText);
})
.then((json) => json)
.catch((error) => {
console.log(error);
});
29 changes: 22 additions & 7 deletions src/ApplicationNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ import FarmersScreen from './screens/FarmersScreen';
import BlocksFoundScreen from './screens/BlocksFoundScreen';
import PayoutScreen from './screens/PayoutScreen';
import ScanScreen from './screens/ScanScreen';
import FarmerScreen, { getHeaderTitle } from './screens/FarmerScreen';
import FarmerScreen, { getHeaderTitle } from './screens/farmer/FarmerScreen';
import SettingsScreen from './screens/SettingsScreen';
import { initialRouteState, launcherIDsState, settingsState } from './Atoms';
import LanguageSelectorScreen from './screens/LanguageSelectorScreen';
import CurrencySelectionScreen from './screens/CurrencySelectionScreen';
import CustomDrawerContent from './components/CustomDrawerContent';
import ChartsScreen from './screens/ChartsScreen';
import PoolspaceScreen from './screens/charts/PoolspaceScreen';
import NewsScreen from './screens/NewsScreen';
import NewsPostScreen from './screens/NewsPostScreen';
import FarmerSettingsScreen from './screens/farmer/FarmerSettingsScreen';
import FarmerNameScreen from './screens/farmer/FarmerNameScreen';

// LogBox.ignoreLogs(['Reanimated 2']);
LogBox.ignoreLogs(['timer']);
Expand Down Expand Up @@ -102,7 +104,7 @@ const LightTheme = {
textGreyLight: '#8c8c8c',
disabled: '#436B34',
placeholder: '#436B34',
backdrop: '#436B34',
// backdrop: '#436B34',
notification: '#436B34',
leaves: 'rgba(41, 50, 57, 0.05)',
borderColor: 'rgba(0,0,0,0.05)',
Expand Down Expand Up @@ -133,7 +135,7 @@ const DarkTheme = {
divider: 'rgba(255, 255, 255, 0.2)',
disabled: '#f5f5f5',
placeholder: '#f5f5f5',
backdrop: '#f5f5f5',
// backdrop: '#f5f5f5',
notification: '#f5f5f5',
borderColor: 'rgba(0,0,0,0.05)',
},
Expand All @@ -149,7 +151,7 @@ const Root = ({ theme, toggleTheme, launcherIDsArray, initialRoute, t }) => (
/>
)}
backBehavior="history"
initialRouteName={initialRoute}
initialRouteName={initialRoute.name}
// useLegacyImplementation
screenOptions={{
headerShown: true,
Expand Down Expand Up @@ -180,8 +182,17 @@ const Root = ({ theme, toggleTheme, launcherIDsArray, initialRoute, t }) => (
<Drawer.Screen name={t('navigate:farmers')} component={FarmersScreen} />
<Drawer.Screen name={t('navigate:blocksFound')} component={BlocksFoundScreen} />
<Drawer.Screen name={t('navigate:payouts')} component={PayoutScreen} />
<Drawer.Screen name={t('navigate:verifyFarm')} component={ScanScreen} />
<Drawer.Screen name={t('navigate:charts')} component={ChartsScreen} />
<Drawer.Screen
name="Farmer Details Drawer"
component={FarmerScreen}
options={({ route }) => ({
title: getHeaderTitle(route, t),
headerRight: () => (
<Button onPress={() => alert('This is a button!')} title="Info" color="#fff" />
),
})}
// options={({ route, navigation }) => ({})}
/>
{/* <Divider /> */}
{launcherIDsArray.map((item) => (
<Drawer.Screen
Expand Down Expand Up @@ -240,8 +251,12 @@ const AppRoot = ({ theme, toggleTheme, launcherIDsArray, isThemeDark, initialRou
// options={({ route, navigation }) => ({})}
/>
<Stack.Screen name="Post" component={NewsPostScreen} />
<Stack.Screen name="Farmer Settings" component={FarmerSettingsScreen} />
<Stack.Screen name={t('common:language')} component={LanguageSelectorScreen} />
<Stack.Screen name={t('common:currency')} component={CurrencySelectionScreen} />
<Stack.Screen name={t('common:poolSpace')} component={PoolspaceScreen} />
<Stack.Screen name={t('common:name')} component={FarmerNameScreen} />
<Stack.Screen name={t('navigate:verifyFarm')} component={ScanScreen} />
</Stack.Navigator>
</NavigationContainer>
);
Expand Down
Loading

0 comments on commit af6a4fa

Please sign in to comment.