-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
virskor
committed
Mar 25, 2020
1 parent
4b86fd9
commit 041250d
Showing
71 changed files
with
1,322 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 0.0.1 | ||
|
||
* TODO: Describe initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO: Add your license here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
org.gradle.jvmargs=-Xmx1536M | ||
android.enableR8=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = 'udid' |
3 changes: 3 additions & 0 deletions
3
dependencies/flutter_udid/android/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
61 changes: 61 additions & 0 deletions
61
dependencies/flutter_udid/android/src/main/java/com/ly/udid/UdidPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#import <Flutter/Flutter.h> | ||
|
||
@interface UdidPlugin : NSObject<FlutterPlugin> | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.