Skip to content

Commit

Permalink
migrate into androidX
Browse files Browse the repository at this point in the history
  • Loading branch information
virskor committed Mar 25, 2020
1 parent 4b86fd9 commit 041250d
Show file tree
Hide file tree
Showing 71 changed files with 1,322 additions and 51 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.vscode
.DS_store
.DS_store
discuz/android/key.properties
discuz/android/android.keystore
49 changes: 34 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# DiscuzQ Flutter Application
<p><img src="discuz/assets/images/logo.png"/> </p>
该项目的诞生,离不开他们的贡献
<p>
<img width="200px" src="./snapshots/logo.png"/>
</p>
<p>
<img width="200px" src="./snapshots/tencentCloud.png"/>
</p>

### 实现目标
基本上和官方版本是保持一致的,只是会增加黑暗模式,主题颜色,字体大小等设置罢了。
Expand All @@ -8,28 +14,33 @@ A new Flutter application for DiscuzQ. This Application is still under developin

If you have any question about this project, follow and post an issue. I will consit to write this application.

## 还在开发和版权说明
现在还在开发,不是最终功能
第三方APP,与Discuz无关,不代表Dz团队,仅做个人学习使用。该Flutter APP将不考虑支持Web。
## 版权说明
第三方APP,不代表Discuz团队,仅做个人学习使用。该Flutter APP将不考虑支持Web。
该APP现在处于开发阶段,暂时不推荐clone并编译,后续编排改动都很大,直到release前暂不要使用这些代码。

### 开发提示
现在,我们的仓库每日都有新的commit,这样一来代码变动都是很大的,并且很多功能都没有完成,你可能跑步起来或者跑起来了还有很多问题。我们将在基础功能完成后,进行很大的Code Review工作和测试工作,现在请不要将代码用于生产环境的构建。

详细关注Release Tags

## 最近UI截屏
<p>
<img width="200px" src="snapshot.png"/>
<img width="200px" src="snapshot_me.png"/>
<img width="200px" src="snapshot_wallet.png"/>
<img width="200px" src="snapshot_notifications.png"/>
<img width="200px" src="snapshot_collection.png"/>
<img width="200px" src="snapshot_dartmode_1.png"/>
<img width="200px" src="snapshot_dartmode_2.png"/>
<img width="200px" src="snapshot_skeleton.png"/>
<img width="200px" src="snapshot_create.png"/>
<img width="200px" src="snapshot_detail.png">
<img width="200px" src="./snapshots/snapshot.png"/>
<img width="200px" src="./snapshots/snapshot_me.png"/>
<img width="200px" src="./snapshots/snapshot_wallet.png"/>
<img width="200px" src="./snapshots/snapshot_notifications.png"/>
<img width="200px" src="./snapshots/snapshot_collection.png"/>
<img width="200px" src="./snapshots/snapshot_dartmode_1.png"/>
<img width="200px" src="./snapshots/snapshot_dartmode_2.png"/>
<img width="200px" src="./snapshots/snapshot_skeleton.png"/>
<img width="200px" src="./snapshots/snapshot_create.png"/>
<img width="200px" src="./snapshots/snapshot_detail.png">
<img width="200px" src="./snapshots/snapshot_android.png">
</p>

### 一起开发
了解开发进度,或者有疑问,可以加我微信奥
<p><img width="200px" src="wechat.jpeg"/> </p>
<p><img width="200px" src="./snapshots/wechat.jpeg"/> </p>

