Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove subdomain code (os.tc) #1142

Merged
merged 35 commits into from
Dec 13, 2023
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ef3ec2c
move unsupported os.tc check
jkasten2 Nov 22, 2023
090d872
rm internalIsUsingSubscriptionWorkaround
jkasten2 Nov 22, 2023
4c06923
rm isUsingSubscriptionWorkaround()
jkasten2 Nov 22, 2023
3c53766
rm isUsingSubscriptionWorkaround
jkasten2 Nov 22, 2023
ab3c9a1
rm getIntegration, everything is secure now
jkasten2 Nov 22, 2023
42848b9
rm AltOriginManager
jkasten2 Nov 22, 2023
eb2176b
rm canTalkToServiceWorker()
jkasten2 Nov 22, 2023
a15799b
rm ONESIGNAL_HTTP_PROMPT_SHOWN
jkasten2 Nov 22, 2023
a2ad30e
rm getOneSignalSubdomainNotificationPermission
jkasten2 Nov 22, 2023
098cd76
rm DeprecatedApiError
jkasten2 Nov 22, 2023
efcfd85
rm LegacyManager and metrics for dropped APIs
jkasten2 Nov 22, 2023
ecf8389
rm httpPermissionRequest
jkasten2 Nov 22, 2023
7a15e3d
Clean up WindowEnvironmentKind
jkasten2 Nov 22, 2023
fa4da7b
rm lastKnownHostUrl and logic around it
jkasten2 Nov 23, 2023
9f42457
remove all proxy frame classes
jkasten2 Nov 23, 2023
1d1c652
rm HTTP logic from PermisionManager
jkasten2 Nov 23, 2023
3cc2b05
rm isFrameContextInsecure
jkasten2 Nov 23, 2023
964dbe7
rm MissingSubdomain
jkasten2 Nov 23, 2023
23ba387
rm isHttps checks, this is already true now
jkasten2 Nov 23, 2023
d4211ea
rm HttpHttpsEnvironment from tests
jkasten2 Nov 23, 2023
541d93d
rm subdomain checks from checkRestrictedOrigin
jkasten2 Nov 23, 2023
cf614a6
AppConfig.subdomain to hasUnsupportedSubdomain
jkasten2 Nov 23, 2023
3a4efe7
rm httpUseOneSignalCom
jkasten2 Nov 23, 2023
443c8b8
remove reduntent useSafariLegacyPush check
jkasten2 Nov 23, 2023
f8ec723
corrected ForSecure naming
jkasten2 Nov 23, 2023
522cf9c
rm isInsecureOrigin(), as it is deadcode
jkasten2 Nov 23, 2023
12e835a
rm postmam
jkasten2 Nov 23, 2023
5dc8959
clean up comments referring to subdomain feature
jkasten2 Nov 23, 2023
8a54932
rm misc types and properites related to os.tc
jkasten2 Nov 23, 2023
0235268
remove unused imports
jkasten2 Nov 23, 2023
97fdfd1
clean up Safari in iframe detection
jkasten2 Nov 23, 2023
e1be1bb
remove onSession HTTP test
jkasten2 Nov 23, 2023
593f80f
rm dead code getSubscriptionStateForInsecure
jkasten2 Nov 23, 2023
6efdb70
rm os.tc from cert gen config
jkasten2 Nov 23, 2023
d869a8e
fix flaky test carry over
jkasten2 Nov 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove all proxy frame classes
jkasten2 committed Nov 28, 2023
commit 9f4245784ef511668ae3fa1fa9e969b2342d88fb
18 changes: 0 additions & 18 deletions src/onesignal/OneSignal.ts
Original file line number Diff line number Diff line change
@@ -2,12 +2,6 @@ import { EnvironmentInfoHelper } from '../page/helpers/EnvironmentInfoHelper';
import ConfigManager from '../page/managers/ConfigManager';
import Context from '../page/models/Context';
import { EnvironmentInfo } from '../page/models/EnvironmentInfo';
import ProxyFrame from '../page/modules/frames/ProxyFrame';
import ProxyFrameHost from '../page/modules/frames/ProxyFrameHost';
import SubscriptionModal from '../page/modules/frames/SubscriptionModal';
import SubscriptionModalHost from '../page/modules/frames/SubscriptionModalHost';
import SubscriptionPopup from '../page/modules/frames/SubscriptionPopup';
import SubscriptionPopupHost from '../page/modules/frames/SubscriptionPopupHost';
import TimedLocalStorage from '../page/modules/TimedLocalStorage';
import { ProcessOneSignalPushCalls } from '../page/utils/ProcessOneSignalPushCalls';
import { SdkInitError, SdkInitErrorKind } from '../shared/errors/SdkInitError';
@@ -297,12 +291,6 @@ export default class OneSignal {
static event = OneSignalEvent;
private static pendingInit = true;

static subscriptionPopup: SubscriptionPopup;
static subscriptionPopupHost: SubscriptionPopupHost;
static subscriptionModal: SubscriptionModal;
static subscriptionModalHost: SubscriptionModalHost;
static proxyFrameHost: ProxyFrameHost;
static proxyFrame: ProxyFrame;
static emitter: Emitter = new Emitter();
static cache: any = {};
static _LOGGING = false;
@@ -321,12 +309,6 @@ export default class OneSignal {
static Debug = new DebugNamespace();
/* END NEW USER MODEL CHANGES */

/**
* Used by Rails-side HTTP popup. Must keep the same name.
* @InternalApi
*/
static _initPopup = () => OneSignal.subscriptionPopup.subscribe();

static POSTMAM_COMMANDS = {
CONNECTED: 'connect',
REMOTE_NOTIFICATION_PERMISSION: 'postmam.remoteNotificationPermission',
6 changes: 0 additions & 6 deletions src/onesignal/OneSignalEvents.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
export const ONESIGNAL_EVENTS = {
/**
* Occurs when the user clicks the "Continue" or "No Thanks" button on the HTTP popup or HTTPS modal prompt.
* For HTTP sites (and HTTPS sites using the modal prompt), this event is fired before the native permission
* prompt is shown. This event is mostly used for HTTP sites.
*/
CUSTOM_PROMPT_CLICKED: 'customPromptClick',
/**
* Occurs immediately when the notification permission changes for the domain at the browser level.
* This normally happens when the user clicks "Allow" or "Block" on the native permission prompt
8 changes: 2 additions & 6 deletions src/page/managers/slidedownManager/SlidedownManager.ts
Original file line number Diff line number Diff line change
@@ -24,9 +24,7 @@ import PushPermissionNotGrantedError, {
PushPermissionNotGrantedErrorReason,
} from '../../../shared/errors/PushPermissionNotGrantedError';
import { DismissHelper } from '../../../shared/helpers/DismissHelper';
import InitHelper, {
RegisterOptions,
} from '../../../shared/helpers/InitHelper';
import InitHelper from '../../../shared/helpers/InitHelper';
import PromptsHelper from '../../../shared/helpers/PromptsHelper';
import Log from '../../../shared/libraries/Log';
import { DelayedPromptType } from '../../../shared/models/Prompts';
@@ -135,9 +133,7 @@ export class SlidedownManager {
}

private registerForPush(): void {
const autoAccept = !OneSignal.environmentInfo.requiresUserInteraction;
const options: RegisterOptions = { autoAccept, slidedown: true };
InitHelper.registerForPushNotifications(options);
InitHelper.registerForPushNotifications();
}

private async handleAllowForCategoryType(): Promise<void> {
7 changes: 0 additions & 7 deletions src/page/models/MessengerMessageEvent.ts

This file was deleted.

31 changes: 0 additions & 31 deletions src/page/models/SubscriptionPopupHostOptions.ts

This file was deleted.

369 changes: 0 additions & 369 deletions src/page/modules/frames/ProxyFrame.ts

This file was deleted.

281 changes: 0 additions & 281 deletions src/page/modules/frames/ProxyFrameHost.ts

This file was deleted.

116 changes: 0 additions & 116 deletions src/page/modules/frames/RemoteFrame.ts

This file was deleted.

24 changes: 0 additions & 24 deletions src/page/modules/frames/SubscriptionModal.ts

This file was deleted.

159 changes: 0 additions & 159 deletions src/page/modules/frames/SubscriptionModalHost.ts

This file was deleted.

54 changes: 0 additions & 54 deletions src/page/modules/frames/SubscriptionPopup.ts

This file was deleted.

280 changes: 0 additions & 280 deletions src/page/modules/frames/SubscriptionPopupHost.ts

This file was deleted.

61 changes: 1 addition & 60 deletions src/shared/helpers/InitHelper.ts
Original file line number Diff line number Diff line change
@@ -4,15 +4,11 @@ import { AppConfig } from '../models/AppConfig';
import MainHelper from './MainHelper';
import SubscriptionHelper from './SubscriptionHelper';
import { SdkInitError, SdkInitErrorKind } from '../errors/SdkInitError';
import { WorkerMessengerCommand } from '../libraries/WorkerMessenger';
import { SubscriptionStrategyKind } from '../models/SubscriptionStrategyKind';
import { Subscription } from '../models/Subscription';
import Log from '../libraries/Log';
import { CustomLinkManager } from '../managers/CustomLinkManager';
import Bell from '../../page/bell/Bell';
import { ContextInterface } from '../../page/models/Context';
import SubscriptionModalHost from '../../page/modules/frames/SubscriptionModalHost';
import SubscriptionPopupHost from '../../page/modules/frames/SubscriptionPopupHost';
import { DynamicResourceLoader } from '../../page/services/DynamicResourceLoader';
import Database from '../services/Database';
import LimitStore from '../services/LimitStore';
@@ -23,11 +19,6 @@ import { bowserCastle } from '../utils/bowserCastle';

declare let OneSignal: any;

export interface RegisterOptions extends SubscriptionPopupHostOptions {
modalPrompt?: boolean;
slidedown?: boolean;
}

export default class InitHelper {
/** Main methods */

@@ -110,21 +101,7 @@ export default class InitHelper {
await OneSignalEvent.trigger(OneSignal.EVENTS.SDK_INITIALIZED);
}

// In-Addition to registering for push, this shows a native browser
// notification permission prompt, if needed.
public static async registerForPushNotifications(
options: RegisterOptions = {},
): Promise<void> {
if (options && options.modalPrompt) {
/* Show the HTTPS fullscreen modal permission message. */
OneSignal.subscriptionModalHost = new SubscriptionModalHost(
OneSignal.config.appId,
options,
);
await OneSignal.subscriptionModalHost.load();
return;
}

public static async registerForPushNotifications(): Promise<void> {
await SubscriptionHelper.registerForPush();
}

@@ -164,23 +141,6 @@ export default class InitHelper {
await OneSignalEvent.trigger(OneSignal.EVENTS.SDK_INITIALIZED_PUBLIC);
}

public static async loadSubscriptionPopup(
options?: SubscriptionPopupHostOptions,
) {
/**
* Users may be subscribed to either .onesignal.com or .os.tc. By this time
* that they are subscribing to the popup, the Proxy Frame has already been
* loaded and the user's subscription status has been obtained. We can then
* use the Proxy Frame present now and check its URL to see whether the user
* is finally subscribed to .onesignal.com or .os.tc.
*/
OneSignal.subscriptionPopupHost = new SubscriptionPopupHost(
OneSignal.proxyFrameHost.url,
options,
);
await OneSignal.subscriptionPopupHost.load();
}

/** Helper methods */

public static async storeInitialValues() {
@@ -249,25 +209,6 @@ export default class InitHelper {
return true;
}

public static async registerSubscriptionInProxyFrame(
context: ContextInterface,
): Promise<Subscription> {
const newSubscription = await new Promise<Subscription>((resolve) => {
context.workerMessenger.once(
WorkerMessengerCommand.SubscribeNew,
(subscription) => {
resolve(Subscription.deserialize(subscription));
},
);
context.workerMessenger.unicast(
WorkerMessengerCommand.SubscribeNew,
context.appConfig,
);
});
Log.debug('Finished registering brand new subscription:', newSubscription);
return newSubscription;
}

public static async doInitialize(): Promise<void> {
const promises: Promise<void>[] = [];

6 changes: 0 additions & 6 deletions src/shared/helpers/MainHelper.ts
Original file line number Diff line number Diff line change
@@ -166,12 +166,6 @@ export default class MainHelper {
return hash;
}

static triggerCustomPromptClicked(clickResult) {
OneSignalEvent.trigger(OneSignal.EVENTS.CUSTOM_PROMPT_CLICKED, {
result: clickResult,
});
}

static async getAppId(): Promise<string> {
if (OneSignal.config.appId) {
return Promise.resolve(OneSignal.config.appId);
1 change: 0 additions & 1 deletion src/shared/managers/CustomLinkManager.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ import {
CUSTOM_LINK_CSS_SELECTORS,
} from '../slidedown/constants';
import { addCssClass } from '../utils/utils';
import InitHelper, { RegisterOptions } from '../helpers/InitHelper';
import Log from '../libraries/Log';
import { AppUserConfigCustomLinkOptions } from '../models/Prompts';

25 changes: 0 additions & 25 deletions src/shared/managers/ServiceWorkerManager.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ import Database from '../services/Database';
import { WindowEnvironmentKind } from '../models/WindowEnvironmentKind';
import Log from '../libraries/Log';
import OneSignalEvent from '../services/OneSignalEvent';
import ProxyFrame from '../../page/modules/frames/ProxyFrame';
import ServiceWorkerRegistrationError from '../errors/ServiceWorkerRegistrationError';
import OneSignalUtils from '../utils/OneSignalUtils';
import ServiceWorkerHelper, {
@@ -321,19 +320,6 @@ export class ServiceWorkerManager {
},
);

workerMessenger.on(WorkerMessengerCommand.RedirectPage, (data) => {
Log.debug(
`${SdkEnvironment.getWindowEnv().toString()} Picked up command.redirect to ${data}, forwarding to host page.`,
);
const proxyFrame: ProxyFrame = OneSignal.proxyFrame;
if (proxyFrame) {
proxyFrame.messenger.message(
OneSignal.POSTMAM_COMMANDS.SERVICEWORKER_COMMAND_REDIRECT,
data,
);
}
});

workerMessenger.on(
WorkerMessengerCommand.NotificationDismissed,
async (data) => {
@@ -361,17 +347,6 @@ export class ServiceWorkerManager {
WorkerMessengerCommand.AreYouVisibleResponse,
payload,
);
} else {
const httpPayload: PageVisibilityRequest = {
timestamp: incomingPayload.timestamp,
};
const proxyFrame: ProxyFrame | undefined = OneSignal.proxyFrame;
if (proxyFrame) {
proxyFrame.messenger.message(
OneSignal.POSTMAM_COMMANDS.ARE_YOU_VISIBLE_REQUEST,
httpPayload,
);
}
}
},
);