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