Skip to content

Commit

Permalink
create nepal build
Browse files Browse the repository at this point in the history
  • Loading branch information
Janderson Souza Matias authored and Janderson Souza Matias committed Nov 22, 2023
1 parent 485e9f1 commit 55bf4af
Show file tree
Hide file tree
Showing 47 changed files with 727 additions and 28 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
API_URL=
COUNTRY=

# OPTIONAL FEATURES
FEATURE_FLAG_TLC=
51 changes: 51 additions & 0 deletions .github/workflows/nepal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build Android APK and upload to Play Store

on:
push:
tags:
- v-*

jobs:
beta-android:
name: Build Android APK and upload to Play Store
runs-on: ubuntu-latest
env:
API_URL: https://coachdigital.org/np/api
COUNTRY: np

steps:
- name: Checkout 🛎️
uses: actions/checkout@v1
with:
persist-credentials: false

- name: Install Java
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: 'gradle'

- name: Switch to Nepal's config
run: ./scripts/switch-to-nepal.sh

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install dependencies
run: npm install

- name: Build APK
run: ./gradlew clean assembleRelease --no-daemon
working-directory: android

- name: Upload APK
uses: actions/upload-artifact@v1
with:
name: apk
path: android/app/build/outputs/apk/release/app-release.apk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
beta-android:
name: Build Android APK and upload to Play Store
runs-on: ubuntu-latest
env:
API_URL: https://coachdigital.org/sl/api
COUNTRY: sl

steps:
- name: Checkout 🛎️
Expand Down
Binary file added android/app/src/main/res-nepal/drawable/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions android/app/src/main/res-nepal/drawable/rn_edit_text_material.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!--
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
-->
<item android:drawable="@color/primary" />
<item android:width="150dp" android:height="150dp" android:drawable="@drawable/icon" android:gravity="center" />
</layer-list>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions android/app/src/main/res-nepal/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<color name="primary">#ffffff</color>
</resources>
3 changes: 3 additions & 0 deletions android/app/src/main/res-nepal/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">CEHRD शिक्षक मेन्टरिङ</string>
</resources>
10 changes: 10 additions & 0 deletions android/app/src/main/res-nepal/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:windowBackground">@drawable/rn_edit_text_material</item>
<item name="android:statusBarColor">@color/primary</item>
</style>

</resources>
22 changes: 22 additions & 0 deletions scripts/switch-to-nepal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Navega até o diretório do projeto Android
cd android/app/src/main

# Renomeia a pasta 'res' para 'res-sl'
if [ -d "res" ]; then
mv res res-sl
fi

# Renomeia a pasta 'res-nepal' para 'res'
if [ -d "res-nepal" ]; then
mv res-nepal res
fi

# Navega para o diretório raiz do projeto Android
cd ../..

# Substitui a string no arquivo build.gradle
# Utiliza o comando sed para a substituição
sed -i '' "s/applicationId 'com.coachappsl'/applicationId 'com.coachappnp'/" build.gradle

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {SQLiteDatabase} from 'react-native-sqlite-storage';
import {getDBConnection} from '../../services/database.service';
import {getDBConnection} from '../../../services/database.service';

