2 Star 1 Fork 1

LiGuoliang / GLEnvs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

logo

GLEnvs

CI Status Version License Platform

可以快速切换已配置好的变量环境,也可以直接自定义变量环境。

Installation

GLEnvs is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'GLEnvs'

Quick Start

  1. 进行配置

    ...
    	GLEnvs *envs = [GLEnvs defaultWithEnvironments:@[
            @{
                @"测试环境":@{
                    @"host":@"http://192.168.1.1:8080",
                    @"nimKey":@"debugkey333",
                    @"wxKey":@"debugkey123"
                }  
            },@{
                @"正式环境":@{
                    @"host":@"https://www.baidu.com",
                    @"nimKey":@"releasekey111",
                    @"wxKey":@"releasekey222"
                }
            }
    	]];
        envs.showTopLine = YES; // 是否在App中显示顶部提示条
        [envs enableWithShakeMotion:<#开启环境切换#> defaultIndex:<#环境的索引编号#>];
        //
        // 例如
        // [envs enableWithShakeMotion:YES defaultIndex:0]; // 用户可以切换环境且使用 envs[0] 作为当前环境
        //
    ...
  2. 使用

    ...
    NSString * key = [GLEnvs loadEnv][@"nimKey"];	// [GLEnvs loadEvn]:获取当前环境,[@"nimKey"]:环境中对应的Key值
    ...

Advanced

<GLEnvs.m>
...
// Manual invoke to change current environment
// 手动改变当前环境
+ manualChangeEnv:

/// Enable GLEnvs With ...
/// 改变环境

// Specify String in PasteBoard
// 从剪切板匹配指定字符串来判断是否开启摇一摇功能
- enableWithPasteBoardString: matchSuccess: matchFailed:

//匹配模式,默认完全匹配 (只在PasteBoard模式生效)
@property MatchType type; // MatchType:[完全 | 开头 | 包含 | 结尾]

// App Icon pop Menu at long touch
// 通过长按app图标弹出的菜单进行环境选择
- enableWithShortCutItemString: PresentConfig: defaultIndex: 


// Shake in Running
// 打开摇一摇环境切换菜单
- enableWithShakeMotion: defaultIndex: 

/// Get Inf
+ loadEnv // Get Current Environment
+ longEnvName // Get Current Environment Name
...

History

- 1.5.9 - 2021-11-23

-- 修复 shortcutItem 在某些已知情况下不可用的情况

- 1.5.8 - 2021-11-23

-- 增加了实用 shortcutItem 来进行设置环境 (3d touch)

- 1.5.4 - 2021-02-23

-- 增加了一个小功能: 使用`showTopLine`来控制是否显示顶部的提示条

-- 并且修改为默认不显示

- 1.5.3 - 2021-02-18

-- 修正了 顶栏状态显示层,遮挡操作事件的问题

- 1.5.2 - 2021-02-18

-- 修正了 顶栏状态显示,可能被干掉的问题

- 1.5.1 - 2021-02-09

-- 增加了对于切换环境的监听器

- 1.5.0 - 2021-02-08

-- 包含了`OC`和`Swift`两个版本的`Demo`

-- 优化了环境列表弹出机制

- 1.4.0 - 2020-12-02

-- 增加了可以通过ShortCut ( 3D Touch 主屏图标 ) 来进行环境切换,并且可以自定义内页,来隐藏Debug模式

- 1.3.0 - 2020-11-12

-- 增加关于开启和关闭,现在可以通过获取剪切板内容来开启或关闭测试模式。可自定义匹配模式

- 1.2.8 - 2020-04-02

-- 修复一个在Debug状态下重修改环境字典未重新加载的问题(正式环境不受影响)

- More...

- 1.2.5

-- 维护:增加了更加明确和更加详细的注释

- 1.2.4

-- 迁移:Github

- 1.2.3

-- 修复:方法交换问题

-- 增加:版本号显示

- 1.2.2

-- 修复:修复一个崩溃Bug,对event做类型验证然后再进行后续操作

- 1.2.1

-- 优化:当前环境显示问题,从小方块修改成全屏条幅

- 1.2.0

-- 修复:一系列在真机导致崩溃的问题

- 1.1.2

-- fix Environment Save FAILED & Improve Save/Load to Archive

- 1.0.0

-- first commit

Author

liguoliang, 36617161@qq.com

License

GLEnvs is available under the MIT license. See the LICENSE file for more info.

Copyright (c) 2019 liandyii@msn.com <guoliang@51jianjiao.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

可以快速切换已配置好的变量环境,也可以直接自定义变量环境 展开 收起
Objective-C 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Objective-C
1
https://gitee.com/GL9700/GLEnvs.git
git@gitee.com:GL9700/GLEnvs.git
GL9700
GLEnvs
GLEnvs
master

搜索帮助

14c37bed 8189591 565d56ea 8189591