Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/app/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ export default () => {
...(IncludedModules || []),

// Built-in modules that depends on other
// CAUTION ! Modules that depends on other (ex myAppMenu) must be listed at the end !
require('~/framework/modules/myAppMenu'),
];
AllModules = loadModules(moduleDeclarations);
return AllModules;
Expand Down
11 changes: 0 additions & 11 deletions src/framework/modules/myAppMenu/index.ts

This file was deleted.

21 changes: 0 additions & 21 deletions src/framework/modules/myAppMenu/module-config.ts

This file was deleted.

17 changes: 0 additions & 17 deletions src/framework/modules/myAppMenu/storage.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { NavBarAction, NavBarActionsGroup } from '~/framework/components/navigat
import { PageView } from '~/framework/components/page';
import SearchBar from '~/framework/components/search-bar';
import { SearchBarHandle } from '~/framework/components/search-bar/types';
import { MyAppsList } from '~/framework/modules/myAppMenu/components/my-apps-list';
import { EMPTY_SCREEN_CONFIG } from '~/framework/modules/myAppMenu/screens/utils';
import { MyAppsList } from '~/framework/modules/myapps/components/my-apps-list';
import { EMPTY_SCREEN_CONFIG } from '~/framework/modules/myapps/screens/utils';
import { navBarOptions } from '~/framework/navigation/navBar';

const HeaderLeft = ({ isSaving, onClose }: HeaderLeftProps) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import SearchBar from '~/framework/components/search-bar';
import { SearchBarHandle } from '~/framework/components/search-bar/types';
import { SmallActionText } from '~/framework/components/text';
import { MyAppsFilterCell } from '~/framework/modules/myAppMenu/components';
import { MyAppsFilterCell } from '~/framework/modules/myapps/components';

