Skip to content

Migrate from Cordova to Capacitor #1266

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

Draft
wants to merge 60 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
5a6d1e5
init
RohitKushvaha01 Apr 17, 2025
5c1f833
fix. compile errors
RohitKushvaha01 Apr 17, 2025
ef1aaf2
Merge branch 'Acode-Foundation:main' into capacitor
RohitKushvaha01 Apr 17, 2025
158ed47
Update readme.md
RohitKushvaha01 Apr 17, 2025
54a6eae
feat. update scripts
RohitKushvaha01 Apr 17, 2025
ba97c4a
feat. added build script
RohitKushvaha01 Apr 17, 2025
e741632
feat. improved build script
RohitKushvaha01 Apr 17, 2025
a737813
feat. added free and paid flavours
RohitKushvaha01 Apr 18, 2025
ccaaddc
feat. working icons based on paid/free flavour + fixed ad_id on free …
RohitKushvaha01 Apr 18, 2025
abaf5b7
fix. back button
RohitKushvaha01 Apr 18, 2025
1856679
removed native splash screen
RohitKushvaha01 Apr 19, 2025
f1c021f
feat. added kotlin
RohitKushvaha01 Apr 19, 2025
38bfbd3
feat. added native layer
RohitKushvaha01 Apr 19, 2025
99b5365
feat. sftp connectWithPassword method ported from cordova plugin
RohitKushvaha01 Apr 19, 2025
41eae92
feat. ported most of the sftp functions to new capacitor sftp plugin
RohitKushvaha01 Apr 20, 2025
1fdb119
rename Sftp.java to .java.x
RohitKushvaha01 Apr 20, 2025
af62133
feat. full port of Sftp plugin to capacitor
RohitKushvaha01 Apr 20, 2025
e9cf086
fix. compile error
RohitKushvaha01 Apr 21, 2025
eddc997
feat. load native layer and sftp plugin
RohitKushvaha01 Apr 21, 2025
7ee13c4
fixed. unable to select folders
RohitKushvaha01 Apr 24, 2025
fd97212
fix. compile error
RohitKushvaha01 Apr 24, 2025
c2a0137
Merge branch 'Acode-Foundation:main' into capacitor
RohitKushvaha01 Apr 25, 2025
07e9738
feat. delete using capacitor
RohitKushvaha01 Apr 26, 2025
a738573
Removed unnecessary changes made by Vivek
RohitKushvaha01 May 1, 2025
a8b77e5
automatically create build folders
RohitKushvaha01 May 1, 2025
1880b2e
Merge branch 'Acode-Foundation:main' into capacitor
RohitKushvaha01 May 2, 2025
10f4c3a
Migrate filesystem
UnschooledGamer May 3, 2025
ff714a4
fix linting
RohitKushvaha01 May 3, 2025
3a4336b
fix. readFile function
RohitKushvaha01 May 4, 2025
e4cddcc
Refactor Android code (#4)
itsvks19 May 4, 2025
6eef661
Merge branch 'main' into capacitor
RohitKushvaha01 May 4, 2025
04fe42c
feat. accept arrayBuffer or string as input in writeFile
RohitKushvaha01 May 4, 2025
a1239cd
lint
RohitKushvaha01 May 4, 2025
6382c9e
implement isSymlink (#5)
itsvks19 May 5, 2025
92e0112
feat. force linting and format when building
RohitKushvaha01 May 5, 2025
3ffd4c4
feat. aaded launch script
RohitKushvaha01 May 5, 2025
6e74729
fix. stuck on loading screen
RohitKushvaha01 May 5, 2025
bd0141a
Revert "implement isSymlink (#5)"
RohitKushvaha01 May 5, 2025
79cf867
fix. infinite loading when installing plugin
RohitKushvaha01 May 5, 2025
45c233f
fix. file curruption when saving non-text files
RohitKushvaha01 May 5, 2025
bf459cc
successfully load and index 'plugins
RohitKushvaha01 May 5, 2025
97df703
feat: add Windows support in build script (#6)
itsvks19 May 8, 2025
1568c5d
fix spelling
RohitKushvaha01 May 10, 2025
39f198a
File Menu & QuickTools Visibility for editor tabs (#1292)
bajrangCoder May 5, 2025
a21e54c
fix: handle edge case for `hideQuickTools` property
bajrangCoder May 8, 2025
8e58da5
feat: add more new keys and symbols for quicktools (#1297)
bajrangCoder May 9, 2025
e4c5ab3
Fixed select box issue and improved multiple aspects of it (#1296)
bajrangCoder May 9, 2025
020dc8f
Update Hungarian translation (#1299)
summoner001 May 9, 2025
d41fd07
chore(i18n): update vi-vn.json (#1300)
Nekitori17 May 10, 2025
5b54276
fix. gradlew permission denied error
RohitKushvaha01 May 12, 2025
5ff9470
feat. disable minification on debug builds
RohitKushvaha01 May 12, 2025
3ca9f73
fix. plugin icons
RohitKushvaha01 May 12, 2025
025cbd5
fix. plugin settings page
RohitKushvaha01 May 12, 2025
daa61fa
feat. use convertFileSrc() instead
RohitKushvaha01 May 12, 2025
893f401
fix. plugin info page
RohitKushvaha01 May 12, 2025
7ba87aa
fix. plugin icons in plugin info page
RohitKushvaha01 May 12, 2025
5d615f3
feat. update plugin base url
RohitKushvaha01 May 14, 2025
15fe73a
format
RohitKushvaha01 May 14, 2025
027f72e
fix: acode javascript console issue
bajrangCoder May 14, 2025
82548c5
Merge branch 'main' into capacitor
bajrangCoder May 14, 2025
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
1 change: 0 additions & 1 deletion .vscode/plugins.json

This file was deleted.

101 changes: 101 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore

# Built application files
*.apk
*.aar
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Google Services (e.g. APIs or Firebase)
# google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

# Android Profiling
*.hprof

# Cordova plugins for Capacitor
capacitor-cordova-android-plugins

# Copied web assets
app/src/main/assets/public

# Generated Config files
app/src/main/assets/capacitor.config.json
app/src/main/assets/capacitor.plugins.json
app/src/main/res/xml/config.xml
2 changes: 2 additions & 0 deletions android/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build/*
!/build/.npmkeep
82 changes: 82 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apply plugin: 'com.android.application'
apply from: 'capacitor.build.gradle'
apply plugin: 'org.jetbrains.kotlin.android'

android {
kotlinOptions {
jvmTarget = '21'
}

namespace "com.foxdebug.acode"
compileSdk rootProject.ext.compileSdkVersion
android.buildFeatures.buildConfig true
defaultConfig {
applicationId "com.foxdebug.acode"


//sdk versions and other stuff should be changed from variables.build.gradle
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion

//fdroid expect this as literals so no fancy logic
versionCode 957
versionName "1.11.1"

flavorDimensions += "default"
productFlavors{
free{
applicationId = "com.foxdebug.acodefree"
dimension = "default"
buildConfigField("boolean", "PAID", "false")
}

paid{
applicationId = "com.foxdebug.acode"
dimension = "default"
buildConfigField("boolean", "PAID", "true")
}
}


aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
implementation project(':capacitor-android')
implementation project(':capacitor-cordova-android-plugins')

//sftp
implementation "com.sshtools:maverick-synergy-client:3.1.2"
}



try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
32 changes: 32 additions & 0 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
}

apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-app')
implementation project(':capacitor-filesystem')
implementation "androidx.webkit:webkit:1.4.0"
implementation "commons-net:commons-net:3.11.1"
implementation "com.android.billingclient:billing:6.0.1"
implementation "commons-io:commons-io:2.11.0"
implementation "commons-codec:commons-codec:1.10"
implementation "androidx.documentfile:documentfile:1.0.1"
implementation "org.nanohttpd:nanohttpd:+"
implementation "androidx.documentfile:documentfile:1.0.1"
implementation "commons-io:commons-io:2.11.0"
implementation "com.sshtools:maverick-synergy-client:3.1.2"
implementation "com.sshtools:maverick-bc:3.1.2"
implementation "androidx.core:core:1.6.0"
implementation "androidx.core:core-google-shortcuts:1.0.0"
}
apply from: "../../node_modules/cordova-plugin-buildinfo/src/android/BuildInfo.gradle"

if (hasProperty('postBuildExtras')) {
postBuildExtras()
}
21 changes: 21 additions & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
14 changes: 14 additions & 0 deletions android/app/src/free/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application>

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-5911839694379275~4255791238"
tools:replace="android:value" />

</application>

</manifest>
5 changes: 5 additions & 0 deletions android/app/src/free/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">@android:color/white</color>
<color name="ic_splash_background">@android:color/white</color>
</resources>
44 changes: 44 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".Acode"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/AppTheme"
tools:targetApi="n">

<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation"
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBar"
android:launchMode="singleTask"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"/>
</provider>
</application>
</manifest>
14 changes: 14 additions & 0 deletions android/app/src/main/java/com/foxdebug/acode/Acode.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.foxdebug.acode

import android.app.Application

class Acode : Application() {
companion object{
lateinit var instance: Acode
private set
}
override fun onCreate() {
super.onCreate()
instance = this
}
}
60 changes: 60 additions & 0 deletions android/app/src/main/java/com/foxdebug/acode/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.foxdebug.acode

import android.content.Context
import android.os.Build
import android.os.Bundle
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.lifecycle.lifecycleScope
import com.foxdebug.acode.plugins.NativeLayer
import com.getcapacitor.BridgeActivity
import kotlinx.coroutines.CoroutineScope
import java.lang.ref.WeakReference


class MainActivity : BridgeActivity() {

companion object {
private var activityRef: WeakReference<MainActivity?>? = WeakReference(null)

fun getActivityContext(): Context? {
return activityRef?.get()
}

val lifeCycleScope: CoroutineScope
get() {
return activityRef?.get()?.lifecycleScope ?: throw IllegalStateException("Activity is not available")
}
}

override fun onCreate(savedInstanceState: Bundle?) {
//register plugins before calling super
registerPlugin(NativeLayer::class.java)

super.onCreate(savedInstanceState)
activityRef = WeakReference(this)

// only apply insets for android 13+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v, insets ->
val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
val imeInsets = insets.getInsets(WindowInsetsCompat.Type.ime())
val isImeVisible = insets.isVisible(WindowInsetsCompat.Type.ime())

v.setPadding(
systemBarsInsets.left,
systemBarsInsets.top,
systemBarsInsets.right,
if (isImeVisible) imeInsets.bottom else systemBarsInsets.bottom
)
insets
}
}
}

override fun onDestroy() {
super.onDestroy()
activityRef = WeakReference(null)
activityRef = null
}
}
9 changes: 9 additions & 0 deletions android/app/src/main/java/com/foxdebug/acode/Utils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.foxdebug.acode

import com.foxdebug.acode.plugins.NativeLayer
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch

fun NativeLayer.runOnUiThread(callback: CoroutineScope.() -> Unit) {
scope.launch { callback() }
}
Loading