-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Theming whitelabel.py script #214
Merged
volodymyr-chekyrta
merged 36 commits into
openedx:develop
from
touchapp:config-whitelabel-script
Jan 2, 2024
Merged
Changes from 33 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
3d0eb60
chore: added whitelabel script, added login background color
rnr 103cfec
style: added rounded corner FF
rnr 7d16778
chore: changed assets for progress bar and unibutton color
rnr 038db77
chore: added multiple assets supporting
rnr e3b3622
chore: move whitelabel config into config repo
rnr 2fc4cac
Merge branch 'develop' into config-whitelabel-script
rnr 53be070
chore: moved extra Assets to Theme target
rnr 7b18e9f
chore: return back splash screen background color
rnr c1a6922
chore: added logs for whitelabel script
rnr 5b4d976
chore: rounded buttons theming
rnr 4667c1f
chore: changes in whitelabel script
rnr 4d13924
Merge branch 'develop' into config-whitelabel-script
rnr cc20eba
chore: fix after merge
rnr 9053dc0
chore: added themed button shape for social login buttons
rnr 91822f4
style: add login navigation text color as separate
rnr d58f45d
Merge branch 'develop' into config-whitelabel-script
rnr 97116ff
chore: added app icon changing
rnr 0093d29
chore: add comment
rnr af35119
chore: added bundle id changing
rnr 676c616
chore: set dev team in project file
rnr 228ae3d
chore: got rid original images names from config, now read from Conte…
rnr fb32c9c
Merge branch 'develop' into config-whitelabel-script
rnr 33c2fa6
chore: reorder configs
rnr abb16b8
chore: added documentation
rnr 20da8aa
chore: missed quotes
rnr 2beed67
refactor: theme config
rnr 54d8bcf
chore: backbutton color on sign in view
rnr 3d9e4dd
chore: fixed misspelling
rnr d1cb76a
refactor: change to snake_style stage1
rnr 9827da1
refactor: changed to snake_style stage2
rnr ecb65a9
Merge branch 'develop' into config-whitelabel-script
rnr 4beb029
chore: added app versions, refactor and unify code to search paramete…
rnr 29f866a
chore: added install dependencies to documentation
rnr a20c810
chore: fixed according feedback, improved documentation
rnr 1d9ceea
chore: fixed how to get config example
rnr f964e81
chore: improve documentation
rnr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// ThemeConfig.swift | ||
// Core | ||
// | ||
// Created by Anton Yarmolenka on 01/12/2023. | ||
// | ||
|
||
import Foundation | ||
|
||
private enum ThemeKeys: String { | ||
case isRoundedCorners = "ROUNDED_CORNERS_STYLE" | ||
} | ||
|
||
public final class ThemeConfig: NSObject { | ||
public var isRoundedCorners: Bool | ||
|
||
init(dictionary: [String: AnyObject]) { | ||
isRoundedCorners = dictionary[ThemeKeys.isRoundedCorners.rawValue] as? Bool != false | ||
super.init() | ||
} | ||
} | ||
|
||
private let ThemeKey = "THEME" | ||
extension Config { | ||
public var theme: ThemeConfig { | ||
ThemeConfig(dictionary: self[ThemeKey] as? [String: AnyObject] ?? [:]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Theming Implementation | ||
This documentation provides instructions on how to implement Theme assets for the OpenEdX iOS project. | ||
|
||
## Python dependecies | ||
The `whitelabel.py` theming script requires the following Python dependencies to be installed: | ||
- `pip install coloredlogs` | ||
- `pip install pillow` | ||
- `pip install pyyaml` | ||
|
||
## How to Run the Script | ||
The theming script `whitelabel.py` can be ran from the OpenEdX iOS root project folder with the following command: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
```bash | ||
python config_script/whitelabel.py --config-file=path/to/configfile/whitelabel.yaml -v | ||
``` | ||
Where | ||
- `config_script/whitelabel.py` is the path to the `whitelabel.py` script. | ||
- `--config-file=path/to/configfile/whitelabel.yaml` is the path to the configuration file `whitelabel.yaml` | ||
- `-v` sets the log level. | ||
|
||
## Config Options | ||
The config file `whitelabel.yaml` can be created by yourself or obtained from some config repo. | ||
shafqat-muneer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This config can contain the following options: | ||
### Folder with source assets | ||
This is the folder where all image assets, which should be copied into the project, are placed: | ||
```yaml | ||
import_dir: 'path/to/images/source' | ||
``` | ||
### Xcode Project Settings | ||
The theming script can change the app name, version, development team and app bundle ID: | ||
```yaml | ||
project_config: | ||
project_path: 'path/to/project/project.pbxproj' # path to project.pbxproj file | ||
dev_team: '1234567890' # Apple development team ID | ||
marketing_version: '1.0.1' # App marketing version | ||
current_project_version: '2' # App build number | ||
configurations: | ||
config1: # Configuration name - can be any | ||
app_bundle_id: "bundle.id.app.new" # Bundle ID to be set | ||
product_name: "Mobile App Name" # App Name to be set | ||
``` | ||
### Assets | ||
The config `whitelabel.yaml` can contain a few Asset items (every added Xcode project can have its own Assets). | ||
Every Asset item can be configured with images, colors, and app Icon Assets: | ||
```yaml | ||
assets: | ||
AssetName: | ||
images_path: 'Theme/Theme/Assets.xcassets' # path where images are placed in this Asset | ||
colors_path: 'Theme/Theme/Assets.xcassets/Colors' # path where colors are placed in this Asset | ||
icon_path: 'Theme/Assets.xcassets' # path where app icon is placed in this Asset | ||
images: | ||
image1: # Asset name | ||
image_name: 'some_image.svg' # image to replace the existing one for image1 Asset (light/universal) | ||
image2: # Asset name | ||
current_path: 'SomeFolder' # Path to image2.imageset inside Assets.xcassets | ||
image_name: 'Rectangle.png' # image to replace the existing one for image2 Asset (light/universal) | ||
dark_image_name: 'RectangleDark.png' # image to replace the existing dark appearance for image2 Asset (dark) | ||
colors: | ||
LoginBackground: # color asset name in Assets | ||
current_path: '' # optional: path to color inside colors_path | ||
light: '#FFFFFF' | ||
dark: '#ED5C13' | ||
icon: | ||
AppIcon: | ||
current_path: '' # optional: path to icon inside icon_path | ||
image_name: 'appIcon.jpg' # image to replace the current AppIcon - png or jpg are supported | ||
``` | ||
### Log level | ||
You can set the log level to 'DEBUG' by adding the `-v` parameter to the script running. | ||
The default log level is 'WARN' | ||
## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Theme/Theme/Assets.xcassets/Colors/AccentButtonColor.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "1.000", | ||
"green" : "0.408", | ||
"red" : "0.235" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"appearances" : [ | ||
{ | ||
"appearance" : "luminosity", | ||
"value" : "dark" | ||
} | ||
], | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0.976", | ||
"green" : "0.471", | ||
"red" : "0.329" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to execute the following command for installing dependencies. I believe it would be beneficial to include these statements as well.
pip3 install coloredlogs
pip3 install pillow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added to documentation all dependencies which are not default python's libs