Git Product home page Git Product logo

Comments (1)

afkT avatar afkT commented on July 25, 2024

其实这个并不算 bug,反而是一个专门加的功能。

支持通过后台数据动态设置配置信息

出现这个过程是这样的:

// 原始注解数据

@Module(alias = "IM 模块")
private class IM {

    @Environment(value = "https://im.release.com/", isRelease = true, alias = "线上环境")
    private String release;

    @Environment(value = "https://im.debug.com", alias = "测试环境")
    private String debug;
}

当你选中某个环境时会存储一个 MODULE_NAME => MODULE_IM 文件 ( 无后缀,JSON 格式 )

接着你修改数据再进行编译时

// 修改注解数据

@module(alias = "IM 模块")
private class IM {

    @Environment(value = "https://im.release.com/", isRelease = true, alias = "线上@环境")
    private String release;

    @Environment(value = "https://im.debug.com", alias = "测试@环境")
    private String debug;
}

这个时候进入 DevEnvironmentActivity 操作页面,优先判断是否存在 MODULE_IM 文件,存在则解析并且选中该环境

接着把新编译的 线上@环境测试@环境 也添加进去展示,则会出现三个环境情况

支持通过后台数据动态设置配置信息 这个功能就是这样实现的,通过后台返回数据可动态设置服务器地址

DevEnvironment.setIMEnvironment(context, EnvironmentBean) 进行设置自定义配置

当你选中其他环境时,这个 MODULE_IM 自然也变成新的配置信息,再次进入时就会出现只有 线上@环境测试@环境

不过目前只有一个 DevEnvironment.reset(context) 重置全部 Module 环境的 ( 既把全部 MODULE_NAME 文件全部删除,恢复默认)

我新加两个方法吧

  • 每个 Module 新增单独的 reset 方法 如 resetIM

  • 每个 Module 新增单独的 方法名待定 方法,功能用于校验已选中环境是否属于注解配置中的环境

这样就能够自行决定是否需要重置某个模块

from devutils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.