Allow setting sandbox mode for APNS

This commit is contained in:
Jake Barnby committed 2024-02-25 01:22:47 +13:00
1 parent 9227730269
commit 082ce65b56
10 files changed
+38 -23

No files matched your search

@@ -130,6 +130,7 @@
$providerParams[$provider].authKeyId,
$providerParams[$provider].teamId,
$providerParams[$provider].bundleId,
$providerParams[$provider].sandbox,
$providerParams[$provider].enabled
);
break;
@@ -69,13 +69,13 @@
);
break;
case Providers.FCM:
response = await sdk.forProject.messaging.updateFCMProvider(
response = await sdk.forProject.messaging.updateFcmProvider(
providerId,
providerName
);
break;
case Providers.APNS:
response = await sdk.forProject.messaging.updateAPNSProvider(
response = await sdk.forProject.messaging.updateApnsProvider(
providerId,
providerName
);
@@ -153,7 +153,8 @@
authKey: $provider.credentials['authKey'],
authKeyId: $provider.credentials['authKeyId'],
teamId: $provider.credentials['teamId'],
bundleId: $provider.credentials['bundleId']
bundleId: $provider.credentials['bundleId'],
sandbox: $provider.options['sandbox']
};
break;
}
@@ -237,14 +238,14 @@
);
break;
case Providers.FCM:
response = await sdk.forProject.messaging.updateFCMProvider(
response = await sdk.forProject.messaging.updateFcmProvider(
providerId,
undefined,
enabled
);
break;
case Providers.APNS:
response = await sdk.forProject.messaging.updateAPNSProvider(
response = await sdk.forProject.messaging.updateApnsProvider(
providerId,
undefined,
enabled
@@ -1,7 +1,7 @@
import type { Column } from '$lib/helpers/types';
import { writable } from 'svelte/store';
import { Providers } from '../provider.svelte';
import { MessagingProviderType, Encryption } from '@appwrite.io/console';
import { MessagingProviderType, SmtpEncryption } from '@appwrite.io/console';
export const columns = writable<Column[]>([
{ id: '$id', title: 'Provider ID', type: 'string', show: true },
@@ -142,7 +142,13 @@ export const providers: ProvidersMap = {
'Head to <b><a class="link" href="https://idmsa.apple.com/IDMSWebAuth/signin?appIdKey=891bd3417a7776362562d2197f89480a8547b108fd934911bcbea0110d07f757&path=%2Faccount%2F&rv=1" target="_blank" rel="noopener noreferrer">Apple Developer Member Center</a></b> (under Program resources) <b>-> Certificates, Identifiers & Profiles -> Keys.</b>',
'Create a key and give it a name. Enable the Apple Push Notifications service (APNS), and register your key.'
]
}
},
{
label: "Sandbox",
name: "sandbox",
type: "switch",
description: "Use the development APNS server."
},
]
}
// [Providers.MQTT]: {
@@ -328,9 +334,9 @@ export const providers: ProvidersMap = {
name: 'encryption',
type: 'select',
options: [
{ label: 'None', value: Encryption.None },
{ label: 'SSL', value: Encryption.Ssl },
{ label: 'TLS', value: Encryption.Tls }
{ label: 'None', value: SmtpEncryption.None },
{ label: 'SSL', value: SmtpEncryption.Ssl },
{ label: 'TLS', value: SmtpEncryption.Tls }
]
},
{
@@ -114,7 +114,7 @@
);
break;
case Providers.FCM:
response = await sdk.forProject.messaging.updateFCMProvider(
response = await sdk.forProject.messaging.updateFcmProvider(
providerId,
$providerParams[$provider].name,
$providerParams[$provider].enabled,
@@ -122,14 +122,15 @@
);
break;
case Providers.APNS:
response = await sdk.forProject.messaging.updateAPNSProvider(
response = await sdk.forProject.messaging.updateApnsProvider(
providerId,
$providerParams[$provider].name,
$providerParams[$provider].enabled,
$providerParams[$provider].authKey,
$providerParams[$provider].authKeyId,
$providerParams[$provider].teamId,
$providerParams[$provider].bundleId
$providerParams[$provider].bundleId,
$providerParams[$provider].sandbox
);
break;
}
@@ -6,7 +6,7 @@
import { FormList, InputText } from '$lib/elements/forms';
import { Pill } from '$lib/elements';
import { Providers } from '../../provider.svelte';
import { Encryption } from '@appwrite.io/console';
import { SmtpEncryption } from '@appwrite.io/console';
let name = '';
let showCustomId = false;
@@ -102,7 +102,7 @@
username: '',
password: '',
autoTLS: true,
encryption: Encryption.Tls,
encryption: SmtpEncryption.Tls,
mailer: '',
fromEmail: '',
fromName: '',
@@ -126,7 +126,8 @@
authKey: '',
authKeyId: '',
teamId: '',
bundleId: ''
bundleId: '',
sandbox: false
};
break;
}
@@ -1,6 +1,6 @@
import { writable } from 'svelte/store';
import type { Providers } from '../../provider.svelte';
import type { MessagingProviderType, Encryption } from '@appwrite.io/console';
import type { MessagingProviderType, SmtpEncryption } from '@appwrite.io/console';
type ProviderParams = {
providerId: string;
@@ -73,7 +73,7 @@ export type SMTPProviderParams = ProviderParams & {
port: number;
username: string;
password: string;
encryption: Encryption;
encryption: SmtpEncryption;
autoTLS: boolean;
mailer: string;
};
@@ -91,6 +91,7 @@ export type APNSProviderParams = ProviderParams & {
authKeyId: string;
teamId: string;
bundleId: string;
sandbox: boolean;
};
export type MQTTProviderParams = ProviderParams & {
+4 -2
View File
@@ -75,8 +75,10 @@
OAuthProvider.Github,
window.location.origin + url,
window.location.origin,
undefined,
['read:user', 'user:email']
[
'read:user',
'user:email'
]
);
}
</script>
+1 -1
View File
@@ -16,7 +16,7 @@
async function verify() {
try {
disabled = true;
const challenge = await sdk.forConsole.account.create2FAChallenge(
const challenge = await sdk.forConsole.account.createChallenge(
AuthenticationFactor.Totp
);
await sdk.forConsole.account.updateChallenge(challenge.$id, code);
+4 -2
View File
@@ -64,8 +64,10 @@
OAuthProvider.Github,
window.location.origin,
window.location.origin,
undefined,
['read:user', 'user:email']
[
'read:user',
'user:email'
]
);
}
</script>