mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Update for new username API
This commit is contained in:
parent
9f7437aa9e
commit
4f58bc11a1
@ -464,7 +464,7 @@
|
|||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||||
|
|
||||||
<!-- Loki -->
|
<!-- Loki -->
|
||||||
<activity android:name="org.thoughtcrime.securesms.loki.AccountDetailsActivity"
|
<activity android:name="org.thoughtcrime.securesms.loki.DisplayNameActivity"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:theme="@style/TextSecure.DarkRegistrationTheme"
|
android:theme="@style/TextSecure.DarkRegistrationTheme"
|
||||||
android:windowSoftInputMode="stateUnchanged"
|
android:windowSoftInputMode="stateUnchanged"
|
||||||
|
@ -35,11 +35,15 @@ import org.thoughtcrime.securesms.components.emoji.EmojiKeyboardProvider;
|
|||||||
import org.thoughtcrime.securesms.components.emoji.EmojiToggle;
|
import org.thoughtcrime.securesms.components.emoji.EmojiToggle;
|
||||||
import org.thoughtcrime.securesms.components.emoji.MediaKeyboard;
|
import org.thoughtcrime.securesms.components.emoji.MediaKeyboard;
|
||||||
import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto;
|
import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto;
|
||||||
|
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
||||||
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil;
|
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil;
|
||||||
import org.thoughtcrime.securesms.database.Address;
|
import org.thoughtcrime.securesms.database.Address;
|
||||||
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
import org.thoughtcrime.securesms.dependencies.InjectableType;
|
import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||||
import org.thoughtcrime.securesms.jobs.MultiDeviceProfileKeyUpdateJob;
|
import org.thoughtcrime.securesms.jobs.MultiDeviceProfileKeyUpdateJob;
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
|
import org.thoughtcrime.securesms.loki.LokiAPIDatabase;
|
||||||
|
import org.thoughtcrime.securesms.loki.LokiUserDatabase;
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||||
import org.thoughtcrime.securesms.profiles.AvatarHelper;
|
import org.thoughtcrime.securesms.profiles.AvatarHelper;
|
||||||
@ -57,6 +61,7 @@ import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
|
|||||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||||
import org.whispersystems.signalservice.api.crypto.ProfileCipher;
|
import org.whispersystems.signalservice.api.crypto.ProfileCipher;
|
||||||
import org.whispersystems.signalservice.api.util.StreamDetails;
|
import org.whispersystems.signalservice.api.util.StreamDetails;
|
||||||
|
import org.whispersystems.signalservice.loki.api.LokiGroupChatAPI;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -368,6 +373,12 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje
|
|||||||
|
|
||||||
TextSecurePreferences.setProfileName(context, name);
|
TextSecurePreferences.setProfileName(context, name);
|
||||||
|
|
||||||
|
String userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(context);
|
||||||
|
byte[] userPrivateKey = IdentityKeyUtil.getIdentityKeyPair(context).getPrivateKey().serialize();
|
||||||
|
LokiAPIDatabase apiDatabase = DatabaseFactory.getLokiAPIDatabase(context);
|
||||||
|
LokiUserDatabase userDatabase = DatabaseFactory.getLokiUserDatabase(context);
|
||||||
|
new LokiGroupChatAPI(userHexEncodedPublicKey, userPrivateKey, apiDatabase, userDatabase).setDisplayName(name, LokiGroupChatAPI.getPublicChatServer());
|
||||||
|
|
||||||
// Loki - Original code
|
// Loki - Original code
|
||||||
// ========
|
// ========
|
||||||
// try {
|
// try {
|
||||||
|
@ -8,10 +8,13 @@ import network.loki.messenger.R
|
|||||||
import org.thoughtcrime.securesms.ApplicationContext
|
import org.thoughtcrime.securesms.ApplicationContext
|
||||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
import org.thoughtcrime.securesms.ConversationListActivity
|
import org.thoughtcrime.securesms.ConversationListActivity
|
||||||
|
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
|
||||||
|
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||||
import org.whispersystems.signalservice.api.crypto.ProfileCipher
|
import org.whispersystems.signalservice.api.crypto.ProfileCipher
|
||||||
|
import org.whispersystems.signalservice.loki.api.LokiGroupChatAPI
|
||||||
|
|
||||||
class AccountDetailsActivity : BaseActionBarActivity() {
|
class DisplayNameActivity : BaseActionBarActivity() {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@ -38,5 +41,12 @@ class AccountDetailsActivity : BaseActionBarActivity() {
|
|||||||
application.startLongPollingIfNeeded()
|
application.startLongPollingIfNeeded()
|
||||||
startActivity(Intent(this, ConversationListActivity::class.java))
|
startActivity(Intent(this, ConversationListActivity::class.java))
|
||||||
finish()
|
finish()
|
||||||
|
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(this)
|
||||||
|
val userPrivateKey = IdentityKeyUtil.getIdentityKeyPair(this).privateKey.serialize()
|
||||||
|
val apiDatabase = DatabaseFactory.getLokiAPIDatabase(this)
|
||||||
|
val userDatabase = DatabaseFactory.getLokiUserDatabase(this)
|
||||||
|
if (name != null) {
|
||||||
|
LokiGroupChatAPI(userHexEncodedPublicKey, userPrivateKey, apiDatabase, userDatabase).setDisplayName(name, LokiGroupChatAPI.publicChatServer)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -34,9 +34,9 @@ class LokiGroupChatPoller(private val context: Context, private val group: LokiG
|
|||||||
|
|
||||||
private val api: LokiGroupChatAPI
|
private val api: LokiGroupChatAPI
|
||||||
get() = {
|
get() = {
|
||||||
|
val userPrivateKey = IdentityKeyUtil.getIdentityKeyPair(context).privateKey.serialize()
|
||||||
val lokiAPIDatabase = DatabaseFactory.getLokiAPIDatabase(context)
|
val lokiAPIDatabase = DatabaseFactory.getLokiAPIDatabase(context)
|
||||||
val lokiUserDatabase = DatabaseFactory.getLokiUserDatabase(context)
|
val lokiUserDatabase = DatabaseFactory.getLokiUserDatabase(context)
|
||||||
val userPrivateKey = IdentityKeyUtil.getIdentityKeyPair(context).privateKey.serialize()
|
|
||||||
LokiGroupChatAPI(userHexEncodedPublicKey, userPrivateKey, lokiAPIDatabase, lokiUserDatabase)
|
LokiGroupChatAPI(userHexEncodedPublicKey, userPrivateKey, lokiAPIDatabase, lokiUserDatabase)
|
||||||
}()
|
}()
|
||||||
// endregion
|
// endregion
|
||||||
|
@ -161,7 +161,7 @@ class SeedActivity : BaseActionBarActivity() {
|
|||||||
Mode.Register -> Analytics.shared.track("Seed Created")
|
Mode.Register -> Analytics.shared.track("Seed Created")
|
||||||
Mode.Restore -> Analytics.shared.track("Seed Restored")
|
Mode.Restore -> Analytics.shared.track("Seed Restored")
|
||||||
}
|
}
|
||||||
startActivity(Intent(this, AccountDetailsActivity::class.java))
|
startActivity(Intent(this, DisplayNameActivity::class.java))
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user