@fto-consult/expo-ui 7.7.2 → 7.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "7.7.2",
3
+ "version": "7.8.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",
@@ -71,8 +71,8 @@
71
71
  "@expo/html-elements": "^0.5.1",
72
72
  "@expo/vector-icons": "^13.0.0",
73
73
  "@faker-js/faker": "^8.0.2",
74
- "@fto-consult/common": "^3.73.44",
75
- "@fto-consult/electron-gen": "^1.2.0",
74
+ "@fto-consult/common": "^3.75.1",
75
+ "@fto-consult/electron-gen": "^1.3.1",
76
76
  "@pchmn/expo-material3-theme": "^1.3.1",
77
77
  "@react-native-async-storage/async-storage": "1.18.2",
78
78
  "@react-native-community/datetimepicker": "7.2.0",
@@ -35,7 +35,7 @@ const UserProfileAvatarComponent = React.forwardRef(({drawerRef,chevronIconProps
35
35
  props.src = u.avatar;
36
36
  size = defaultNumber(size,!withLabel?40:40);
37
37
  const userPseudo = Auth.getUserPseudo();
38
- const pseudo = defaultStr(userPseudo,Auth.getUserEmail(),Auth.getUserCode());
38
+ const pseudo = defaultStr(userPseudo,Auth.getUserCode(),Auth.getUserEmail());
39
39
  const label = defaultStr(Auth.getUserFullName(),userPseudo);
40
40
  const onLongPress = ()=>{
41
41
  appConfig.setDeviceId().then((r)=>{
@@ -10,7 +10,8 @@ import avatarProps from "$eauth/avatarProps";
10
10
  import useContext from "$econtext/hooks";
11
11
  import PropTypes from "prop-types";
12
12
  import APP from "$capp/instance";
13
-
13
+ import {isElectron} from "$cplatform";
14
+ import {isValidUrl} from "$cutils/uri";
14
15
  import {screenName} from "./utils";
15
16
 
16
17
  export default function UserProfileScreen({fields,...p}){
@@ -66,11 +67,25 @@ export default function UserProfileScreen({fields,...p}){
66
67
  if(args.value === user.avatar) return;
67
68
  hasChangeRef.current = true;
68
69
  }
70
+ if(isElectron() && typeof ELECTRON !=='undefined' && window?.ELECTRON && ELECTRON.session && typeof ELECTRON.session?.get =='function'){
71
+ fields.mainElectronAppUrl = {
72
+ label : "Url de l'application",
73
+ onValidatorValid : ({value})=>{
74
+ if(value && !isValidUrl(value)){
75
+ return "Vous devez spécifier une adresse url valide";
76
+ }
77
+ },
78
+ defaultValue : ELECTRON.appUrl,
79
+ };
80
+ }
69
81
  const onSaveProfile = ({data,goBack,...rest})=>{
70
82
  data.theme = themeRef.current;
71
83
  Preloader.open("Modification en cours...");
72
84
  const toSave = {...user,...data};
73
85
  return Auth.upsertUser(toSave,true).then((response)=>{
86
+ if(isValidUrl(data.mainElectronAppUrl) && isElectron()){
87
+ ELECTRON.appUrl = data.mainElectronAppUrl;
88
+ }
74
89
  setTimeout(()=>{
75
90
  APP.trigger(APP.EVENTS.UPDATE_THEME,user.theme);
76
91
  APP.trigger(APP.EVENTS.AUTH_UPDATE_PROFILE,toSave);