Skip to content
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

feat: Open edX app theming capability improvements (Option 2) #182

Conversation

saeedbashir
Copy link
Contributor

In this PR, I've made the changes that will support app theming. Below are the changes that I made:

Multiple colors and images
I've broken down the xcassets folder of Core Framework and move the configureables (most likely those will change for theming of openedX app) and moved them into a new framework Theme. From now on, Core framework will contain all the images, icons, colors, etc, that won't change with theming of the app, like button icons, nav bar icons, and bottom bar icons. Likewise, Theme Assets will contain all the changeable assets.

Fonts

I've added an extra layer between the fonts and the theme class. The font names were hardcoded in the theme class, which made it a bit hard to change the fonts in a new theme. I've added a json file for key: name pair and a parser around it. Now the font change will only require the replacement of fonts JSON and font_file, and there won't be any code changes.

Note: It's the second PR for making the theming easier. Another PR with different approach is already created and available here: #173

@saeedbashir
Copy link
Contributor Author

@volodymyr-chekyrta @rnr @eyatsenkoperpetio I've created this PR with a different approach. Hopefully, this approach will work because we are already following the framework approach, and I've created another framework, Theme and moved the changeable things into the framework. Can you guys please take a look into it and let me know about this approach?

@rnr
Copy link
Contributor

rnr commented Nov 29, 2023

@volodymyr-chekyrta @rnr @eyatsenkoperpetio I've created this PR with a different approach. Hopefully, this approach will work because we are already following the framework approach, and I've created another framework, Theme and moved the changeable things into the framework. Can you guys please take a look into it and let me know about this approach?

I'm ok with both approach where we break down Assets on static and configurable since we need to change it with whitelabel script (but even without dividing whitelabel script can change assets just needs more configs perhaps). Using 'framework' way looks more structural for me. I'm waiting for @volodymyr-chekyrta inputs here.
Thank you.

@miankhalid
Copy link

@touchapp would love to have your thoughts on this approach as well.

@volodymyr-chekyrta
Copy link
Contributor

@saeedbashir makes sense to me 🙌
Thank you!

One concern.
I see that the Theme framework is not linked as a framework to any other module.
I am trying to understand why it's a building project now, but something might break it in the future.
Screenshot 2023-11-30 at 11 25 00

We probably need to link frameworks to each other in the same way as we do with other modules.
Screenshot 2023-11-30 at 11 28 47

@saeedbashir
Copy link
Contributor Author

We probably need to link frameworks to each other in the same way as we do with other modules.

What benefit will we get after linking the theme framework to any other framework, like to Core framework?

@volodymyr-chekyrta
Copy link
Contributor

We probably need to link frameworks to each other in the same way as we do with other modules.

What benefit will we get after linking the theme framework to any other framework, like to Core framework?

There are no benefits, that just shouldn't work that way.
Frameworks are essentially independent mini-projects.
For instance, you can't utilize a pod dependency unless you've incorporated it into the project.

So, the question arises - how does this work, especially since the prior version of XCode would have thrown an error in this situation 🤔

@saeedbashir
Copy link
Contributor Author

So, the question arises - how does this work, especially since the prior version of XCode would have thrown an error in this situation 🤔

I'm not sure, but it might be working because it's linked with the OpenedX target along with other frameworks. Anyhow, I've linked the Theme framework with Core framework.

image

@saeedbashir
Copy link
Contributor Author

@volodymyr-chekyrta Can you please look into this PR, there is a big change-set because of structual change. If we don't merge it early, most probably every merge will result in a conflict.

@volodymyr-chekyrta
Copy link
Contributor

@volodymyr-chekyrta Can you please look into this PR, there is a big change-set because of structual change. If we don't merge it early, most probably every merge will result in a conflict.

I'm currently waiting for reviews from @rnr and @eyatsenkoperpetio, but I'll take a closer look today to speed up this process 🤝

@volodymyr-chekyrta
Copy link
Contributor

@saeedbashir, the project is building to the device, but the Archive build is not working. Could you please check it?
It's not emitting reasonable errors, maybe it's something with frameworks linking, I'm not sure.

image

rnr
rnr previously approved these changes Dec 4, 2023
@@ -0,0 +1,89 @@
//
// Environment.swift
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saeedbashir this file is still existing in OpenEdX folder. I believe it should be deleted. Thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted.

@saeedbashir
Copy link
Contributor Author

@saeedbashir, the project is building to the device, but the Archive build is not working. Could you please check it?

It is fixed; the debug statement was missing for Preview.

@volodymyr-chekyrta
Copy link
Contributor

@saeedbashir, the project is building to the device, but the Archive build is not working. Could you please check it?

It is fixed; the debug statement was missing for Preview.

Thank you! I'll check a little later

fonts = loadANdParseFonts()
}

private func loadANdParseFonts() -> [String: String] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misspelling
loadANdParseFonts -> loadAndParseFonts

@volodymyr-chekyrta volodymyr-chekyrta merged commit 153e195 into openedx:develop Dec 4, 2023
2 checks passed
@saeedbashir saeedbashir deleted the saeed/app_theme_configurable_option2 branch January 17, 2024 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants