Skip to content

Commit

Permalink
Add record wechat envelope function.
Browse files Browse the repository at this point in the history
  • Loading branch information
xbdcc committed Jan 22, 2020
1 parent d8fc0e3 commit 2558e27
Show file tree
Hide file tree
Showing 19 changed files with 441 additions and 35 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ https://github.com/xbdcc/CUtils
- 通知监控开关说明:需要微信通知权限开启,此时若开启此功能收到通知有红包消息会自动跳转点击。
- 聊天列表页监控开关说明:若打开则在微信首页列表也发现红包消息则会跳转到详情页点击。
- 延迟时间说明:为防止秒抢拉仇恨加了延迟功能,延迟可以选择0-9秒。
- 自定义拆红包坐标点说明:解决部分Android7.0以上机型无法自动拆红包的问题。
- 自定义拆红包坐标点说明:自定义红包拆按钮的横纵坐标,解决部分Android7.0以上机型无法自动拆红包的问题。

最新版适配微信7.0.3,7.0.4,7.0.5,7.0.8,7.0.9版本,代码开源仅供学习使用,请勿用作商业用途。
最新版适配微信7.0.3,7.0.4,7.0.5,7.0.8,7.0.9,7.0.10版本,代码开源仅供学习使用,请勿用作商业用途。

## 打赏
<table>
Expand Down
15 changes: 12 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'org.greenrobot.greendao' // apply plugin
apply plugin: 'kotlinx-serialization'

apply plugin: 'io.sentry.android.gradle'

apply plugin: 'org.greenrobot.greendao'

def defaultPropertiesFile = rootProject.file("buildsystem/default.properties")
def defaultProperties = new Properties()
Expand Down Expand Up @@ -107,13 +107,21 @@ sentry {
autoUpload true
}

