releasing 4.6.2

This commit is contained in:
k0shk0sh 2018-01-20 15:52:00 +01:00
parent 66c2fc55e3
commit c030f532d2
20 changed files with 146 additions and 91 deletions

View File

@ -1,4 +1,4 @@
since-tag=4.5.5
since-tag=4.5.6
issues-wo-labels=false
issue-line-labels=true
exclude-labels=Type: Invalid,Type: Duplicate,Type: Unknown,Type: Question,Type: No API,Type: Work as Intended,Type: Can't Reproduce,Status: Won't Fix

3
.gitignore vendored
View File

@ -8,4 +8,5 @@
/app/google-services.json
/app/build/
/app/src/main/res/values/secrets.xml
/app/fastaccess-key
/app/fastaccess-key
/changelog_generator

View File

@ -29,8 +29,8 @@ android {
applicationId "com.fastaccess.github"
minSdkVersion 21
targetSdkVersion 27
versionCode 461
versionName "4.6.1"
versionCode 462
versionName "4.6.2"
buildConfigString "GITHUB_CLIENT_ID", (buildProperties.secrets['github_client_id'] | buildProperties.notThere['github_client_id']).string
buildConfigString "GITHUB_SECRET", (buildProperties.secrets['github_secret'] | buildProperties.notThere['github_secret']).string
buildConfigString "IMGUR_CLIENT_ID", (buildProperties.secrets['imgur_client_id'] | buildProperties.notThere['imgur_client_id']).string

View File

@ -14,6 +14,7 @@ import io.reactivex.Observable;
import retrofit2.Response;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;
@ -66,4 +67,16 @@ public interface UserRestService {
Observable<Response<Boolean>> unfollowUser(@Path("username") @NonNull String username);
@GET Observable<String> getContributions(@Url String url);
@GET("user/blocks/{username}")
@Headers("Accept: application/vnd.github.giant-sentry-fist-preview+json")
Observable<Response<Boolean>> isUserBlocked(@Path("username") @NonNull String username);
@PUT("user/blocks/{username}")
@Headers("Accept: application/vnd.github.giant-sentry-fist-preview+json")
Observable<Response<Boolean>> blockUser(@Path("username") @NonNull String username);
@DELETE("user/blocks/{username}")
@Headers("Accept: application/vnd.github.giant-sentry-fist-preview+json")
Observable<Response<Boolean>> unBlockUser(@Path("username") @NonNull String username);
}

View File

@ -220,7 +220,7 @@ public class IssueDetailsViewHolder extends BaseViewHolder<TimelineModel> {
owner.setVisibility(View.VISIBLE);
owner.setText(R.string.owner);
} else {
owner.setText(null);
owner.setText("");
owner.setVisibility(View.GONE);
}
if (reactionsModel != null) {

View File

@ -150,7 +150,7 @@ public class ReviewCommentsViewHolder extends BaseViewHolder<ReviewCommentModel>
owner.setVisibility(View.VISIBLE);
owner.setText(R.string.original_poster);
} else {
owner.setText(null);
owner.setText("");
owner.setVisibility(View.GONE);
}
}

View File

