Difference between revisions of "Step By Step Guide"

From Ethora iOS & Android ERC-20 & NFT tokenized community platform
Jump to navigation Jump to search
(Updated the steps in the guide and drafted different guides for different platform (Android and iOS))
Line 1: Line 1:
== Introduction ==
== Introduction ==
=== Expected result ===
=== Expected result ===
By following this guide you will build your own mobile app (iOS, Android or both) with all Ethora engine features (alternatively you may choose to disable / limit some features via Config file).  
By following this guide you will build your own mobile app (iOS, Android or both) with all Ethora engine features (alternatively you may choose to disable / limit some features via Config file).  


In the process you will specify your own name and do a basic branding (logo, colours).
In the process you will specify your own name and do a basic branding (logo, colours).
=== How long does it take? ===
=== How long does it take? ===
A) It takes just '''0.5h''' for a React Native engineer experienced with Ethora engine to produce a new app build.  
A) It takes just '''0.5h''' for a React Native engineer experienced with Ethora engine to produce a new app build.  
Line 13: Line 11:
C) You may need a '''2-3 work days''' if you have done some software development but you don't have much experience with React Native.  
C) You may need a '''2-3 work days''' if you have done some software development but you don't have much experience with React Native.  


In any case, it would take not less than 4-6 months for a team of experienced software engineers to develop a new app for your project with similar qualities and a feature set of Ethora engine. So irrespective of the option above, you are going to be saving a ton of time and investment by building on top of it.
In any case, it would take not less than 4-6 months for a team of experienced software engineers to develop a new app for your project with similar qualities and a feature set of Ethora engine. So irrespective of the option above, you are going to be saving a ton of time and investment by building on top of it.  


Note: whilst Ethora can be called a "no-code" or a "low-code" product and we encourage you to use the product as is, some projects would opt for an advanced customization. Such as adding new screens, features, custom backend integrations or chat bots etc. You might need to allocate '''1-2 months''' or more if you plan to add new functionality on top of Ethora engine, depending on the extent of additional functionalities and modifications.
Note: whilst Ethora can be called a "no-code" or a "low-code" product and we encourage you to use the product as is, some projects would opt for an advanced customization. Such as adding new screens, features, custom backend integrations or chat bots etc. You might need to allocate '''1-2 months''' or more if you plan to add new functionality on top of Ethora engine, depending on the extent of additional functionalities and modifications.  


Make sure to check the Config file first to see if the changes you want are not covered by parameters and switches there.  
Make sure to check the Config file first to see if the changes you want are not covered by parameters and switches there.  
== Pre-requisites ==
== Pre-requisites ==
You are expected to have your system set up already for React Native development for either iOS or Android, or both.
You are expected to have your system set up already for React Native development for either iOS or Android, or both.


