Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Remove Space notification pilot restrictions

Anand Baburajan9ad968a09c41
diff --git a/web/apps/space/src/hooks/useSpaceWebPushPrompt.ts b/web/apps/space/src/hooks/useSpaceWebPushPrompt.ts
index 34d36e26ae..1a7c9b99e5 100644
--- a/web/apps/space/src/hooks/useSpaceWebPushPrompt.ts
+++ b/web/apps/space/src/hooks/useSpaceWebPushPrompt.ts
@@ -1,4 +1,3 @@
-import { savedPartialLocalUser } from "ente-accounts-rs/services/accounts-db";
import { isSpaceIOS, isSpaceStandalone } from "hooks/useSpacePWAInstallPrompt";
import React from "react";
import {
@@ -9,7 +8,6 @@ import {
unsubscribeFromSpaceWebPush,
type SpaceWebPushState,
} from "services/spaceWebPush";
-import { isSpaceWebPushPilotAccount } from "services/spaceWebPushPilot";
type PromptStatus = "enabling" | "error" | "hidden" | "loading" | "ready";
@@ -51,7 +49,6 @@ const isDismissed = () => {
export const useSpaceWebPushPrompt = () => {
const updating = React.useRef(false);
const [isAvailable, setIsAvailable] = React.useState(false);
- const [isPilotEligible, setIsPilotEligible] = React.useState(false);
const [isSubscribed, setIsSubscribed] = React.useState<boolean | null>(
null,
);
@@ -62,14 +59,8 @@ export const useSpaceWebPushPrompt = () => {
const [status, setStatus] = React.useState<PromptStatus>("loading");
React.useEffect(() => {
- const pilotEligible = isSpaceWebPushPilotAccount(
- savedPartialLocalUser()?.email,
- );
- setIsPilotEligible(pilotEligible);
const available =
- pilotEligible &&
- isSpaceWebPushSupported() &&
- (!isSpaceIOS() || isSpaceStandalone());
+ isSpaceWebPushSupported() && (!isSpaceIOS() || isSpaceStandalone());
setIsAvailable(available);
if (!available) {
setStatus("hidden");
@@ -180,7 +171,6 @@ export const useSpaceWebPushPrompt = () => {
enable,
isAvailable,
isEnabling: status == "enabling",
- isPilotEligible,
isResolved: status != "loading",
isSubscribed,
needsBravePushMessaging,
diff --git a/web/apps/space/src/pages/index.tsx b/web/apps/space/src/pages/index.tsx
index c0d1e8bcc5..519322fd91 100644
--- a/web/apps/space/src/pages/index.tsx
+++ b/web/apps/space/src/pages/index.tsx
@@ -37,7 +37,6 @@ import {
type SpaceInviteIntent,
type SpaceInviteRoute,
} from "services/spaceInvite";
-import { isSpaceWebPushPilotPublicPage } from "services/spaceWebPushPilot";
import {
useSpaceAppState,
type OnboardingEntrySource,
@@ -646,13 +645,9 @@ export const Page: React.FC<PageProps> = ({ invitePreview }) => {
postsCount={publicLink.postsCount}
profile={publicLink.profile}
publicNotificationControl={
- isSpaceWebPushPilotPublicPage(
- publicIdentity.username,
- ) ? (
- <SpacePublicProfileNotificationControl
- session={publicLink}
- />
- ) : undefined
+ <SpacePublicProfileNotificationControl
+ session={publicLink}
+ />
}
showAddingFriendSpinner={
isAddingFriend && Boolean(profile)
diff --git a/web/apps/space/src/screens/SettingsScreen.tsx b/web/apps/space/src/screens/SettingsScreen.tsx
index 8a354e012b..945991c325 100644
--- a/web/apps/space/src/screens/SettingsScreen.tsx
+++ b/web/apps/space/src/screens/SettingsScreen.tsx
@@ -506,36 +506,29 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
label="Change cover image"
onClick={onChangeCoverImage}
/>
- {(webPushPrompt.isPilotEligible ||
- installPrompt.canInstall) && (
- <SettingsEyebrow>PREFERENCES</SettingsEyebrow>
- )}
- {webPushPrompt.isPilotEligible && (
- <SettingsRow
- icon={Notification02Icon}
- label="Notifications"
- onClick={
- requiresIOSInstall
- ? toggleNotifications
- : undefined
- }
- trailingOnClick={
- webPushPrompt.isResolved &&
- !webPushPrompt.isEnabling &&
- webPushPrompt.isAvailable
- ? toggleNotifications
- : undefined
- }
- toggleState={
- requiresIOSInstall
- ? undefined
- : webPushPrompt.isResolved &&
- webPushPrompt.isAvailable
- ? Boolean(webPushPrompt.isSubscribed)
- : null
- }
- />
- )}
+ <SettingsEyebrow>PREFERENCES</SettingsEyebrow>
+ <SettingsRow
+ icon={Notification02Icon}
+ label="Notifications"
+ onClick={
+ requiresIOSInstall ? toggleNotifications : undefined
+ }
+ trailingOnClick={
+ webPushPrompt.isResolved &&
+ !webPushPrompt.isEnabling &&
+ webPushPrompt.isAvailable
+ ? toggleNotifications
+ : undefined
+ }
+ toggleState={
+ requiresIOSInstall
+ ? undefined
+ : webPushPrompt.isResolved &&
+ webPushPrompt.isAvailable
+ ? Boolean(webPushPrompt.isSubscribed)
+ : null
+ }
+ />
{installPrompt.canInstall && (
<SettingsRow
icon={ScreenAddToHomeIcon}
diff --git a/web/apps/space/src/services/spaceWebPushPilot.ts b/web/apps/space/src/services/spaceWebPushPilot.ts
deleted file mode 100644
index ca2841c656..0000000000
--- a/web/apps/space/src/services/spaceWebPushPilot.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-const pilotAccountEmails = new Set([
-]);
-const pilotPublicUsernames = new Set(["anand", "anandbaburajan"]);
-
-const normalize = (value: string | undefined) =>
- value?.trim().toLowerCase() ?? "";
-
-export const isSpaceWebPushPilotAccount = (email: string | undefined) =>
- pilotAccountEmails.has(normalize(email));
-
-export const isSpaceWebPushPilotPublicPage = (username: string | undefined) =>
- pilotPublicUsernames.has(normalize(username));