Skip to content

Commit

Permalink
Solara
Browse files Browse the repository at this point in the history
  • Loading branch information
IdeaS0ft committed Sep 22, 2024
1 parent 6530f37 commit b80d175
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion solara/lib/core/brands/brand_switcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def switch
@theme_switcher.switch(Language::Swift)
@brand_config_switcher.switch(Language::Swift)
switch_infoplist
switch_xcode_project
BrandResourcesSwitcher.new(@brand_key).switch(Platform::IOS)
switch_xcode_project
end

private
Expand Down
18 changes: 15 additions & 3 deletions solara/lib/core/scripts/brand_resources_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,27 @@ def initialize(brand_key)
end

def switch
Solara.logger.log_step("Switch iOS resources") do
add_to_asset_catalog
Solara.logger.log_step("Switch iOS resources") do
add_raw_assets_to_asset_catalog

copy_directories(FilePath.ios_brand_xcassets(@brand_key), FilePath.ios_project_assets_artifacts)

copy_solara_assets
end
end

private

def add_to_asset_catalog
def copy_solara_assets
source = FilePath.ios_brand_assets(@brand_key)
destination = FilePath.ios_project_artifacts_assets

return unless File.exist?(source)

FolderCopier.new(source, destination).copy
end

def add_raw_assets_to_asset_catalog
source = FilePath.ios_brand_xcassets(@brand_key)
destination = FilePath.ios_project_assets_artifacts
asset_manager = XcodeAssetManager.new(destination)
Expand Down
4 changes: 4 additions & 0 deletions solara/lib/core/scripts/file_path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ def self.ios_assets
File.join(project_root, path)
end

def self.ios_project_artifacts_assets
File.join(ios_project_root_artifacts, 'Assets')
end

def self.app_xcconfig_directory
Pathname.new(app_xcconfig('Debug.xcconfig')).parent.to_s
end
Expand Down
2 changes: 1 addition & 1 deletion solara/lib/core/scripts/folder_copier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def initialize(source_path, destination_path)
end

def copy
FileUtils.mkdir_p(@destination_path)
FileUtils.mkdir_p(@destination_path) unless File.exist?(@destination_path)
copy_files_and_folders(@source_path, @destination_path)
Solara.logger.debug("🚗 Copied\n\t↑ From: #{@source_path} \n\t↓ To: #{@destination_path}")
end
Expand Down

0 comments on commit b80d175

Please sign in to comment.