greendao {
schemaVersion 1//数据库版本号
daoPackage 'com.carlos.grabredenvelope.db'//设置DaoMaster、DaoSession、Dao包名
targetGenDir 'src/main/java'//设置DaoMaster、DaoSession、Dao目录
//targetGenDirTest:设置生成单元测试目录
//generateTests:设置自动生成单元测试用例
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.9.1"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1'

// implementation 'com.carlos.cutils:cutils:0.0.26'
implementation 'com.github.xbdcc:cutils:0.0.26-SNAPSHOT'
implementation 'com.carlos.cutils:cutils:0.0.26'
// implementation 'com.github.xbdcc:cutils:0.0.26-SNAPSHOT'

//jpush
implementation 'cn.jiguang.sdk:jpush:3.3.2'
Expand All @@ -127,6 +135,7 @@ dependencies {
implementation 'com.liulishuo.filedownloader:library:1.7.7'
implementation 'com.google.android.material:material:1.0.0'

implementation 'org.greenrobot:greendao:3.2.2' // add library

}
repositories {
Expand Down
26 changes: 12 additions & 14 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,19 @@
}


# ProGuard configurations for Bugtags
-keepattributes LineNumberTable,SourceFile

-keep class com.bugtags.library.** {*;}
-dontwarn com.bugtags.library.**
-keep class io.bugtags.** {*;}
-dontwarn io.bugtags.**
-dontwarn org.apache.http.**
-dontwarn android.net.http.AndroidHttpClient

# End Bugtags


# sentry
-keepattributes LineNumberTable,SourceFile
-dontwarn org.slf4j.**
-dontwarn javax.**
-keep class io.sentry.event.Event { *; }
-keep class io.sentry.event.Event { *; }


# greendao
-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
public static java.lang.String TABLENAME;
}
-keep class **$Properties {*;}
# If you do not use SQLCipher:
-dontwarn net.sqlcipher.database.**
# If you do not use RxJava:
-dontwarn rx.**
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ open class MainActivity : BaseActivity() {
private val WECHAT_SERVICE_NAME = "com.carlos.grabredenvelope/.services.WechatService"

var fragments = mutableListOf<Fragment>(ControlFragment(), GuideFragment(), AboutFragment(),
CodeFragment(), RewardFragment()
CodeFragment(), RewardFragment(), RecordFragment()
)
var titles = mutableListOf("控制", "教程", "说明", "源码", "打赏")
var titles = mutableListOf("控制", "教程", "说明", "源码", "打赏", "记录")

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
63 changes: 63 additions & 0 deletions app/src/main/java/com/carlos/grabredenvelope/db/GreenDaoManager.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.carlos.grabredenvelope.data
import com.carlos.grabredenvelope.MyApplication
import com.carlos.grabredenvelope.db.DaoMaster
import com.carlos.grabredenvelope.db.DaoSession

/**
* _ooOoo_
* o8888888o
* 88" . "88
* (| -_- |)
* O\ = /O
* ____/`---'\____
* .' \\| |// `.
* / \\||| : |||// \
* / _||||| -:- |||||- \
* | | \\\ - /// | |
* | \_| ''\---/'' | |
* \ .-\__ `-` ___/-. /
* ___`. .' /--.--\ `. . __
* ."" '< `.___\_<|>_/___.' >'"".
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
* \ \ `-. \_ __\ /__ _/ .-` / /
* ======`-.____`-.___\_____/___.-`____.-'======
* `=---='
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* 佛祖保佑 永无BUG
* 佛曰:
* 写字楼里写字间,写字间里程序员;
* 程序人员写程序,又拿程序换酒钱。
* 酒醒只在网上坐,酒醉还来网下眠;
* 酒醉酒醒日复日,网上网下年复年。
* 但愿老死电脑间,不愿鞠躬老板前;
* 奔驰宝马贵者趣,公交自行程序员。
* 别人笑我忒疯癫,我笑自己命太贱;
* 不见满街漂亮妹,哪个归得程序员?
*/

/**
* Github: https://github.com/xbdcc/.
* Created by caochang on 2017/8/27.
*/

class GreenDaoManager {
var master: DaoMaster //以一定的模式管理Dao类的数据库对象
var session: DaoSession //管理制定模式下的所有可用Dao对象
var newSession: DaoSession? = null
get() {
session = master.newSession()
return session
}

init {
val devOpenHelper = DaoMaster.DevOpenHelper(MyApplication.instance.applicationContext, "grabredenvelope", null)
master = DaoMaster(devOpenHelper.writableDatabase)
session = master.newSession()
}

companion object {
val instance by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
GreenDaoManager()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package com.carlos.grabredenvelope.db;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;

/**
* _ooOoo_
* o8888888o
* 88" . "88
* (| -_- |)
* O\ = /O
* ____/`---'\____
* .' \\| |// `.
* / \\||| : |||// \
* / _||||| -:- |||||- \
* | | \\\ - /// | |
* | \_| ''\---/'' | |
* \ .-\__ `-` ___/-. /
* ___`. .' /--.--\ `. . __
* ."" '< `.___\_<|>_/___.' >'"".
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
* \ \ `-. \_ __\ /__ _/ .-` / /
* ======`-.____`-.___\_____/___.-`____.-'======
* `=---='
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* 佛祖保佑 永无BUG
* 佛曰:
* 写字楼里写字间,写字间里程序员;
* 程序人员写程序,又拿程序换酒钱。
* 酒醒只在网上坐,酒醉还来网下眠;
* 酒醉酒醒日复日,网上网下年复年。
* 但愿老死电脑间,不愿鞠躬老板前;
* 奔驰宝马贵者趣,公交自行程序员。
* 别人笑我忒疯癫,我笑自己命太贱;
* 不见满街漂亮妹,哪个归得程序员?
*/

/**
* Github: https://github.com/xbdcc/.
* Created by caochang on 2017/8/27.
*/

@Entity
public class WechatRedEnvelope {
@Id(autoincrement = true)
private Long id;
private long time = System.currentTimeMillis();
private String count = "";
@Generated(hash = 1534010414)
public WechatRedEnvelope(Long id, long time, String count) {
this.id = id;
this.time = time;
this.count = count;
}
@Generated(hash = 1019243491)
public WechatRedEnvelope() {
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public long getTime() {
return this.time;
}
public void setTime(long time) {
this.time = time;
}
public String getCount() {
return this.count;
}
public void setCount(String count) {
this.count = count;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.carlos.grabredenvelope.db

import com.carlos.grabredenvelope.data.GreenDaoManager

/**
* _ooOoo_
* o8888888o
* 88" . "88
* (| -_- |)
* O\ = /O
* ____/`---'\____
* .' \\| |// `.
* / \\||| : |||// \
* / _||||| -:- |||||- \
* | | \\\ - /// | |
* | \_| ''\---/'' | |
* \ .-\__ `-` ___/-. /
* ___`. .' /--.--\ `. . __
* ."" '< `.___\_<|>_/___.' >'"".
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
* \ \ `-. \_ __\ /__ _/ .-` / /
* ======`-.____`-.___\_____/___.-`____.-'======
* `=---='
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* 佛祖保佑 永无BUG
* 佛曰:
* 写字楼里写字间,写字间里程序员;
* 程序人员写程序,又拿程序换酒钱。
* 酒醒只在网上坐,酒醉还来网下眠;
* 酒醉酒醒日复日,网上网下年复年。
* 但愿老死电脑间,不愿鞠躬老板前;
* 奔驰宝马贵者趣,公交自行程序员。
* 别人笑我忒疯癫,我笑自己命太贱;
* 不见满街漂亮妹,哪个归得程序员?
*/

/**
* Github: https://github.com/xbdcc/.
* Created by Carlos on 2020-01-22.
*/
object WechatRedEnvelopeDb {

private val sQQRedEnvelopeDao = GreenDaoManager.instance.session.wechatRedEnvelopeDao

val allData: List<WechatRedEnvelope>
@Synchronized get() = sQQRedEnvelopeDao.loadAll()

@Synchronized
fun insertData(qqRedEnvelope: WechatRedEnvelope) {
sQQRedEnvelopeDao.insert(qqRedEnvelope)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,38 @@ package com.carlos.grabredenvelope.execption
import com.carlos.cutils.execption.CUncaughtExceptionHandler
import io.sentry.Sentry

/**
* _ooOoo_
* o8888888o
* 88" . "88
* (| -_- |)
* O\ = /O
* ____/`---'\____
* .' \\| |// `.
* / \\||| : |||// \
* / _||||| -:- |||||- \
* | | \\\ - /// | |
* | \_| ''\---/'' | |
* \ .-\__ `-` ___/-. /
* ___`. .' /--.--\ `. . __
* ."" '< `.___\_<|>_/___.' >'"".
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
* \ \ `-. \_ __\ /__ _/ .-` / /
* ======`-.____`-.___\_____/___.-`____.-'======
* `=---='
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* 佛祖保佑 永无BUG
* 佛曰:
* 写字楼里写字间,写字间里程序员;
* 程序人员写程序,又拿程序换酒钱。
* 酒醒只在网上坐,酒醉还来网下眠;
* 酒醉酒醒日复日,网上网下年复年。
* 但愿老死电脑间,不愿鞠躬老板前;
* 奔驰宝马贵者趣,公交自行程序员。
* 别人笑我忒疯癫,我笑自己命太贱;
* 不见满街漂亮妹,哪个归得程序员?
*/

/**
* Github: https://github.com/xbdcc/.
* Created by Carlos on 2019-11-08.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ import com.carlos.cutils.base.fragment.CBaseWebFragment
* Github: https://github.com/xbdcc/.
* Created by Carlos on 2019/2/23.
*/
open class AboutFragment : CBaseWebFragment("http://xbdcc.cn/GrabRedEnvelope/index.html")
class AboutFragment : CBaseWebFragment("http://xbdcc.cn/GrabRedEnvelope/index.html")
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,39 @@ import android.view.View
import com.carlos.cutils.base.fragment.CBaseFragment

/**
* _ooOoo_
* o8888888o
* 88" . "88
* (| -_- |)
* O\ = /O
* ____/`---'\____
* .' \\| |// `.
* / \\||| : |||// \
* / _||||| -:- |||||- \
* | | \\\ - /// | |
* | \_| ''\---/'' | |
* \ .-\__ `-` ___/-. /
* ___`. .' /--.--\ `. . __
* ."" '< `.___\_<|>_/___.' >'"".
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
* \ \ `-. \_ __\ /__ _/ .-` / /
* ======`-.____`-.___\_____/___.-`____.-'======
* `=---='
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* 佛祖保佑 永无BUG
* 佛曰:
* 写字楼里写字间,写字间里程序员;
* 程序人员写程序,又拿程序换酒钱。
* 酒醒只在网上坐,酒醉还来网下眠;
* 酒醉酒醒日复日,网上网下年复年。
* 但愿老死电脑间,不愿鞠躬老板前;
* 奔驰宝马贵者趣,公交自行程序员。
* 别人笑我忒疯癫,我笑自己命太贱;
* 不见满街漂亮妹,哪个归得程序员?
*/

/**
* Github: https://github.com/xbdcc/.
* Created by Carlos on 2020-01-21.
*/
open class BaseFragment(val layoutid: Int) : CBaseFragment() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,5 @@ class GuideFragment : BaseFragment(R.layout.fragment_about) {
mainActivity2.checkItem(4)
}
}
////
//// fun donate(view: View) {
//// startActivity(Intent(this@GuideFragment, RewardFragment::class.java))
//// }

}
Loading

0 comments on commit 2558e27

Please sign in to comment.