## 一些隐藏的功能
有的时候因为不同需要,有的功能可能开发了,但是并没有直接启用,因为这些功能取决于你的后端情况或者偏好。
Expand Down Expand Up @@ -78,12 +89,20 @@ void dispose() {
```

### 启动调试
首先,要确认你的Flutter版本
```yaml
environment:
sdk: ">=2.6.0 <3.0.0"
```
你可以使用命令行开启调试,如果你使用android studio,你可以直接运行。
不过在此之前值得说明的是,如果你的网络不能正常快速访问一些技术类网站,建议你使用pub国内源,你可以搜索找到配置的方式。
```sh
cd ./discuz
flutter run
```
项目中的 ./dependencies 本地化了一些依赖,这些依赖有改动所以没有直接使用pub.dev中的进行安装。
我们推荐使用IOS模拟器开始你的调试,如果你Build Android版本,首先你需要生成一个keystore文件,存储到 ./discuz/android/目录下,并命名为android.keystore
接下来,将同目录下的 key.properties.example 文件修改为 key.properties 并更新里面的签名配置内容。切记不要将其提交到Git,这些签名文件是涉及安全的。其次你还可以根据需要修改gradle文件,我们默认下使用了国内的源。

## 如何自定义主体颜色,字体大小
App自设计开始就设计了支持主题模式,所以你可以在lib/ui/ui.dart修改对应的参数,在lib/utils/global.dart中修改对应的参数完整定制。
Expand Down
13 changes: 13 additions & 0 deletions dependencies/flutter_udid/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# See https://www.dartlang.org/guides/libraries/private-files

# Files and directories created by pub
.dart_tool/
.packages
.pub/
build/
# If you're building an application, you may want to check-in your pubspec.lock
pubspec.lock

# Directory created by dartdoc
# If you don't generate documentation locally you can remove this line.
doc/api/
3 changes: 3 additions & 0 deletions dependencies/flutter_udid/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
1 change: 1 addition & 0 deletions dependencies/flutter_udid/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
25 changes: 25 additions & 0 deletions dependencies/flutter_udid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# UDID(唯一设备标识符)

UDID`s full name is Unique Device Identifier。

Android reference:
https://blog.csdn.net/sunsteam/article/details/73189268
iOS reference:
https://github.com/herody/UQIDDemo



Sample usage to check current status:

```dart
import 'package:udid/udid.dart';
String udid = await Udid.udid;
```
## Getting Started

For help getting started with Flutter, view our online
[documentation](https://flutter.io/).

For help on editing plugin code, view the [documentation](https://flutter.io/developing-packages/#edit-plugin-package).

8 changes: 8 additions & 0 deletions dependencies/flutter_udid/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
34 changes: 34 additions & 0 deletions dependencies/flutter_udid/android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
group 'com.ly.udid'
version '1.0-SNAPSHOT'

buildscript {
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}

rootProject.allprojects {
repositories {
google()
jcenter()
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 29

defaultConfig {
minSdkVersion 16
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
}
}
2 changes: 2 additions & 0 deletions dependencies/flutter_udid/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
1 change: 1 addition & 0 deletions dependencies/flutter_udid/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'udid'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ly.udid">
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.ly.udid;

import android.os.Build;
import android.provider.Settings;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry.Registrar;

public class UdidPlugin implements MethodCallHandler {
private Registrar registrar;

private UdidPlugin(Registrar registrar) {
this.registrar = registrar;
}

public static void registerWith(Registrar registrar) {
final MethodChannel channel = new MethodChannel(registrar.messenger(), "plugins.ly.com/udid");
channel.setMethodCallHandler(new UdidPlugin(registrar));
}

@Override
public void onMethodCall(MethodCall call, Result result) {
if (call.method.equals("udid")) {
result.success(getUniqueId());
} else {
result.notImplemented();
}
}

// https://blog.csdn.net/sunsteam/article/details/73189268
private String getUniqueId() {
String androidID = Settings.Secure.getString(registrar.activity().getContentResolver(), Settings.Secure.ANDROID_ID);
String id = androidID + Build.SERIAL;
return md5(id);
}

private static String md5(String string) {
byte[] hash;
try {
hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Huh, MD5 should be supported?", e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Huh, UTF-8 should be supported?", e);
}
StringBuilder hex = new StringBuilder(hash.length * 2);
for (byte b : hash) {
if ((b & 0xFF) < 0x10)
hex.append("0");
hex.append(Integer.toHexString(b & 0xFF));
}
return hex.toString();
}
}
36 changes: 36 additions & 0 deletions dependencies/flutter_udid/ios/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.idea/
.vagrant/
.sconsign.dblite
.svn/

.DS_Store
*.swp
profile

DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m

.generated/

*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3

!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3

xcuserdata

*.moved-aside

*.pyc
*sync/
Icon?
.tags*

/Flutter/Generated.xcconfig
Empty file.
4 changes: 4 additions & 0 deletions dependencies/flutter_udid/ios/Classes/UdidPlugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#import <Flutter/Flutter.h>

@interface UdidPlugin : NSObject<FlutterPlugin>
@end
32 changes: 32 additions & 0 deletions dependencies/flutter_udid/ios/Classes/UdidPlugin.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#import "UdidPlugin.h"
#import "YDDevice.h"
#import <CommonCrypto/CommonDigest.h>

@implementation UdidPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
FlutterMethodChannel* channel = [FlutterMethodChannel
methodChannelWithName:@"plugins.ly.com/udid"
binaryMessenger:[registrar messenger]];
UdidPlugin* instance = [[UdidPlugin alloc] init];
[registrar addMethodCallDelegate:instance channel:channel];
}

- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if ([@"udid" isEqualToString:call.method]) {
result([self md5:[YDDevice getUQID]]);
} else {
result(FlutterMethodNotImplemented);
}
}

- (NSString *) md5:(NSString *) input {
const char *cStr = [input UTF8String];
unsigned char digest[CC_MD5_DIGEST_LENGTH];
CC_MD5( cStr, strlen(cStr), digest ); // This is the md5 call
NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
[output appendFormat:@"%02x", digest[i]];
return output;
}

@end
18 changes: 18 additions & 0 deletions dependencies/flutter_udid/ios/Classes/YDDevice.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface YDDevice : NSObject

//获取IDFA
+ (NSString *)getIDFA;

//获取IDFV
+ (NSString *)getIDFV;

//获取UUID
+ (NSString *)getUUID;

//获取UQID
+ (NSString *)getUQID;

@end
Loading

0 comments on commit 041250d

Please sign in to comment.