Skip to content

Commit

Permalink
Merge pull request #25 from tomfong/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
tomfong authored Dec 25, 2021
2 parents 4164bdd + c7b3a72 commit 6384bcb
Show file tree
Hide file tree
Showing 110 changed files with 2,652 additions and 437 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@ npm-debug.log*
/coverage
/dist
/node_modules
/platforms
/plugins
/www
55 changes: 23 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,40 +84,20 @@ Thanks for your support!
- Open issue for bug reports
- Email me for any ideas regarding Simple QR or Project Simple

### If you want to build the project
### Build the project

- Run ```npm install``` to install all dependencies
- Go to ```platforms/android/app/src/main/java/com/bitpay/cordova/qrscanner/QRScanner.java``` and find the following codes

```java
ArrayList<BarcodeFormat> formatList = new ArrayList<BarcodeFormat>();
formatList.add(BarcodeFormat.QR_CODE);
```

and then replace it by

```java
ArrayList<BarcodeFormat> formatList = new ArrayList<BarcodeFormat>();
formatList.add(BarcodeFormat.AZTEC);
formatList.add(BarcodeFormat.CODABAR);
formatList.add(BarcodeFormat.CODE_128);
formatList.add(BarcodeFormat.CODE_39);
formatList.add(BarcodeFormat.CODE_93);
formatList.add(BarcodeFormat.DATA_MATRIX);
formatList.add(BarcodeFormat.EAN_13);
formatList.add(BarcodeFormat.EAN_8);
formatList.add(BarcodeFormat.ITF);
formatList.add(BarcodeFormat.PDF_417);
formatList.add(BarcodeFormat.QR_CODE);
formatList.add(BarcodeFormat.RSS_14);
formatList.add(BarcodeFormat.RSS_EXPANDED);
formatList.add(BarcodeFormat.UPC_A);
formatList.add(BarcodeFormat.UPC_E);
formatList.add(BarcodeFormat.UPC_EAN_EXTENSION);
- Run ```npm run build```
- Replace ```android/app/src/main/java/com/bitpay/cordova/qrscanner/QRScanner.java``` by ```backup/QRScanner.java```
- In ```android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml```, add ```android:exported="false"``` inside receiver tag.
- In ```android/app/src/main/res/values/styles.xml```, change

```xml
<style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar">
<item name="android:background">#00a5aa</item>
</style>
```

- If you want to run on Android device, run ```npm run start```.

### How to help to do translation?

0. (Optional) Clone or fork this project
Expand All @@ -128,7 +108,14 @@ Thanks for your support!

## Changelogs

### 1.3.0 - 1.3.2 (Current)
### 1.4.0 (Current)

- Migrated the app to Capacitor
- Improve experience when using "Special Actions" feature in Result page
- Show barcode type when scanning
- Improve performance and fix issues

#### 1.3.0 - 1.3.3

- Redesign UI/UX
- Add vibration on/off setting
Expand Down Expand Up @@ -163,13 +150,17 @@ Thanks for your support!
## Framework

```sh
Ionic CLI : 6.13.1
Ionic CLI : 6.18.1
Ionic Framework : @ionic/angular 5.9.3
@angular-devkit/build-angular : 12.2.1
@angular-devkit/schematics : 12.2.1
@angular/cli : 12.2.1
@ionic/angular-toolkit : 4.0.0

Capacitor CLI : 3.3.3
@capacitor/android : 3.3.3
@capacitor/core : 3.3.3

Cordova CLI : 10.0.0

Android SDK Tools : 26.1.1
Expand Down
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.

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

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

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

android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.tomfong.simpleqr"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 10400
versionName "1.4.0.20211225"
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:!*~'
}
}
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 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")
}
27 changes: 27 additions & 0 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN

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

apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-community-contacts')
implementation project(':capacitor-app')
implementation project(':capacitor-camera')
implementation project(':capacitor-clipboard')
implementation project(':capacitor-device')
implementation project(':capacitor-haptics')
implementation project(':capacitor-keyboard')
implementation project(':capacitor-splash-screen')
implementation project(':capacitor-status-bar')
implementation "androidx.legacy:legacy-support-v4:1.0.0"
}
apply from: "../../node_modules/cordova-plugin-qrscanner/src/android/qrscanner.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
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());
}
}
Loading

0 comments on commit 6384bcb

Please sign in to comment.