Skip to content

Commit

Permalink
Update to reflect isContentAvailable supports iPhone 6s and newer
Browse files Browse the repository at this point in the history
  • Loading branch information
devinbileck committed Oct 30, 2019
1 parent 0cdf54a commit 4c27d08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions core/src/main/java/bisq/core/notifications/MobileModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ boolean parseDescriptor(String descriptor) {
iPad Pro 12.9 Inch 2. Generation
iPad Pro 10.5 Inch
*/
// iPhone 6 does not support isContentAvailable, iPhone 7 does.
// iPhone 6 does not support isContentAvailable, iPhone 6s and 7 does.
// We don't know for other versions, but lets assume all above iPhone 6 are ok.
if (descriptor != null) {
String[] descriptorTokens = descriptor.split(" ");
Expand All @@ -143,14 +143,17 @@ boolean parseDescriptor(String descriptor) {
if (Arrays.asList(validVersions).contains(versionString)) {
return true;
}
String versionSuffix = "";
if (versionString.matches("\\d[^\\d]")) {
versionSuffix = versionString.substring(1);
versionString = versionString.substring(0, 1);
} else if (versionString.matches("\\d{2}[^\\d]")) {
versionSuffix = versionString.substring(2);
versionString = versionString.substring(0, 2);
}
try {
int version = Integer.parseInt(versionString);
return version > 5;
return version > 6 || (version == 6 && versionSuffix.equalsIgnoreCase("s"));
} catch (Throwable ignore) {
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public void testParseDescriptor() {
new Tuple2<>("iPhone 5c", false),
new Tuple2<>("iPhone 5s", false),

new Tuple2<>("iPhone 6", true),
new Tuple2<>("iPhone 6 Plus", true),
new Tuple2<>("iPhone 6", false),
new Tuple2<>("iPhone 6 Plus", false),
new Tuple2<>("iPhone 6s", true),
new Tuple2<>("iPhone 6s Plus", true),

Expand Down

0 comments on commit 4c27d08

Please sign in to comment.