Skip to content

Commit 3bf693b

Browse files
committed
refactor(demo): replace LogManager with console and add E2E value masking
1 parent 006421e commit 3bf693b

29 files changed

Lines changed: 271 additions & 494 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_modules
44
# Build & test output
55
dist/
66
coverage/
7+
.capacitor-sdk-source.stamp
78

89
# macOS
910
.DS_Store

examples/build.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ rm -rf android/app/src/main/res/mipmap-anydpi-v26 \
5151
android/app/src/main/res/mipmap-*/ic_launcher_foreground.png
5252
```
5353

54+
Then verify both platforms picked up the OneSignal logo and not a default Capacitor icon:
55+
56+
- iOS: open `ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png`
57+
- Android: open `android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png`
58+
59+
If either still shows the default Capacitor blue X, re-run the generator. `@capacitor/assets generate` has been observed to silently skip the iOS output on a first run.
60+
5461
Local SDK reference via packed tarball:
5562

5663
```json
-45 KB
Loading

examples/demo/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"images": [
33
{
4-
"filename": "AppIcon-512@2x.png",
54
"idiom": "universal",
6-
"platform": "ios",
7-
"size": "1024x1024"
5+
"size": "1024x1024",
6+
"filename": "AppIcon-512@2x.png",
7+
"platform": "ios"
88
}
99
],
1010
"info": {

examples/demo/src/components/sections/AppSection.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { IonToggle } from '@ionic/react';
22
import type { FC } from 'react';
33

4+
import { maskValue } from '../../utils/maskValue';
45
import SectionCard from '../SectionCard';
56

67
interface AppSectionProps {
@@ -23,7 +24,7 @@ const AppSection: FC<AppSectionProps> = ({
2324
<div className="kv-row">
2425
<span>App ID</span>
2526
<span className="id-value" data-testid="app_id_value">
26-
{appId}
27+
{maskValue(appId)}
2728
</span>
2829
</div>
2930
</div>

examples/demo/src/components/sections/PushSection.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { IonToggle } from '@ionic/react';
22
import type { FC } from 'react';
33

4+
import { maskValue } from '../../utils/maskValue';
45
import ActionButton from '../ActionButton';
56
import SectionCard from '../SectionCard';
67

@@ -26,7 +27,7 @@ const PushSection: FC<PushSectionProps> = ({
2627
<div className="kv-row">
2728
<span>Push ID</span>
2829
<span className="id-value" data-testid="push_id_value">
29-
{pushSubscriptionId ?? '—'}
30+
{maskValue(pushSubscriptionId ?? '—')}
3031
</span>
3132
</div>
3233
<div className="divider" />

examples/demo/src/components/sections/TriggersSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const TriggersSection: FC<TriggersSectionProps> = ({
2727
<SectionCard title="TRIGGERS" sectionKey="triggers" onInfoTap={onInfoTap}>
2828
<PairList
2929
items={triggerItems}
30-
emptyText="No Triggers Added"
30+
emptyText="No triggers added"
3131
onRemove={onRemoveTrigger}
3232
sectionKey="triggers"
3333
/>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Mirrors the trim/strict-equals check used elsewhere so a stray newline
2+
// or whitespace in `.env` doesn't accidentally enable masking.
3+
const E2E_MODE = (import.meta.env.VITE_E2E_MODE ?? '').trim() === 'true';
4+
const MASK_CHAR = '•';
5+
6+
export function maskValue(value: string): string {
7+
if (E2E_MODE) {
8+
return MASK_CHAR.repeat(value.length);
9+
}
10+
return value;
11+
}

examples/demo_pods/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
VITE_ONESIGNAL_APP_ID=your_onesignal_app_id
12
VITE_ONESIGNAL_API_KEY=your_rest_api_key
3+
VITE_E2E_MODE=false

examples/demo_pods/android/app/build.gradle

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)