Application qui marche sur android et ios
continuous-integration/drone/push Build is failing Details

Persistance
Thomas Chazot 3 years ago
parent 821982fb99
commit 95de9e2f34

@ -26,14 +26,9 @@ export const MANAGER_GAME = new ManagerGame(new LoaderGameApi);
export default function App() { export default function App() {
return ( return (
<Text>CC</Text>
/*
<Provider store={store}> <Provider store={store}>
<MainTabNavigator/> <MainTabNavigator/>
</Provider> </Provider>
*/
); );
} }

@ -3,11 +3,7 @@ module.exports = function(api) {
return { return {
presets: [ presets: [
['babel-preset-expo'], ['babel-preset-expo'],
'@babel/preset-typescript', ['@babel/preset-env', { targets: { node: 'current' } }]
],
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript', '@babel/preset-react',
], ],
}; };
}; };

@ -45,7 +45,11 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.9", "@babel/core": "^7.12.9",
"@babel/preset-typescript": "^7.18.6", "@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"@babel/runtime": "^7.5.5",
"@jest/globals": "^29.3.1", "@jest/globals": "^29.3.1",
"@types/jest": "^29.2.3", "@types/jest": "^29.2.3",
"@types/jquery": "^3.5.14", "@types/jquery": "^3.5.14",
@ -53,6 +57,7 @@
"@types/node": "^18.8.4", "@types/node": "^18.8.4",
"@types/react": "~18.0.14", "@types/react": "~18.0.14",
"@types/react-native": "~0.69.1", "@types/react-native": "~0.69.1",
"babel-preset-react-native": "^4.0.0",
"ts-jest": "^29.0.3", "ts-jest": "^29.0.3",
"typescript": "^4.9.3" "typescript": "^4.9.3"
}, },

