@@ -14,8 +14,8 @@ public enum PopupViewType
14
14
AuthenticationView
15
15
}
16
16
17
+ [ SerializeField ] private bool shouldCloseOnFinish ;
17
18
[ SerializeField ] private PopupViewType activeViewType ;
18
-
19
19
[ SerializeField ] private AuthenticationView authenticationView ;
20
20
[ SerializeField ] private PublishView publishView ;
21
21
[ SerializeField ] private LoadingView loadingView ;
@@ -44,11 +44,6 @@ private void Open(PopupViewType popupViewType, Action<bool> onClose)
44
44
OnClose . SafeInvoke ( false ) ;
45
45
OnClose = null ;
46
46
47
- onClose = onClose ?? ( b => {
48
- Logger . Trace ( "Closing Window" ) ;
49
- Close ( ) ;
50
- } ) ;
51
-
52
47
Logger . Trace ( "OpenView: {0}" , popupViewType . ToString ( ) ) ;
53
48
54
49
var viewNeedsAuthentication = popupViewType == PopupViewType . PublishView ;
@@ -61,12 +56,13 @@ private void Open(PopupViewType popupViewType, Action<bool> onClose)
61
56
Logger . Trace ( "User validated opening view" ) ;
62
57
63
58
OpenInternal ( popupViewType , onClose ) ;
59
+ shouldCloseOnFinish = true ;
64
60
65
61
} , exception => {
66
62
67
63
Logger . Trace ( "User required validation opening AuthenticationView" ) ;
68
64
69
- Open ( PopupViewType . AuthenticationView , completedAuthentication => {
65
+ OpenInternal ( PopupViewType . AuthenticationView , completedAuthentication => {
70
66
71
67
if ( completedAuthentication )
72
68
{
@@ -75,11 +71,13 @@ private void Open(PopupViewType popupViewType, Action<bool> onClose)
75
71
Open ( popupViewType , onClose ) ;
76
72
}
77
73
} ) ;
74
+ shouldCloseOnFinish = false ;
78
75
} ) ;
79
76
}
80
77
else
81
78
{
82
79
OpenInternal ( popupViewType , onClose ) ;
80
+ shouldCloseOnFinish = true ;
83
81
}
84
82
}
85
83
@@ -177,6 +175,13 @@ public override void Finish(bool result)
177
175
{
178
176
OnClose . SafeInvoke ( result ) ;
179
177
OnClose = null ;
178
+
179
+ if ( shouldCloseOnFinish )
180
+ {
181
+ shouldCloseOnFinish = false ;
182
+ Close ( ) ;
183
+ }
184
+
180
185
base . Finish ( result ) ;
181
186
}
182
187
0 commit comments