diff --git a/mastodon/build.gradle b/mastodon/build.gradle index 50ceac09..67164cef 100644 --- a/mastodon/build.gradle +++ b/mastodon/build.gradle @@ -13,8 +13,8 @@ android { applicationId "org.joinmastodon.android" minSdk 23 targetSdk 34 - versionCode 119 - versionName "2.7.0" + versionCode 120 + versionName "2.7.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -90,7 +90,7 @@ dependencies { implementation 'me.grishka.litex:viewpager:1.0.0' implementation 'me.grishka.litex:viewpager2:1.0.0' implementation 'me.grishka.litex:palette:1.0.0' - implementation 'me.grishka.appkit:appkit:1.4.0' + implementation 'me.grishka.appkit:appkit:1.4.1' implementation 'com.google.code.gson:gson:2.8.9' implementation 'org.jsoup:jsoup:1.14.3' implementation 'com.squareup:otto:1.3.8' diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSession.java b/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSession.java index fc82d7f9..00eca9a4 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSession.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSession.java @@ -119,9 +119,11 @@ public class AccountSession{ activated=(flags & FLAG_ACTIVATED)==FLAG_ACTIVATED; needUpdatePushSettings=(flags & FLAG_NEED_UPDATE_PUSH_SETTINGS)==FLAG_NEED_UPDATE_PUSH_SETTINGS; JsonObject pushKeys=JsonParser.parseString(values.getAsString("push_keys")).getAsJsonObject(); - pushAuthKey=pushKeys.get("auth").getAsString(); - pushPrivateKey=pushKeys.get("private").getAsString(); - pushPublicKey=pushKeys.get("public").getAsString(); + if(!pushKeys.get("auth").isJsonNull() && !pushKeys.get("private").isJsonNull() && !pushKeys.get("public").isJsonNull()){ + pushAuthKey=pushKeys.get("auth").getAsString(); + pushPrivateKey=pushKeys.get("private").getAsString(); + pushPublicKey=pushKeys.get("public").getAsString(); + } pushSubscription=MastodonAPIController.gson.fromJson(values.getAsString("push_subscription"), PushSubscription.class); JsonObject legacyFilters=JsonParser.parseString(values.getAsString("legacy_filters")).getAsJsonObject(); wordFilters=MastodonAPIController.gson.fromJson(legacyFilters.getAsJsonArray("filters"), new TypeToken>(){}.getType()); diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSessionManager.java b/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSessionManager.java index 022b361c..f4c0a06d 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSessionManager.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountSessionManager.java @@ -714,8 +714,7 @@ public class AccountSessionManager{ File file=new File(MastodonApp.context.getFilesDir(), "instance_"+domain.replace('.', '_')+".json"); try(FileInputStream in=new FileInputStream(file)){ JsonObject jobj=JsonParser.parseReader(new InputStreamReader(in, StandardCharsets.UTF_8)).getAsJsonObject(); - - insertInstanceIntoDatabase(db, domain, MastodonAPIController.gson.fromJson(jobj.get("instance"), Instance.class), + insertInstanceIntoDatabase(db, domain, MastodonAPIController.gson.fromJson(jobj.get(jobj.has("instance") ? "instance" : "a"), Instance.class), MastodonAPIController.gson.fromJson(jobj.get("emojis"), new TypeToken<>(){}.getType()), jobj.get("last_updated").getAsLong()); }catch(Exception x){ Log.w(TAG, "Error reading instance info file for "+domain, x); diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/onboarding/SignupFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/onboarding/SignupFragment.java index d3516bbc..e027e3a0 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/onboarding/SignupFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/onboarding/SignupFragment.java @@ -42,6 +42,7 @@ import org.jsoup.nodes.TextNode; import org.jsoup.select.NodeVisitor; import org.parceler.Parcels; +import java.time.Instant; import java.time.ZoneId; import java.util.Arrays; import java.util.HashSet; @@ -237,6 +238,11 @@ public class SignupFragment extends ToolbarFragment{ fakeAccount.acct=fakeAccount.username=username; fakeAccount.id="tmp"+System.currentTimeMillis(); fakeAccount.displayName=displayName.getText().toString(); + fakeAccount.createdAt=Instant.now(); + fakeAccount.username=username; + fakeAccount.acct=username; + fakeAccount.url="https://"+instance.getDomain()+"/@"+username; + fakeAccount.avatar=fakeAccount.avatarStatic=fakeAccount.headerStatic=fakeAccount.header=fakeAccount.note=""; AccountSessionManager.getInstance().addAccount(instance, result, fakeAccount, apiApplication, new AccountActivationInfo(email, System.currentTimeMillis())); Bundle args=new Bundle(); args.putString("account", AccountSessionManager.getInstance().getLastActiveAccountID());