If you don't have that setup yet, you will need to install the required packages, such as:
If you don't have that setup yet, you will need to install the required packages, such as:
* Android Studio  
* Android Studio  
* Node.js
* Node.js
*XCode
* Yarn or NPM  
* Yarn or NPM  
*React Native environment (https://reactnative.dev/docs/environment-setup)  
*React Native environment (https://reactnative.dev/docs/environment-setup)  
<blockquote>Note for vscode users: if you use Visual Studio Code, we personally recommend installing the following extensions to make your life better/easier:
<blockquote>Note for vscode users: if you use Visual Studio Code, we personally recommend installing the following extensions to make your life better/easier:
* React native snippet
* React native snippet
* Gitlens
* Gitlens
Line 35: Line 31:
* Prettier
* Prettier
</blockquote>
</blockquote>
== Steps to build white-labelled Android app using Ethora ==
<blockquote>
# <code>'''mkdir [your_app_name]'''</code>: This command creates a new directory (folder) with the name <code>[your_app_name]</code>. Replace <code>[your_app_name]</code> with the desired name of your app.
# <code>'''cd [your_app_name]'''</code>: This command navigates into the newly created directory, making it the current working directory.
# <code>'''git clone <nowiki>https://github.com/dappros/ethora.git</nowiki>'''</code>: This command clones the Ethora GitHub repository into your newly created <code>[your_app_name]</code> directory. It downloads all the code and files from the repository to your local machine.
# <code>'''cd ethora/client-reactnative/'''</code>: This command moves into the <code>client-reactnative</code> directory within the cloned repository. This is the root directory of the React Native application.
# <code>'''npm i react-native-rename'''</code>: This installs the <code>react-native-rename</code> package, which is used to rename the React Native app easily. The package will be installed locally in the project directory.
# <code>'''npx react-native-rename@latest "your_app_name" -b "com.yourappname"'''</code>: This renames the React Native app to <code>[your_app_name]</code> and changes the package name (bundle identifier) to <code>"com.yourappname"</code>. You should replace <code>[your_app_name]</code> with your desired app name and update <code>"com.yourappname"</code> to a unique identifier for your app.  The package name is an important identifier for Android apps, and it should be unique to avoid conflicts when publishing the app to the Google Play Store.
# <code>'''yarn'''</code>: This command installs the project dependencies using Yarn. It reads the <code>package.json</code> file and installs all the required packages for the React Native project.
# <code>'''find and replace com.ethora with com.yourappname throughout the entire project directory'''</code>: This step involves manually searching for the string <code>"com.ethora"</code> in the entire project directory and replacing it with <code>"com.yourappname"</code>. This is necessary because some files may contain the old package name, and it needs to be updated to the new one.
# <code>'''yarn android / npm run android'''</code>: This command builds the Android app and runs it on an Android device or emulator. It bundles the JavaScript code and compiles the native code required for the Android platform. Once the build is successful, it deploys the app to the connected Android device or emulator.


== Steps to build ==
</blockquote>These steps allow you to create a white-labeled version of the Ethora React Native app, with a new name and package name that can be used for branding and distribution as a separate app. Keep in mind that while the steps provided are generally applicable, specific issues or variations may arise depending on the complexity of the project, version of dependencies, or the system you are working on.


=== Step 1 - create a new React Native project locally ===
You'll find all the options for the modification in the <code>'''docs/config.ts'''</code> for you to continue building your own product with ethora engine.
Open the terminal at your project directory and create your new project <code>npx react-native init [proj_name]</code>
'''NOTE''': If you're not using M1 chipset mac machine then remove the line <code>'''__apply_Xcode_12_5_M1_post_install_workaround(installer)'''</code> from '''Podfile.'''
 
== Steps to build white-labelled Android app using Ethora ==
It will download the react-native template and install cocoapods dependencies. This may take few minutes depending on your network speed.
<blockquote>
 
# <code>'''mkdir [your_app_name]'''</code>: This command creates a new directory (folder) with the name <code>[your_app_name]</code>. Replace <code>[your_app_name]</code> with the desired name of your app.
=== Step 2 - activate Yarn ===
# <code>'''cd [your_app_name]'''</code>: This command navigates into the newly created directory, making it the current working directory.
Now we need to go inside the project folder to execute further commands
# <code>'''git clone <nowiki>https://github.com/dappros/ethora.git</nowiki>'''</code>: This command clones the Ethora GitHub repository into your newly created <code>[your_app_name]</code> directory. It downloads all the code and files from the repository to your local machine.
 
# <code>'''cd ethora/client-reactnative/'''</code>: This command moves into the <code>client-reactnative</code> directory within the cloned repository. This is the root directory of the React Native application.
<code>cd [proj_name]</code>
# <code>'''npm i react-native-rename'''</code>: This installs the <code>react-native-rename</code> package, which is used to rename the React Native app easily. The package will be installed locally in the project directory.
 
# <code>'''npx react-native-rename@latest "your_app_name" -b "com.yourappname"'''</code>: This renames the React Native app to <code>[your_app_name]</code> and changes the package name (bundle identifier) to <code>"com.yourappname"</code>. You should replace <code>[your_app_name]</code> with your desired app name and update <code>"com.yourappname"</code> to a unique identifier for your app. The bundle identifier is a unique identifier for iOS apps, and it needs to be changed to avoid conflicts when distributing the app on the App Store.
<code>yarn</code>
# <code>'''cd ios'''</code>: This command moves into the <code>ios</code> directory, which contains iOS-specific files and configuration for the React Native app.
 
# <code>'''pod install'''</code>: This command installs the CocoaPods dependencies for the iOS project. CocoaPods is a dependency manager for iOS projects, and it is used to install and manage native dependencies for React Native projects.
=== Step 3 - retrieve and set up the repository ===
# <code>'''cd ..'''</code>: This command goes back to the previous directory (<code>/ethora/client-reactnative/</code>) from the <code>ios</code> directory.
Now download/clone the code from GitHub repo and update the folder structure as instructed below.
# <code>'''open xcode and choose "Open existing project"; select the ios folder located in /[your_app_name]/ethora/client-reactnative/'''</code>: This step opens Xcode and allows you to open the iOS project of your React Native app. Navigate to the <code>ios</code> folder within your <code>[your_app_name]</code> directory, and select the Xcode project file (with a .xcodeproj extension) to open it.
 
# <code>'''Navigate to ios/[your_app_name]/AppDelegate.mm and search for the keyword "ethora"'''</code>: In this step, you need to modify the <code>AppDelegate.mm</code> file in Xcode. Search for the keyword "ethora" and replace it with your actual app name in the following line of code:  <code>UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"your_app_name", nil);</code>
Locate "src" and "docs" folder in Ethora project directory and copy both the folders
# '''Click on "Build" button'''; iOS emulator will run once the build is finished, and in the terminal, Metro Bundler will start bundling.  '''NOTE''': This step mentions that the process will likely fail, and it recommends running "npm start" from your previous terminal or directly from the code editor's terminal at /ethora/client-reactnative/ directory to avoid any failures. Running "npm start" launches the Metro Bundler, which is responsible for bundling JavaScript code for the React Native app. By following these steps, you will be able to create a white-labeled version of the Ethora React Native app with a new name and bundle identifier, suitable for running on iOS devices and potentially distributing through the App Store.  Please note that specific issues or variations may occur based on the complexity of the project, version of dependencies, or the Xcode environment you are using.
 
</blockquote>
Paste them in your project directory
 
Now open both the projects in your code editor side by side.
 
Navigate to package.json and replace dependencies, devDependencies and jest from package.json of Ethora to your project's package.json
 
Navigate to <code>index.js</code>
 
Now we need to change the import from default app.js to app.js from inside the src folder
 
In order to do this, change <code>import App from './App';</code> to <code>import App from './src/App';</code>
 
Go to your terminal again and execute <code>yarn</code> command in your project directory because the package.json is now updated.
 
This will install all the required packages.
 
=== Step 4 - build for iOS/Android ===
Now in your project folder execute the following commands.
 
<code>cd ios</code>
 
<code>pod install</code>
 
resolve the errors then in your project directory execute <code>yarn ios</code> for iOS or <code>yarn android</code> for Android build.
 
This will build the app.
 
=== Step 5 - configure and add your branding ===
Dismiss the notice and navigate to "docs" folder in your project directory.
 
Open config.js
 
You can now set the appTitle to your project name and add your own logo for rebranding.
 
You'll find all the options for the modification in this config.js for you to continue building your own product with ethora engine.
 
'''NOTE''': If you're not using M1 chipset mac machine then remove the line <code>__apply_Xcode_12_5_M1_post_install_workaround(installer)</code> from '''Podfile.'''
 
Please check out the video for more details regarding the setup of Ethora.
 
== Video guide ==
The video guide below demonstrates the steps listed above.
 
This video hasn't been edited. This is to show how long does it take with all the compiling, troubleshooting etc: '''32 minutes''' from A to Z.  
 
<youtube>vX9XbVwyrVc</youtube>


== Troubleshooting: Android ==
== Troubleshooting: Android ==
=== Can't run the build on the physical device ===
=== Can't run the build on the physical device ===
Enable the "Developer options" menu by going to Settings → About phone → Software information and then tapping the <code>Build number</code> row at the bottom seven times. You can then go back to Settings → Developer options to enable "USB debugging".  
Enable the "Developer options" menu by going to Settings → About phone → Software information and then tapping the <code>Build number</code> row at the bottom seven times. You can then go back to Settings → Developer options to enable "USB debugging".  
Line 110: Line 70:


Note: sometimes you need to enable multiple options, for example in my case I needed to enable these 3:
Note: sometimes you need to enable multiple options, for example in my case I needed to enable these 3:
* USB debugging
* USB debugging
* Install via USB
* Install via USB
* USB debugging (Security settings)
* USB debugging (Security settings)
=== Things don't update ===
=== Things don't update ===
If you changed some asset like a logo or background image, launch and see the old one (or see image is gone) the culprit could be the cache. To troubleshoot:
If you changed some asset like a logo or background image, launch and see the old one (or see image is gone) the culprit could be the cache. To troubleshoot:
# Kill the node server (just close your terminal tab where node/metro is running)
# Kill the node server (just close your terminal tab where node/metro is running)
# Open a new terminal (in vs code or a new terminal window in the same project folder) and run this command: yarn start --reset-cache
# Open a new terminal (in vs code or a new terminal window in the same project folder) and run this command: yarn start --reset-cache
# Build again ("yarn android").
# Build again ("yarn android").

Revision as of 13:24, 26 July 2023

Introduction

Expected result

By following this guide you will build your own mobile app (iOS, Android or both) with all Ethora engine features (alternatively you may choose to disable / limit some features via Config file).

In the process you will specify your own name and do a basic branding (logo, colours).

How long does it take?

A) It takes just 0.5h for a React Native engineer experienced with Ethora engine to produce a new app build.

B) A React Native engineer without previous Ethora experience should be able to complete it within around 1 work day.

C) You may need a 2-3 work days if you have done some software development but you don't have much experience with React Native.

In any case, it would take not less than 4-6 months for a team of experienced software engineers to develop a new app for your project with similar qualities and a feature set of Ethora engine. So irrespective of the option above, you are going to be saving a ton of time and investment by building on top of it.

Note: whilst Ethora can be called a "no-code" or a "low-code" product and we encourage you to use the product as is, some projects would opt for an advanced customization. Such as adding new screens, features, custom backend integrations or chat bots etc. You might need to allocate 1-2 months or more if you plan to add new functionality on top of Ethora engine, depending on the extent of additional functionalities and modifications.

Make sure to check the Config file first to see if the changes you want are not covered by parameters and switches there.

Pre-requisites

You are expected to have your system set up already for React Native development for either iOS or Android, or both.

If you don't have that setup yet, you will need to install the required packages, such as:

Note for vscode users: if you use Visual Studio Code, we personally recommend installing the following extensions to make your life better/easier:

  • React native snippet
  • Gitlens
  • Color highlight
  • Prettier

Steps to build white-labelled Android app using Ethora

  1. mkdir [your_app_name]: This command creates a new directory (folder) with the name [your_app_name]. Replace [your_app_name] with the desired name of your app.
  2. cd [your_app_name]: This command navigates into the newly created directory, making it the current working directory.
  3. git clone https://github.com/dappros/ethora.git: This command clones the Ethora GitHub repository into your newly created [your_app_name] directory. It downloads all the code and files from the repository to your local machine.
  4. cd ethora/client-reactnative/: This command moves into the client-reactnative directory within the cloned repository. This is the root directory of the React Native application.
  5. npm i react-native-rename: This installs the react-native-rename package, which is used to rename the React Native app easily. The package will be installed locally in the project directory.
  6. npx react-native-rename@latest "your_app_name" -b "com.yourappname": This renames the React Native app to [your_app_name] and changes the package name (bundle identifier) to "com.yourappname". You should replace [your_app_name] with your desired app name and update "com.yourappname" to a unique identifier for your app. The package name is an important identifier for Android apps, and it should be unique to avoid conflicts when publishing the app to the Google Play Store.
  7. yarn: This command installs the project dependencies using Yarn. It reads the package.json file and installs all the required packages for the React Native project.
  8. find and replace com.ethora with com.yourappname throughout the entire project directory: This step involves manually searching for the string "com.ethora" in the entire project directory and replacing it with "com.yourappname". This is necessary because some files may contain the old package name, and it needs to be updated to the new one.
  9. yarn android / npm run android: This command builds the Android app and runs it on an Android device or emulator. It bundles the JavaScript code and compiles the native code required for the Android platform. Once the build is successful, it deploys the app to the connected Android device or emulator.

These steps allow you to create a white-labeled version of the Ethora React Native app, with a new name and package name that can be used for branding and distribution as a separate app. Keep in mind that while the steps provided are generally applicable, specific issues or variations may arise depending on the complexity of the project, version of dependencies, or the system you are working on.

You'll find all the options for the modification in the docs/config.ts for you to continue building your own product with ethora engine. NOTE: If you're not using M1 chipset mac machine then remove the line __apply_Xcode_12_5_M1_post_install_workaround(installer) from Podfile.

Steps to build white-labelled Android app using Ethora

  1. mkdir [your_app_name]: This command creates a new directory (folder) with the name [your_app_name]. Replace [your_app_name] with the desired name of your app.
  2. cd [your_app_name]: This command navigates into the newly created directory, making it the current working directory.
  3. git clone https://github.com/dappros/ethora.git: This command clones the Ethora GitHub repository into your newly created [your_app_name] directory. It downloads all the code and files from the repository to your local machine.
  4. cd ethora/client-reactnative/: This command moves into the client-reactnative directory within the cloned repository. This is the root directory of the React Native application.
  5. npm i react-native-rename: This installs the react-native-rename package, which is used to rename the React Native app easily. The package will be installed locally in the project directory.
  6. npx react-native-rename@latest "your_app_name" -b "com.yourappname": This renames the React Native app to [your_app_name] and changes the package name (bundle identifier) to "com.yourappname". You should replace [your_app_name] with your desired app name and update "com.yourappname" to a unique identifier for your app. The bundle identifier is a unique identifier for iOS apps, and it needs to be changed to avoid conflicts when distributing the app on the App Store.
  7. cd ios: This command moves into the ios directory, which contains iOS-specific files and configuration for the React Native app.
  8. pod install: This command installs the CocoaPods dependencies for the iOS project. CocoaPods is a dependency manager for iOS projects, and it is used to install and manage native dependencies for React Native projects.
  9. cd ..: This command goes back to the previous directory (/ethora/client-reactnative/) from the ios directory.
  10. open xcode and choose "Open existing project"; select the ios folder located in /[your_app_name]/ethora/client-reactnative/: This step opens Xcode and allows you to open the iOS project of your React Native app. Navigate to the ios folder within your [your_app_name] directory, and select the Xcode project file (with a .xcodeproj extension) to open it.
  11. Navigate to ios/[your_app_name]/AppDelegate.mm and search for the keyword "ethora": In this step, you need to modify the AppDelegate.mm file in Xcode. Search for the keyword "ethora" and replace it with your actual app name in the following line of code: UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"your_app_name", nil);
  12. Click on "Build" button; iOS emulator will run once the build is finished, and in the terminal, Metro Bundler will start bundling. NOTE: This step mentions that the process will likely fail, and it recommends running "npm start" from your previous terminal or directly from the code editor's terminal at /ethora/client-reactnative/ directory to avoid any failures. Running "npm start" launches the Metro Bundler, which is responsible for bundling JavaScript code for the React Native app. By following these steps, you will be able to create a white-labeled version of the Ethora React Native app with a new name and bundle identifier, suitable for running on iOS devices and potentially distributing through the App Store. Please note that specific issues or variations may occur based on the complexity of the project, version of dependencies, or the Xcode environment you are using.

Troubleshooting: Android

Can't run the build on the physical device

Enable the "Developer options" menu by going to Settings → About phone → Software information and then tapping the Build number row at the bottom seven times. You can then go back to Settings → Developer options to enable "USB debugging".

Note: enabling "Developer options" may vary across devices / OS versions. Google the instructions for yours.

Note: sometimes you need to enable multiple options, for example in my case I needed to enable these 3:

  • USB debugging
  • Install via USB
  • USB debugging (Security settings)

Things don't update

If you changed some asset like a logo or background image, launch and see the old one (or see image is gone) the culprit could be the cache. To troubleshoot:

  1. Kill the node server (just close your terminal tab where node/metro is running)
  2. Open a new terminal (in vs code or a new terminal window in the same project folder) and run this command: yarn start --reset-cache
  3. Build again ("yarn android").