@ -162,14 +162,14 @@ public class TimelineCommentsViewHolder extends BaseViewHolder<TimelineModel> {
owner.setVisibility(View.VISIBLE);
owner.setText(R.string.original_poster);
} else {
owner.setText(null);
owner.setText("");
owner.setVisibility(View.GONE);
}
}
}
} else {
avatar.setUrl(null, null, false, false);
name.setText(null);
name.setText("");
}
if (!InputHelper.isEmpty(commentsModel.getPath()) && commentsModel.getPosition() > 0) {
pathText.setVisibility(View.VISIBLE);

View File

@ -307,7 +307,7 @@ public class GistActivity extends BaseActivity<GistMvp.View, GistPresenter>
}
@SuppressWarnings("ConstantConditions") @Override public void onClearEditText() {
if (commentEditorFragment != null && commentEditorFragment.commentText != null) commentEditorFragment.commentText.setText(null);
if (commentEditorFragment != null && commentEditorFragment.commentText != null) commentEditorFragment.commentText.setText("");
}
@NonNull @Override public ArrayList<String> getNamesToTag() {

View File

@ -268,7 +268,7 @@ public class CommitPagerActivity extends BaseActivity<CommitPagerMvp.View, Commi
}
@SuppressWarnings("ConstantConditions") @Override public void onClearEditText() {
if (commentEditorFragment != null && commentEditorFragment.commentText != null) commentEditorFragment.commentText.setText(null);
if (commentEditorFragment != null && commentEditorFragment.commentText != null) commentEditorFragment.commentText.setText("");
}
@NonNull @Override public ArrayList<String> getNamesToTag() {

View File

@ -396,7 +396,7 @@ public class CreateIssueActivity extends BaseActivity<CreateIssueMvp.View, Creat
milestoneDescription.setText(milestoneModel.getDescription());
milestoneDescription.setVisibility(View.VISIBLE);
} else {
milestoneDescription.setText(null);
milestoneDescription.setText("");
milestoneDescription.setVisibility(View.GONE);
}
}

View File

@ -405,7 +405,7 @@ public class IssuePagerActivity extends BaseActivity<IssuePagerMvp.View, IssuePa
@Override public void onCreateComment(String text, Bundle bundle) {}
@SuppressWarnings("ConstantConditions") @Override public void onClearEditText() {
if (commentEditorFragment != null && commentEditorFragment.commentText != null) commentEditorFragment.commentText.setText(null);
if (commentEditorFragment != null && commentEditorFragment.commentText != null) commentEditorFragment.commentText.setText("");
}
@NonNull @Override public ArrayList<String> getNamesToTag() {

View File

@ -477,7 +477,7 @@ public class PullRequestPagerActivity extends BaseActivity<PullRequestPagerMvp.V
}
@SuppressWarnings("ConstantConditions") @Override public void onClearEditText() {
if (commentEditorFragment != null && commentEditorFragment.commentText != null) commentEditorFragment.commentText.setText(null);
if (commentEditorFragment != null && commentEditorFragment.commentText != null) commentEditorFragment.commentText.setText("");
}
@Override public ArrayList<String> getNamesToTag() {

View File

@ -25,6 +25,7 @@ import com.fastaccess.helper.ActivityHelper;
import com.fastaccess.helper.BundleConstant;
import com.fastaccess.helper.Bundler;
import com.fastaccess.helper.InputHelper;
import com.fastaccess.helper.Logger;
import com.fastaccess.helper.ViewHelper;
import com.fastaccess.provider.scheme.LinkParserHelper;
import com.fastaccess.ui.adapter.FragmentsPagerAdapter;
@ -117,8 +118,12 @@ public class UserPagerActivity extends BaseActivity<UserPagerMvp.View, UserPager
login = getIntent().getExtras().getString(BundleConstant.EXTRA);
isOrg = getIntent().getExtras().getBoolean(BundleConstant.EXTRA_TYPE);
index = getIntent().getExtras().getInt(BundleConstant.EXTRA_TWO, -1);
if (!InputHelper.isEmpty(login) && isOrg) {
getPresenter().checkOrgMembership(login);
if (!InputHelper.isEmpty(login)) {
if (isOrg) {
getPresenter().checkOrgMembership(login);
} else {
if (!Login.getUser().getLogin().equalsIgnoreCase(login)) getPresenter().onCheckBlocking(login);
}
}
} else {
Login user = Login.getUser();
@ -208,6 +213,21 @@ public class UserPagerActivity extends BaseActivity<UserPagerMvp.View, UserPager
setTaskName(login);
}
@Override public void onUserBlocked() {
showMessage(R.string.success, R.string.user_blocked);
onInvalidateMenu();
}
@Override public void onInvalidateMenu() {
hideProgress();
supportInvalidateOptionsMenu();
}
@Override public void onUserUnBlocked() {
showMessage(R.string.success, R.string.user_unblocked);
onInvalidateMenu();
}
@Override public void onCheckType(boolean isOrg) {
if (!this.isOrg == isOrg) {
startActivity(this, login, isOrg, isEnterprise(), index);
@ -253,20 +273,25 @@ public class UserPagerActivity extends BaseActivity<UserPagerMvp.View, UserPager
.appendPath(login)
.toString());
return true;
} else if (item.getItemId() == R.id.block && !InputHelper.isEmpty(login)) {
getPresenter().onBlockUser(login);
}
return super.onOptionsItemSelected(item);
}
@Override public boolean onPrepareOptionsMenu(Menu menu) {
// final int blockId = 10110;
// MenuItem blockItem;
// if (menu.findItem(blockId) == null) {
// blockItem = menu.add(0, blockId, 0, getString(R.string.block));
// } else {
// blockItem = menu.findItem(blockId);
// }
// blockItem.setIcon(ContextCompat.getDrawable(this, R.drawable.ic_block))
// .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
Logger.e(getPresenter().isUserBlockedRequested(), getPresenter().isUserBlocked());
if (getPresenter().isUserBlockedRequested()) {
Login login = Login.getUser();
if (login != null && !isOrg) {
String username = login.getLogin();
if (!username.equalsIgnoreCase(this.login)) {
menu.findItem(R.id.block)
.setIcon(getPresenter().isUserBlocked() ? R.drawable.ic_unlock : R.drawable.ic_lock)
.setVisible(true);
}
}
}
return super.onPrepareOptionsMenu(menu);
}

