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