zulip-android-legacy icon indicating copy to clipboard operation
zulip-android-legacy copied to clipboard

Switch/Add servers without logging in/out

Open kunall17 opened this issue 8 years ago • 23 comments

Developed #47 and also fixes #1

  • [x] Ability to add your own server
  • [x] Give a name to the server you are saving.
  • [x] Ability to add new servers
  • [x] Switch between these servers/user accounts.

Screenshots:

This saves the newly added servers in a new sharedPreference, hence saving their api_key which is further used for the authentication!

kunall17 avatar Apr 17 '16 11:04 kunall17

Automated message from Dropbox CLA bot

@kunall17, it looks like you've already signed the Dropbox CLA. Thanks!

smarx avatar Apr 17 '16 11:04 smarx

Hey bro,

I'm having problems connecting zulip/zulip-android/master branch to my localhost with the login hack for [email protected]. Does your code connect to localhost without any problems?

I'll fork it if I don't hear a response within the next few hours and try it myself - I just thought I would ask the most knowledgeable person first.

ryansnowboarder avatar Apr 19 '16 15:04 ryansnowboarder

@ryansnowboarder problems as in? your server URL is not taken or you cannot sign in? I haven't tested with the iago hack, And if you are talking about forking this branch then i have commented out the IAGO hack as there's no point of having it anymore because you have to specify the server now.

And sorry, I am not the most knowledgeable person here.

kunall17 avatar Apr 20 '16 01:04 kunall17

My problem is that my local hosted Zulip server does not respond to HTTP Requests from the app on the Android Emulator and an Android device. Works fine with curl from the command prompt though. I've tried allowing everything through the firewall while sending a request and that didn't fix it. I tried connecting to the Zulip server from the browser from the browser and device, which showed a socket error.

I ran out of time and didn't fork your repo, but I'll do that soon to see if it works.

On Tue, Apr 19, 2016 at 9:33 PM, Kunal Gupta [email protected] wrote:

@ryansnowboarder https://github.com/ryansnowboarder problems as in? your server URL is not taken or you cannot sign in? I haven't tested with the iago hack.

And sorry, I am not the most knowledgeable person here.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/zulip/zulip-android/pull/51#issuecomment-212202366

ryansnowboarder avatar Apr 20 '16 17:04 ryansnowboarder

@kunall17 if it's not too much trouble, do you mind rebasing this against master?

niftynei avatar May 10 '16 13:05 niftynei

@niftynei rebased and updated this branch! :)

kunall17 avatar Jun 27 '16 18:06 kunall17

@kunall17 what's the status of this PR?

niftynei avatar Jul 19 '16 00:07 niftynei

Hello kunal. I wasn't able to try this out because of the merge conflicts, but I left some notes on the code. Thanks!

niftynei avatar Aug 12 '16 19:08 niftynei

@kunall17 I got a crash when I successfully logged into a second realm.

