@@ -397,69 +397,12 @@ data class UserData(
397397### Prompt 4.1 - Tooltip JSON Content
398398
399399```
400- Create app/src/main/assets/tooltip_content.json:
401-
402- {
403- "aliases": {
404- "title": "Aliases",
405- "description": "Aliases are alternative identifiers for the user. Use them to reference users by your own IDs (e.g., database ID, username)."
406- },
407- "push": {
408- "title": "Push Subscription",
409- "description": "The push subscription ID for this device. Used to send targeted push notifications."
410- },
411- "emails": {
412- "title": "Email Subscriptions",
413- "description": "Email addresses associated with this user for email messaging campaigns."
414- },
415- "sms": {
416- "title": "SMS Subscriptions",
417- "description": "Phone numbers associated with this user for SMS messaging."
418- },
419- "tags": {
420- "title": "Tags",
421- "description": "Key-value data attached to the user for segmentation and personalization."
422- },
423- "triggers": {
424- "title": "Triggers",
425- "description": "Local triggers that control when in-app messages are displayed. Stored in memory only - cleared on app restart."
426- },
427- "outcomes": {
428- "title": "Outcomes",
429- "description": "Track user actions and conversions attributed to OneSignal messaging."
430- },
431- "inAppMessaging": {
432- "title": "In-App Messaging",
433- "description": "Display rich messages inside your app based on user behavior and segments."
434- },
435- "location": {
436- "title": "Location",
437- "description": "Share device location for location-based targeting and analytics."
438- },
439- "trackEvent": {
440- "title": "Track Event",
441- "description": "Track custom events with optional properties for analytics and segmentation."
442- },
443- "sendPushNotification": {
444- "title": "Send Push Notification",
445- "description": "Test push notifications by sending them to this device.",
446- "options": [
447- {"name": "Simple", "description": "Basic push notification with title and body text only."},
448- {"name": "With Image", "description": "Push notification with a large image attachment (big picture style)."},
449- {"name": "Custom", "description": "Create a custom notification with your own title and message content."}
450- ]
451- },
452- "sendInAppMessage": {
453- "title": "Send In-App Message",
454- "description": "Test in-app message display formats. These trigger local IAMs for testing UI layouts.",
455- "options": [
456- {"name": "Top Banner", "description": "Slides in from the top of the screen. Best for non-intrusive alerts and quick info."},
457- {"name": "Bottom Banner", "description": "Slides in from the bottom of the screen. Great for prompts and soft CTAs."},
458- {"name": "Center Modal", "description": "Centered popup dialog. Ideal for important announcements requiring user attention."},
459- {"name": "Full Screen", "description": "Takes over the entire screen. Best for onboarding, promotions, or rich media content."}
460- ]
461- }
462- }
400+ Tooltip content is fetched at runtime from the sdk-shared repo. Do NOT bundle a local copy.
401+
402+ URL:
403+ https://raw.githubusercontent.com/OneSignal/sdk-shared/main/demo/tooltip_content.json
404+
405+ This file is maintained in the sdk-shared repo and shared across all platform demo apps.
463406```
464407
465408### Prompt 4.2 - Tooltip Helper
@@ -471,13 +414,17 @@ object TooltipHelper {
471414 private var tooltips: Map<String, TooltipData> = emptyMap()
472415 private var initialized = false
473416
417+ private const val TOOLTIP_URL =
418+ "https://raw.githubusercontent.com/OneSignal/sdk-shared/main/demo/tooltip_content.json"
419+
474420 fun init(context: Context) {
475421 if (initialized) return
476422
477- // IMPORTANT: Load on background thread to avoid blocking app startup
423+ // IMPORTANT: Fetch on background thread to avoid blocking app startup
478424 CoroutineScope(Dispatchers.IO).launch {
479- // Load tooltip_content.json from assets
425+ // Fetch tooltip_content.json from TOOLTIP_URL using HttpURLConnection
480426 // Parse JSON into tooltips map
427+ // On failure (no network, etc.), leave tooltips empty — tooltips are non-critical
481428
482429 withContext(Dispatchers.Main) {
483430 // Update tooltips map on main thread
@@ -593,8 +540,6 @@ Examples/OneSignalDemo/
593540│ └── Plugins.kt # Plugin IDs
594541├── app/
595542│ ├── src/main/
596- │ │ ├── assets/
597- │ │ │ └── tooltip_content.json
598543│ │ ├── java/com/onesignal/sdktest/
599544│ │ │ ├── application/
600545│ │ │ │ └── MainApplication.kt
0 commit comments