Commit 7c031b4e by wong.peiyi

android加上打包渠道

parent d897b6d0
...@@ -120,6 +120,7 @@ android { ...@@ -120,6 +120,7 @@ android {
versionName appVersion versionName appVersion
missingDimensionStrategy 'react-native-camera', 'general' missingDimensionStrategy 'react-native-camera', 'general'
multiDexEnabled true multiDexEnabled true
flavorDimensions "versionCode"
} }
splits { splits {
abi { abi {
...@@ -146,6 +147,16 @@ android { ...@@ -146,6 +147,16 @@ android {
matchingFallbacks = ['release'] 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 are e.g. debug, release
applicationVariants.all { variant -> applicationVariants.all { variant ->
variant.outputs.each { output -> variant.outputs.each { output ->
......
This diff could not be displayed because it is too large.
...@@ -76,10 +76,10 @@ public class RNToolsManager extends ReactContextBaseJavaModule { ...@@ -76,10 +76,10 @@ public class RNToolsManager extends ReactContextBaseJavaModule {
} }
} }
// // 声明的设置域名方法,外界调用 // 声明的设置域名方法,外界调用
// @ReactMethod @ReactMethod
// public void getBaseUrl(Promise promise) { public void getBaseUrl(Promise promise) {
// String STRING_API_ENV = getReactApplicationContext().getResources().getString(R.string.strKey); // 需要在 android/app/build.gradle 添加'productFlavors' String STRING_API_ENV = getReactApplicationContext().getResources().getString(R.string.baseUrl); // 需要在 android/app/build.gradle 添加'productFlavors'
// promise.resolve(STRING_API_ENV); promise.resolve(STRING_API_ENV);
// } }
} }
\ No newline at end of file
...@@ -57,12 +57,22 @@ class LoginPage extends Component{ ...@@ -57,12 +57,22 @@ class LoginPage extends Component{
componentDidMount() { componentDidMount() {
SplashScreen.hide() //关闭启动屏幕 SplashScreen.hide() //关闭启动屏幕
this.timer = setTimeout(() => { this.timer = setTimeout(() => {
this.setDefaultDomain()
this.getLocalUserName() this.getLocalUserName()
this.setVersion() this.setVersion()
this.initLoginInfo() this.initLoginInfo()
}, 300) }, 300)
} }
async setDefaultDomain() {
try {
const baseUrl = await NativeModules.RNToolsManager.getBaseUrl()
this.props.setDomainConfigurate(baseUrl)
} catch (error) {
console.log('do not suppor getBaseUrl')
}
}
componentWillUnmount() { componentWillUnmount() {
clearTimeout(this.timer) 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