Fix mobile onboarding (#1670)

* attempts

* expo stop using spaces pls

* attempt

* you used to work without this sir

* fixed

* use serde instead of specta

* remove `serde(default`) and update bindings

* fix mobile

* fix types

---------

Co-authored-by: jake <77554505+brxken128@users.noreply.github.com>
This commit is contained in:
Utku
2023-10-26 20:38:15 +03:00
committed by GitHub
parent 968bf8985a
commit bf93d97874
8 changed files with 28 additions and 22 deletions

View File

@@ -25,10 +25,11 @@ if [ "${CONFIGURATION:-}" != "Debug" ]; then
export CARGO_FLAGS
fi
# Required for CI and for everyone I guess?
export PATH="${CARGO_HOME:-"${HOME}/.cargo"}/bin:$PATH"
# TODO: Also do this for non-Apple Silicon Macs
if [ "${SPACEDRIVE_CI:-}" = "1" ]; then
# Required for CI
export PATH="${CARGO_HOME:-"${HOME}/.cargo"}/bin:$PATH"
cargo build -p sd-mobile-ios --target x86_64-apple-ios

View File

@@ -27,7 +27,7 @@
"@rspc/react": "=0.0.0-main-799eec5d",
"@sd/assets": "workspace:*",
"@sd/client": "workspace:*",
"@shopify/flash-list": "1.5.0",
"@shopify/flash-list": "1.4.3",
"@tanstack/react-query": "^4.36.1",
"class-variance-authority": "^0.7.0",
"dayjs": "^1.11.10",
@@ -36,23 +36,23 @@
"expo-build-properties": "~0.8.3",
"expo-linking": "~5.0.2",
"expo-media-library": "~15.4.1",
"expo-splash-screen": "~0.20.4",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0",
"intl": "^1.2.5",
"lottie-react-native": "6.2.0",
"lottie-react-native": "5.1.6",
"moti": "^0.26.0",
"phosphor-react-native": "^1.1.2",
"react": "^18.2.0",
"react-hook-form": "^7.47.0",
"react-native": "0.72.4",
"react-native": "0.72.5",
"react-native-document-picker": "^9.0.1",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "~2.12.1",
"react-native-popup-menu": "^0.16.1",
"react-native-reanimated": "~3.4.2",
"react-native-safe-area-context": "4.7.1",
"react-native-screens": "~3.23.0",
"react-native-svg": "13.10.0",
"react-native-reanimated": "~3.3.0",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.1",
"react-native-svg": "13.9.0",
"react-native-wheel-color-picker": "^1.2.0",
"twrnc": "^3.6.4",
"use-count-up": "^3.0.1",

View File

@@ -65,7 +65,7 @@ const CreateLibraryModal = forwardRef<ModalRef, unknown>((_, ref) => {
/>
<Button
variant="accent"
onPress={() => createLibrary({ name: libName })}
onPress={() => createLibrary({ name: libName, default_locations: null })}
style={tw`mt-4`}
disabled={libName.length === 0 || createLibLoading}
>

View File

@@ -88,7 +88,8 @@ const useFormState = () => {
// show creation screen for a bit for smoothness
const [library] = await Promise.all([
createLibrary.mutateAsync({
name: data.NewLibrary.name
name: data.NewLibrary.name,
default_locations: null
}),
new Promise((res) => setTimeout(res, 500))
]);

View File

@@ -126,8 +126,7 @@ pub(crate) fn mount() -> AlphaRouter<Ctx> {
#[derive(Deserialize, Type)]
pub struct CreateLibraryArgs {
name: LibraryName,
#[specta(default)]
default_locations: DefaultLocations,
default_locations: Option<DefaultLocations>,
}
async fn create_default_locations_on_library_creation(
@@ -256,12 +255,14 @@ pub(crate) fn mount() -> AlphaRouter<Ctx> {
debug!("Created library {}", library.id);
create_default_locations_on_library_creation(
default_locations,
node,
Arc::clone(&library),
)
.await?;
if let Some(locations) = default_locations {
create_default_locations_on_library_creation(
locations,
node,
Arc::clone(&library),
)
.await?;
}
Ok(LibraryConfigWrapped {
uuid: library.id,

View File

@@ -26,7 +26,10 @@ export default (props: UseDialogProps) => {
const onSubmit = form.handleSubmit(async (data) => {
try {
const library = await createLibrary.mutateAsync({ name: data.name });
const library = await createLibrary.mutateAsync({
name: data.name,
default_locations: null
});
queryClient.setQueryData<LibraryConfigWrapped[]>(['library.list'], (libraries) => [
...(libraries || []),

View File

@@ -146,7 +146,7 @@ export type CreateEphemeralFolderArgs = { path: string; name: string | null }
export type CreateFolderArgs = { location_id: number; sub_path: string | null; name: string | null }
export type CreateLibraryArgs = { name: LibraryName; default_locations?: DefaultLocations }
export type CreateLibraryArgs = { name: LibraryName; default_locations: DefaultLocations | null }
export type CursorOrderItem<T> = { order: SortOrder; data: T }

BIN
pnpm-lock.yaml generated
View File

Binary file not shown.