AutoX Documentation

repository·master·Indexed 42 days ago

https://github.com/autox-community/autox

An Android-based development project maintained as a backup of original source code. The project includes utilities for ARSC file manipulation via ArscUtil, OCR capabilities using Google MLKit, and integrated npm modules such as bluebird-co for high-performance coroutine yield handlers and lodash v4.17.21.

Tokens
36.1K
Snippets
175
Records
195
Agent score
56%

What's inside AutoX

  1. Compare bluebird-co performance with co

    master

    The bluebird-co package is designed to provide a high-performance alternative to tj/co by leveraging Bluebird promises. Benchmarks indicate that bluebird-co generally outperforms both standard co and co with Bluebird promises across various yieldable types like Promises, Arrays, Objects, Generators, Iterables, and Thunks.

    Note: bluebird-co may be slower specifically during error handling because errors pass through the Bluebird.coroutine circuitry, but this is typically negligible unless your application throws errors at an extremely high frequency.

  2. Supported Yieldable Types in bluebird-co

    master

    The following types can be yielded within a Bluebird coroutine and will be automatically transformed into Promises by bluebird-co:

    • Promises
    • Arrays (elements are resolved)
    • Objects (properties are resolved)
    • Generators and GeneratorFunctions
    • Iterables (e.g., new Set([1, 2, 3]).values())
    • Functions (treated as Thunks)
    • Custom data types (via .addYieldHandler)
    • Any combination or nesting of the above types.
  3. Add custom yieldable types with addYieldHandler

    master

    You can extend bluebird-co to handle custom data types by registering a new yield handler. This allows you to yield or await your own class instances directly.

    Note on Caveats: This will NOT work if the class inherits from Object or if Object is in the prototype chain of the value's constructor. If it inherits from Object, it will be treated as a standard object and processed by the default object handler.

    import {coroutine} from 'bluebird-co';
    
    class MyModel {
        async fetch() {
            return 'data';
        }
    }
    
    // Register the handler
    coroutine.addYieldHandler(function(value) {
        if(value instanceof MyModel) {
            return value.fetch();
        }
    });
    
    async function test() {
        let model = new MyModel();
        // The model is automatically fetched when yielded/awaited
        let data = await model; 
    }
    import {coroutine} from 'bluebird-co';
    
    class MyModel {
        async fetch() {
            return 'data';
        }
    }
    
    coroutine.addYieldHandler(function(value) {
        if(value instanceof MyModel) {
            return value.fetch();
        }
    });
    
    async function test() {
        let model = new MyModel();
        let data = await model;
    }
  4. OCR Capabilities in AutoX

    master

    AutoX supports multiple Optical Character Recognition (OCR) engines:

    • Google ML Kit OCR API: Available for high-quality text recognition.
    • Tesseract OCR: Available as an additional engine.
    • Paddle API: Supported (with backward compatibility maintained in recent versions).
  5. Automatic traversal of Iterables in bluebird-co

    master

    Bluebird-co allows for the automatic traversal of ES6 Iterables (such as Set, Map, and TypedArray). It functions similarly to Array.from, but with the added benefit of automatically resolving any asynchronous values encountered during traversal.

    Note: While native for..of loops in modern environments can iterate through iterables without conversion, they do not automatically resolve asynchronous values. bluebird-co provides this resolution capability.

    let mySet = new Set( [Promise.resolve( 1 ), 2, [Promise.resolve( 3 ), 4], 5] );
    
    async function() {
        let values = await mySet.values();
    
        console.log(values); //[1, 2, [3, 4], 5]
    }
  6. Use OCR and Computer Vision features

    master

    AutoX integrates OpenCV and PaddleOCR for advanced image recognition:

    • OpenCV: Versions 5.5.6 and later use OpenCV 4.5.5. Earlier versions used 4.2.0.
    • PaddleOCR: Integrated in version 5.6.1 for enhanced OCR capabilities.
    • OCR Models: Version 5.6.4 introduced more models and refinements to the OCR engine.
    • Memory Management: Be aware that older versions (pre-5.7.5) had known OCR memory leak issues which have been addressed in later releases.
  7. Import lodash modules in Node.js

    master

    Lodash can be imported in various ways depending on whether you need the full library, the core build, the functional programming (FP) build, or specific method categories/individual methods to reduce bundle size.

    // Load the full build.
    var _ = require('lodash');
    // Load the core build.
    var _ = require('lodash/core');
    // Load the FP build for immutable auto-curried iteratee-first data-last methods.
    var fp = require('lodash/fp');
    
    // Load method categories.
    var array = require('lodash/array');
    var object = require('lodash/fp/object');
    
    // Cherry-pick methods for smaller browserify/rollup/webpack bundles.
    var at = require('lodash/at');
    var curryN = require('lodash/fp/curryN');
  8. Configure Gradle to use domestic mirrors for dependency acceleration

    master

    If you are experiencing slow dependency downloads, you can configure Gradle to use Aliyun mirrors. Create an init.gradle file at C:\Users\{YourUsername}\.gradle\init.gradle and add the following configuration to redirect repository requests to domestic mirrors.

    def repoConfig = {  
        maven { url 'https://maven.aliyun.com/repository/central' }
        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
        maven { url 'https://maven.aliyun.com/repository/releases' }
        // maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url "https://jitpack.io"}
        
        google()
        jcenter()
        mavenLocal()
        mavenCentral()    
    }
    allprojects {
        buildscript {
            repositories repoConfig
        }
        repositories repoConfig
    }
  9. Install bluebird-co

    master

    To use bluebird-co, you must install both the package and bluebird as a dependency.

    npm install bluebird-co
    npm install bluebird@3
    npm install bluebird-co
    npm install bluebird@3
  10. Configure Babel 6 to use bluebird-co for async/await

    master

    You can use the transform-async-to-module-method Babel plugin to convert async/await syntax into Bluebird coroutines. This allows you to write modern async functions that transparently use bluebird-co's high-performance yield handlers.

    // .babelrc
    {
        "plugins": [
            ["transform-async-to-module-method", {
                "module": "bluebird-co",
                "method": "coroutine"
            }]
        ]
    }
  11. Manage Accessibility Service permissions

    master

    AutoX requires Accessibility Service permissions to function correctly.

    • Root Access: In version 6.2.6, a fix was implemented to allow opening Accessibility Services directly when running with root permissions.
    • Service Descriptions: Starting from version 5.3.1, you can configure the description for the Accessibility Service.
    • Permission Prompts: Version 5.6.1 improved the flow by prompting the user to enable permissions before running scripts.