re-arrange code, support auto-closing dialog
re-arrange code, support auto-closing dialog

SummerWish/privly-applications,SummerWish/privly-applications,SummerWish/privly-applications,SummerWish/privly-applications,SummerWish/privly-applications