export const MyAppsFilters = ({ onFilterChange, selectedFilter }: MyAppsFiltersProps) => {
const searchQuery = selectedFilter.type === 'search' ? selectedFilter.value : '';
Expand All @@ -27,11 +27,11 @@
const searchRef = React.useRef<SearchBarHandle>(null);

const { animatedContainerStyle, animatedIconStyle, animatedSearchStyle, close, open } = useAnimatedSearchStyles();
const borderColor = !searchActive

Check warning on line 30 in src/framework/modules/myapps/components/my-apps-filters/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unexpected negated condition.

See more on https://sonarcloud.io/project/issues?id=edificeio_edifice-mobile-framework&issues=AZ0lyMZ8D8FEDW_18QGQ&open=AZ0lyMZ8D8FEDW_18QGQ&pullRequest=294
? theme.palette.primary.regular
: searchFocused
? theme.palette.primary.regular
: theme.palette.grey.cloudy;

Check warning on line 34 in src/framework/modules/myapps/components/my-apps-filters/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Extract this nested ternary operation into an independent statement.

See more on https://sonarcloud.io/project/issues?id=edificeio_edifice-mobile-framework&issues=AZ0lyMZ8D8FEDW_18QGR&open=AZ0lyMZ8D8FEDW_18QGR&pullRequest=294

const scrollToItem = React.useCallback((index: number) => {
listRef.current?.scrollToIndex({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { buildAllAppsCategoryList, buildAppItem, isSeparator } from './utils';
import { I18n } from '~/app/i18n';
import { EmptyScreen } from '~/framework/components/empty-screens';
import { SmallBoldText } from '~/framework/components/text';
import { MyAppsCard } from '~/framework/modules/myAppMenu/components';
import { MyAppsCard } from '~/framework/modules/myapps/components';

const NUM_COLUMNS = 2;

Expand Down
12 changes: 4 additions & 8 deletions src/framework/modules/myapps/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { Action } from 'redux';

import './init';
import config from './module-config';
import getRoot from './navigation/navigator';
import reducer from './reducer/reducer';
import { AppsInfoState } from './types';
import { storage } from './storage';

import { Module } from '~/framework/util/moduleTool';
import { NavigableModule } from '~/framework/util/moduleTool';

module.exports = new Module<'myapps', typeof config, AppsInfoState, Action>({
config,
reducer,
});
module.exports = new NavigableModule({ config, getRoot, reducer, storage });
11 changes: 8 additions & 3 deletions src/framework/modules/myapps/module-config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import type { AppsInfoState } from './types';

import { ModuleConfig } from '~/framework/util/moduleTool';
import { ModuleType, NavigableModuleConfig } from '~/framework/util/moduleTool';

export default new ModuleConfig<'myapps', AppsInfoState>({
export default new NavigableModuleConfig<'myapps', AppsInfoState>({
displayAs: ModuleType.TAB_MODULE,
displayI18n: 'myapp-appname',
displayOrder: 3,
displayPicture: { name: 'icon-apps-off', type: 'Icon' },
displayPictureFocus: { name: 'icon-apps-on', type: 'Icon' },
entcoreScope: [],
hasRight: () => true,
matchEntcoreApp: 'myapps',

matchEntcoreWidget: () => false,
name: 'myapps',
storageName: 'myapps',
testID: 'tabbar-apps',
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* A specific moduleMap that exists inside myAppMenu
* A specific moduleMap that exists inside myapps
*/
import { ModuleRegister, setGlobalRegister, UnknownNavigableModule } from '~/framework/util/moduleTool';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ParamListBase } from '@react-navigation/native';

import moduleConfig from '~/framework/modules/myAppMenu/module-config';
import moduleConfig from '~/framework/modules/myapps/module-config';

export const myAppsRouteNames = {
Home: `${moduleConfig.routeName}` as 'Home',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import { IMyAppsNavigationParams, myAppsRouteNames } from '.';

import moduleConfig from '~/framework/modules/myAppMenu/module-config';
import { myAppsConnector, myAppsModules, myAppsSecondaryModules } from '~/framework/modules/myAppMenu/myAppsModules';
import MyAppsHomeScreen, { computeNavBar as homeNavBar } from '~/framework/modules/myAppMenu/screens/MyAppsHomeScreen';
import moduleConfig from '~/framework/modules/myapps/module-config';
import { myAppsConnector, myAppsModules, myAppsSecondaryModules } from '~/framework/modules/myapps/myAppsModules';
import MyAppsHomeScreen, { computeNavBar as homeNavBar } from '~/framework/modules/myapps/screens/myapps-home-screen';
import { createModuleNavigator } from '~/framework/navigation/moduleScreens';
import { AnyNavigableModule, NavigableModuleArray } from '~/framework/util/moduleTool';

Expand All @@ -16,8 +16,8 @@
<MyAppsHomeScreen {...props} modules={modules} secondaryModules={secondaryModules} connectors={connectors} />
);
return createModuleNavigator<IMyAppsNavigationParams>(moduleConfig.name, Stack => (
<>
<Stack.Screen name={myAppsRouteNames.Home} component={MyAppsContainer} options={homeNavBar} initialParams={undefined} />
</>

Check warning on line 21 in src/framework/modules/myapps/navigation/navigator.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

A fragment with only one child is redundant.

See more on https://sonarcloud.io/project/issues?id=edificeio_edifice-mobile-framework&issues=AZ0lyMenD8FEDW_18QGS&open=AZ0lyMenD8FEDW_18QGS&pullRequest=294
));
}) as AnyNavigableModule['getRoot'];
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ import { NavBarAction, NavBarActionsGroup } from '~/framework/components/navigat
import { PageView } from '~/framework/components/page';
import { Svg } from '~/framework/components/picture';
import { Toggle } from '~/framework/components/toggle';
import {
MAOSProps,
MyAppsFilters,
MyAppsList,
MyAppsMenuItem,
MyAppsOnboardingModal,
} from '~/framework/modules/myAppMenu/components';
import { MAOSProps, MyAppsFilters, MyAppsList, MyAppsMenuItem, MyAppsOnboardingModal } from '~/framework/modules/myapps/components';
import { AppsInfoAggregated } from '~/framework/modules/myapps/types';
import { navBarOptions } from '~/framework/navigation/navBar';
import Feedback from '~/framework/util/feedback/feedback';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NativeStackScreenProps } from '@react-navigation/native-stack';

import { IMyAppsNavigationParams, myAppsRouteNames } from '~/framework/modules/myAppMenu/navigation';
import { IMyAppsNavigationParams, myAppsRouteNames } from '~/framework/modules/myapps/navigation';
import { NavigableModuleArray } from '~/framework/util/moduleTool';

export interface MyAppsHomeScreenProps extends NativeStackScreenProps<IMyAppsNavigationParams, typeof myAppsRouteNames.Home> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { I18n } from '~/app/i18n';
import { AppDispatch, getStore } from '~/app/store';
import { ModalBoxHandle } from '~/framework/components/ModalBox';
import Toast from '~/framework/components/toast';
import { MyAppsListItem } from '~/framework/modules/myAppMenu/components/my-apps-list/types';
import { MyAppsListItem } from '~/framework/modules/myapps/components/my-apps-list/types';
import {
getAllappsShowedState,
refreshMyApps,
Expand Down
18 changes: 15 additions & 3 deletions src/framework/modules/myapps/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ export interface MyAppsOnboardingStorageData {
}

export interface MyAppsStorageData {
preferences?: MyAppsPreferencesStorageData;
onboarding?: MyAppsOnboardingStorageData;
'preferences'?: MyAppsPreferencesStorageData;
'onboarding'?: MyAppsOnboardingStorageData;
'infobubble-ack'?: boolean;
}

type MyAppsStorageMap = {
Expand All @@ -21,7 +22,16 @@ type MyAppsStorageMap = {

const STORAGE_KEY: keyof MyAppsStorageMap = 'myapps';

const myAppsStorage = Storage.preferences<MyAppsStorageMap>(moduleConfig, function () {});
const oldStorageKey = 'infoBubbleAck-myAppsScreen.redirect';

const myAppsStorage = Storage.preferences<MyAppsStorageMap>(moduleConfig, function () {
const oldValue = Storage.global.getString(oldStorageKey) as 'true' | 'false' | undefined;
if (oldValue === 'true') {
const data = this.getJSON(STORAGE_KEY) ?? {};
this.setJSON(STORAGE_KEY, { ...data, 'infobubble-ack': true });
}
Storage.global.delete(oldStorageKey);
});

export const readMyAppsPreferences = (): MyAppsPreferencesStorageData => {
const data = myAppsStorage.getJSON(STORAGE_KEY);
Expand Down Expand Up @@ -60,3 +70,5 @@ export const writeMyAppsOnboardingSeen = (version: string) => {
export const resetMyAppsStorage = () => {
myAppsStorage.delete(STORAGE_KEY);
};

export const storage = myAppsStorage;
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Image } from '~/framework/util/media-deprecated';
const Selected = () => (
<View style={[styles.thumbnailSelectedItem, { borderColor: (moduleConfig.displayPicture as SvgProps).fill }]} />
);
const rawNewsIconName = 'actualites-large';

export default function ThumbnailThread({ status = ThreadItemStatus.DEFAULT, ...props }: ThumbnailThreadProps) {
const { icon, square } = props;
Expand Down Expand Up @@ -51,20 +52,20 @@ export default function ThumbnailThread({ status = ThreadItemStatus.DEFAULT, ...
return (
<View style={[globalStyle, styles.thumbnailContainerSelected]}>
<Selected />
<Svg name="newsFeed" fill={(moduleConfig.displayPicture as SvgProps).fill} height={heightSVGNoIcon} />
<Svg name={rawNewsIconName} fill={(moduleConfig.displayPicture as SvgProps).fill} height={heightSVGNoIcon} />
</View>
);
}
if (status === ThreadItemStatus.DISABLED) {
return (
<View style={[globalStyle, styles.thumbnailNoIconDisabled]}>
<Svg name="newsFeed" fill={theme.palette.grey.graphite} height={heightSVGNoIcon} />
<Svg name={rawNewsIconName} fill={theme.palette.grey.graphite} height={heightSVGNoIcon} />
</View>
);
}
return (
<View style={globalStyle}>
<Svg name="newsFeed" fill={(moduleConfig.displayPicture as SvgProps).fill} height={heightSVGNoIcon} />
<Svg name={rawNewsIconName} fill={(moduleConfig.displayPicture as SvgProps).fill} height={heightSVGNoIcon} />
</View>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default StyleSheet.create({
position: 'relative',
},
thumbnailItem: {
alignItems: 'center',
justifyContent: 'center',
},
thumbnailItemRectangle: {
Expand Down
2 changes: 1 addition & 1 deletion src/framework/navigation/modals/navigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import AttachmentsImportScreen, {
import {
computeNavBar as ManageFavoritesAddNavbar,
ManageFavoritesModalScreen,
} from '~/framework/modules/myAppMenu/components/manage-favorite-modal';
} from '~/framework/modules/myapps/components/manage-favorite-modal';
import SplashadsScreen, { computeNavBar as SplashadsNavBar } from '~/framework/modules/splashads/screen';
import { setCrossIconBlackForRoutes, setModalModeForRoutes } from '~/framework/navigation/hideTabBarAndroid';
import { getTypedRootStack } from '~/framework/navigation/navigators';
Expand Down