Skip to content

Commit b3540fe

Browse files
committed
Fix two crashes, lint warnings and an errant log message. Bump to v43 in anticipation of release
1 parent 2afb60e commit b3540fe

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ android {
1111
compileSdk 34
1212
minSdkVersion 29
1313
targetSdkVersion 34
14-
versionCode 42
15-
versionName "0.42"
14+
versionCode 43
15+
versionName "0.43"
1616
multiDexEnabled true
1717
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1818
resourceConfigurations += ['en']

app/src/main/java/io/pijun/george/MessageProcessor.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import io.pijun.george.queue.PersistentQueue;
3333
import retrofit2.Response;
3434
import xyz.zood.george.AvatarManager;
35+
import xyz.zood.george.Permissions;
3536
import xyz.zood.george.service.LocationService;
3637
import xyz.zood.george.service.ScreamerService;
3738
import xyz.zood.george.worker.BackupDatabaseWorker;
@@ -348,6 +349,17 @@ private static Result handleLocationUpdateRequest(@NonNull Context context, @Non
348349
return Result.Success;
349350
}
350351

352+
// does the app have background location permission?
353+
if (!Permissions.checkBackgroundLocationPermission(context)) {
354+
// we don't, so just inform the requester that we're done providing updates
355+
UserComm done = UserComm.newLocationUpdateRequestReceived(UserComm.LOCATION_UPDATE_REQUEST_ACTION_FINISHED);
356+
String errMsg = OscarClient.immediatelySendMessage(userRecord, accessToken, keyPair, done, true, true);
357+
if (errMsg != null) {
358+
L.w(errMsg);
359+
}
360+
return Result.Success;
361+
}
362+
351363
// Only perform the update if it's been more than 3 minutes since the last one
352364
// and the app isn't in the foreground
353365
long timeSinceUpdate = System.currentTimeMillis() - updateTime;

app/src/main/java/io/pijun/george/Utils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ public static boolean isValidEmail(String email) {
116116
}
117117

118118
String local = parts[0];
119-
if (local.length() == 0 || local.length() > 64) {
119+
if (local.isEmpty() || local.length() > 64) {
120120
return false;
121121
}
122122

123123
// check if we have the format of a domain
124124
String domain = parts[1];
125-
if (domain.length() == 0 || domain.length() > 255) {
125+
if (domain.isEmpty() || domain.length() > 255) {
126126
return false;
127127
}
128128
String[] domainParts = domain.split("\\.");

app/src/main/java/io/pijun/george/WelcomeActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ public void onRegisterAction() {
357357

358358
final Editable password = binding.regPassword.getText();
359359
if (password == null || password.length() < Constants.PASSWORD_TEXT_MIN_LENGTH) {
360-
L.i("reg password: '" + password + "'");
361360
binding.regPasswordContainer.setError(getString(R.string.too_short));
362361
foundError = true;
363362
}

app/src/main/java/io/pijun/george/api/OscarSocket.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ public void run() {
110110
@AnyThread
111111
public void disconnect() {
112112
L.i("socket.cancel");
113-
socket.cancel();
113+
if (socket != null) {
114+
socket.cancel();
115+
}
114116
}
115117

116118
@AnyThread

app/src/main/java/xyz/zood/george/service/LocationService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ private void startForegroundService() {
112112
Notification notification = new NotificationCompat.Builder(this, FINDING_LOCATION_CHANNEL_ID)
113113
.setContentTitle(getString(R.string.finding_your_location))
114114
.setSmallIcon(R.drawable.ic_position_service)
115+
.setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE)
115116
.build();
116117
startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
117118
}

0 commit comments

Comments
 (0)