View File

@ -14,11 +14,23 @@ public interface UserPagerMvp {
interface View extends BaseMvp.FAView, ProfilePagerMvp.View, RepoPagerMvp.TabsBadgeListener {
void onInitOrg(boolean isMember);
void onUserBlocked();
void onInvalidateMenu();
void onUserUnBlocked();
}
interface Presenter extends BaseMvp.FAPresenter {
void onCheckBlocking(@NonNull String login);
void checkOrgMembership(@NonNull String org);
void onBlockUser(@NonNull String login);
void onUnblockUser(@NonNull String login);
}
}

View File

@ -14,6 +14,17 @@ import lombok.Getter;
@Getter class UserPagerPresenter extends BasePresenter<UserPagerMvp.View> implements UserPagerMvp.Presenter {
@com.evernote.android.state.State int isMember = -1;
@com.evernote.android.state.State boolean isUserBlocked;
@com.evernote.android.state.State boolean isUserBlockedRequested;
@Override public void onCheckBlocking(@NonNull String login) {
makeRestCall(RestProvider.getUserService(isEnterprise()).isUserBlocked(login),
booleanResponse -> sendToView(view -> {
isUserBlockedRequested = true;
isUserBlocked = booleanResponse.code() == 204;
view.onInvalidateMenu();
}));
}
@Override public void checkOrgMembership(@NonNull String org) {
makeRestCall(RestProvider.getOrgService(isEnterprise()).isMember(org, Login.getUser().getLogin()),
@ -22,4 +33,24 @@ import lombok.Getter;
view.onInitOrg(isMember == 1);
}));
}
@Override public void onBlockUser(@NonNull String login) {
if (isUserBlocked()) {
onUnblockUser(login);
} else {
makeRestCall(RestProvider.getUserService(isEnterprise()).blockUser(login),
booleanResponse -> sendToView(view -> {
isUserBlocked = true;
view.onUserBlocked();
}));
}
}
@Override public void onUnblockUser(@NonNull String login) {
makeRestCall(RestProvider.getUserService(isEnterprise()).unBlockUser(login),
booleanResponse -> sendToView(view -> {
isUserBlocked = false;
view.onUserUnBlocked();
}));
}
}

View File

