Skip to content
Merged

Sami #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions .github/workflows/build-apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,33 @@ jobs:
run: pnpm install

- name: Build Next.js app
run: pnpm run build
run: |
# Move API routes out of the way because they cannot be statically exported
if [ -d "app/api" ]; then
mv app/api .temp-api-backup
fi
pnpm run build:capacitor
env:
# Add any environment variables needed for the build here
NODE_ENV: production

- name: Sync Capacitor Android
- name: Prepare Capacitor files
run: |
mkdir -p android/app/src/main/assets/public
npx cap sync android
# Install capacitor CLI and core
pnpm add -D @capacitor/cli @capacitor/core @capacitor/android

# Create a root capacitor config to bundle the static files
cat <<EOF > capacitor.config.json
{
"appId": "com.hirfa.app",
"appName": "Hirfa",
"webDir": "out",
"bundledWebRuntime": false
}
EOF

# Add and sync the android platform
rm -rf android # Remove the broken or incomplete android folder
npx cap add android

- name: Build APK
working-directory: ./android
Expand Down
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,17 @@ node_modules/
.DS_Store
*.swp
*.swo

# Next.js
out/
build/
.turbo/

# Capacitor / Android
android/.gradle
android/app/build
android/build
android/local.properties
android/.idea
android/**/*.iml
app-debug.apk
58 changes: 0 additions & 58 deletions @/components/ui/button.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions @/components/ui/input.tsx

This file was deleted.

9 changes: 9 additions & 0 deletions android/app/src/main/assets/capacitor.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"appId": "com.hirfa.app",
"appName": "Hirfa",
"webDir": "out",
"server": {
"url": "https://hirfa-amber.vercel.app",
"cleartext": true
}
}
10 changes: 10 additions & 0 deletions android/app/src/main/assets/capacitor.plugins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"pkg": "@capacitor/app",
"classpath": "com.capacitorjs.plugins.app.AppPlugin"
},
{
"pkg": "@capacitor/local-notifications",
"classpath": "com.capacitorjs.plugins.localnotifications.LocalNotificationsPlugin"
}
]
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions android/app/src/main/res/xml/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<access origin="*" />


</widget>
59 changes: 59 additions & 0 deletions android/capacitor-cordova-android-plugins/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
ext {
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
cordovaAndroidVersion = project.hasProperty('cordovaAndroidVersion') ? rootProject.ext.cordovaAndroidVersion : '14.0.1'
}

buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.13.0'
}
}

apply plugin: 'com.android.library'

android {
namespace = "capacitor.cordova.android.plugins"
compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError = false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
}

repositories {
google()
mavenCentral()
flatDir{
dirs 'src/main/libs', 'libs'
}
}

dependencies {
implementation fileTree(dir: 'src/main/libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "org.apache.cordova:framework:$cordovaAndroidVersion"
// SUB-PROJECT DEPENDENCIES START

// SUB-PROJECT DEPENDENCIES END
}

// PLUGIN GRADLE EXTENSIONS START
apply from: "cordova.variables.gradle"
// PLUGIN GRADLE EXTENSIONS END

for (def func : cdvPluginPostBuildExtras) {
func()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
ext {
cdvMinSdkVersion = project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
// Plugin gradle extensions can append to this to have code run at the end.
cdvPluginPostBuildExtras = []
cordovaConfig = [:]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:amazon="http://schemas.amazon.com/apk/res/android">
<application android:usesCleartextTraffic="true">

</application>

</manifest>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file removed app-debug.apk
Binary file not shown.
Loading
Loading