Skip to content

Commit

Permalink
Changed android UUID flow, again
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Mar 9, 2018
1 parent 2a306d7 commit 1d83e94
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
28 changes: 12 additions & 16 deletions android/src/io/anuke/mindustry/AndroidLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,6 @@ public byte[] getUUID() {
String s = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);

if(s == null){
Settings.defaults("uuid", "");

String uuid = Settings.getString("uuid");
if(uuid.isEmpty()){
byte[] result = new byte[8];
new Random().nextBytes(result);
uuid = new String(Base64Coder.encode(result));
Settings.putString("uuid", uuid);
Settings.save();
return result;
}
return Base64Coder.decode(uuid);
}

int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
Expand All @@ -132,7 +117,18 @@ public byte[] getUUID() {

return data;
}catch (Exception e){
return null;
Settings.defaults("uuid", "");

String uuid = Settings.getString("uuid");
if(uuid.isEmpty()){
byte[] result = new byte[8];
new Random().nextBytes(result);
uuid = new String(Base64Coder.encode(result));
Settings.putString("uuid", uuid);
Settings.save();
return result;
}
return Base64Coder.decode(uuid);
}
}
};
Expand Down
6 changes: 3 additions & 3 deletions core/assets/version.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Autogenerated file. Do not modify.
#Thu Mar 08 20:46:47 EST 2018
#Thu Mar 08 22:36:02 EST 2018
version=release
androidBuildCode=357
androidBuildCode=359
name=Mindustry
code=3.4
build=33
build=custom build

0 comments on commit 1d83e94

Please sign in to comment.