export const runMigrationV0 = async () => {
const db = await getDBConnection();
Expand Down
66 changes: 66 additions & 0 deletions src/database/migrations/np/01.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import {SQLiteDatabase} from 'react-native-sqlite-storage';
import {getDBConnection} from '../../../services/database.service';

export const runMigrationV1 = async () => {
const db = await getDBConnection();
await insertCompetencies(db);
await insertQuestions(db);
};

const insertCompetencies = async (db: SQLiteDatabase) => {
await db.executeSql(`
INSERT OR REPLACE INTO competence(id, title, _status)
VALUES
('4d15a3be-db2a-4fef-913a-6535bcd9d389', 'Time on learning', 'synced'),
('0f8d1dcb-1d26-4073-a184-80e32012ae1b', 'Positive expectations','synced'),
('b9f2de44-2825-4353-a092-e979b7190a28', 'Creating High Expectations and Inclusive Learning Environment', 'synced'),
('8860e659-02da-4d99-abe4-135c25f1c26f', 'Effective and Engaging Learning Strategies', 'synced'),
('968d595a-d033-4b6c-9758-943cfb6c412c', 'Assessing learning', 'synced')
`);
};

const insertQuestions = async (db: SQLiteDatabase) => {
await db.executeSql(`
INSERT OR REPLACE INTO question(id, title, description, tooltip_data, type, competence_id, scale, _status)
VALUES
('c97cfef5-61e6-4667-b97b-8f4e602674ac', 'Students are engaged on given task', 'In the 1st part of the class', '{"title":"","subtitle":"","items":[]}', 'option', '4d15a3be-db2a-4fef-913a-6535bcd9d389', 3, 'synced'),
('a7704226-f4cd-432a-893a-811024b27ad0', 'Students are engaged on given task', 'In the 2nd part of the class', '{"title":"","subtitle":"","items":[]}', 'option', '4d15a3be-db2a-4fef-913a-6535bcd9d389', 3, 'synced'),
('80b6a0fe-9a43-4d06-884c-8ade0b46774b', 'Students are engaged on given task', 'In the 3rd part of the class', '{"title":"","subtitle":"","items":[]}', 'option', '4d15a3be-db2a-4fef-913a-6535bcd9d389', 3, 'synced');
`);

await db.executeSql(`
INSERT OR REPLACE INTO question(id, title, description, tooltip_data, type, competence_id, scale, _status)
VALUES
('e668f4cc-e34a-448e-b371-67a6b97c2d3a', 'The teacher acknowledges positive student behaviour.', NULL, '{"title":"","subtitle":"","items":[]}', 'option', '0f8d1dcb-1d26-4073-a184-80e32012ae1b', 5, 'synced'),
('2580c928-edc5-4f64-b506-6f47efb8b061', 'The teacher redirects unexpected behaviour and focuses on the expected behaviour.', NULL, '{"title":"","subtitle":"","items":[]}', 'option', '0f8d1dcb-1d26-4073-a184-80e32012ae1b', 5, 'synced');
`);

await db.executeSql(`
INSERT OR REPLACE INTO question(id, title, description, tooltip_data, type, competence_id, scale, _status)
VALUES
('d4e263c1-5943-489b-87ff-255f28b09762', 'The teacher treats all students respectfully.', NULL, '{"title":"","subtitle":"","items":[]}', 'option', 'b9f2de44-2825-4353-a092-e979b7190a28', 5, 'synced'),
('5d11e5c4-3d00-45b0-b53f-b306da7f1a1d', 'The teacher responds to students'' needs.', NULL, '{"title":"","subtitle":"","items":[]}', 'option', 'b9f2de44-2825-4353-a092-e979b7190a28', 5, 'synced'),
('7a5d1b69-00d4-4b12-8f23-27de65614ebe', 'The teacher acknowledges students'' efforts, rather than focusing only on results, students'' intelligence, or natural abilities.', NULL, '{"title":"","subtitle":"","items":[]}', 'option', 'b9f2de44-2825-4353-a092-e979b7190a28', 5, 'synced'),
('b3d29e0d-a7dc-4aa3-96d4-1294ad6b723e', 'Teacher uses additional learning materials effectively', NULL, '{"title":"","subtitle":"","items":[]}', 'option', 'b9f2de44-2825-4353-a092-e979b7190a28', 5, 'synced'),
('fb64470b-7a59-4fb9-9396-e67f97343434', 'Teacher Manages the Physical arrangement of the classroom to allow all students to learn', NULL, '{"title":"","subtitle":"","items":[]}', 'option', 'b9f2de44-2825-4353-a092-e979b7190a28', 5, 'synced');
`);

await db.executeSql(`
INSERT OR REPLACE INTO question(id, title, description, tooltip_data, type, competence_id, scale, _status)
VALUES
('b9160bc1-7345-4632-961c-124b7427ee75', 'The teacher explicitly articulates the objectives of the lesson and relates classroom activities to the objectives.', NULL, '{"title":"","subtitle":"","items":[]}', 'option', '8860e659-02da-4d99-abe4-135c25f1c26f', 5, 'synced'),
('6f5fcf4f-f462-4faf-b8fd-75066093419a', 'Teacher is teaching using Student-centered activities', NULL, '{"title":"","subtitle":"","items":[]}', 'option', '8860e659-02da-4d99-abe4-135c25f1c26f', 5, 'synced'),
('e6cd38a4-d86d-4b39-b263-da32a3f71f5a', 'The teacher makes connections in the lesson that related to other content knowledge or students'' daily lives.', NULL, '{"title":"","subtitle":"","items":[]}', 'option', '8860e659-02da-4d99-abe4-135c25f1c26f', 5, 'synced'),
('6f24fafb-7672-4d45-a31f-223e2eae7d6f', 'The teacher uses questions, prompts or other strategies to ensure students'' level of understanding.', NULL, '{"title":"","subtitle":"","items":[]}', 'option', '8860e659-02da-4d99-abe4-135c25f1c26f', 5, 'synced'),
('99914c89-5b84-44ef-8ffb-440f28a17a37', 'The teacher asks open-ended questions. (Critical Thinking)', NULL, '{"title":"","subtitle":"","items":[]}', 'option', '8860e659-02da-4d99-abe4-135c25f1c26f', 5, 'synced');
`);

await db.executeSql(`
INSERT OR REPLACE INTO question(id, title, description, tooltip_data, type, competence_id, scale, _status)
VALUES
('b1626e4f-94e4-4384-a811-5c18115bc8ab', 'The teacher monitors most students during independent/group work.', NULL, '{"title":"","subtitle":"","items":[]}', 'option', '968d595a-d033-4b6c-9758-943cfb6c412c', 5, 'synced'),
('6eb713cb-2887-47e9-8987-afc833cc27bd', 'The teacher adjusts teaching to the level of the students.', NULL, '{"title":"","subtitle":"","items":[]}', 'option', '968d595a-d033-4b6c-9758-943cfb6c412c', 5, 'synced'),
('2856af7b-6855-49b2-b7df-f4e7844182be', 'The teacher provides specific comments or guiding questions to help students clarify misunderstandings ', NULL, '{"title":"","subtitle":"","items":[]}', 'option', '968d595a-d033-4b6c-9758-943cfb6c412c', 5, 'synced');
`);
};
14 changes: 14 additions & 0 deletions src/database/migrations/np/02.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {SQLiteDatabase} from 'react-native-sqlite-storage';
import {getDBConnection} from '../../../services/database.service';

export const runMigrationV2 = async () => {
const db = await getDBConnection();
await updateSchool(db);
};

const updateSchool = (db: SQLiteDatabase) => {
db.executeSql(`
ALTER TABLE school
ADD emis_number TEXT null
`);
};
14 changes: 14 additions & 0 deletions src/database/migrations/np/03.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {SQLiteDatabase} from 'react-native-sqlite-storage';
import {getDBConnection} from '../../../services/database.service';

export const runMigrationV3 = async () => {
const db = await getDBConnection();
await updateSchool(db);
};

const updateSchool = (db: SQLiteDatabase) => {
return db.executeSql(`
ALTER TABLE school
ADD region TEXT null
`);
};
21 changes: 21 additions & 0 deletions src/database/migrations/np/04.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {SQLiteDatabase} from 'react-native-sqlite-storage';
import {getDBConnection} from '../../../services/database.service';

export const runMigrationV4 = async () => {
const db = await getDBConnection();
await createTLCTable(db);
};

const createTLCTable = (db: SQLiteDatabase) => {
return db.executeSql(`
CREATE TABLE IF NOT EXISTS TLC_evaluation (
id TEXT PRIMARY KEY,
unit_id TEXT null,
coach_id TEXT REFERENCES coach(id),
evaluation TEXT null,
_status TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
`);
};
Loading

0 comments on commit 55bf4af

Please sign in to comment.