打包修改配置
1、header居中 看這個(gè)https://blog.csdn.net/hunannanhu/article/details/79285736
注釋掉關(guān)于安卓的特殊處理:
2厅目、修改網(wǎng)絡(luò)請(qǐng)求api地址嚣鄙,全部換成正式
\Portal\js\network\constants.js
3盒发、修改IM環(huán)境切換成正式的
\Portal\js\network\constants.js
4臀蛛、覆蓋documentpicker 這個(gè)文件,
路徑Portal\node_modules\react-native-document-picker\android\src\main\java\com\reactnativedocumentpicker\DocumentPicker.java
新文件內(nèi)容:
package com.reactnativedocumentpicker;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.provider.OpenableColumns;
import android.util.Log;
import android.webkit.MimeTypeMap;
import com.facebook.react.bridge.ActivityEventListener;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
/**
* @see <a >android documentation</a>
* marvin.ma use for production
*/
public class DocumentPicker extends ReactContextBaseJavaModule implements ActivityEventListener {
private static final String NAME = "RNDocumentPicker";
private static final int READ_REQUEST_CODE = 41;
private Context mContex;
private static class Fields {
private static final String FILE_SIZE = "fileSize";
private static final String FILE_NAME = "fileName";
private static final String TYPE = "type";
}
private Callback callback;
public DocumentPicker(ReactApplicationContext reactContext) {
super(reactContext);
this.mContex = reactContext;
reactContext.addActivityEventListener(this);
}
@Override
public String getName() {
return NAME;
}
@ReactMethod
public void show(ReadableMap args, Callback callback) {
Intent intent;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
} else {
intent = new Intent(Intent.ACTION_PICK);
}
intent.addCategory(Intent.CATEGORY_OPENABLE);
if (!args.isNull("filetype")) {
ReadableArray filetypes = args.getArray("filetype");
if (filetypes.size() > 0) {
intent.setType(filetypes.getString(0));
}
}
this.callback = callback;
getReactApplicationContext().startActivityForResult(intent, READ_REQUEST_CODE, Bundle.EMPTY);
}
// removed @Override temporarily just to get it working on RN0.33 and RN0.32 - will remove
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
onActivityResult(requestCode, resultCode, data);
}
// removed @Override temporarily just to get it working on RN0.33 and RN0.32
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode != READ_REQUEST_CODE)
return;
if (resultCode != Activity.RESULT_OK) {
callback.invoke("Bad result code: " + resultCode, null);
return;
}
if (data == null) {
callback.invoke("No data", null);
return;
}
try {
Uri uri = data.getData();
callback.invoke(null, toMapWithMetadata(uri));
} catch (Exception e) {
Log.e(NAME, "Failed to read", e);
callback.invoke(e.getMessage(), null);
}
}
private WritableMap toMapWithMetadata(Uri uri) {
WritableMap map;
if(uri.toString().startsWith("/")) {
map = metaDataFromFile(new File(uri.toString()));
} else if (uri.toString().startsWith("http")) {
map = metaDataFromUri(uri);
} else {
map = metaDataFromContentResolver(uri);
}
map.putString("uri", uri.toString());
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
map.putString("filePath", getPath(mContex, uri));
}else {
map.putString("filePath", uri2Path(mContex, uri));
}
return map;
}
private WritableMap metaDataFromUri(Uri uri) {
WritableMap map = Arguments.createMap();
File outputDir = getReactApplicationContext().getCacheDir();
try {
File downloaded = download(uri, outputDir);
map.putInt(Fields.FILE_SIZE, (int) downloaded.length());
map.putString(Fields.FILE_NAME, downloaded.getName());
map.putString(Fields.TYPE, mimeTypeFromName(uri.toString()));
} catch (IOException e) {
Log.e("DocumentPicker", "Failed to download file", e);
}
return map;
}
private WritableMap metaDataFromFile(File file) {
WritableMap map = Arguments.createMap();
if(!file.exists())
return map;
map.putInt(Fields.FILE_SIZE, (int) file.length());
map.putString(Fields.FILE_NAME, file.getName());
map.putString(Fields.TYPE, mimeTypeFromName(file.getAbsolutePath()));
return map;
}
private WritableMap metaDataFromContentResolver(Uri uri) {
WritableMap map = Arguments.createMap();
ContentResolver contentResolver = getReactApplicationContext().getContentResolver();
map.putString(Fields.TYPE, contentResolver.getType(uri));
Cursor cursor = contentResolver.query(uri, null, null, null, null, null);
try {
if (cursor != null && cursor.moveToFirst()) {
map.putString(Fields.FILE_NAME, cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)));
int sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE);
if (!cursor.isNull(sizeIndex)) {
String size = cursor.getString(sizeIndex);
if (size != null)
map.putInt(Fields.FILE_SIZE, Integer.valueOf(size));
}
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return map;
}
private static File download(Uri uri, File outputDir) throws IOException {
File file = File.createTempFile("prefix", "extension", outputDir);
URL url = new URL(uri.toString());
ReadableByteChannel channel = Channels.newChannel(url.openStream());
try{
FileOutputStream stream = new FileOutputStream(file);
try {
stream.getChannel().transferFrom(channel, 0, Long.MAX_VALUE);
return file;
} finally {
stream.close();
}
} finally {
channel.close();
}
}
private static String mimeTypeFromName(String absolutePath) {
String extension = MimeTypeMap.getFileExtensionFromUrl(absolutePath);
if (extension != null) {
return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
} else {
return null;
}
}
// Required for RN 0.30+ modules than implement ActivityEventListener
public void onNewIntent(Intent intent) {
}
/**
* 專為Android4.4以上設(shè)計(jì)的從Uri獲取文件路徑
*/
public static String getPath(final Context context, final Uri uri) {
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
// DocumentProvider
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
// ExternalStorageProvider
if (isExternalStorageDocument(uri)) {
// LogUtils.logInfoStar("isExternalStorageDocument");
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
if ("primary".equalsIgnoreCase(type)) {
return Environment.getExternalStorageDirectory() + "/" + split[1];
}
// TODO handle non-primary volumes
}
// DownloadsProvider
else if (isDownloadsDocument(uri)) {
// LogUtils.logInfoStar("isDownloadsDocument");
final String id = DocumentsContract.getDocumentId(uri);
final Uri contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
return getDataColumn(context, contentUri, null, null);
}
// MediaProvider
else if (isMediaDocument(uri)) {
// LogUtils.logInfoStar("isMediaDocument");
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
Uri contentUri = null;
if ("image".equals(type)) {
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
} else if ("video".equals(type)) {
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
} else if ("audio".equals(type)) {
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
}
final String selection = "_id=?";
final String[] selectionArgs = new String[]{split[1]};
return getDataColumn(context, contentUri, selection, selectionArgs);
}
}
// MediaStore (and general)
else if ("content".equalsIgnoreCase(uri.getScheme())) {
return getDataColumn(context, uri, null, null);
}
// File
else if ("file".equalsIgnoreCase(uri.getScheme())) {
return uri.getPath();
}
return null;
}
/**
* Get the value of the data column for this Uri. This is useful for
* MediaStore Uris, and other file-based ContentProviders.
*
* @param context The context.
* @param uri The Uri to query.
* @param selection (Optional) Filter used in the query.
* @param selectionArgs (Optional) Selection arguments used in the query.
* @return The value of the _data column, which is typically a file path.
*/
public static String getDataColumn(Context context, Uri uri, String selection,
String[] selectionArgs) {
Cursor cursor = null;
final String column = "_data";
final String[] projection = {column};
try {
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
null);
if (cursor != null && cursor.moveToFirst()) {
final int column_index = cursor.getColumnIndexOrThrow(column);
return cursor.getString(column_index);
}
} finally {
if (cursor != null)
cursor.close();
}
return null;
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is ExternalStorageProvider.
*/
public static boolean isExternalStorageDocument(Uri uri) {
return "com.android.externalstorage.documents".equals(uri.getAuthority());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is DownloadsProvider.
*/
public static boolean isDownloadsDocument(Uri uri) {
return "com.android.providers.downloads.documents".equals(uri.getAuthority());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is MediaProvider.
*/
public static boolean isMediaDocument(Uri uri) {
return "com.android.providers.media.documents".equals(uri.getAuthority());
}
/**
* Try to return the absolute file path from the given Uri
*
* @param context
* @param uri
* @return the file path or null
*/
public static String uri2Path(final Context context, final Uri uri) {
if (null == uri) return null;
final String scheme = uri.getScheme();
String data = null;
if (scheme == null)
data = uri.getPath();
else if (ContentResolver.SCHEME_FILE.equals(scheme)) {
data = uri.getPath();
} else if (ContentResolver.SCHEME_CONTENT.equals(scheme)) {
Cursor cursor = context.getContentResolver().query(uri, new String[]{MediaStore.Images.ImageColumns.DATA}, null, null, null);
if (null != cursor) {
if (cursor.moveToFirst()) {
int index = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
if (index == -1) {
index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
}
if (index > -1) {
data = cursor.getString(index);
}
}
cursor.close();
}
}
return data;
}
}
5忆嗜、使用命令unzip -l wuliuxj20181010.zip檢查物流等js bundle文件內(nèi)容是否正確吓笙,需要有子文件夾淑玫。
6、替換圖標(biāo):
\Portal\android\app\src\main\AndroidManifest.xml
7观蓄、放開熱更
Portal\index.js混移,確保這行代碼沒被注釋掉
8、修改BTC通知侮穿、請(qǐng)示報(bào)告單等HTML的位置為正式的歌径。
9、打包
keystore 在這個(gè)路徑下
******這是密碼
新版發(fā)出前內(nèi)測(cè)檢查事項(xiàng)
1亲茅、所有地址是不是生產(chǎn)的
1.1回铛、 登錄
1.2狗准、水站
1.3、IM系統(tǒng)
1.4茵肃、會(huì)議室預(yù)訂
1.5腔长、BTB/BTC
2、常用功能正常
2.1验残、啟動(dòng)
2.2捞附、登錄
2.3、日程您没,列表鸟召,創(chuàng)建會(huì)議/任務(wù),能添加附件
2.4氨鹏、直播
2.5欧募、BTC/BTB/巡檢能打開,首次加載有進(jìn)度條仆抵,能下載
2.6跟继、我的團(tuán)隊(duì),列表正常镣丑,能創(chuàng)建團(tuán)隊(duì)
2.7舔糖、IM登錄正常,能聊天传轰,視頻剩盒,白版協(xié)同
2.8谷婆、可以檢查更新