1 // Copyright 2015-present 650 Industries. All rights reserved. 2 package host.exp.exponent.kernel 3 4 import host.exp.exponent.analytics.EXL 5 import host.exp.exponent.experience.DetachActivity 6 import host.exp.exponent.notifications.ExponentNotification 7 8 object KernelConstants { 9 val TAG = KernelConstants::class.java.simpleName 10 11 const val MANIFEST_KEY = "manifest" 12 const val BUNDLE_URL_KEY = "bundleUrl" 13 const val MANIFEST_URL_KEY = "experienceUrl" 14 const val NOTIFICATION_MANIFEST_URL_KEY = "notificationExperienceUrl" 15 const val NOTIFICATION_ACTION_TYPE_KEY = "actionType" 16 17 // TODO: Remove once we decide to stop supporting shortcuts to experiences. 18 const val SHORTCUT_MANIFEST_URL_KEY = "shortcutExperienceUrl" 19 const val HOME_MANIFEST_URL = "" 20 const val LINKING_URI_KEY = "linkingUri" 21 const val INTENT_URI_KEY = "intentUri" 22 const val IS_HEADLESS_KEY = "isHeadless" 23 const val IS_OPTIMISTIC_KEY = "isOptimistic" 24 const val LOAD_FROM_CACHE_KEY = "loadFromCache" 25 const val BUNDLE_TAG = "BUNDLE" 26 const val HOME_MODULE_NAME = "main" 27 const val BUNDLE_FILE_PREFIX = "cached-bundle-" 28 const val KERNEL_BUNDLE_ID = "kernel" 29 const val OPEN_OPTIMISTIC_EXPERIENCE_ACTIVITY_KEY = "openOptimisticExperienceActivity" 30 const val OPEN_EXPERIENCE_ACTIVITY_KEY = "openExperienceActivity" 31 const val LOAD_BUNDLE_FOR_EXPERIENCE_ACTIVITY_KEY = "loadBundleForExperienceActivity" 32 const val EXPERIENCE_ID_SET_FOR_ACTIVITY_KEY = "experienceIdSetForActivity" 33 const val DELAY_TO_PRELOAD_KERNEL_JS: Long = 5000 34 const val HTTP_NOT_MODIFIED = 304 35 const val OVERLAY_PERMISSION_REQUEST_CODE = 123 36 const val DEFAULT_APPLICATION_KEY = "main" 37 const val NOTIFICATION_KEY = "notification" 38 const val NOTIFICATION_ID_KEY = "notification_id" 39 const val NOTIFICATION_OBJECT_KEY = "notification_object" 40 41 var MAIN_ACTIVITY_CLASS: Class<*> = DetachActivity::class.java 42 init { 43 try { 44 MAIN_ACTIVITY_CLASS = Class.forName("host.exp.exponent.MainActivity") 45 } catch (e: Exception) { 46 EXL.e(TAG, "Could not find MainActivity, falling back to DetachActivity: " + e.message) 47 } 48 } 49 50 class ExperienceOptions { 51 val manifestUri: String 52 val uri: String? 53 @Deprecated("deprecated") val notification: String? 54 val notificationObject: ExponentNotification? 55 56 constructor(manifestUri: String, uri: String?, notification: String?) { 57 this.manifestUri = manifestUri 58 this.uri = uri 59 this.notification = notification 60 this.notificationObject = null 61 } 62 63 constructor( 64 manifestUri: String, 65 uri: String?, 66 notification: String?, 67 notificationObject: ExponentNotification 68 ) { 69 this.manifestUri = manifestUri 70 this.uri = uri 71 this.notification = notification 72 this.notificationObject = notificationObject 73 } 74 } 75 76 data class ExperienceEvent(val eventName: String, val eventPayload: String) 77 data class AddedExperienceEventEvent(val manifestUrl: String) 78 } 79