Skip to content

Commit

Permalink
Merge pull request #1189 from ItzNotABug/remove-cloud-endpoints
Browse files Browse the repository at this point in the history
Remove Cloud `Endpoints` from `Initialize SDKs` Wizards
  • Loading branch information
ernstmul authored Oct 9, 2024
2 parents 5942b66 + cd0f99d commit d5915dd
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
import Id from '$lib/components/id.svelte';
import { WizardStep } from '$lib/layout';
import { sdk } from '$lib/stores/sdk';
import { isCloud } from '$lib/system';
const { endpoint, project } = sdk.forProject.client.config;
const code = `import io.appwrite.Client
import io.appwrite.services.Account
val client = Client(context)
${
isCloud
? `val client = Client(context).setProject("${project}")`
: `val client = Client(context)
.setEndpoint("${endpoint}")
.setProject("${project}")
.setSelfSigned(status = true) // For self signed certificates, only use for development`;
.setSelfSigned(status: true) // For self signed certificates, only use for development`
}`;
</script>

<WizardStep>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<script lang="ts">
import { Alert, Code } from '$lib/components';
import { WizardStep } from '$lib/layout';
import { isSelfHosted } from '$lib/system';
import { isCloud } from '$lib/system';
import { sdk } from '$lib/stores/sdk';
import Id from '$lib/components/id.svelte';
const { endpoint, project } = sdk.forProject.client.config;
const code = `import Appwrite
let client = Client()
${
isCloud
? `let client = Client().setProject("${project}")`
: `let client = Client()
.setEndpoint("${endpoint}")
.setProject("${project}")
.setSelfSigned(true) // For self signed certificates, only use for development`;
.setSelfSigned(true) // For self signed certificates, only use for development`
}`;
let showAlert = true;
</script>
Expand All @@ -21,16 +25,16 @@ let client = Client()

<h2 class="heading-level-7">Initialize your SDK</h2>
<p>
Initialize your SDK by pointing the client to your Appwrite project using your <Id
value={project}>Project ID</Id
>.
Initialize your SDK by pointing the client to your Appwrite project using your
<Id value={project}>Project ID</Id>
.
</p>
<Code label="Apple SDK" labelIcon="apple" language="swift" {code} withCopy withLineNumbers />
<p class="u-margin-block-start-24">
Before sending any API calls to your new Appwrite project, make sure your device or emulator
has network access to your Appwrite project's hostname or IP address.
</p>
{#if showAlert && isSelfHosted}
{#if showAlert && !isCloud}
<div class="common-section">
<Alert type="info" dismissible on:dismiss={() => (showAlert = false)}>
<svelte:fragment slot="title">For self-hosted solutions</svelte:fragment>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<script lang="ts">
import { Alert, Code } from '$lib/components';
import { WizardStep } from '$lib/layout';
import { isSelfHosted } from '$lib/system';
import { isCloud } from '$lib/system';
import { sdk } from '$lib/stores/sdk';
import Id from '$lib/components/id.svelte';
const { endpoint, project } = sdk.forProject.client.config;
const code = `import 'package:appwrite/appwrite.dart';
Client client = Client();
client
${
isCloud
? `client.setProject('${project}');`
: `client
.setEndpoint('${endpoint}')
.setProject('${project}')
.setSelfSigned(status: true); // For self signed certificates, only use for development`;
.setSelfSigned(status: true); // For self signed certificates, only use for development;`
}`;
let showAlert = true;
</script>
Expand All @@ -22,8 +26,8 @@ client

<h2 class="heading-level-7">Initialize your SDK</h2>
<p data-private>
Initialize your SDK by pointing the client to your Appwrite project using your <Id
value={project}>Project ID</Id>
Initialize your SDK by pointing the client to your Appwrite project using your
<Id value={project}>Project ID</Id>
</p>
<div class="u-margin-block-start-16">
<Code
Expand All @@ -39,7 +43,7 @@ client
Before sending any API calls to your new Appwrite project, make sure your device or emulator
has network access to your Appwrite project's hostname or IP address.
</p>
{#if showAlert && isSelfHosted}
{#if showAlert && !isCloud}
<div class="common-section">
<Alert type="info" on:dismiss={() => (showAlert = false)}>
<svelte:fragment slot="title">For self-hosted solutions</svelte:fragment>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<script lang="ts">
import { Alert, Code } from '$lib/components';
import { WizardStep } from '$lib/layout';
import { isSelfHosted } from '$lib/system';
import { isCloud } from '$lib/system';
import { sdk } from '$lib/stores/sdk';
import { createPlatform } from '../store';
import Id from '$lib/components/id.svelte';
const { endpoint, project } = sdk.forProject.client.config;
const code = `import { Client, Account, ID } from 'react-native-appwrite';
const client = new Client();
const client
.setEndpoint('${endpoint}')
const client = new Client()${
isCloud
? ''
: `
.setEndpoint('${endpoint}')`
}
.setProject('${project}')
.setPlatform('${$createPlatform.key}');`;
.setPlatform('${$createPlatform.key}');
`;
let showAlert = true;
</script>
Expand All @@ -40,7 +44,7 @@ const client
Before sending any API calls to your new Appwrite project, make sure your device or emulator
has network access to your Appwrite project's hostname or IP address.
</p>
{#if showAlert && isSelfHosted}
{#if showAlert && !isCloud}
<div class="common-section">
<Alert type="info" on:dismiss={() => (showAlert = false)}>
<svelte:fragment slot="title">For self-hosted solutions</svelte:fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
import Id from '$lib/components/id.svelte';
import { WizardStep } from '$lib/layout';
import { sdk } from '$lib/stores/sdk';
import { isCloud } from '$lib/system';
const { endpoint, project } = sdk.forProject.client.config;
const code = `const client = new Client();
client
${
isCloud
? `client.setProject('${project}');`
: `client
.setEndpoint('${endpoint}')
.setProject('${project}');`;
.setProject('${project}');`
}`;
</script>

<WizardStep>
Expand Down

0 comments on commit d5915dd

Please sign in to comment.