@ -86,9 +86,8 @@ function CookieClicker(props: { navigation: any}){
} }
function endGame(){ function endGame(){
let tmp: User | null; const tmp=MANAGER_USER.getCurrentUser();
tmp=MANAGER_USER.getCurrentUser(); if (tmp!==null){
if (tmp!=null){
if (MANAGER_MATCH.getCurrentMatch()?.getTabUsers().includes(tmp)){ if (MANAGER_MATCH.getCurrentMatch()?.getTabUsers().includes(tmp)){
MANAGER_MATCH.getCurrentMatch()?.updatePostMatch(tmp, points); MANAGER_MATCH.getCurrentMatch()?.updatePostMatch(tmp, points);
setUser(tmp); setUser(tmp);

@ -37,8 +37,7 @@ export const BotBar :
(the string must be the name of the screen) (the string must be the name of the screen)
*/ */
FC<{ nav: any, state?: String }> = FC<{ nav: any, state?: String }> =
({nav, state}) => ({ nav, state }) => {
{
const setTabSkin = useStoreStore((state) => state.setTabSkin); const setTabSkin = useStoreStore((state) => state.setTabSkin);
const setTabConv = useConversationStore((state) => state.setTabConv); const setTabConv = useConversationStore((state) => state.setTabConv);
@ -46,9 +45,9 @@ FC<{nav: any, state?: String}> =
const handleStoreChange = useCallback(async () => { const handleStoreChange = useCallback(async () => {
let tabSkinStore = [...tabSkinApp]; let tabSkinStore = [...tabSkinApp];
let tmp=MANAGER_USER.getCurrentUser()?.getTabSkin(); // const tmp=MANAGER_USER.getCurrentUser()?.getTabSkin();
if (tmp!=undefined){ // if (tmp!==undefined){
tmp.forEach(skin => { MANAGER_USER.getCurrentUser()?.getTabSkin()?.forEach(skin => {
for (let i = 0; i < tabSkinStore.length; i++) { for (let i = 0; i < tabSkinStore.length; i++) {
if (skin.isEqual(tabSkinStore[i])) { if (skin.isEqual(tabSkinStore[i])) {
tabSkinStore.splice(i, 1); tabSkinStore.splice(i, 1);
@ -56,12 +55,12 @@ FC<{nav: any, state?: String}> =
} }
}); });
setTabSkin(tabSkinStore); setTabSkin(tabSkinStore);
} // }
}, []); }, []);
const handleConversationChange = useCallback(async () => { const handleConversationChange = useCallback(async () => {
let tmp=MANAGER_USER.getCurrentUser(); const tmp = MANAGER_USER.getCurrentUser();
if (tmp!=undefined){ if (tmp !== null) {
await MANAGER_CONVERSATION.getLoaderConversation().loadByUser(tmp).then((res) => { await MANAGER_CONVERSATION.getLoaderConversation().loadByUser(tmp).then((res) => {
MANAGER_CONVERSATION.setCurrentTabConv(res); MANAGER_CONVERSATION.setCurrentTabConv(res);
setTabConv(res); setTabConv(res);

@ -30,8 +30,8 @@ FC<{game: Game, nav: any}> =
const createNewMatchSolo = useCallback(async (game : Game, nav: any) => { const createNewMatchSolo = useCallback(async (game : Game, nav: any) => {
const m=new MatchCreator(); const m=new MatchCreator();
let tmp=MANAGER_USER.getCurrentUser(); const tmp=MANAGER_USER.getCurrentUser();
if (tmp!=null){ if (tmp!==null){
let match=await m.createMatch(tmp, game); let match=await m.createMatch(tmp, game);
MANAGER_MATCH.setCurrentMatch(match); MANAGER_MATCH.setCurrentMatch(match);
setMatch(match); setMatch(match);

@ -30,8 +30,7 @@ export const SkinComponent :
* state : Indicates from wich screen the component has been called * state : Indicates from wich screen the component has been called
*/ */
FC<{ nav: any, skin: Skin, state: String }> = FC<{ nav: any, skin: Skin, state: String }> =
({nav, skin, state}) => ({ nav, skin, state }) => {
{
const navigation = nav; const navigation = nav;
@ -45,7 +44,7 @@ FC<{nav : any, skin: Skin, state: String}> =
async function changerSkin(skin: Skin) { async function changerSkin(skin: Skin) {
const m = new UserSkinModifier(); const m = new UserSkinModifier();
const tmp = MANAGER_USER.getCurrentUser(); const tmp = MANAGER_USER.getCurrentUser();
if (tmp!=null){ if (tmp !== null) {
await m.changeCurrentSkin(tmp, skin); await m.changeCurrentSkin(tmp, skin);
setUser(tmp); setUser(tmp);
MANAGER_USER.setCurrentUser(tmp); MANAGER_USER.setCurrentUser(tmp);
@ -55,9 +54,9 @@ FC<{nav : any, skin: Skin, state: String}> =
const handleStoreChange = useCallback(async () => { const handleStoreChange = useCallback(async () => {
let tabSkinStore = [...tabSkinApp]; let tabSkinStore = [...tabSkinApp];
let tmp=MANAGER_USER.getCurrentUser()?.getTabSkin(); // const tmp=MANAGER_USER.getCurrentUser()?.getTabSkin();
if (tmp!=undefined){ // if (tmp!=undefined){
tmp.forEach(skin => { MANAGER_USER.getCurrentUser()?.getTabSkin()?.forEach(skin => {
for (let i = 0; i < tabSkinStore.length; i++) { for (let i = 0; i < tabSkinStore.length; i++) {
if (skin.isEqual(tabSkinStore[i])) { if (skin.isEqual(tabSkinStore[i])) {
tabSkinStore.splice(i, 1); tabSkinStore.splice(i, 1);
@ -65,7 +64,7 @@ FC<{nav : any, skin: Skin, state: String}> =
} }
}); });
setTabSkin(tabSkinStore); setTabSkin(tabSkinStore);
} //}
}, []); }, []);
@ -74,7 +73,7 @@ FC<{nav : any, skin: Skin, state: String}> =
const mSkin = new UserSkinModifier(); const mSkin = new UserSkinModifier();
const mCoins = new ManagerCoinsUser(); const mCoins = new ManagerCoinsUser();
const tmp = MANAGER_USER.getCurrentUser(); const tmp = MANAGER_USER.getCurrentUser();
if (tmp!=null){ if (tmp !== null) {
await mCoins.removeCoins(tmp, skin.getSkinCost()).then(async (res) => { await mCoins.removeCoins(tmp, skin.getSkinCost()).then(async (res) => {
if (res == true) { if (res == true) {

@ -31,7 +31,6 @@ export const currentUserSlice = createSlice({
updatePseudo: (state, action: PayloadAction<string>) =>{ updatePseudo: (state, action: PayloadAction<string>) =>{
const newUser: User = new User(currentUser.getId(), currentUser.getUsername(), currentUser.getPassword(), currentUser.getNationality(), currentUser.getSexe(), currentUser.getDateOfBirth()); const newUser: User = new User(currentUser.getId(), currentUser.getUsername(), currentUser.getPassword(), currentUser.getNationality(), currentUser.getSexe(), currentUser.getDateOfBirth());
console.log(currentUser);
newUser.setUsername(action.payload); newUser.setUsername(action.payload);
return { return {
...state, ...state,

@ -81,8 +81,8 @@ function Home(props: { navigation: any; }) {
const handleGame = useCallback(async (typeJeu: string) => { const handleGame = useCallback(async (typeJeu: string) => {
let tmp=MANAGER_GAME.getTabGame(); const tmp = MANAGER_GAME.getTabGame();
if (tmp==null){ if (tmp === null) {
await MANAGER_GAME.getLoaderGame().loadAllGame().then((res) => { await MANAGER_GAME.getLoaderGame().loadAllGame().then((res) => {
MANAGER_GAME.setTabGame(res); MANAGER_GAME.setTabGame(res);
setTabGame(res); setTabGame(res);

@ -30,8 +30,8 @@ function Settings(props: { navigation: any; }) {
async function changeUsername(username:string){ async function changeUsername(username:string){
const m = new UserModificationManager(); const m = new UserModificationManager();
let tmp=MANAGER_USER.getCurrentUser(); const tmp=MANAGER_USER.getCurrentUser();
if (tmp!=null){ if (tmp!==null){
await m.changeUsername(tmp, username); await m.changeUsername(tmp, username);
setUser(tmp); setUser(tmp);
MANAGER_USER.setCurrentUser(tmp); MANAGER_USER.setCurrentUser(tmp);
@ -40,8 +40,8 @@ function Settings(props: { navigation: any; }) {
async function changePassword(password:string){ async function changePassword(password:string){
const m = new UserModificationManager(); const m = new UserModificationManager();
let tmp=MANAGER_USER.getCurrentUser(); const tmp=MANAGER_USER.getCurrentUser();
if (tmp!=null){ if (tmp!==null){
await m.changePassword(tmp, password); await m.changePassword(tmp, password);
setUser(tmp); setUser(tmp);
MANAGER_USER.setCurrentUser(tmp); MANAGER_USER.setCurrentUser(tmp);

@ -26,7 +26,6 @@ function SignUp(props: { navigation: any; }) {
function onDateSelected(event : DateTimePickerEvent, value : Date | undefined) { function onDateSelected(event : DateTimePickerEvent, value : Date | undefined) {
console.log(value);
if (value != undefined) { if (value != undefined) {
setDate(value); setDate(value);
} }

File diff suppressed because it is too large Load Diff

@ -0,0 +1 @@
Subproject commit b2c910a85ed84cb7e5108e7cb3406a2e825a858f
Loading…
Cancel
Save