Skip to content

Commit

Permalink
chore: merge pull request #342 from raphckrman/feature/canteen-izly
Browse files Browse the repository at this point in the history
cantine: Fix d'un crash sur la page QRCode et fix du reload Izly
  • Loading branch information
Vexcited authored Nov 8, 2024
2 parents 6a7b90d + 7c58576 commit 1152843
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/services/izly/reload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { log } from "@/utils/logger/logger";
import {Identification, refresh} from "ezly";

export const reload = async (account: IzlyAccount): Promise<Identification> => {
const instance = account.instance!;
const secret = account.authentication.secret;
const instance = account.authentication.identification
const secret = account.authentication.secret

await refresh(instance, secret);
log("session refreshed", "izly");
Expand Down
1 change: 1 addition & 0 deletions src/stores/account/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export interface IzlyAccount extends BaseExternalAccount {
instance?: Identification
authentication: {
secret: string
identification: Identification
configuration: Configuration
}
}
Expand Down
20 changes: 14 additions & 6 deletions src/views/account/Restaurant/Modals/QrCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
StatusBar,
TouchableOpacity,
StyleSheet,
ScrollView,
ScrollView, Platform,
} from "react-native";
import { DeviceMotion } from "expo-sensors";
import { SafeAreaView } from "react-native-safe-area-context";
Expand Down Expand Up @@ -57,11 +57,19 @@ const RestaurantQrCode: Screen<"RestaurantQrCode"> = ({ route, navigation }) =>
}, [navigation]);

useEffect(() => {
Brightness.setBrightnessAsync(1);
return () => {
Brightness.setBrightnessAsync(0.5);
};
}, []);
(async () => {
if (Platform.OS === 'android') {
const { status } = await Brightness.requestPermissionsAsync();
if (status !== 'granted') {
navigation.goBack();
return;
}
}
try { await Brightness.setBrightnessAsync(1); } catch (e) { console.warn("Brightness error:", e); }
})();
return () => { Brightness.setBrightnessAsync(0.5); };
}, [navigation]);


useEffect(() => {
const subscription = DeviceMotion.addListener(({ rotation }) => {
Expand Down
1 change: 1 addition & 0 deletions src/views/settings/ExternalAccount/IzlyActivation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const IzlyActivation: Screen<"IzlyActivation"> = ({ navigation, route }) => {
instance: identification,
authentication: {
secret: secret,
identification: identification,
configuration: configuration
},
isExternal: true,
Expand Down

0 comments on commit 1152843

Please sign in to comment.