Commit 7c031b4e by wong.peiyi

android加上打包渠道

parent d897b6d0
......@@ -120,6 +120,7 @@ android {
versionName appVersion
missingDimensionStrategy 'react-native-camera', 'general'
multiDexEnabled true
flavorDimensions "versionCode"
}
splits {
abi {
......@@ -146,6 +147,16 @@ android {
matchingFallbacks = ['release']
}
}
productFlavors {
sz {
resValue "string", "baseUrl", '"https://obs.uat.guke.tech"'
}
xhk {
resValue "string", "baseUrl", '"https://obs.xhk.orth.tech"'
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
......
This diff could not be displayed because it is too large.
......@@ -76,10 +76,10 @@ public class RNToolsManager extends ReactContextBaseJavaModule {
}
}
// // 声明的设置域名方法,外界调用
// @ReactMethod
// public void getBaseUrl(Promise promise) {
// String STRING_API_ENV = getReactApplicationContext().getResources().getString(R.string.strKey); // 需要在 android/app/build.gradle 添加'productFlavors'
// promise.resolve(STRING_API_ENV);
// }
// 声明的设置域名方法,外界调用
@ReactMethod
public void getBaseUrl(Promise promise) {
String STRING_API_ENV = getReactApplicationContext().getResources().getString(R.string.baseUrl); // 需要在 android/app/build.gradle 添加'productFlavors'
promise.resolve(STRING_API_ENV);
}
}
\ No newline at end of file
......@@ -57,12 +57,22 @@ class LoginPage extends Component{
componentDidMount() {
SplashScreen.hide() //关闭启动屏幕
this.timer = setTimeout(() => {
this.setDefaultDomain()
this.getLocalUserName()
this.setVersion()
this.initLoginInfo()
}, 300)
}
async setDefaultDomain() {
try {
const baseUrl = await NativeModules.RNToolsManager.getBaseUrl()
this.props.setDomainConfigurate(baseUrl)
} catch (error) {
console.log('do not suppor getBaseUrl')
}
}
componentWillUnmount() {
clearTimeout(this.timer)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment