@@ -30,9 +30,13 @@ boolean systemConditionsAvailable() {
30
30
return false ;
31
31
}
32
32
33
- if (isDialogFragmentShowing (ActivityLifecycleHandler .curActivity )) {
34
- OneSignal .onesignalLog (OneSignal .LOG_LEVEL .WARN , "OSSystemConditionObserver dialog fragment detected" );
35
- return false ;
33
+ try {
34
+ if (isDialogFragmentShowing (ActivityLifecycleHandler .curActivity )) {
35
+ OneSignal .onesignalLog (OneSignal .LOG_LEVEL .WARN , "OSSystemConditionObserver dialog fragment detected" );
36
+ return false ;
37
+ }
38
+ } catch (NoClassDefFoundError exception ) {
39
+ OneSignal .onesignalLog (OneSignal .LOG_LEVEL .INFO , "AppCompatActivity is not used in this app, skipping 'isDialogFragmentShowing' check: " + exception );
36
40
}
37
41
38
42
boolean keyboardUp = OSViewUtils .isKeyboardUp (new WeakReference <>(ActivityLifecycleHandler .curActivity ));
@@ -43,7 +47,7 @@ boolean systemConditionsAvailable() {
43
47
return !keyboardUp ;
44
48
}
45
49
46
- boolean isDialogFragmentShowing (Context context ) {
50
+ boolean isDialogFragmentShowing (Context context ) throws NoClassDefFoundError {
47
51
// Detect if user has a dialog fragment showing
48
52
if (context instanceof AppCompatActivity ) {
49
53
final FragmentManager manager = ((AppCompatActivity ) context ).getSupportFragmentManager ();
@@ -67,7 +71,6 @@ public void onFragmentDetached(@NonNull FragmentManager fm, @NonNull Fragment fr
67
71
return fragment .isVisible () && fragment instanceof DialogFragment ;
68
72
}
69
73
}
70
-
71
74
// We already have Activity lifecycle listener, that listener will handle Activity focus/unFocus state
72
75
// - Permission prompts will make activity loose focus
73
76
// We cannot detect AlertDialogs because they are added to the decor view as linear layout without an identification
0 commit comments