Skip to content

Commit

Permalink
fix: react-native-config
Browse files Browse the repository at this point in the history
  • Loading branch information
stackchain committed Nov 27, 2024
1 parent cf08d94 commit 98a2136
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 5 deletions.
50 changes: 46 additions & 4 deletions apps/wallet/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

// YOROI react-native-config
project.ext.envConfigFiles = [
devdebug: '.env',
productionrelease: '.env.production',
productiondebug: '.env.production',
nightlyrelease: '.env.nightly',
nightlydebug: '.env.nightly',
]

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

/**
* This is the configuration block to customize your React Native Android app.
* By default you don't need to apply any configuration, just uncomment the lines you need.
*/
import com.android.build.OutputFile
// END YOROI react-native-config

react {
/* Folders */
// The root of your project, i.e. where "package.json" lives. Default is '..'
Expand Down Expand Up @@ -86,13 +93,15 @@ android {
compileSdk rootProject.ext.compileSdkVersion

namespace "com.yoroi"

defaultConfig {
applicationId "com.yoroi"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}

signingConfigs {
debug {
storeFile file('debug.keystore')
Expand All @@ -101,6 +110,7 @@ android {
keyPassword 'android'
}
}

buildTypes {
debug {
signingConfig signingConfigs.debug
Expand All @@ -113,6 +123,38 @@ android {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}

// YOROI react-native-config
flavorDimensions "version"
productFlavors {
production {
dimension "version"
resValue "string", "build_config_package", "com.yoroi"
}
dev {
dimension "version"
applicationIdSuffix ".dev"
resValue "string", "build_config_package", "com.yoroi"
}
nightly {
dimension "version"
applicationIdSuffix ".nightly"
resValue "string", "build_config_package", "com.yoroi"
}
}

applicationVariants.all { variant ->
variant.outputs.each { output ->
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) {
output.versionCodeOverride =
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
}

}
}
// END YOROI react-native-config
}

dependencies {
Expand Down
54 changes: 54 additions & 0 deletions apps/wallet/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,59 @@ target 'yoroi' do
:mac_catalyst_enabled => false,
# :ccache_enabled => true
)

dev_team_id = ""
project = installer.aggregate_targets[0].user_project

# YOROI react-native-config
ENVFILES = {
'yoroi' => {
'Debug' => '$(PODS_ROOT)/../../.env',
'Release' => '$(PODS_ROOT)/../../.env.production',
},
'nightly' => {
'Debug' => '$(PODS_ROOT)/../../.env.nightly',
'Release' => '$(PODS_ROOT)/../../.env.nightly',
},
'yoroiTests' => {
'Debug' => '$(PODS_ROOT)/../../.env',
'Release' => '$(PODS_ROOT)/../../.env',
},
}

project.targets.each do |target|
target.build_configurations.each do |config|
envfile = ENVFILES[target.name][config.name]
if envfile
puts "Set the enviroment file to #{envfile} for target #{target.name} and config #{config.name}"
config.build_settings['ENVFILE'] = envfile
end
end
end
# END YOROI react-native-config

# YOROI signing settings
project.targets.each do |target|
target.build_configurations.each do |config|
puts "Set development team for target #{target.name} #{dev_team_id}"
if dev_team_id.empty? and !config.build_settings['DEVELOPMENT_TEAM'].nil?
dev_team_id = config.build_settings['DEVELOPMENT_TEAM']
end
end
end

installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if target.respond_to?(:product_type) and target.product_type == 'com.apple.product-type.bundle'
config.build_settings['DEVELOPMENT_TEAM'] = dev_team_id
config.build_settings['CODE_SIGN_IDENTITY'] = 'Apple Distribution';
config.build_settings['CODE_SIGN_STYLE'] = 'Manual';
end

config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
# END YOROI signing settings

end
end
2 changes: 1 addition & 1 deletion apps/wallet/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1868,6 +1868,6 @@ SPEC CHECKSUMS:
Yoga: 950bbfd7e6f04790fdb51149ed51df41f329fcc8
ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5

PODFILE CHECKSUM: 15d39dfcd4ea663b4d672b1a12cd8c45bbc26728
PODFILE CHECKSUM: 7dfc1c05e9772815c02c330e25a13cebda192eec

COCOAPODS: 1.14.3

0 comments on commit 98a2136

Please sign in to comment.