Skip to content
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

Android App with dApp Connector and in-app dApp Browser #557

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
96 changes: 96 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# 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
3 changes: 3 additions & 0 deletions android/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions android/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions android/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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
72 changes: 72 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apply plugin: 'com.android.application'

android {
namespace 'io.nami.app'
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "io.nami.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "3.3.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
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:!*~'
}

def addConstant = {constantName, constantValue ->
manifestPlaceholders += [(constantName):constantValue]
buildConfigField "String", "${constantName}", "\"${constantValue}\""
}
addConstant("CARDANO_WALLET_INTENT_ACTION_ENABLE", "cardano.wallet.intent.action.ENABLE")
addConstant("CARDANO_WALLET_INTENT_ACTION_IS_ENABLED", "cardano.wallet.intent.action.IS_ENABLED")
addConstant("CARDANO_WALLET_INTENT_ACTION_GET_NETWORK_ID", "cardano.wallet.intent.action.GET_NETWORK_ID")
addConstant("CARDANO_WALLET_INTENT_ACTION_GET_BALANCE", "cardano.wallet.intent.action.GET_BALANCE")
addConstant("CARDANO_WALLET_INTENT_ACTION_GET_UTXOS", "cardano.wallet.intent.action.GET_UTXOS")
addConstant("CARDANO_WALLET_INTENT_ACTION_GET_COLLATERAL", "cardano.wallet.intent.action.GET_COLLATERAL")
addConstant("CARDANO_WALLET_INTENT_ACTION_GET_USED_ADDRESSES", "cardano.wallet.intent.action.GET_USED_ADDRESSES")
addConstant("CARDANO_WALLET_INTENT_ACTION_GET_UNUSED_ADDRESSES", "cardano.wallet.intent.action.GET_UNUSED_ADDRESSES")
addConstant("CARDANO_WALLET_INTENT_ACTION_GET_CHANGE_ADDRESS", "cardano.wallet.intent.action.GET_CHANGE_ADDRESS")
addConstant("CARDANO_WALLET_INTENT_ACTION_GET_REWARD_ADDRESSES", "cardano.wallet.intent.action.GET_REWARD_ADDRESSES")
addConstant("CARDANO_WALLET_INTENT_ACTION_SIGN_DATA", "cardano.wallet.intent.action.SIGN_DATA")
addConstant("CARDANO_WALLET_INTENT_ACTION_SIGN_TX", "cardano.wallet.intent.action.SIGN_TX")
addConstant("CARDANO_WALLET_INTENT_ACTION_SUBMIT_TX", "cardano.wallet.intent.action.SUBMIT_TX")
}
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 "androidx.core:core-splashscreen:$coreSplashScreenVersion"
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation project(':capacitor-android')
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')
}

apply from: 'capacitor.build.gradle'

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")
}
19 changes: 19 additions & 0 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN

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

apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-app')

}


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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.getcapacitor.myapp;

import static org.junit.Assert.*;

import android.content.Context;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {

@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();

assertEquals("com.getcapacitor.app", appContext.getPackageName());
}
}
60 changes: 60 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">

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

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

<intent-filter>
<data android:host="wallet.nami" android:scheme="cardano" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_ENABLE}" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_IS_ENABLED}" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_GET_NETWORK_ID}" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_GET_BALANCE}" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_GET_UTXOS}" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_GET_COLLATERAL}" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_GET_USED_ADDRESSES}" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_GET_UNUSED_ADDRESSES}" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_GET_CHANGE_ADDRESS}" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_GET_REWARD_ADDRESSES}" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_SIGN_DATA}" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_SIGN_TX}" />
<action android:name="${CARDANO_WALLET_INTENT_ACTION_SUBMIT_TX}" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</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"></meta-data>
</provider>
</application>

<!-- Permissions -->

<uses-permission android:name="android.permission.INTERNET" />
</manifest>
6 changes: 6 additions & 0 deletions android/app/src/main/assets/capacitor.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"appId": "io.nami.app",
"appName": "Nami Wallet",
"webDir": "build",
"bundledWebRuntime": false
}
6 changes: 6 additions & 0 deletions android/app/src/main/assets/capacitor.plugins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"pkg": "@capacitor/app",
"classpath": "com.capacitorjs.plugins.app.AppPlugin"
}
]
Binary file added android/app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading