Nothing Phone (1)

Nothing Phone (1)

Nothing Phone (1)

Android/iPhone

We have decided to use an iPhone for the rest of our website so we need a web framework that supports it, so I used Cordova but there are other frameworks like Angular, React, etc that can be integrated on this project too.

I’ve made a couple of mock-ups to show you how it works. If you want to see how the code looks like without using any framework, I’m sure you’ll find them here!

Let’s start with the first thing I do when starting this project is writing a basic HTML file. All the files for this project are now stored in my Github repo, and the source code can be found here. The project directory structure is structured like this:

I’ve moved the index.html to /src/app/index which is a different folder from where all the other folders. It’s the place where the resources are hosted by the hosting provider. As far as I know only one host provider has two domains —.com and.org (don’t judge me, don’t even look at my IP address because I didn’t provide my DNS details), however both were configured properly by default except for localhost. So the index.html should not be changed.

In order to load the HTML, we add the script tag attribute to a block of text in index.html.

Then, I’ve also used Google tools to add an ID in index.html as the root reference of our application and to edit this URL in chrome console to point towards our index.html. I was able to get this from “URL Inspection Tool” in Chrome and this URL works for several others websites too. This is how my index.html looks like.

So far so good, let’s move forward to the next step — the template files. We need a separate configuration file that can store the contents of the html templates. A simple configuration file as shown below.

The reason for this configuration is that I am not a big fan of css. Everything in the site needs to look professional. Also, we can create a very specific layout for each site. To achieve such configuration, I’ve used Bootstrap, another popular design tool. In addition to the design, bootstrap comes along with some additional features to make your app look professional as well. These include a CSS plugin to make the layout easier to manage and some advanced features that allow customization. As shown in its architecture diagram, there are three layers: 1. Template layer 2. Layout Layer 3. Footer LAYER.

This configuration file is already present in https://github.com/alexkhan/NothingPhone/tree/master/. You will notice that I am changing the name of everything in my config file.

If we run the app in simulator, the first thing showing up in the background when visiting http://localhost:8000/test/test_page.html should be our config file, if we go on clicking the test_page.html on our browser, then it loads the layout file and makes changes and shows us what we want. At this moment I’ve created a new folder called ‘test’(which is actually the location of our test page which only contains html template files) and added an empty folder, we call it as ‘test’ folder.

Now if we check the source code, we see that the config file has been modified by adding more variables in the same file, and some attributes that require variable values. This is done so that each time we write to the config file, we need to change the value of the variables. By doing so, I have managed to reduce our configuration to only a few lines and add some validation logic too. There are no fields or fields that need to be filled and this reduces the possibility that any fields in class don’t exist. But there is still enough information in the config that it’s important to update it.

To update our config and to test the app locally, we can push some button, by pressing on that button, in order to do that, we need not to have to modify anything in the config file(which is already present) but now we can have control over some variables in the config file, which we can change anytime as per our requirement.

The last thing left is making a simple demo of our app. We can start by setting up the project in Xcode and select a template we’ll be building for, open the terminal and type ‘raffle build’. After running the build command, we can start putting our app in debug mode in simulator, once there is no error message on simulator, we can start pushing our view controller into the simulator and click save and we can test what we have just built.

After checking it in simulator, we can try out the demo on iPhone simulator as well.

Tags

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !