@@ -130,6 +130,21 @@ fun APModuleScreen(navigator: DestinationsNavigator) {
130130 viewModel.fetchModuleList()
131131 }
132132 }
133+
134+ var pendingInstallUri by remember { mutableStateOf<Uri ?>(null ) }
135+ val installConfirmDialog = rememberConfirmDialog(
136+ onConfirm = {
137+ pendingInstallUri?.let { uri ->
138+ navigator.navigate(InstallScreenDestination (uri, MODULE_TYPE .APM ))
139+ viewModel.markNeedRefresh()
140+ }
141+ pendingInstallUri = null
142+ },
143+ onDismiss = {
144+ pendingInstallUri = null
145+ }
146+ )
147+
133148 val webUILauncher = rememberLauncherForActivityResult(
134149 contract = ActivityResultContracts .StartActivityForResult ()
135150 ) { viewModel.fetchModuleList() }
@@ -158,9 +173,30 @@ fun APModuleScreen(navigator: DestinationsNavigator) {
158173
159174 Log .i(" ModuleScreen" , " select zip result: $uri " )
160175
161- navigator.navigate(InstallScreenDestination (uri, MODULE_TYPE .APM ))
162-
163- viewModel.markNeedRefresh()
176+ val prefs = APApplication .sharedPreferences
177+ if (prefs.getBoolean(" apm_install_confirm_enabled" , true )) {
178+ pendingInstallUri = uri
179+ val fileName = try {
180+ var name = uri.path ? : " Module"
181+ context.contentResolver.query(uri, null , null , null , null )?.use { cursor ->
182+ val nameIndex = cursor.getColumnIndex(android.provider.OpenableColumns .DISPLAY_NAME )
183+ if (cursor.moveToFirst() && nameIndex >= 0 ) {
184+ name = cursor.getString(nameIndex)
185+ }
186+ }
187+ name
188+ } catch (e: Exception ) {
189+ " Module"
190+ }
191+ installConfirmDialog.showConfirm(
192+ title = context.getString(R .string.apm_install_confirm_title),
193+ content = context.getString(R .string.apm_install_confirm_content, fileName),
194+ markdown = false
195+ )
196+ } else {
197+ navigator.navigate(InstallScreenDestination (uri, MODULE_TYPE .APM ))
198+ viewModel.markNeedRefresh()
199+ }
164200 }
165201
166202 FloatingActionButton (
0 commit comments