Skip to content

Commit

Permalink
Merge pull request zingolabs#771 from juanky201271/dev_messages_exper…
Browse files Browse the repository at this point in the history
…imental_feature

Messages/Chats marked as experimental feature
  • Loading branch information
juanky201271 authored Feb 11, 2025
2 parents ee37f35 + d836460 commit 5fede0d
Show file tree
Hide file tree
Showing 21 changed files with 196 additions and 102 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/ci-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ jobs:
cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
arch: ${{ matrix.arch }}

android-macos-integration-test:
strategy:
matrix:
arch: [arm64-v8a, armeabi-v7a]
uses: ./.github/workflows/android-macos-integration-test.yaml
needs: [ create-timestamp, create-cache-key, android-build ]
with:
timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
abi: ${{ matrix.arch }}
# those are really long, near to one hour and sometimes more
#android-macos-integration-test:
# strategy:
# matrix:
# arch: [arm64-v8a, armeabi-v7a]
# uses: ./.github/workflows/android-macos-integration-test.yaml
# needs: [ create-timestamp, create-cache-key, android-build ]
# with:
# timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
# cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
# abi: ${{ matrix.arch }}

android-ubuntu-integration-test-ci:
strategy:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
arch: ${{ matrix.arch }}

# those are really long, near to one hour and sometimes more
# I leave them in ci-nightly.
#android-macos-integration-test:
# strategy:
# matrix:
Expand Down
8 changes: 4 additions & 4 deletions __tests__/__snapshots__/History.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ exports[`Component History - test History currency USD, privacy high & mode adva
"borderColor": "#18bd18",
"borderRadius": 15,
"borderWidth": 1,
"marginHorizontal": 0,
"marginHorizontal": 10,
"paddingHorizontal": 10,
"paddingVertical": 5,
}
Expand Down Expand Up @@ -875,7 +875,7 @@ exports[`Component History - test History currency USD, privacy high & mode adva
"borderColor": "#888888",
"borderRadius": 15,
"borderWidth": 1,
"marginHorizontal": 10,
"marginHorizontal": 0,
"paddingHorizontal": 10,
"paddingVertical": 5,
}
Expand Down Expand Up @@ -1395,7 +1395,7 @@ exports[`Component History - test History no currency, privacy normal & mode bas
"borderColor": "#18bd18",
"borderRadius": 15,
"borderWidth": 1,
"marginHorizontal": 0,
"marginHorizontal": 10,
"paddingHorizontal": 10,
"paddingVertical": 5,
}
Expand Down Expand Up @@ -1455,7 +1455,7 @@ exports[`Component History - test History no currency, privacy normal & mode bas
"borderColor": "#888888",
"borderRadius": 15,
"borderWidth": 1,
"marginHorizontal": 10,
"marginHorizontal": 0,
"paddingHorizontal": 10,
"paddingVertical": 5,
}
Expand Down
10 changes: 6 additions & 4 deletions __tests__/__snapshots__/Messages.snapshot.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Component Messages - test Messages currency USD, privacy high & mode advanced - snapshot 1`] = `
<View
<RCTSafeAreaView
accessibilityLabel="text translated"
accessible={true}
style={
{
"backgroundColor": "#011401",
"display": "flex",
"height": "100%",
"justifyContent": "flex-start",
Expand Down Expand Up @@ -614,15 +615,16 @@ exports[`Component Messages - test Messages currency USD, privacy high & mode ad
}
}
/>
</View>
</RCTSafeAreaView>
`;

exports[`Component Messages - test Messages no currency, privacy normal & mode basic - snapshot 1`] = `
<View
<RCTSafeAreaView
accessibilityLabel="text translated"
accessible={true}
style={
{
"backgroundColor": "#011401",
"display": "flex",
"height": "100%",
"justifyContent": "flex-start",
Expand Down Expand Up @@ -1196,5 +1198,5 @@ exports[`Component Messages - test Messages no currency, privacy normal & mode b
}
}
/>
</View>
</RCTSafeAreaView>
`;
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ android {
applicationId 'org.ZingoLabs.Zingo' // Real
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 217 // Real
versionCode 218 // Real
versionName "zingo-1.11.0" // Real
missingDimensionStrategy 'react-native-camera', 'general'
testBuildType System.getProperty('testBuildType', 'debug')
Expand Down
1 change: 1 addition & 0 deletions app/AppState/AppStateLoaded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default interface AppStateLoaded {
poolsModalVisible: boolean;
insightModalVisible: boolean;
addressBookModalVisible: boolean;
messagesModalVisible: boolean;

// change server helper
newServer: ServerType;
Expand Down
1 change: 1 addition & 0 deletions app/AppState/enums/MenuItemEnum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export enum MenuItemEnum {
Info = 'Info',
VoteForNym = 'Vote For Nym',
Support = 'Support',
Chats = 'Chats',
}
70 changes: 39 additions & 31 deletions app/LoadedApp/LoadedApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from 'react-native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
import { faList, faUpload, faDownload, faCog, faComments, faRefresh } from '@fortawesome/free-solid-svg-icons';
import { faList, faUpload, faDownload, faCog, faRefresh } from '@fortawesome/free-solid-svg-icons';
import { useTheme } from '@react-navigation/native';
import { DrawerLayout } from 'react-native-gesture-handler';
import { I18n } from 'i18n-js';
Expand Down Expand Up @@ -91,8 +91,8 @@ import Send from '../../components/Send';
import Receive from '../../components/Receive';
import Settings from '../../components/Settings';
import Menu from './components/Menu';
import { Messages } from '../../components/Messages';
import RegText from '../../components/Components/RegText';
import { MessagesModal } from '../../components/Messages';

const About = React.lazy(() => import('../../components/About'));
const Seed = React.lazy(() => import('../../components/Seed'));
Expand Down Expand Up @@ -517,6 +517,7 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
poolsModalVisible: false,
insightModalVisible: false,
addressBookModalVisible: false,
messagesModalVisible: false,
newServer: {} as ServerType,
newSelectServer: null,
scrollToTop: false,
Expand Down Expand Up @@ -804,6 +805,7 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
addressBookModalVisible: false,
addressBookCurrentAddress: '',
addressBookOpenPriorModal: () => {},
messagesModalVisible: false,
});
};

Expand Down Expand Up @@ -1256,6 +1258,8 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
this.setShowSwipeableIcons(false);
await sendEmail(this.state.translate, this.state.info.zingolib);
this.setShowSwipeableIcons(true);
} else if (item === MenuItemEnum.Chats) {
this.setState({ messagesModalVisible: true });
}
this.closeDrawer();
this.setState({
Expand Down Expand Up @@ -1713,6 +1717,7 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
ufvkBackupModalVisible,
ufvkServerModalVisible,
addressBookModalVisible,
messagesModalVisible,
snackbars,
mode,
valueTransfersTotal,
Expand Down Expand Up @@ -1799,8 +1804,6 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
}
} else if (route.name === translate('loadedapp.receive-menu')) {
iconName = faDownload;
} else if (route.name === translate('loadedapp.messages-menu')) {
iconName = faComments;
} else {
iconName = faCog;
}
Expand Down Expand Up @@ -2095,13 +2098,34 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
</Suspense>
</Modal>

<Modal
animationType="slide"
transparent={false}
visible={messagesModalVisible}
onRequestClose={() => this.setState({ messagesModalVisible: false })}>
<Suspense fallback={<Loading backgroundColor={colors.background} spinColor={colors.primary} />}>
<MessagesModal
syncingStatusMoreInfoOnClick={this.syncingStatusMoreInfoOnClick /* header */}
setPrivacyOption={this.setPrivacyOption /* header */}
setScrollToTop={this.setScrollToTop /* chats */}
scrollToTop={scrollToTop /* chats */}
setScrollToBottom={this.setScrollToBottom /* messages */}
scrollToBottom={scrollToBottom /* messages */}
setUfvkViewModalVisible={this.setUfvkViewModalVisible /* header */}
sendTransaction={this.sendTransaction /* messages */}
setServerOption={this.setServerOption /* messages */}
closeModal={() => this.setState({ messagesModalVisible: false })}
/>
</Suspense>
</Modal>

<Snackbars snackbars={snackbars} removeFirstSnackbar={this.removeFirstSnackbar} translate={translate} />

{mode === ModeEnum.advanced ||
(valueTransfersTotal !== null && valueTransfersTotal > 0) ||
(!readOnly && !!totalBalance && totalBalance.spendableOrchard + totalBalance.spendablePrivate > 0) ? (
<Tab.Navigator
initialRouteName={translate('loadedapp.messages-menu') as string}
initialRouteName={translate('loadedapp.history-menu') as string}
screenOptions={({ route, navigation }) => ({
tabBarIcon: ({ focused }) => fnTabBarIcon(route, focused, navigation),
tabBarLabelPosition: 'below-icon',
Expand All @@ -2116,15 +2140,18 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
},
headerShown: false,
})}>
<Tab.Screen name={translate('loadedapp.messages-menu') as string}>
<Tab.Screen name={translate('loadedapp.history-menu') as string}>
{() => (
<Messages
<History
toggleMenuDrawer={this.toggleMenuDrawer /* header */}
poolsMoreInfoOnClick={this.poolsMoreInfoOnClick /* header */}
syncingStatusMoreInfoOnClick={this.syncingStatusMoreInfoOnClick /* header */}
setPrivacyOption={this.setPrivacyOption /* header */}
setScrollToTop={this.setScrollToTop /* chats */}
scrollToTop={scrollToTop /* chats */}
setScrollToBottom={this.setScrollToBottom /* messages */}
setShieldingAmount={this.setShieldingAmount /* header */}
setComputingModalVisible={this.setComputingModalVisible /* header */}
setScrollToTop={this.setScrollToTop /* header & history */}
scrollToTop={scrollToTop /* history */}
setScrollToBottom={this.setScrollToBottom /* header & messages */}
scrollToBottom={scrollToBottom /* messages */}
setUfvkViewModalVisible={this.setUfvkViewModalVisible /* header */}
sendTransaction={this.sendTransaction /* messages */}
Expand Down Expand Up @@ -2169,33 +2196,14 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
/>
)}
</Tab.Screen>
<Tab.Screen name={translate('loadedapp.history-menu') as string}>
{() => (
<History
toggleMenuDrawer={this.toggleMenuDrawer /* header */}
poolsMoreInfoOnClick={this.poolsMoreInfoOnClick /* header */}
syncingStatusMoreInfoOnClick={this.syncingStatusMoreInfoOnClick /* header */}
setPrivacyOption={this.setPrivacyOption /* header */}
setShieldingAmount={this.setShieldingAmount /* header */}
setComputingModalVisible={this.setComputingModalVisible /* header */}
setScrollToTop={this.setScrollToTop /* header & history */}
scrollToTop={scrollToTop /* history */}
setScrollToBottom={this.setScrollToBottom /* header & messages */}
scrollToBottom={scrollToBottom /* messages */}
setUfvkViewModalVisible={this.setUfvkViewModalVisible /* header */}
sendTransaction={this.sendTransaction /* messages */}
setServerOption={this.setServerOption /* messages */}
/>
)}
</Tab.Screen>
</Tab.Navigator>
) : (
<>
{valueTransfersTotal === null || addresses === null || totalBalance === null ? (
<Loading backgroundColor={colors.background} spinColor={colors.primary} />
) : (
<Tab.Navigator
initialRouteName={translate('loadedapp.messages-menu') as string}
initialRouteName={translate('loadedapp.history-menu') as string}
screenOptions={{
tabBarStyle: {
borderTopColor: colors.background,
Expand All @@ -2204,7 +2212,7 @@ export class LoadedAppClass extends Component<LoadedAppClassProps, LoadedAppClas
},
headerShown: false,
}}>
<Tab.Screen name={translate('loadedapp.messages-menu') as string}>
<Tab.Screen name={translate('loadedapp.history-menu') as string}>
{() => (
<Receive
toggleMenuDrawer={this.toggleMenuDrawer /* header */}
Expand Down
7 changes: 7 additions & 0 deletions app/LoadedApp/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ const Menu: React.FunctionComponent<MenuProps> = ({ onItemSelected, closeDrawer
{translate('loadedapp.settings') as string}
</RegText>

<RegText
testID="menu.messages"
onPress={() => onItemSelectedWrapper(MenuItemEnum.Chats)}
style={{ ...item, color: colors.primary }}>
{translate('messages.title-chats') as string}
</RegText>

<RegText
testID="menu.addressbook"
onPress={() => onItemSelectedWrapper(MenuItemEnum.AddressBook)}
Expand Down
6 changes: 3 additions & 3 deletions app/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"zingo": "Zingo",
"version": "zingo-1.11.0 (217)",
"version": "zingo-1.11.0 (218)",
"loading": "loading...",
"connectingserver": "Connecting to the server...",
"wait": "Please wait...",
Expand Down Expand Up @@ -36,8 +36,8 @@
"syncing": "Syncing -",
"synced": "Synced",
"messages": {
"title": "Messages",
"title-chats": "Chats",
"title": "Messages (experimental)",
"title-chats": "Chats (experimental)",
"empty": "No Messages yet.",
"message-placeholder": "Message",
"message-placeholder-error": "No spendable funds available",
Expand Down
6 changes: 3 additions & 3 deletions app/translations/es.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"zingo": "Zingo",
"version": "zingo-1.11.0 (217)",
"version": "zingo-1.11.0 (218)",
"loading": "cargando...",
"connectingserver": "Conectando con el servidor...",
"wait": "Por favor espere...",
Expand Down Expand Up @@ -36,8 +36,8 @@
"syncing": "Sincronizando -",
"synced": "Sincronizada",
"messages": {
"title": "Mensajes",
"title-chats": "Chats",
"title": "Mensajes (experimental)",
"title-chats": "Chats (experimental)",
"empty": "Todavía no hay mensajes.",
"message-placeholder": "Mensaje",
"message-placeholder-error": "No hay fondos disponibles gastables",
Expand Down
6 changes: 3 additions & 3 deletions app/translations/pt.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"zingo": "Zingo",
"version": "zingo-1.11.0 (217)",
"version": "zingo-1.11.0 (218)",
"loading": "carregando...",
"connectingserver": "Conectando-se ao servidor...",
"wait": "Aguarde um momento...",
Expand Down Expand Up @@ -36,8 +36,8 @@
"syncing": "Sincronizando -",
"synced": "Sincronizada",
"messages": {
"title": "Mensagens",
"title-chats": "Chats",
"title": "Mensagens (experimental)",
"title-chats": "Chats (experimental)",
"empty": "Nenhuma mensagem ainda.",
"message-placeholder": "Mensagem",
"message-placeholder-error": "Não há fundos disponíveis para gastar",
Expand Down
6 changes: 3 additions & 3 deletions app/translations/ru.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"zingo": "Zingo",
"version": "zingo-1.11.0 (217)",
"version": "zingo-1.11.0 (218)",
"loading": "загрузка...",
"connectingserver": "Подключение к серверу...",
"wait": "Пожалуйста, подождите...",
Expand Down Expand Up @@ -36,8 +36,8 @@
"syncing": "Синхронизация -",
"synced": "Синхронизировано",
"messages": {
"title": "Сообщения",
"title-chats": "Чаты",
"title": "Сообщения (экспериментально)",
"title-chats": "Чаты (экспериментально)",
"empty": "Сообщений пока нет.",
"message-placeholder": "Сообщение",
"message-placeholder-error": "Нет средств, которые можно потратить",
Expand Down
2 changes: 1 addition & 1 deletion components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ const Header: React.FunctionComponent<HeaderProps> = ({
await RPC.rpcSetInterruptSyncAfterBatch(GlobalConst.false);
// change to the history screen, just in case.
if (navigation) {
navigation.navigate(translate('loadedapp.messages-menu') as string);
navigation.navigate(translate('loadedapp.history-menu') as string);
}
// scroll to top in history, just in case.
if (setScrollToTop) {
Expand Down
Loading

0 comments on commit 5fede0d

Please sign in to comment.