mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 21:33:12 +08:00 
			
		
		
		
	Rename file_paths.xml to avoid overwrite
This commit is contained in:
		| @@ -11,7 +11,7 @@ | |||||||
|             android:grantUriPermissions="true"> |             android:grantUriPermissions="true"> | ||||||
|             <meta-data |             <meta-data | ||||||
|             android:name="android.support.FILE_PROVIDER_PATHS" |             android:name="android.support.FILE_PROVIDER_PATHS" | ||||||
|             android:resource="@xml/file_paths" /> |             android:resource="@xml/pushy_file_paths" /> | ||||||
|         </provider> |         </provider> | ||||||
|     </application> |     </application> | ||||||
| </manifest> | </manifest> | ||||||
|   | |||||||
| @@ -489,6 +489,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> { | |||||||
|             if (UpdateContext.DEBUG) { |             if (UpdateContext.DEBUG) { | ||||||
|                 e.printStackTrace(); |                 e.printStackTrace(); | ||||||
|             } |             } | ||||||
|  |             Log.e("pushy", "download task failed", e); | ||||||
|             params[0].listener.onDownloadFailed(e); |             params[0].listener.onDownloadFailed(e); | ||||||
|         } |         } | ||||||
|         return null; |         return null; | ||||||
|   | |||||||
| @@ -116,17 +116,18 @@ public class UpdateModule extends ReactContextBaseJavaModule{ | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void installApk(File toInstall) { |     public static void installApk(File toInstall) { | ||||||
|  |         Uri apkUri; | ||||||
|  |         Intent intent; | ||||||
|         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | ||||||
|             Uri apkUri = getUriForFile(mContext, mContext.getPackageName() + ".pushy.fileprovider", toInstall); |             apkUri = getUriForFile(mContext, mContext.getPackageName() + ".pushy.fileprovider", toInstall); | ||||||
|  |             intent = new Intent(Intent.ACTION_INSTALL_PACKAGE); | ||||||
|             Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE); |  | ||||||
|             intent.setData(apkUri); |             intent.setData(apkUri); | ||||||
|             intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |             intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | ||||||
|             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||||||
|             mContext.startActivity(intent); |             mContext.startActivity(intent); | ||||||
|         } else { |         } else { | ||||||
|             Uri apkUri = Uri.fromFile(toInstall); |             apkUri = Uri.fromFile(toInstall); | ||||||
|             Intent intent = new Intent(Intent.ACTION_VIEW); |             intent = new Intent(Intent.ACTION_VIEW); | ||||||
|             intent.setDataAndType(apkUri, "application/vnd.android.package-archive"); |             intent.setDataAndType(apkUri, "application/vnd.android.package-archive"); | ||||||
|             intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |             intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||||||
|             mContext.startActivity(intent); |             mContext.startActivity(intent); | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
| <paths xmlns:android="http://schemas.android.com/apk/res/android"> | <paths xmlns:android="http://schemas.android.com/apk/res/android"> | ||||||
|     <files-path name="." path="."/> |     <files-path | ||||||
|  |         name="pushy" | ||||||
|  |         path="." /> | ||||||
| </paths> | </paths> | ||||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm