Skip to content

Commit

Permalink
fix: Support custom application identifier (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 authored Jul 7, 2020
1 parent bfee3d9 commit bec14b2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ apply from: file("${testAppDir}/test-app.gradle")
applyTestAppModule(project, "com.react.testapp")

project.ext.react = [
applicationId: getApplicationId(),
enableFlipper: getFlipperVersion(rootDir),
enableHermes: true,
]
Expand All @@ -51,7 +52,7 @@ android {
}

defaultConfig {
applicationId "com.react.testapp"
applicationId project.ext.react.applicationId
minSdkVersion 21
targetSdkVersion 29
versionCode 1
Expand Down
8 changes: 8 additions & 0 deletions android/test-app-util.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ ext.findNodeModulesPath = { baseDir, packageName ->
return null
}

ext.getApplicationId = {
if (project.hasProperty('TEST_APP_IDENTIFIER')) {
return project.getProperty('TEST_APP_IDENTIFIER')
}

return 'com.react.testapp'
}

ext.getFlipperVersion = { baseDir ->
def reactNativePath = findNodeModulesPath(baseDir, 'react-native')
def props = new Properties()
Expand Down
10 changes: 10 additions & 0 deletions ios/test_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ def resources_pod(project_root, target_platform)
Pathname.new(app_dir).relative_path_from(project_root).to_s
end

# rubocop:disable Style/TrivialAccessors
def test_app_bundle_identifier(identifier)
@test_app_bundle_identifier = identifier
end
# rubocop:enable Style/TrivialAccessors

def use_flipper!(versions = {})
@flipper_versions = versions
end
Expand Down Expand Up @@ -179,6 +185,10 @@ def make_project!(xcodeproj, project_root, target_platform)
'USE_FLIPPER=' + (use_flipper ? '1' : '0'),
]

if @test_app_bundle_identifier.is_a? String
config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = @test_app_bundle_identifier
end

next unless use_flipper

config.build_settings['OTHER_SWIFT_FLAGS'] ||= [
Expand Down

0 comments on commit bec14b2

Please sign in to comment.