Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ddyos committed Jan 31, 2020
1 parent 02f7900 commit b4f28b2
Show file tree
Hide file tree
Showing 40 changed files with 1,469 additions and 0 deletions.
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2020 ddyos

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.
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Flipper MMKV Viewer Plugin

[![](https://jitpack.io/v/ddyos/flipper-plugin-mmkv-viewer.svg)](https://jitpack.io/#ddyos/flipper-plugin-mmkv-viewer)
[![npm version](https://img.shields.io/npm/v/flipper-plugin-mmkv-viewer.svg)](https://www.npmjs.com/package/flipper-plugin-mmkv-viewer)

*[English](README.md) | [简体中文](README.zh-cn.md)*

## Introduction

A plugin for the debug tool [Flipper](https://fbflipper.com) that inspect the [MMKV](https://github.com/Tencent/MMKV) file of your native app.

It can view or edit the key-value inside the MMKV file.

![](https://user-images.githubusercontent.com/8358125/73119200-4ba6f300-3f99-11ea-8391-a22cc826b5ca.png)

Currently only Android is supported.

Note:

MMKV did not implement OnSharedPreferenceChangeListener on Android, so you should update the data manually by press "Refresh" Button.

## Setup

### Flipper Desktop

1. Installed [Flipper Desktop](https://fbflipper.com)
2. Go to **Manage Plugins** by pressing the button in the lower left corner of the Flipper app, or in the **View** menu
3. Select **Install Plugins** and search for `mmkv-viewer`
4. Press the **Install** button

![](https://user-images.githubusercontent.com/8358125/73119201-52356a80-3f99-11ea-95b3-1a0013acbce8.png)

### Android

1. Add [Flipper Android SDK](https://github.com/facebook/flipper) to `build.gradle` on your app module:
```gradle
dependencies {
// please use Latest Version
debugImplementation 'com.facebook.flipper:flipper:0.30.1'
debugImplementation 'com.facebook.soloader:soloader:0.8.0'
releaseImplementation 'com.facebook.flipper:flipper-noop:0.30.1'
}
```
2. Add JitPack in your root build.gradle at the end of repositories:
```gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
3. Add this plugin library as a dependency in your app's build.gradle file:
```gradle
dependencies {
// please use Latest Version
debugImplementation 'com.github.ddyos:flipper-plugin-mmkv-viewer:1.0.0'
}
```
4. Init the plugin:
```Kotlin
val client = AndroidFlipperClient.getInstance(this)
client.addPlugin(MMKVFlipperPlugin("other_mmkv"))
client.start()
```

## Android Demo

See the projects in the [`sample`](/android/sample) folder.

## License

MIT License, as found in the [LICENSE](/LICENSE) file.
73 changes: 73 additions & 0 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Flipper MMKV 调试插件

[![](https://jitpack.io/v/ddyos/flipper-plugin-mmkv-viewer.svg)](https://jitpack.io/#ddyos/flipper-plugin-mmkv-viewer)
[![npm version](https://img.shields.io/npm/v/flipper-plugin-mmkv-viewer.svg)](https://www.npmjs.com/package/flipper-plugin-mmkv-viewer)

*[English](README.md) | [简体中文](README.zh-cn.md)*

## 简介

一个基于 [Flipper](https://fbflipper.com) 的调试插件,可以用于浏览原生应用中的 [MMKV](https://github.com/Tencent/MMKV) 文件。

插件可以查看和修改MMKV文件中的数据。

![](https://user-images.githubusercontent.com/8358125/73119200-4ba6f300-3f99-11ea-8391-a22cc826b5ca.png)

当前仅支持Android。

注意:

由于MMKV for Android没有实现OnSharedPreferenceChangeListener接口, 所以需要通过“Refresh”按钮去刷新数据。

## 安装

### Flipper Desktop

1. 安装 [Flipper Desktop](https://fbflipper.com)
2. 通过 Flipper Desktop 左下角的 **Manage Plugins** 按钮 或者 **View** 菜单项, 进入插件管理页面
3. 选择 **Install Plugins** 选项卡,并搜索 `mmkv-viewer` 关键词
4. 通过 **Install** 按钮安装插件

![](https://user-images.githubusercontent.com/8358125/73119201-52356a80-3f99-11ea-95b3-1a0013acbce8.png)

### Android

1. 添加 [Flipper Android SDK](https://github.com/facebook/flipper) 到app模块的 `build.gradle` :
```gradle
dependencies {
// please use Latest Version
debugImplementation 'com.facebook.flipper:flipper:0.30.1'
debugImplementation 'com.facebook.soloader:soloader:0.8.0'
releaseImplementation 'com.facebook.flipper:flipper-noop:0.30.1'
}
```
2. 添加 JitPack源 到根目录的 build.gradle 中:
```gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
3. 添加插件依赖到 app 的 build.gradle 中:
```gradle
dependencies {
// please use Latest Version
debugImplementation 'com.github.ddyos:flipper-plugin-mmkv-viewer:1.0.0'
}
```
4. 初始化插件:
```Kotlin
val client = AndroidFlipperClient.getInstance(this)
client.addPlugin(MMKVFlipperPlugin("other_mmkv"))
client.start()
```

## Android 示例

参见[`sample`](/android/sample) 文件夹中的项目。

## License

基于 MIT License, 参看 [LICENSE](/LICENSE) 文件。
29 changes: 29 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
}
}

allprojects {
repositories {
google()
jcenter()

}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
21 changes: 21 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
Binary file added android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Sat Jan 18 11:28:21 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Loading

0 comments on commit b4f28b2

Please sign in to comment.