Always skip document selector for single valid document; remove toggle and info text (#1622)

* Remove skip info text

* prettier

* fix test
This commit is contained in:
Justin Hernandez
2026-01-20 13:11:36 -08:00
committed by GitHub
parent 62f602a5e9
commit 04f67ed2df
4 changed files with 15 additions and 63 deletions

View File

@@ -18,12 +18,7 @@ import { dinot } from '@selfxyz/mobile-sdk-alpha/constants/fonts';
import { useSettingStore } from '@/stores/settingStore';
const ProofSettingsScreen: React.FC = () => {
const {
skipDocumentSelector,
setSkipDocumentSelector,
skipDocumentSelectorIfSingle,
setSkipDocumentSelectorIfSingle,
} = useSettingStore();
const { skipDocumentSelector, setSkipDocumentSelector } = useSettingStore();
return (
<YStack flex={1} backgroundColor={white}>
@@ -49,35 +44,6 @@ const ProofSettingsScreen: React.FC = () => {
testID="skip-document-selector-toggle"
/>
</View>
<View style={styles.divider} />
<View style={styles.settingRow}>
<View style={styles.settingTextContainer}>
<Text style={styles.settingLabel}>
Skip when only one document
</Text>
<Text style={styles.settingDescription}>
Automatically select your document when you only have one valid
ID available
</Text>
</View>
<Switch
value={skipDocumentSelectorIfSingle}
onValueChange={setSkipDocumentSelectorIfSingle}
trackColor={{ false: slate200, true: blue600 }}
thumbColor={white}
disabled={skipDocumentSelector}
testID="skip-document-selector-if-single-toggle"
/>
</View>
{skipDocumentSelector && (
<Text style={styles.infoText}>
Document selection is always skipped. The &quot;Skip when only one
document&quot; setting has no effect.
</Text>
)}
</YStack>
</ScrollView>
</YStack>
@@ -114,17 +80,6 @@ const styles = StyleSheet.create({
fontFamily: dinot,
color: slate500,
},
divider: {
height: 1,
backgroundColor: slate200,
},
infoText: {
fontSize: 13,
fontFamily: dinot,
fontStyle: 'italic',
color: slate500,
paddingHorizontal: 4,
},
});
export { ProofSettingsScreen };

View File

@@ -26,7 +26,7 @@ import { getDocumentTypeName } from '@/utils/documentUtils';
*
* This screen:
* 1. Loads document catalog and counts valid documents
* 2. Checks skip settings (skipDocumentSelector, skipDocumentSelectorIfSingle)
* 2. Checks skip settings (skipDocumentSelector, auto-skip on single document)
* 3. Routes to appropriate screen:
* - No valid documents -> DocumentDataNotFound
* - Skip enabled -> auto-select and go to Prove
@@ -37,8 +37,7 @@ const ProvingScreenRouter: React.FC = () => {
useNavigation<NativeStackNavigationProp<RootStackParamList>>();
const { loadDocumentCatalog, getAllDocuments, setSelectedDocument } =
usePassport();
const { skipDocumentSelector, skipDocumentSelectorIfSingle } =
useSettingStore();
const { skipDocumentSelector } = useSettingStore();
const [error, setError] = useState<string | null>(null);
const abortControllerRef = useRef<AbortController | null>(null);
const hasRoutedRef = useRef(false);
@@ -87,11 +86,7 @@ const ProvingScreenRouter: React.FC = () => {
const documentType = getDocumentTypeName(firstValidDoc?.documentCategory);
// Determine if we should skip the selector
const shouldSkip =
skipDocumentSelector ||
(skipDocumentSelectorIfSingle &&
validCount === 1 &&
firstValidDoc.isRegistered);
const shouldSkip = skipDocumentSelector || validCount === 1;
if (shouldSkip) {
// Auto-select and navigate to Prove
@@ -136,7 +131,6 @@ const ProvingScreenRouter: React.FC = () => {
navigation,
setSelectedDocument,
skipDocumentSelector,
skipDocumentSelectorIfSingle,
]);
useFocusEffect(

View File

@@ -35,12 +35,10 @@ interface PersistedSettingsState {
setLoggingSeverity: (severity: LoggingSeverity) => void;
setPointsAddress: (address: string | null) => void;
setSkipDocumentSelector: (value: boolean) => void;
setSkipDocumentSelectorIfSingle: (value: boolean) => void;
setSubscribedTopics: (topics: string[]) => void;
setTurnkeyBackupEnabled: (turnkeyBackupEnabled: boolean) => void;
setUseStrongBox: (useStrongBox: boolean) => void;
skipDocumentSelector: boolean;
skipDocumentSelectorIfSingle: boolean;
subscribedTopics: string[];
toggleCloudBackupEnabled: () => void;
turnkeyBackupEnabled: boolean;
@@ -145,9 +143,6 @@ export const useSettingStore = create<SettingsState>()(
skipDocumentSelector: false,
setSkipDocumentSelector: (value: boolean) =>
set({ skipDocumentSelector: value }),
skipDocumentSelectorIfSingle: true,
setSkipDocumentSelectorIfSingle: (value: boolean) =>
set({ skipDocumentSelectorIfSingle: value }),
// StrongBox setting for Android keystore (default: false)
useStrongBox: false,