-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathMpRoktEventCallback.kt
More file actions
89 lines (75 loc) · 1.91 KB
/
Copy pathMpRoktEventCallback.kt
File metadata and controls
89 lines (75 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.mparticle
/**
* ### Optional callback events for when the view loads and unloads.
*/
interface MpRoktEventCallback {
/**
* onLoad Callback will be triggered immediately when the View displays.
*/
fun onLoad()
/**
* onUnLoad Callback will be triggered if the View failed to show or it closed.
*/
fun onUnload(reason: UnloadReasons)
/**
* onShouldShowLoadingIndicator callback will be triggered if View starts processing.
*/
fun onShouldShowLoadingIndicator()
/**
* onShouldHideLoadingIndicator callback will be triggered if View ends processing.
*/
fun onShouldHideLoadingIndicator()
}
/**
* Enum representing the reasons for unloading.
*/
enum class UnloadReasons {
/**
* Called when there are no offers to display so the view does not get loaded in.
*/
NO_OFFERS,
/**
* View has been rendered and has been completed.
*/
FINISHED,
/**
* Operation to fetch view took too long to resolve.
*/
TIMEOUT,
/**
* Some error has occurred regarding the network.
*/
NETWORK_ERROR,
/**
* View is empty.
*/
NO_WIDGET,
/**
* Init request was not successful.
*/
INIT_FAILED,
/**
* Placeholder string mismatch.
*/
UNKNOWN_PLACEHOLDER,
/**
* Catch-all for all issues.
*/
UNKNOWN;
companion object {
/**
* Returns the enum constant matching the provided string.
* If no match is found, UNKNOWN is returned.
*
* @param value the name of the enum constant to look up
* @return the corresponding UnloadReasons constant or UNKNOWN if no match is found
*/
fun from(value: String): UnloadReasons {
return try {
valueOf(value)
} catch (e: IllegalArgumentException) {
UNKNOWN
}
}
}
}