Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Switch/Add servers without logging in/out #51

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

kunall17
Copy link
Collaborator

@kunall17 kunall17 commented Apr 17, 2016

Developed #47 and also fixes #1

  • Ability to add your own server
  • Give a name to the server you are saving.
  • Ability to add new servers
  • 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!

@smarx
Copy link

smarx commented Apr 17, 2016

Automated message from Dropbox CLA bot

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

@ryansnowboarder
Copy link

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.

@kunall17
Copy link
Collaborator Author

kunall17 commented Apr 20, 2016

@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.

@ryansnowboarder
Copy link

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
#51 (comment)

@niftynei
Copy link
Contributor

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

@kunall17
Copy link
Collaborator Author

@niftynei rebased and updated this branch! :)

@niftynei
Copy link
Contributor

@kunall17 what's the status of this PR?

username = you.getEmail();
} catch (Exception e) {
//SQL Exception can occur if name is not updated!
ZLog.logException(e);
Copy link
Contributor

@niftynei niftynei Aug 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what cases would username be null?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be, as setEmail is being called always before this is called!

@niftynei
Copy link
Contributor

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
Copy link
Contributor

@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 (?,

@kunall17
Copy link
Collaborator Author

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

@niftynei
Copy link
Contributor

niftynei commented Aug 16, 2016

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 :)

@kunall17
Copy link
Collaborator Author

kunall17 commented Aug 17, 2016

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!

realmNameET = (EditText) findViewById(R.id.realmName);
if (getIntent().getBooleanExtra("FROM_ADDREALM", false)) {
startedFromAddRealm = true;
((TextView) findViewById(R.id.textView1)).setText(R.string.add_realm);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kunall17 this is possibly a rebasing error, but i can't get my version of this to compile because it can't find the textView1 view.

This GlobalSettings will store all the info about the saved
realms.
@kunall17
Copy link
Collaborator Author

Updated the branch!

@niftynei
Copy link
Contributor

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

@kunall17
Copy link
Collaborator Author

@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.

@niftynei
Copy link
Contributor

@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.

@timabbott
Copy link
Member

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

@kunall17
Copy link
Collaborator Author

@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!

@saketkumar
Copy link
Collaborator

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

@kunall17
Copy link
Collaborator Author

@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!

@yadav-rahul
Copy link
Collaborator

@kunall17 Can I test this PR?

@kunall17
Copy link
Collaborator Author

@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!

@zulipbot
Copy link
Member

Heads up @kunall17, we just merged some commits (latest: 471dca2) 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update login form to support zulip servers that aren't zulip.com
8 participants