[feat](client): address one instance origin instead of connection modes
Apps reach every service through Maestro on one port; direct service addressing is no longer a supported deployment, and Maestro has no per-service hostname or host-port route. Replace the maestro/direct modes and the serviceRef lookup with one configured origin and the fixed paths /api/alarm/{action,auth,ws}, defaulting dev builds to 127.0.0.1:8080 through adb reverse. The old mode-specific body wrapping and the direct-mode socket branch go with it.
This commit is contained in:
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
|
||||
import { KeyboardAvoidingView, Platform, View } from 'react-native';
|
||||
import { useAuth } from '../state/AuthContext';
|
||||
import { useConnection } from '../state/ConnectionContext';
|
||||
import { navigationRef } from '../navigationRef';
|
||||
import {
|
||||
AppText,
|
||||
Button,
|
||||
@@ -17,7 +18,7 @@ type Mode = 'signin' | 'register';
|
||||
|
||||
export default function LoginScreen() {
|
||||
const { login, register } = useAuth();
|
||||
const { online, resolved } = useConnection();
|
||||
const { online, resolved, settings } = useConnection();
|
||||
|
||||
const [mode, setMode] = useState<Mode>('signin');
|
||||
const [username, setUsername] = useState('');
|
||||
@@ -134,11 +135,25 @@ export default function LoginScreen() {
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* A release build starts with no instance configured, and sign-in
|
||||
is impossible until one is set — Settings also owns that field,
|
||||
so the login screen must be able to reach it. Without this the
|
||||
app is unconfigurable on a fresh install (Settings was only
|
||||
reachable from Home, which needs a session). */}
|
||||
<Button
|
||||
label={settings.instanceUrl ? `Server · ${settings.instanceUrl}` : 'Choose your server'}
|
||||
variant="ghost"
|
||||
height={44}
|
||||
onPress={() => {
|
||||
if (navigationRef.isReady()) navigationRef.navigate('Settings');
|
||||
}}
|
||||
/>
|
||||
|
||||
{!online ? (
|
||||
<AppText style={{ ...typeCaption, color: textSecondary, textAlign: 'center' }}>
|
||||
{resolved
|
||||
? 'The alarm service did not answer. Check Settings → Connection.'
|
||||
: 'Looking for the alarm service…'}
|
||||
? 'Your instance did not answer. Check Settings → Connection.'
|
||||
: 'Looking for your instance…'}
|
||||
</AppText>
|
||||
) : null}
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user