mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
remove duplicate code (#312)
* remove duplicate code * Update login.dart
This commit is contained in:
committed by
GitHub
parent
192cd60a4f
commit
9e242fb902
@@ -3,6 +3,7 @@ import 'package:PiliPlus/http/constants.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/view.dart' show ReplyOption;
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
import '../models/msg/account.dart';
|
||||
import '../models/msg/session.dart';
|
||||
@@ -583,36 +584,37 @@ class MsgHttp {
|
||||
}
|
||||
|
||||
static String getDevId() {
|
||||
final List<String> b = [
|
||||
'0',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F'
|
||||
];
|
||||
final List<String> s = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split('');
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
if ('-' == s[i] || '4' == s[i]) {
|
||||
continue;
|
||||
}
|
||||
final int randomInt = Random().nextInt(16);
|
||||
if ('x' == s[i]) {
|
||||
s[i] = b[randomInt];
|
||||
} else {
|
||||
s[i] = b[3 & randomInt | 8];
|
||||
}
|
||||
}
|
||||
return s.join();
|
||||
return Uuid().v4();
|
||||
// final List<String> b = [
|
||||
// '0',
|
||||
// '1',
|
||||
// '2',
|
||||
// '3',
|
||||
// '4',
|
||||
// '5',
|
||||
// '6',
|
||||
// '7',
|
||||
// '8',
|
||||
// '9',
|
||||
// 'A',
|
||||
// 'B',
|
||||
// 'C',
|
||||
// 'D',
|
||||
// 'E',
|
||||
// 'F'
|
||||
// ];
|
||||
// final List<String> s = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split('');
|
||||
// for (int i = 0; i < s.length; i++) {
|
||||
// if ('-' == s[i] || '4' == s[i]) {
|
||||
// continue;
|
||||
// }
|
||||
// final int randomInt = Random().nextInt(16);
|
||||
// if ('x' == s[i]) {
|
||||
// s[i] = b[randomInt];
|
||||
// } else {
|
||||
// s[i] = b[3 & randomInt | 8];
|
||||
// }
|
||||
// }
|
||||
// return s.join();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user