Skip to content

Commit d5915dd

Browse files
authored
Merge pull request #1189 from ItzNotABug/remove-cloud-endpoints
Remove Cloud `Endpoints` from `Initialize SDKs` Wizards
2 parents 5942b66 + cd0f99d commit d5915dd

File tree

5 files changed

+45
-24
lines changed

5 files changed

+45
-24
lines changed

src/routes/(console)/project-[project]/overview/platforms/wizard/android/step3.svelte

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@
33
import Id from '$lib/components/id.svelte';
44
import { WizardStep } from '$lib/layout';
55
import { sdk } from '$lib/stores/sdk';
6+
import { isCloud } from '$lib/system';
67
78
const { endpoint, project } = sdk.forProject.client.config;
89
const code = `import io.appwrite.Client
910
import io.appwrite.services.Account
1011
11-
val client = Client(context)
12+
${
13+
isCloud
14+
? `val client = Client(context).setProject("${project}")`
15+
: `val client = Client(context)
1216
.setEndpoint("${endpoint}")
1317
.setProject("${project}")
14-
.setSelfSigned(status = true) // For self signed certificates, only use for development`;
18+
.setSelfSigned(status: true) // For self signed certificates, only use for development`
19+
}`;
1520
</script>
1621

1722
<WizardStep>

src/routes/(console)/project-[project]/overview/platforms/wizard/apple/step3.svelte

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
<script lang="ts">
22
import { Alert, Code } from '$lib/components';
33
import { WizardStep } from '$lib/layout';
4-
import { isSelfHosted } from '$lib/system';
4+
import { isCloud } from '$lib/system';
55
import { sdk } from '$lib/stores/sdk';
66
import Id from '$lib/components/id.svelte';
77
88
const { endpoint, project } = sdk.forProject.client.config;
99
const code = `import Appwrite
1010
11-
let client = Client()
11+
${
12+
isCloud
13+
? `let client = Client().setProject("${project}")`
14+
: `let client = Client()
1215
.setEndpoint("${endpoint}")
1316
.setProject("${project}")
14-
.setSelfSigned(true) // For self signed certificates, only use for development`;
17+
.setSelfSigned(true) // For self signed certificates, only use for development`
18+
}`;
1519
1620
let showAlert = true;
1721
</script>
@@ -21,16 +25,16 @@ let client = Client()
2125

2226
<h2 class="heading-level-7">Initialize your SDK</h2>
2327
<p>
24-
Initialize your SDK by pointing the client to your Appwrite project using your <Id
25-
value={project}>Project ID</Id
26-
>.
28+
Initialize your SDK by pointing the client to your Appwrite project using your
29+
<Id value={project}>Project ID</Id>
30+
.
2731
</p>
2832
<Code label="Apple SDK" labelIcon="apple" language="swift" {code} withCopy withLineNumbers />
2933
<p class="u-margin-block-start-24">
3034
Before sending any API calls to your new Appwrite project, make sure your device or emulator
3135
has network access to your Appwrite project's hostname or IP address.
3236
</p>
33-
{#if showAlert && isSelfHosted}
37+
{#if showAlert && !isCloud}
3438
<div class="common-section">
3539
<Alert type="info" dismissible on:dismiss={() => (showAlert = false)}>
3640
<svelte:fragment slot="title">For self-hosted solutions</svelte:fragment>

src/routes/(console)/project-[project]/overview/platforms/wizard/flutter/step3.svelte

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
<script lang="ts">
22
import { Alert, Code } from '$lib/components';
33
import { WizardStep } from '$lib/layout';
4-
import { isSelfHosted } from '$lib/system';
4+
import { isCloud } from '$lib/system';
55
import { sdk } from '$lib/stores/sdk';
66
import Id from '$lib/components/id.svelte';
77
88
const { endpoint, project } = sdk.forProject.client.config;
99
const code = `import 'package:appwrite/appwrite.dart';
1010
1111
Client client = Client();
12-
client
12+
${
13+
isCloud
14+
? `client.setProject('${project}');`
15+
: `client
1316
.setEndpoint('${endpoint}')
1417
.setProject('${project}')
15-
.setSelfSigned(status: true); // For self signed certificates, only use for development`;
18+
.setSelfSigned(status: true); // For self signed certificates, only use for development;`
19+
}`;
1620
1721
let showAlert = true;
1822
</script>
@@ -22,8 +26,8 @@ client
2226

2327
<h2 class="heading-level-7">Initialize your SDK</h2>
2428
<p data-private>
25-
Initialize your SDK by pointing the client to your Appwrite project using your <Id
26-
value={project}>Project ID</Id>
29+
Initialize your SDK by pointing the client to your Appwrite project using your
30+
<Id value={project}>Project ID</Id>
2731
</p>
2832
<div class="u-margin-block-start-16">
2933
<Code
@@ -39,7 +43,7 @@ client
3943
Before sending any API calls to your new Appwrite project, make sure your device or emulator
4044
has network access to your Appwrite project's hostname or IP address.
4145
</p>
42-
{#if showAlert && isSelfHosted}
46+
{#if showAlert && !isCloud}
4347
<div class="common-section">
4448
<Alert type="info" on:dismiss={() => (showAlert = false)}>
4549
<svelte:fragment slot="title">For self-hosted solutions</svelte:fragment>

src/routes/(console)/project-[project]/overview/platforms/wizard/react-native/step3.svelte

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
<script lang="ts">
22
import { Alert, Code } from '$lib/components';
33
import { WizardStep } from '$lib/layout';
4-
import { isSelfHosted } from '$lib/system';
4+
import { isCloud } from '$lib/system';
55
import { sdk } from '$lib/stores/sdk';
66
import { createPlatform } from '../store';
77
import Id from '$lib/components/id.svelte';
88
99
const { endpoint, project } = sdk.forProject.client.config;
1010
const code = `import { Client, Account, ID } from 'react-native-appwrite';
1111
12-
const client = new Client();
13-
const client
14-
.setEndpoint('${endpoint}')
12+
const client = new Client()${
13+
isCloud
14+
? ''
15+
: `
16+
.setEndpoint('${endpoint}')`
17+
}
1518
.setProject('${project}')
16-
.setPlatform('${$createPlatform.key}');`;
19+
.setPlatform('${$createPlatform.key}');
20+
`;
1721
1822
let showAlert = true;
1923
</script>
@@ -40,7 +44,7 @@ const client
4044
Before sending any API calls to your new Appwrite project, make sure your device or emulator
4145
has network access to your Appwrite project's hostname or IP address.
4246
</p>
43-
{#if showAlert && isSelfHosted}
47+
{#if showAlert && !isCloud}
4448
<div class="common-section">
4549
<Alert type="info" on:dismiss={() => (showAlert = false)}>
4650
<svelte:fragment slot="title">For self-hosted solutions</svelte:fragment>

src/routes/(console)/project-[project]/overview/platforms/wizard/web/step3.svelte

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
import Id from '$lib/components/id.svelte';
44
import { WizardStep } from '$lib/layout';
55
import { sdk } from '$lib/stores/sdk';
6+
import { isCloud } from '$lib/system';
67
78
const { endpoint, project } = sdk.forProject.client.config;
89
const code = `const client = new Client();
9-
10-
client
10+
${
11+
isCloud
12+
? `client.setProject('${project}');`
13+
: `client
1114
.setEndpoint('${endpoint}')
12-
.setProject('${project}');`;
15+
.setProject('${project}');`
16+
}`;
1317
</script>
1418

1519
<WizardStep>

0 commit comments

Comments
 (0)