Skip to content

Commit

Permalink
fix: web/tablet tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexogamer committed Feb 1, 2024
1 parent 81341f8 commit 695f5db
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 21 deletions.
36 changes: 20 additions & 16 deletions src/components/navigation/ChannelHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
import React from 'react';
import {View, TouchableOpacity} from 'react-native';
import {TouchableOpacity, useWindowDimensions, View} from 'react-native';

import MaterialIcon from 'react-native-vector-icons/MaterialIcons';

import {app} from '../../Generic';
import {currentTheme, styles} from '../../Theme';
import {app} from '@rvmob/Generic';
import {currentTheme, styles} from '@rvmob/Theme';

export const ChannelHeader = ({children}: {children: any}) => {
const {width, height} = useWindowDimensions();

return (
<View style={styles.channelHeader}>
<TouchableOpacity
style={styles.headerIcon}
onPress={() => {
app.openLeftMenu(true);
}}>
<View style={styles.iconContainer}>
<MaterialIcon
name="menu"
size={20}
color={currentTheme.foregroundPrimary}
/>
</View>
</TouchableOpacity>
{width < height ? (
<TouchableOpacity
style={styles.headerIcon}
onPress={() => {
app.openLeftMenu(true);
}}>
<View style={styles.iconContainer}>
<MaterialIcon
name="menu"
size={20}
color={currentTheme.foregroundPrimary}
/>
</View>
</TouchableOpacity>
) : null}
{children}
</View>
);
Expand Down
12 changes: 9 additions & 3 deletions src/components/sheets/SettingsSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {Pressable, ScrollView, View} from 'react-native';
import {Platform, Pressable, ScrollView, View} from 'react-native';
import {useTranslation} from 'react-i18next';
import {observer} from 'mobx-react-lite';

Expand All @@ -10,6 +10,7 @@ import {
getBrand,
getBundleId,
getDevice,
getUserAgent,
} from 'react-native-device-info';
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons';
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
Expand Down Expand Up @@ -37,8 +38,13 @@ async function copyDebugInfo() {
const obj = {
deviceInfo: {
time: new Date().getTime(),
model: `${getBrand()}/${await getDevice()}`,
version: `${await getApiLevel()}`,
platform: Platform.OS,
model:
Platform.OS === 'android'
? `${getBrand()}/${await getDevice()}`
: 'N/A',
browser: Platform.OS === 'web' ? `${await getUserAgent()}` : 'N/A',
version: Platform.OS === 'android' ? `${await getApiLevel()}` : 'N/A',
},

appInfo: {
Expand Down
10 changes: 8 additions & 2 deletions src/lib/auth/login.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import {Platform} from 'react-native';

import AsyncStorage from '@react-native-async-storage/async-storage';

import {decodeTime} from 'ulid';

import {client} from '@rvmob/Generic';

export async function loginRegular(state: any) {
const friendlyName = `RVMob for ${Platform.OS.charAt(
0,
).toUpperCase()}${Platform.OS.slice(1)}`;

state.setState({status: 'tryingLogin'});
try {
console.log('[AUTH] Attempting login with email and password...');
let session = await client.api.post('/auth/session/login', {
email: state.state.emailInput,
password: state.state.passwordInput,
friendly_name: 'RVMob',
friendly_name: friendlyName,
});

// check if account is disabled; if not, prompt for MFA verificaiton if necessary
Expand Down Expand Up @@ -41,7 +47,7 @@ export async function loginRegular(state: any) {
? {recovery_code: state.state.tfaInput}
: {totp_code: state.state.tfaInput},
mfa_ticket: state.state.tfaTicket,
friendly_name: 'RVMob',
friendly_name: friendlyName,
});
console.log(`[AUTH] Result: ${session.result}`);
if (session.result !== 'Success') {
Expand Down

0 comments on commit 695f5db

Please sign in to comment.