Skip to content

Commit 9673631

Browse files
authored
Merge pull request #1400 from OneSignal/fg/size-reduction-2
chore: more size reduction
2 parents c20a21f + b794c31 commit 9673631

Some content is hidden

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

57 files changed

+533
-522
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ngrok.log
1414
!.vscode/launch.json
1515
!.vscode/settings.json
1616
!.vscode/keybindings.json
17+
!.vscode/extensions.json
1718
.cursor/
1819

1920
coverage

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["esbenp.prettier-vscode", "jeff-hykin.macro-commander"]
3+
}

.vscode/keybindings.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[
2+
// wont automatically be applied
3+
// example keybinding, copy to your own keybindings.json
24
{
3-
"key": "shift+cmd+y",
4-
"command": "macros.rename_"
5+
"key": "shift+cmd+/",
6+
"command": "macros.rename_",
7+
"when": "editorTextFocus"
58
}
69
]

.vscode/settings.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"source.fixAll.eslint": "explicit",
44
"source.organizeImports": "always"
55
},
6+
67
// a macro to rename a variable to _variable
78
"macros": {
89
"rename_": [
@@ -24,9 +25,9 @@
2425
" pos,",
2526
" newName",
2627
");",
27-
"if (edit) {",
28-
" await vscode.workspace.applyEdit(edit);",
29-
"}"
28+
"if (edit) await vscode.workspace.applyEdit(edit);",
29+
"await new Promise(resolve => setTimeout(resolve, 100));",
30+
"await vscode.commands.executeCommand('workbench.action.files.saveAll');"
3031
]
3132
}
3233
]

__test__/support/environment/TestEnvironment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class TestEnvironment {
3232
) {
3333
mockJsonp();
3434
const oneSignal = initOSGlobals(config);
35-
OneSignal._coreDirector._operationRepo.queue = [];
35+
OneSignal._coreDirector._operationRepo._queue = [];
3636

3737
if (config.initOneSignalId) {
3838
updateIdentityModel('onesignal_id', ONESIGNAL_ID);

__test__/unit/push/registerForPush.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('Register for push', () => {
3232
const promise = OneSignal.User.PushSubscription.optIn();
3333

3434
expect(spy).not.toHaveBeenCalled();
35-
OneSignalEvent.trigger(OneSignal.EVENTS.SDK_INITIALIZED);
35+
OneSignalEvent._trigger(OneSignal.EVENTS.SDK_INITIALIZED);
3636
await promise;
3737
expect(OneSignal._initialized).toBe(true);
3838
expect(spy).toHaveBeenCalledTimes(1);

__test__/unit/pushSubscription/nativePermissionChange.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('Notification Types are set correctly on subscription change', () => {
5050
});
5151
await setDbPermission('granted');
5252

53-
await MainHelper.checkAndTriggerNotificationPermissionChanged();
53+
await MainHelper._checkAndTriggerNotificationPermissionChanged();
5454
expect(triggerNotificationSpy).not.toHaveBeenCalled();
5555
});
5656

@@ -74,7 +74,7 @@ describe('Notification Types are set correctly on subscription change', () => {
7474
permChangeStringListener,
7575
);
7676

77-
await MainHelper.checkAndTriggerNotificationPermissionChanged();
77+
await MainHelper._checkAndTriggerNotificationPermissionChanged();
7878

7979
// should update the db
8080
const dbPermission = await getOptionsValue<NotificationPermission>(

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
},
8585
{
8686
"path": "./build/releases/OneSignalSDK.page.es6.js",
87-
"limit": "48.83 kB",
87+
"limit": "47.886 kB",
8888
"gzip": true
8989
},
9090
{

src/core/CoreModuleDirector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export class CoreModuleDirector {
117117
SubscriptionModel | undefined
118118
> {
119119
logMethodCall('CoreModuleDirector.getPushSubscriptionModelByCurrentToken');
120-
const pushToken = await MainHelper.getCurrentPushToken();
120+
const pushToken = await MainHelper._getCurrentPushToken();
121121
if (pushToken) {
122122
return this._getSubscriptionOfTypeWithToken(
123123
SubscriptionChannel.Push,

src/core/controllers/CustomEventController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class CustomEventController implements ICustomEventController {
2222
}
2323

2424
_sendCustomEvent(event: ICustomEvent): void {
25-
const appId = MainHelper.getAppId();
25+
const appId = MainHelper._getAppId();
2626
const identityModel = this._identityModelStore.model;
2727

2828
const op = new TrackCustomEventOperation({
@@ -33,6 +33,6 @@ export class CustomEventController implements ICustomEventController {
3333
event,
3434
});
3535

36-
this._opRepo.enqueue(op);
36+
this._opRepo._enqueue(op);
3737
}
3838
}

0 commit comments

Comments
 (0)