Feature Request: Open Repo in browser #32

Manually merged
mmarif merged 7 commits from 6543/GitNex:open-repo-web into master 2019-09-11 06:27:01 +00:00
Member
Issue: https://gitea.com/mmarif/GitNex/issues/26
Owner

Thanks for the PR.

Adding it to the bottomsheet in repo detail is one way of dong it.

Another one which I am currently exploring(wip) is to add it to repo recyclerview with new menu which will have watchers, stars for the repo too.

But I will accept this PR as is to provide more flexibility.

Thanks for the PR. Adding it to the bottomsheet in repo detail is one way of dong it. Another one which I am currently exploring(wip) is to add it to repo recyclerview with new menu which will have watchers, stars for the repo too. But I will accept this PR as is to provide more flexibility.
mmarif added the
Feature
Major-release
labels 2019-09-05 10:14:55 +00:00
mmarif added this to the 2.0.0 milestone 2019-09-05 10:15:09 +00:00
Author
Member

@mmarif where can i read how bmListener contect event handler with a function?

83e3564c13 is a try but i dont get it jet ...

@mmarif where can i read how bmListener contect event handler with a function? https://gitea.com/6543/GitNex/commit/83e3564c136d4ee1e947c11951680aff3b834526 is a try but i dont get it jet ...
Owner

Thank you @6543. I will check it out.

Thank you @6543. I will check it out.
Owner

To make this PR work, here are the working updates.

You can safely remove OpenWebRepoActivity.java activity file.

Add the following in RepoDetailActivity.java activity file in onButtonClicked function.

case "openWebRepo":
                TinyDB tinyDb = new TinyDB(getApplicationContext());
                String repoFullName = tinyDb.getString("repoFullName");
                String instanceUrlWithProtocol = "https://" + tinyDb.getString("instanceUrlRaw");
                if(!tinyDb.getString("instanceUrlWithProtocol").isEmpty()) {
                    instanceUrlWithProtocol = tinyDb.getString("instanceUrlWithProtocol");
                }
                Uri url = Uri.parse(instanceUrlWithProtocol + "/" + repoFullName);
                Intent i = new Intent(Intent.ACTION_VIEW, url);
                startActivity(i);
                break;

And in LoginActivity.java file,

String instanceUrlWithProtocol;
        if(protocol.toLowerCase().equals("https")) {
            instanceUrl = "https://" + instanceHost + "/api/v1/";
            instanceUrlWithProtocol = "https://" + instanceHost;
        }
        else {
            instanceUrl = "http://" + instanceHost + "/api/v1/";
            instanceUrlWithProtocol = "http://" + instanceHost;
        }

        tinyDb.putString("instanceUrlWithProtocol", instanceUrlWithProtocol);

Do let me know if you need any help with it.

To make this PR work, here are the working updates. You can safely remove `OpenWebRepoActivity.java` activity file. Add the following in `RepoDetailActivity.java` activity file in `onButtonClicked` function. ``` case "openWebRepo": TinyDB tinyDb = new TinyDB(getApplicationContext()); String repoFullName = tinyDb.getString("repoFullName"); String instanceUrlWithProtocol = "https://" + tinyDb.getString("instanceUrlRaw"); if(!tinyDb.getString("instanceUrlWithProtocol").isEmpty()) { instanceUrlWithProtocol = tinyDb.getString("instanceUrlWithProtocol"); } Uri url = Uri.parse(instanceUrlWithProtocol + "/" + repoFullName); Intent i = new Intent(Intent.ACTION_VIEW, url); startActivity(i); break; ``` And in `LoginActivity.java` file, ``` String instanceUrlWithProtocol; if(protocol.toLowerCase().equals("https")) { instanceUrl = "https://" + instanceHost + "/api/v1/"; instanceUrlWithProtocol = "https://" + instanceHost; } else { instanceUrl = "http://" + instanceHost + "/api/v1/"; instanceUrlWithProtocol = "http://" + instanceHost; } tinyDb.putString("instanceUrlWithProtocol", instanceUrlWithProtocol); ``` Do let me know if you need any help with it.
Author
Member

i got the message twice is this a bug of gitea?

-> thanks, couldn't find the right locations where i have to change it. I'll try and push :D

i got the message twice is this a bug of gitea? -> thanks, couldn't find the right locations where i have to change it. I'll try and push :D
Owner

i got the message twice is this a bug of gitea?

gitea.com sometime has "content corruption error", that happened just now. So I refreshed the page, that's why two messages.

This will help.

https://gitea.com/mmarif/GitNex/src/branch/master/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java#L196

https://gitea.com/mmarif/GitNex/src/branch/master/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java#L155

> i got the message twice is this a bug of gitea? gitea.com sometime has "content corruption error", that happened just now. So I refreshed the page, that's why two messages. This will help. https://gitea.com/mmarif/GitNex/src/branch/master/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java#L196 https://gitea.com/mmarif/GitNex/src/branch/master/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java#L155
mmarif reviewed 2019-09-10 17:21:09 +00:00
Dismissed

browser -> Browser

browser -> `Browser`
Author
Member

got time to add, test worked fine - thanks

got time to add, test worked fine - thanks
6543 changed title from [WIP] Feature Request: Open Repo in browser to Feature Request: Open Repo in browser 2019-09-10 17:49:58 +00:00
Author
Member

@mmarif now it is ready? 🚀

@mmarif now it is ready? :rocket:
Owner

@6543 yes, time to merge.

@6543 yes, time to merge.
mmarif closed this pull request 2019-09-11 06:27:00 +00:00
mmarif closed this pull request 2019-09-11 06:27:00 +00:00
6543 deleted branch open-repo-web 2019-09-11 08:08:24 +00:00
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No Assignees
2 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitnex/GitNex#32
No description provided.