@ -35,7 +35,14 @@ class BottomPaddingDecoration extends RecyclerView.ItemDecoration {
super.getItemOffsets(outRect, view, parent, state);
int dataSize = state.getItemCount();
int position = parent.getChildAdapterPosition(view);
if (parent.getLayoutManager() instanceof LinearLayoutManager) {
if (parent.getLayoutManager() instanceof GridLayoutManager) {
GridLayoutManager grid = (GridLayoutManager) parent.getLayoutManager();
if ((dataSize - position) <= grid.getSpanCount()) {
outRect.set(0, 0, 0, bottomPadding);
} else {
outRect.set(0, 0, 0, 0);
}
} else if (parent.getLayoutManager() instanceof LinearLayoutManager) {
if (dataSize > 0 && position == dataSize - 1) {
outRect.set(0, 0, 0, bottomPadding);
} else {
@ -48,13 +55,6 @@ class BottomPaddingDecoration extends RecyclerView.ItemDecoration {
} else {
outRect.set(0, 0, 0, 0);
}
} else if (parent.getLayoutManager() instanceof GridLayoutManager) {
GridLayoutManager grid = (GridLayoutManager) parent.getLayoutManager();
if ((dataSize - position) <= grid.getSpanCount()) {
outRect.set(0, 0, 0, bottomPadding);
} else {
outRect.set(0, 0, 0, 0);
}
}
}
}

View File

@ -2,6 +2,13 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/block"
android:icon="@drawable/ic_lock"
android:title="@string/block"
android:visible="false"
app:showAsAction="always"/>
<item
android:id="@+id/share"
android:icon="@drawable/ic_share"

View File

@ -8,75 +8,39 @@
<body id="preview">
<h2><a id="FastHub_changelog_0"></a>FastHub changelog
</h2>
<h3><a id="Version__420_Create_Edit__Delete_files_make_Commits_2"></a>Version 4.6.0(Starred Gists)
<h3><a id="Version__420_Create_Edit__Delete_files_make_Commits_2"></a>Version 4.6.2(Block/Unblock Users)
</h3>
<blockquote>
<p>Please report the issues in FastHub repo instead, by opening the Drawer Menu and clicking on “Report an Issue”<strong>
PLEASE USE IT</strong>.
</p>
</blockquote>
<p><strong>Implemented enhancements:</strong></p>
<ul>
<li>[Feature request] Block or report user <a href="https://github.com/k0shk0sh/FastHub/issues/1230">#1230</a></li>
<li>[README] GPLv3 Badge Added <a href="https://github.com/k0shk0sh/FastHub/pull/1409">#1409</a> (<a
href="https://github.com/BTaskaya">BTaskaya</a>)
</li>
</ul>
<p><strong>Fixed bugs:</strong></p>
<ul>
<li>Comment submition error <a href="https://github.com/k0shk0sh/FastHub/issues/1419">#1419</a></li>
<li>Incorrect url when sharing wiki <a href="https://github.com/k0shk0sh/FastHub/issues/1417">#1417</a></li>
</ul>
<p><strong>Closed issues:</strong></p>
<ul>
<li>Handle Issues and Prs search urls <a href="https://github.com/k0shk0sh/FastHub/issues/1394">#1394</a></li>
<li>Format persists when pasting text in search field <a href="https://github.com/k0shk0sh/FastHub/issues/1393">#1393</a></li>
<li>View issues with embedded image crashes the app <a href="https://github.com/k0shk0sh/FastHub/issues/1392">#1392</a></li>
<li>Cant scroll down on a repos README when my phone is in Battery Saver mode <a href="https://github.com/k0shk0sh/FastHub/issues/1390">#1390</a></li>
<li>Opening Label links not working properly. <a href="https://github.com/k0shk0sh/FastHub/issues/1389">#1389</a></li>
<li>tool <a href="https://github.com/k0shk0sh/FastHub/issues/1388">#1388</a></li>
<li>Download Unsuccessful <a href="https://github.com/k0shk0sh/FastHub/issues/1387">#1387</a></li>
<li>Profile photo is not updated <a href="https://github.com/k0shk0sh/FastHub/issues/1385">#1385</a></li>
<li>Following is missing <a href="https://github.com/k0shk0sh/FastHub/issues/1384">#1384</a></li>
<li>Purchasing pro doesnt enable pro features <a href="https://github.com/k0shk0sh/FastHub/issues/1383">#1383</a></li>
<li>[Request Feature] Chat for teams <a href="https://github.com/k0shk0sh/FastHub/issues/1382">#1382</a></li>
<li>Crashes when trying to edit issues <a href="https://github.com/k0shk0sh/FastHub/issues/1381">#1381</a></li>
<li>The app crashes when trying to edit an issue <a href="https://github.com/k0shk0sh/FastHub/issues/1380">#1380</a></li>
<li>Scroll Area Height in Code View <a href="https://github.com/k0shk0sh/FastHub/issues/1378">#1378</a></li>
<li>Cant see organization. <a href="https://github.com/k0shk0sh/FastHub/issues/1377">#1377</a></li>
<li>When reviewing a PR, I cannot choose whether to approve <a href="https://github.com/k0shk0sh/FastHub/issues/1376">#1376</a></li>
<li>[feature request] sharing repo/wiki pages <a href="https://github.com/k0shk0sh/FastHub/issues/1375">#1375</a></li>
<li>Clarification on Kotlin migration <a href="https://github.com/k0shk0sh/FastHub/issues/1373">#1373</a></li>
<li>Backup creates a json file that is greyed out when trying to restore <a href="https://github.com/k0shk0sh/FastHub/issues/1372">#1372</a></li>
<li>Allow to pin searches <a href="https://github.com/k0shk0sh/FastHub/issues/1371">#1371</a></li>
<li>Default issues header update <a href="https://github.com/k0shk0sh/FastHub/issues/1369">#1369</a></li>
<li>Migrate horizontal progressbar somewhere else while loading <a href="http://README.md">README.md</a> <a href="https://github.com/k0shk0sh/FastHub/issues/1368">#1368</a></li>
<li>Pictures are not shown in mk table <a href="https://github.com/k0shk0sh/FastHub/issues/1366">#1366</a></li>
<li>Overlapping pictures in md table <a href="https://github.com/k0shk0sh/FastHub/issues/1365">#1365</a></li>
<li>Issues are shown twice <a href="https://github.com/k0shk0sh/FastHub/issues/1364">#1364</a></li>
<li>Koshosh <a href="https://github.com/k0shk0sh/FastHub/issues/1363">#1363</a></li>
<li>Enable opening URLs in an external browser <a href="https://github.com/k0shk0sh/FastHub/issues/1362">#1362</a></li>
<li>Click Feeds button when in same view to scroll to top <a href="https://github.com/k0shk0sh/FastHub/issues/1360">#1360</a></li>
<li>test <a href="https://github.com/k0shk0sh/FastHub/issues/1359">#1359</a></li>
<li>Labels dont work at all <a href="https://github.com/k0shk0sh/FastHub/issues/1358">#1358</a></li>
<li>Cant see my organization nor norbky organization repositories <a href="https://github.com/k0shk0sh/FastHub/issues/1357">#1357</a></li>
<li>Reaction button clickable area <a href="https://github.com/k0shk0sh/FastHub/issues/1356">#1356</a></li>
<li>LICENSE template suggestion <a href="https://github.com/k0shk0sh/FastHub/issues/1355">#1355</a></li>
<li>Cant add/view images in issue comments <a href="https://github.com/k0shk0sh/FastHub/issues/1354">#1354</a></li>
<li>Notification on wear is shown <a href="https://github.com/k0shk0sh/FastHub/issues/1353">#1353</a></li>
<li>Copy line specific urls <a href="https://github.com/k0shk0sh/FastHub/issues/1352">#1352</a></li>
<li>Improve behaviour at launch <a href="https://github.com/k0shk0sh/FastHub/issues/1350">#1350</a></li>
<li>Alfarizie <a href="https://github.com/k0shk0sh/FastHub/issues/1349">#1349</a></li>
<li>Remove branding from comments for pro users. <a href="https://github.com/k0shk0sh/FastHub/issues/1346">#1346</a></li>
<li>Change log wont completely go away <a href="https://github.com/k0shk0sh/FastHub/issues/1345">#1345</a></li>
<li>DL always fail <a href="https://github.com/k0shk0sh/FastHub/issues/1344">#1344</a></li>
<li>Downloads wont open <a href="https://github.com/k0shk0sh/FastHub/issues/1342">#1342</a></li>
<li>Back button goes too far <a href="https://github.com/k0shk0sh/FastHub/issues/1340">#1340</a></li>
<li>Missing translations <a href="https://github.com/k0shk0sh/FastHub/issues/1338">#1338</a></li>
<li>C Syntex is not Highlighted <a href="https://github.com/k0shk0sh/FastHub/issues/1337">#1337</a></li>
<li>Opening issue on k0shk0sh/fasthub: model not detected <a href="https://github.com/k0shk0sh/FastHub/issues/1336">#1336</a></li>
<li>Resize of filter window <a href="https://github.com/k0shk0sh/FastHub/issues/1335">#1335</a></li>
<li>Typo in Playstore description <a href="https://github.com/k0shk0sh/FastHub/issues/1334">#1334</a></li>
<li>Ability to create (or initialize repository in app) <a href="https://github.com/k0shk0sh/FastHub/issues/1333">#1333</a></li>
<li>[ poll ] Make some of GitHub terms translatable <a href="https://github.com/k0shk0sh/FastHub/issues/1329">#1329</a></li>
<li>Opening issue #448 on openhab/openhab.android crashes app <a href="https://github.com/k0shk0sh/FastHub/issues/1280">#1280</a></li>
<li>I believe your BottomPaddingDecoration is flawed <a href="https://github.com/k0shk0sh/FastHub/issues/1434">#1434</a></li>
</ul>
<p><strong>Merged pull requests:</strong></p>
<ul>
<li>Updated Russian translation <a href="https://github.com/k0shk0sh/FastHub/pull/1386">#1386</a> (<a href="https://github.com/dedepete">dedepete</a>)</li>
<li>Reduce the boilerplate in making a Kotlin class parcelable <a href="https://github.com/k0shk0sh/FastHub/pull/1374">#1374</a> (<a href="https://github.com/veyndan">veyndan</a>)</li>
<li>Add Portuguese (Portugal) language <a href="https://github.com/k0shk0sh/FastHub/pull/1361">#1361</a> (<a href="https://github.com/KcNirvana">KcNirvana</a>)</li>
<li>Update french <a href="https://github.com/k0shk0sh/FastHub/pull/1348">#1348</a> (<a href="https://github.com/ptt-homme">ptt-homme</a>)</li>
<li>fix typos in russian translation <a href="https://github.com/k0shk0sh/FastHub/pull/1343">#1343</a> (<a href="https://github.com/olshevskiy87">olshevskiy87</a>)</li>
<li>Update korean strings for 4.6.0 <a href="https://github.com/k0shk0sh/FastHub/pull/1341">#1341</a> (<a href="https://github.com/cozyplanes">cozyplanes</a>)</li>
<li>Updated German Translation <a href="https://github.com/k0shk0sh/FastHub/pull/1431">#1431</a> (<a href="https://github.com/Stargamers">Stargamers</a>)
</li>
<li>Fixed incorrect URL when sharing wiki page (#1417) <a href="https://github.com/k0shk0sh/FastHub/pull/1418">#1418</a> (<a
href="https://github.com/dedepete">dedepete</a>)
</li>
<li>Completely removed banners <a href="https://github.com/k0shk0sh/FastHub/pull/1400">#1400</a> (<a
href="https://github.com/dedepete">dedepete</a>)
</li>
</ul>
<h3><a id="What_left_in_FastHub_29"></a>What's left for FastHub?
</h3>

View File

@ -595,4 +595,6 @@
<string name="disable_loading_image_summary">Disable loading image while on data plan</string>
<string name="report_issue_warning">This issue will be submitted to FastHub\'s repo in GitHub</string>
<string name="block">Block</string>
<string name="user_blocked">User blocked</string>
<string name="user_unblocked">User unlocked</string>
</resources>

View File

@ -23,7 +23,7 @@ buildscript {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-alpha07'
classpath 'com.android.tools.build:gradle:3.1.0-alpha08'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.novoda:gradle-build-properties-plugin:0.3'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2'