| 
						
						
						
					 | 
					 | 
					@ -1,5 +1,6 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					package io.legado.app.utils | 
					 | 
					 | 
					 | 
					package io.legado.app.utils | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import androidx.core.os.postDelayed | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import io.legado.app.exception.RegexTimeoutException | 
					 | 
					 | 
					 | 
					import io.legado.app.exception.RegexTimeoutException | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import io.legado.app.help.CrashHandler | 
					 | 
					 | 
					 | 
					import io.legado.app.help.CrashHandler | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import kotlinx.coroutines.suspendCancellableCoroutine | 
					 | 
					 | 
					 | 
					import kotlinx.coroutines.suspendCancellableCoroutine | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -23,20 +24,20 @@ suspend fun CharSequence.replace(regex: Regex, replacement: String, timeout: Lon | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                block.resumeWithException(e) | 
					 | 
					 | 
					 | 
					                block.resumeWithException(e) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        mainHandler.postDelayed({ | 
					 | 
					 | 
					 | 
					        mainHandler.postDelayed(timeout) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (thread.isAlive) { | 
					 | 
					 | 
					 | 
					            if (thread.isAlive) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                val timeoutMsg = "替换超时,3秒后还未结束将重启应用\n替换规则$regex\n替换内容:${this}" | 
					 | 
					 | 
					 | 
					                val timeoutMsg = "替换超时,3秒后还未结束将重启应用\n替换规则$regex\n替换内容:${this}" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                val exception = RegexTimeoutException(timeoutMsg) | 
					 | 
					 | 
					 | 
					                val exception = RegexTimeoutException(timeoutMsg) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                block.cancel(exception) | 
					 | 
					 | 
					 | 
					                block.cancel(exception) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                appCtx.longToastOnUi(timeoutMsg) | 
					 | 
					 | 
					 | 
					                appCtx.longToastOnUi(timeoutMsg) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                CrashHandler.saveCrashInfo2File(exception) | 
					 | 
					 | 
					 | 
					                CrashHandler.saveCrashInfo2File(exception) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                mainHandler.postDelayed({ | 
					 | 
					 | 
					 | 
					                mainHandler.postDelayed(3000) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    if (thread.isAlive) { | 
					 | 
					 | 
					 | 
					                    if (thread.isAlive) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        appCtx.restart() | 
					 | 
					 | 
					 | 
					                        appCtx.restart() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    } | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }, 3000) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }, timeout) | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
  |