diff --git a/app/mobile/ios/Databag.xcodeproj/project.pbxproj b/app/mobile/ios/Databag.xcodeproj/project.pbxproj
index e18215b7..d6343f17 100644
--- a/app/mobile/ios/Databag.xcodeproj/project.pbxproj
+++ b/app/mobile/ios/Databag.xcodeproj/project.pbxproj
@@ -567,7 +567,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
- CLANG_CXX_LANGUAGE_STANDARD = "c++17";
+ CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -639,7 +639,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
- CLANG_CXX_LANGUAGE_STANDARD = "c++17";
+ CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
diff --git a/app/mobile/src/session/Session.jsx b/app/mobile/src/session/Session.jsx
index ec51ed82..2b73a19f 100644
--- a/app/mobile/src/session/Session.jsx
+++ b/app/mobile/src/session/Session.jsx
@@ -11,16 +11,12 @@ import { styles } from './Session.styled';
import Colors from 'constants/Colors';
import { Profile } from './profile/Profile';
import { CardsTitle, CardsBody, Cards } from './cards/Cards';
-import { useCards } from './cards/useCards.hook';
import { RegistryTitle, RegistryBody, Registry } from './registry/Registry';
-import { useRegistry } from './registry/useRegistry.hook';
import { Contact, ContactTitle } from './contact/Contact';
import { Details, DetailsHeader, DetailsBody } from './details/Details';
import { Conversation, ConversationHeader, ConversationBody } from './conversation/Conversation';
import { Welcome } from './welcome/Welcome';
import { ChannelsTitle, ChannelsBody, Channels } from './channels/Channels';
-import { useConversation } from './conversation/useConversation.hook';
-import { useChannels } from './channels/useChannels.hook';
import { CommonActions } from '@react-navigation/native';
import { ConversationContext } from 'context/ConversationContext';
import { ProfileIcon } from './profileIcon/ProfileIcon';
@@ -40,178 +36,111 @@ const Tab = createBottomTabNavigator();
export function Session() {
const { state, actions } = useSession();
- const [selectedConversation, setSelectedConversation] = useState(null);
- const [selectedContact, setSelectedContact] = useState(null);
- // tabbed containers
+ const drawerParams = { drawerPosition: 'right', headerShown: false, swipeEnabled: false, drawerType: 'front' };
+ const stackParams = { headerStyle: { backgroundColor: Colors.titleBackground }, headerBackTitleVisible: false };
+ const screenParams = { headerShown: true, headerTintColor: Colors.primary };
+
const ConversationStackScreen = () => {
+ const conversation = useContext(ConversationContext);
- const setConversation = (navigation, cardId, channelId, revision) => {
+ const setConversation = (navigation, cardId, channelId) => {
navigation.navigate('conversation');
- setSelectedConversation({ cardId, channelId, revision });
+ conversation.actions.setConversation(cardId, channelId);
}
const clearConversation = (navigation) => {
navigation.dispatch(
- CommonActions.reset({
- index: 0,
- routes: [
- { name: 'channels' },
- ],
- })
+ CommonActions.reset({ index: 0, routes: [ { name: 'channels' }, ], })
);
+ conversation.actions.clearConversation();
}
const setDetail = (navigation) => {
navigation.navigate('details');
}
- const clearDetail = (navigation) => {
- navigation.goBack();
- }
-
- const conversation = useConversation();
- const channels = useChannels();
- const conversationContext = useContext(ConversationContext);
-
- useEffect(() => {
- if (selectedConversation) {
- const { cardId, channelId } = selectedConversation || {}
- conversationContext.actions.setConversation(cardId, channelId);
- }
- else {
- conversationContext.actions.clearConversation();
- }
- }, [selectedConversation]);
return (
({ headerShown: true, headerTintColor: Colors.primary })}
- screenListeners={{ state: (e) => { if (e?.data?.state?.index === 0 && selectedConversation) { setSelectedConversation(null); }}, }}>
-
- }}>
- {(props) => setConversation(props.navigation, cardId, channelId, revision)} />}
+ screenOptions={({ route }) => (screenParams)}
+ screenListeners={{ state: (e) => { if (e?.data?.state?.index === 0) { conversation.actions.clearConversation() }} }}>
+
+ }}>
+ {(props) => setConversation(props.navigation, cardId, channelId)} />}
-
- }}>
- {(props) => }
+
+ }}>
+ {(props) => }
-
- }}>
- {(props) => clearConversation(props.navigation)} />}
+
+ }}>
+ {(props) => clearConversation(props.navigation)} />}
+
);
}
+
const ProfileStackScreen = () => {
return (
- ({ headerShown: true, headerTintColor: Colors.primary })}>
+ (screenParams)}>
);
}
+
const ContactStackScreen = () => {
- const setCardStack = (navigation, contact) => {
- setSelectedContact(contact);
+ const [contact, setContact] = useState(null);
+
+ const openContact = (navigation, contact) => {
+ setContact(contact);
navigation.navigate('contact')
}
- const clearCardStack = (navigation) => {
- navigation.goBack();
- }
- const setRegistryStack = (navigation) => {
+ const openRegistry = (navigation) => {
navigation.navigate('registry');
}
- const clearRegistryStack = (navigation) => {
- navigation.goBack();
- }
-
- const registry = useRegistry();
- const cards = useCards();
return (
- ({ headerShow: true, headerTintColor: Colors.primary })}
- initialRouteName="cards">
-
- }}>
- {(props) => setCardStack(props.navigation, contact)} />}
+ (screenParams)} initialRouteName="cards">
+
+ }}>
+ {(props) => openContact(props.navigation, contact)} />}
-
- }}>
- {(props) => clearCardStack(props.navigation)} />}
+
+ }}>
+ {(props) => }
-
- }}>
- {(props) => setCardStack(props.navigation, contact)} />}
+
+ }}>
+ {(props) => openContact(props.navigation, contact)} />}
+
);
}
- const HomeScreen = ({ cardNav, registryNav, detailNav, contactNav, profileNav, setDetails, resetConversation, clearReset }) => {
-
- const [channel, setChannel] = useState(null);
- const setConversation = (cardId, channelId, revision) => {
- setChannel({ cardId, channelId, revision });
- };
- const clearConversation = () => {
- setChannel(null);
- };
- const setProfile = () => {
- profileNav.openDrawer();
- };
- const setChannelDetails = (channel) => {
- setDetails(channel);
- detailNav.openDrawer();
- };
-
- const openProfile = () => {
- profileNav.openDrawer();
- }
- const openCards = () => {
- cardNav.openDrawer();
- }
- const isCardOpen = () => {
- return cardNav.getState().history.length > 1;
- }
+ const HomeScreen = ({ navParams }) => {
const conversation = useContext(ConversationContext);
+ const [channel, setChannel] = useState(false);
+
+ const setConversation = (cardId, channelId) => {
+ conversation.actions.setConversation(cardId, channelId);
+ setChannel(true);
+ };
+ const openDetails = () => {
+ navParams.detailNav.openDrawer();
+ };
+ const openProfile = () => {
+ navParams.profileNav.openDrawer();
+ }
+ const openCards = () => {
+ navParams.cardNav.openDrawer();
+ }
useEffect(() => {
- if (resetConversation) {
- detailNav.closeDrawer();
- setChannel(null);
- setDetails(null);
- clearReset();
- }
- }, [resetConversation]);
-
- useEffect(() => {
-console.log("CHANNEL IS: ", channel);
- if (channel) {
- const { cardId, channelId } = channel;
- conversation.actions.setConversation(cardId, channelId);
- }
- else {
- conversation.actions.clearConversation();
- }
- }, [channel]);
+ navParams.detailNav.closeDrawer();
+ setChannel(false);
+ }, [navParams.closeCount]);
return (
@@ -222,7 +151,7 @@ console.log("CHANNEL IS: ", channel);
Profile
-
+
Contacts
@@ -232,7 +161,7 @@ console.log("CHANNEL IS: ", channel);
{ channel && (
-
+
)}
{ !channel && (
@@ -242,124 +171,71 @@ console.log("CHANNEL IS: ", channel);
)
}
- const CardDrawerScreen = ({ registryNav, detailNav, contactNav, profileNav, setContact, setDetails, clearReset, resetConversation }) => {
-
+ const CardDrawerScreen = ({ navParams }) => {
+ const openContact = (contact) => {
+ navParams.setContact(contact);
+ navParams.contactNav.openDrawer();
+ };
const openRegistry = () => {
- registryNav.openDrawer();
- };
- setCardContact = (contact) => {
- setContact(contact);
- contactNav.openDrawer();
- };
-
- const params = {
- profileNav,
- registryNav,
- detailNav,
- contactNav,
- setDetails,
- setContact,
- clearReset,
- resetConversation,
+ navParams.registryNav.openDrawer();
};
return (
- }>
+ }>
- {(props) => }
+ {(props) => }
);
};
- const RegistryDrawerScreen = ({ detailNav, contactNav, profileNav, setContact, setDetails, clearReset, resetConversation }) => {
-
- const setRegistryContact = (contact) => {
- setContact(contact);
- contactNav.openDrawer();
- };
-
- const params = {
- profileNav,
- detailNav,
- contactNav,
- setDetails,
- setContact,
- clearReset,
- resetConversation,
+ const RegistryDrawerScreen = ({ navParams }) => {
+ const openContact = (contact) => {
+ navParams.setContact(contact);
+ navParams.contactNav.openDrawer();
};
return (
- }>
+ }>
- {(props) => }
+ {(props) => }
);
};
- const ContactDrawerScreen = ({ detailNav, profileNav, setDetails, resetConversation, clearReset }) => {
-
- const [selected, setSelected] = useState(null);
- const setContact = (contact) => {
- setSelected(contact);
- }
-
- const params = {
- profileNav,
- detailNav,
- setDetails,
- setContact,
- clearReset,
- resetConversation,
- };
+ const ContactDrawerScreen = ({ navParams }) => {
+ const [contact, setContact] = useState(null);
return (
- }>
+ }>
- {(props) => }
+ {(props) => }
);
}
- const DetailDrawerScreen = ({ profileNav }) => {
-
- const [selected, setSelected] = useState(null);
- const [resetConversation, setResetConversation] = useState(false);
- const setDetails = (channel) => {
- setSelected(channel);
+ const DetailDrawerScreen = ({ navParams }) => {
+ const [closeCount, setCloseCount] = useState(0);
+ const closeConversation = () => {
+ setCloseCount(closeCount+1);
};
- const clearConversation = () => {
- setResetConversation(true);
- }
- const clearReset = () => {
- setResetConversation(false);
- }
- const params = {
- profileNav,
- setDetails,
- clearReset,
- resetConversation,
- };
-
return (
- }
+ }
>
- {(props) => }
+ {(props) => }
);
}
- const [cardsActive, setCardsActive] = useState(false);
-
return (
@@ -392,16 +268,15 @@ console.log("CHANNEL IS: ", channel);
{ state.firstRun == false && (
{ state.tabbed === false && (
- }>
- {(props) => }
+ {(props) => }
)}
{ state.tabbed === true && (
setCardsActive(e?.data?.state?.index === 2) }}
screenOptions={({ route }) => ({
tabBarStyle: styles.tabBar,
headerShown: false,
@@ -413,7 +288,7 @@ console.log("CHANNEL IS: ", channel);
return ;
}
if (route.name === 'Contacts') {
- return ;
+ return ;
}
},
tabBarShowLabel: false,
diff --git a/app/mobile/src/session/contact/Contact.jsx b/app/mobile/src/session/contact/Contact.jsx
index f5e57ac1..47c96385 100644
--- a/app/mobile/src/session/contact/Contact.jsx
+++ b/app/mobile/src/session/contact/Contact.jsx
@@ -4,6 +4,10 @@ export function ContactTitle({ contact, closeContact }) {
ContactTitle
}
+export function ContactBody({ contact }) {
+ ContactBody;
+}
+
export function Contact({ contact, closeContact }) {
Contact
}