Skip to content

Commit b70f071

Browse files
authored
Merge pull request #1402 from OneSignal/fg/size-reduction-5
chore: more size reduction
2 parents 8b56676 + e5f9698 commit b70f071

File tree

144 files changed

+1650
-1672
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+1650
-1672
lines changed

__test__/constants/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ export const BASE_SUB = {
2828
device_model: '',
2929
device_os: '56',
3030
enabled: true,
31-
notification_types: NotificationType.Subscribed,
31+
notification_types: NotificationType._Subscribed,
3232
sdk: __VERSION__,
3333
};

__test__/setupTests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ afterEach(() => {
2020
server.resetHandlers();
2121
if (typeof OneSignal !== 'undefined') {
2222
OneSignal._coreDirector?._operationRepo._clear();
23-
OneSignal._emitter?.removeAllListeners();
23+
OneSignal._emitter?._removeAllListeners();
2424
}
2525
});
2626

@@ -53,7 +53,7 @@ Object.defineProperty(navigator, 'userAgent', {
5353
let downloadSpy: MockInstance;
5454
export const mockJsonp = () => {
5555
const serverConfig = TestContext.getFakeServerAppConfig(
56-
ConfigIntegrationKind.Custom,
56+
ConfigIntegrationKind._Custom,
5757
);
5858

5959
if (!downloadSpy)

__test__/support/environment/TestContext.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class TestContext {
2323
appId: string = APP_ID,
2424
): ServerAppConfig {
2525
let remoteConfigMockDefaults: ServerAppConfig;
26-
if (configIntegrationKind === ConfigIntegrationKind.Custom) {
26+
if (configIntegrationKind === ConfigIntegrationKind._Custom) {
2727
remoteConfigMockDefaults = {
2828
success: true,
2929
version: 2,
@@ -49,7 +49,7 @@ export default class TestContext {
4949
proxyOriginEnabled: true,
5050
},
5151
integration: {
52-
kind: ConfigIntegrationKind.Custom,
52+
kind: ConfigIntegrationKind._Custom,
5353
},
5454
staticPrompts: {
5555
native: {
@@ -311,8 +311,8 @@ export default class TestContext {
311311
},
312312
notificationBehavior: {
313313
click: {
314-
match: NotificationClickMatchBehavior.Exact,
315-
action: NotificationClickActionBehavior.Navigate,
314+
match: NotificationClickMatchBehavior._Exact,
315+
action: NotificationClickActionBehavior._Navigate,
316316
},
317317
display: {
318318
persist: false,
@@ -453,15 +453,15 @@ export default class TestContext {
453453
'notification.dismissed':
454454
'https://fake-config.com/notification-dismissed',
455455
},
456-
notificationClickHandlerMatch: NotificationClickMatchBehavior.Origin,
457-
notificationClickHandlerAction: NotificationClickActionBehavior.Focus,
456+
notificationClickHandlerMatch: NotificationClickMatchBehavior._Origin,
457+
notificationClickHandlerAction: NotificationClickActionBehavior._Focus,
458458
};
459459
}
460460

461461
static getFakeMergedConfig(config: TestEnvironmentConfig = {}): AppConfig {
462462
const fakeUserConfig = config.userConfig || this.getFakeAppUserConfig();
463463
const fakeServerConfig = this.getFakeServerAppConfig(
464-
config.integration || ConfigIntegrationKind.Custom,
464+
config.integration || ConfigIntegrationKind._Custom,
465465
config.overrideServerConfig,
466466
);
467467
const fakeMergedConfig = getMergedConfig(fakeUserConfig, fakeServerConfig);

__test__/support/environment/TestEnvironmentHelpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const createPushSub = ({
6565
id,
6666
onesignalId,
6767
token,
68-
type: SubscriptionType.ChromePush,
68+
type: SubscriptionType._ChromePush,
6969
});
7070
return pushSubscription;
7171
};
@@ -97,7 +97,7 @@ export const setupSubModelStore = async ({
9797
await setPushToken(pushModel.token);
9898
OneSignal._coreDirector._subscriptionModelStore._replaceAll(
9999
[pushModel],
100-
ModelChangeTags.NO_PROPAGATE,
100+
ModelChangeTags._NoPropogate,
101101
);
102102

103103
return pushModel;

__test__/support/helpers/configHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function getFinalAppConfig(
1414
fakeUserConfig: any,
1515
): Promise<AppConfig> {
1616
const fakeServerConfig = TestContext.getFakeServerAppConfig(
17-
ConfigIntegrationKind.Custom,
17+
ConfigIntegrationKind._Custom,
1818
);
1919
fakeUserConfig.appId = fakeServerConfig.app_id;
2020
const getFakeServerConfig = () =>

__test__/support/helpers/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function generateNewSubscription(modelId = '0000000000') {
77
const model = new SubscriptionModel();
88
model._modelId = modelId;
99
model._mergeData({
10-
type: SubscriptionType.Email,
10+
type: SubscriptionType._Email,
1111
id: '123', // subscription id
1212
token: 'myToken',
1313
});

__test__/support/helpers/executors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class SomeOperation extends Operation {
1818
}
1919

2020
get _groupComparisonType() {
21-
return GroupComparisonType.CREATE;
21+
return GroupComparisonType._Create;
2222
}
2323

2424
get _canStartExecute() {

__test__/support/helpers/setup.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ export const setupIdentityModel = async (
6464
) => {
6565
const newIdentityModel = new IdentityModel();
6666
newIdentityModel._onesignalId = onesignalID;
67-
OneSignal._coreDirector._identityModelStore.replace(
67+
OneSignal._coreDirector._identityModelStore._replace(
6868
newIdentityModel,
69-
ModelChangeTags.NO_PROPAGATE,
69+
ModelChangeTags._NoPropogate,
7070
);
7171
};
7272

@@ -78,9 +78,9 @@ export const setupPropertiesModel = async (
7878
) => {
7979
const newPropertiesModel = new PropertiesModel();
8080
newPropertiesModel._onesignalId = onesignalID;
81-
OneSignal._coreDirector._propertiesModelStore.replace(
81+
OneSignal._coreDirector._propertiesModelStore._replace(
8282
newPropertiesModel,
83-
ModelChangeTags.NO_PROPAGATE,
83+
ModelChangeTags._NoPropogate,
8484
);
8585

8686
// wait for db to be updated
@@ -97,7 +97,7 @@ export const updateIdentityModel = async <
9797
value?: IdentitySchema[T],
9898
) => {
9999
const identityModel = OneSignal._coreDirector._getIdentityModel();
100-
identityModel._setProperty(property, value, ModelChangeTags.NO_PROPAGATE);
100+
identityModel._setProperty(property, value, ModelChangeTags._NoPropogate);
101101
};
102102

103103
/**
@@ -113,7 +113,7 @@ export const updatePropertiesModel = async <
113113
value?: PropertiesSchema[T],
114114
) => {
115115
const propertiesModel = OneSignal._coreDirector._getPropertiesModel();
116-
propertiesModel._setProperty(property, value, ModelChangeTags.NO_PROPAGATE);
116+
propertiesModel._setProperty(property, value, ModelChangeTags._NoPropogate);
117117
};
118118

119119
/**
@@ -128,7 +128,7 @@ export const setupSubscriptionModel = async (
128128
subscriptionModel.token = token || '';
129129
OneSignal._coreDirector._subscriptionModelStore._replaceAll(
130130
[subscriptionModel],
131-
ModelChangeTags.NO_PROPAGATE,
131+
ModelChangeTags._NoPropogate,
132132
);
133133
};
134134

@@ -139,7 +139,7 @@ export const setupLoadStylesheet = async () => {
139139
vi.spyOn(
140140
OneSignal._context._dynamicResourceLoader,
141141
'_loadSdkStylesheet',
142-
).mockResolvedValue(ResourceLoadState.Loaded);
142+
).mockResolvedValue(ResourceLoadState._Loaded);
143143
};
144144

145145
export const getRawPushSubscription = () => {

__test__/unit/http/sdkVersion.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('Sdk Version Header Tests', () => {
4646
getUserByAlias(
4747
{ appId: APP_ID },
4848
{
49-
label: IdentityConstants.EXTERNAL_ID,
49+
label: IdentityConstants._ExternalID,
5050
id: EXTERNAL_ID,
5151
},
5252
);
@@ -57,7 +57,7 @@ describe('Sdk Version Header Tests', () => {
5757
updateUserByAlias(
5858
{ appId: APP_ID },
5959
{
60-
label: IdentityConstants.EXTERNAL_ID,
60+
label: IdentityConstants._ExternalID,
6161
id: EXTERNAL_ID,
6262
},
6363
{},
@@ -69,7 +69,7 @@ describe('Sdk Version Header Tests', () => {
6969
updateUserByAlias(
7070
{ appId: APP_ID, subscriptionId: SUB_ID },
7171
{
72-
label: IdentityConstants.EXTERNAL_ID,
72+
label: IdentityConstants._ExternalID,
7373
id: EXTERNAL_ID,
7474
},
7575
{},
@@ -81,7 +81,7 @@ describe('Sdk Version Header Tests', () => {
8181
deleteUserByAlias(
8282
{ appId: APP_ID },
8383
{
84-
label: IdentityConstants.EXTERNAL_ID,
84+
label: IdentityConstants._ExternalID,
8585
id: EXTERNAL_ID,
8686
},
8787
);
@@ -92,7 +92,7 @@ describe('Sdk Version Header Tests', () => {
9292
createSubscriptionByAlias(
9393
{ appId: APP_ID },
9494
{
95-
label: IdentityConstants.EXTERNAL_ID,
95+
label: IdentityConstants._ExternalID,
9696
id: EXTERNAL_ID,
9797
},
9898
{
@@ -107,7 +107,7 @@ describe('Sdk Version Header Tests', () => {
107107
getUserIdentity(
108108
{ appId: APP_ID },
109109
{
110-
label: IdentityConstants.EXTERNAL_ID,
110+
label: IdentityConstants._ExternalID,
111111
id: EXTERNAL_ID,
112112
},
113113
);
@@ -118,10 +118,10 @@ describe('Sdk Version Header Tests', () => {
118118
deleteAlias(
119119
{ appId: APP_ID },
120120
{
121-
label: IdentityConstants.EXTERNAL_ID,
121+
label: IdentityConstants._ExternalID,
122122
id: EXTERNAL_ID,
123123
},
124-
IdentityConstants.EXTERNAL_ID,
124+
IdentityConstants._ExternalID,
125125
);
126126
expectHeaderToBeSent();
127127
});

__test__/unit/pushSubscription/nativePermissionChange.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('Notification Types are set correctly on subscription change', () => {
130130
lastKnownPushToken: PUSH_TOKEN_2,
131131
lastKnownPushId: SUB_ID_3,
132132
});
133-
OneSignal._coreDirector._subscriptionModelStore.add(pushModel);
133+
OneSignal._coreDirector._subscriptionModelStore._add(pushModel);
134134

135135
await checkAndTriggerSubscriptionChanged();
136136
expect(changeListener).toHaveBeenCalledWith({

0 commit comments

Comments
 (0)