08-16 13:59:17.490 E/AndroidRuntime(10928): FATAL EXCEPTION: main
08-16 13:59:17.490 E/AndroidRuntime(10928): Process: com.zulip.android.dev, PID: 10928
08-16 13:59:17.490 E/AndroidRuntime(10928): java.lang.RuntimeException: java.sql.SQLException: Unable to run insert stmt on object com.zulip.android.models.Stream@2275a78e: INSERT INTO `streams` (`color` ,`inHomeView` ,`inviteOnly` ,`name` ,`subscribed` ) VALUES (?,?,?,?,?)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at com.j256.ormlite.dao.RuntimeExceptionDao.createIfNotExists(RuntimeExceptionDao.java:240)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at com.zulip.android.models.Stream.getByName(Stream.java:138)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at com.zulip.android.activities.ZulipActivity$20.setViewValue(ZulipActivity.java:690)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.SimpleCursorTreeAdapter.bindView(SimpleCursorTreeAdapter.java:220)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.SimpleCursorTreeAdapter.bindGroupView(SimpleCursorTreeAdapter.java:264)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.CursorTreeAdapter.getGroupView(CursorTreeAdapter.java:207)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.ExpandableListConnector.getView(ExpandableListConnector.java:446)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.AbsListView.obtainView(AbsListView.java:2346)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.ListView.makeAndAddView(ListView.java:1876)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.ListView.fillSpecific(ListView.java:1355)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.ListView.layoutChildren(ListView.java:1663)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.AbsListView.onLayout(AbsListView.java:2148)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.View.layout(View.java:16636)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.ViewGroup.layout(ViewGroup.java:5437)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1215)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.View.layout(View.java:16636)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.ViewGroup.layout(ViewGroup.java:5437)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.View.layout(View.java:16636)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.ViewGroup.layout(ViewGroup.java:5437)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1735)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1579)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1488)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.View.layout(View.java:16636)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.ViewGroup.layout(ViewGroup.java:5437)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.View.layout(View.java:16636)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.ViewGroup.layout(ViewGroup.java:5437)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1735)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1579)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1488)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.View.layout(View.java:16636)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.ViewGroup.layout(ViewGroup.java:5437)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.View.layout(View.java:16636)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.ViewGroup.layout(ViewGroup.java:5437)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2179)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1939)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1115)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6023)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.Choreographer.doCallbacks(Choreographer.java:670)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.Choreographer.doFrame(Choreographer.java:606)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.os.Handler.handleCallback(Handler.java:739)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.os.Handler.dispatchMessage(Handler.java:95)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.os.Looper.loop(Looper.java:148)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at android.app.ActivityThread.main(ActivityThread.java:5422)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at java.lang.reflect.Method.invoke(Native Method)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
08-16 13:59:17.490 E/AndroidRuntime(10928):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
08-16 13:59:17.490 E/AndroidRuntime(10928): Caused by: java.sql.SQLException: Unable to run insert stmt on object com.zulip.android.models.Stream@2275a78e: INSERT INTO `streams` (`color` ,`inHomeView` ,`inviteOnly` ,`name` ,`subscribed` ) VALUES (?,

niftynei avatar Aug 16 '16 18:08 niftynei

If you used the DevAuthBackEnd in the second login attempt (when adding realm) then this should fix the error!

kunall17 avatar Aug 16 '16 20:08 kunall17

it seems to work ok now, is there some context for why this occurs? otherwise it looks really good and i'd love to get it merged in 👍

cc @kunall17 :)

niftynei avatar Aug 16 '16 22:08 niftynei

If you had tried devAuthBackEnd then this error seems valid before the fix, otherwise it shouldn't occur! Never encountered this error! Updated the branch as well!

kunall17 avatar Aug 17 '16 03:08 kunall17

Updated the branch!

kunall17 avatar Aug 23 '16 04:08 kunall17

@kunall17 this is super old, but do you have any interest in reviving this PR?

niftynei avatar Oct 19 '16 21:10 niftynei

@niftynei yeah sure! There would be a complexity with the widget implemented now We'll have to show from which user are these messages from.

kunall17 avatar Oct 21 '16 04:10 kunall17

@kunall17 awesome! is there a way for the widget to only be registered for messages from a single realm? for example if you log in to more than realm, you pick which realm to see messages for in the configuration activity. just an idea.

niftynei avatar Oct 21 '16 17:10 niftynei

@kunall17 what's the status of this PR? Is it still something we intend to do?

timabbott avatar Dec 15 '16 22:12 timabbott

@timabbott yeah definitely, this is one great feature, but after migration to retrofit this PR would have to undergo a lot of changes, I'll see to update this one!

kunall17 avatar Dec 16 '16 04:12 kunall17

@kunall17 This is really a great feature. Tell me if you need any kind of help in this. I would be happy to help. :)

saketkumar avatar Dec 21 '16 23:12 saketkumar

@saketkumar95 sure if you want to revive this PR, you can use the commits in this PR! Just make sure you will have to edit the widget as well!

kunall17 avatar Dec 27 '16 18:12 kunall17

@kunall17 Can I test this PR?

yadav-rahul avatar Jan 29 '17 15:01 yadav-rahul

@yadav-rahul

Can I test this PR?

Testing? This works as expected but this one is very old, and will have to be worked intensively to be revived again! If you want you can definitely use the the commits and fix the merge conflicts and post as PR!

kunall17 avatar Jan 30 '17 10:01 kunall17

Heads up @kunall17, we just merged some commits (latest: 471dca2a6ad26daf4d57505c8f675b4ea31f1a8f) that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master branch and resolve your pull request's merge conflicts accordingly.

zulipbot avatar May 22 '17 21:05 zulipbot