mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2025-12-08 19:05:54 +00:00
Merge pull request #2841 from k0shk0sh/master
merge Master to development
This commit is contained in:
commit
5ce910ea21
@ -29,7 +29,7 @@ android {
|
||||
applicationId "com.fastaccess.github"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 470
|
||||
versionCode 471
|
||||
versionName "4.7.0"
|
||||
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
|
||||
|
||||
@ -306,7 +306,6 @@
|
||||
</service>
|
||||
<service android:name=".provider.tasks.notification.ReadNotificationService" />
|
||||
<service android:name=".provider.tasks.git.GithubActionService" />
|
||||
<service android:name=".provider.tasks.git.ReactionService" />
|
||||
<service android:name=".provider.tasks.slack.SlackInvitationService" />
|
||||
<service android:name=".provider.tasks.version.CheckVersionService" />
|
||||
<service
|
||||
|
||||
@ -35,6 +35,16 @@ public enum ReactionTypes {
|
||||
return content;
|
||||
}
|
||||
|
||||
public String getPostContent() {
|
||||
if (this == PLUS_ONE) {
|
||||
return "+1";
|
||||
} else if (this == MINUS_ONE) {
|
||||
return "-1";
|
||||
} else {
|
||||
return getContent();
|
||||
}
|
||||
}
|
||||
|
||||
@IdRes public int getvId() {
|
||||
return vId;
|
||||
}
|
||||
|
||||
@ -1,109 +0,0 @@
|
||||
package com.fastaccess.provider.tasks.git;
|
||||
|
||||
import android.app.IntentService;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
||||
import com.fastaccess.R;
|
||||
import com.fastaccess.data.dao.PostReactionModel;
|
||||
import com.fastaccess.data.dao.types.ReactionTypes;
|
||||
import com.fastaccess.helper.BundleConstant;
|
||||
import com.fastaccess.helper.Bundler;
|
||||
import com.fastaccess.helper.InputHelper;
|
||||
import com.fastaccess.helper.RxHelper;
|
||||
import com.fastaccess.provider.rest.RestProvider;
|
||||
|
||||
/**
|
||||
* Created by Kosh on 29 Mar 2017, 9:59 PM
|
||||
*/
|
||||
|
||||
public class ReactionService extends IntentService {
|
||||
|
||||
private NotificationCompat.Builder notification;
|
||||
private NotificationManager notificationManager;
|
||||
|
||||
public static void start(@NonNull Context context, @NonNull String login, @NonNull String repo,
|
||||
long commentId, ReactionTypes reactionType, boolean isCommit, boolean isDelete,
|
||||
boolean isEnterprise) {
|
||||
Intent intent = new Intent(context, ReactionService.class);
|
||||
intent.putExtras(Bundler.start()
|
||||
.put(BundleConstant.EXTRA, isCommit)
|
||||
.put(BundleConstant.EXTRA_TWO, login)
|
||||
.put(BundleConstant.EXTRA_THREE, repo)
|
||||
.put(BundleConstant.EXTRA_FOUR, isDelete)
|
||||
.put(BundleConstant.ID, commentId)
|
||||
.put(BundleConstant.EXTRA_TYPE, reactionType)
|
||||
.put(BundleConstant.IS_ENTERPRISE, isEnterprise)
|
||||
.end());
|
||||
context.startService(intent);
|
||||
}
|
||||
|
||||
public ReactionService() {
|
||||
super(ReactionService.class.getSimpleName());
|
||||
}
|
||||
|
||||
@Override protected void onHandleIntent(@Nullable Intent intent) {
|
||||
if (intent != null && intent.getExtras() != null) {
|
||||
Bundle bundle = intent.getExtras();
|
||||
ReactionTypes reactionType = (ReactionTypes) bundle.getSerializable(BundleConstant.EXTRA_TYPE);
|
||||
boolean isCommit = bundle.getBoolean(BundleConstant.EXTRA);
|
||||
String login = bundle.getString(BundleConstant.EXTRA_TWO);
|
||||
String repo = bundle.getString(BundleConstant.EXTRA_THREE);
|
||||
long commentId = bundle.getLong(BundleConstant.ID);
|
||||
boolean isEnterprise = bundle.getBoolean(BundleConstant.IS_ENTERPRISE);
|
||||
if (InputHelper.isEmpty(login) || InputHelper.isEmpty(repo) || reactionType == null) {
|
||||
stopSelf();
|
||||
return;
|
||||
}
|
||||
if (isCommit) {
|
||||
postCommit(reactionType, login, repo, commentId, isEnterprise);
|
||||
} else {
|
||||
post(reactionType, login, repo, commentId, isEnterprise);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void post(@NonNull ReactionTypes reactionType, @NonNull String login, @NonNull String repo, long commentId, boolean isEnterprise) {
|
||||
RxHelper.safeObservable(RestProvider.getReactionsService(isEnterprise)
|
||||
.postIssueCommentReaction(new PostReactionModel(reactionType.getContent()), login, repo, commentId))
|
||||
.doOnSubscribe(disposable -> showNotification(getNotification(reactionType), (int) commentId))
|
||||
.subscribe(response -> hideNotification((int) commentId), throwable -> hideNotification((int) commentId));
|
||||
}
|
||||
|
||||
private void postCommit(@NonNull ReactionTypes reactionType, @NonNull String login, @NonNull String repo, long commentId, boolean isEnterprise) {
|
||||
RxHelper.safeObservable(RestProvider.getReactionsService(isEnterprise)
|
||||
.postCommitReaction(new PostReactionModel(reactionType.getContent()), login, repo, commentId))
|
||||
.doOnSubscribe(disposable -> showNotification(getNotification(reactionType), (int) commentId))
|
||||
.subscribe(response -> hideNotification((int) commentId), throwable -> hideNotification((int) commentId));
|
||||
}
|
||||
|
||||
public NotificationCompat.Builder getNotification(@NonNull ReactionTypes reactionTypes) {
|
||||
if (notification == null) {
|
||||
notification = new NotificationCompat.Builder(this, "reaction")
|
||||
.setSmallIcon(R.drawable.ic_sync)
|
||||
.setProgress(0, 100, true);
|
||||
}
|
||||
notification.setContentTitle(getString(R.string.posting_reaction, reactionTypes.getContent()));
|
||||
return notification;
|
||||
}
|
||||
|
||||
public NotificationManager getNotificationManager() {
|
||||
if (notificationManager == null) {
|
||||
notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
}
|
||||
return notificationManager;
|
||||
}
|
||||
|
||||
private void showNotification(@NonNull NotificationCompat.Builder builder, int id) {
|
||||
getNotificationManager().notify(id, builder.build());
|
||||
}
|
||||
|
||||
private void hideNotification(int id) {
|
||||
getNotificationManager().cancel(id);
|
||||
}
|
||||
}
|
||||
@ -1,28 +1,21 @@
|
||||
package com.fastaccess.provider.timeline;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.fastaccess.R;
|
||||
import com.fastaccess.data.dao.ReactionsModel;
|
||||
import com.fastaccess.data.dao.TimelineModel;
|
||||
import com.fastaccess.data.dao.model.Comment;
|
||||
import com.fastaccess.data.dao.types.ReactionTypes;
|
||||
import com.fastaccess.provider.tasks.git.ReactionService;
|
||||
import com.fastaccess.ui.widgets.SpannableBuilder;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* Created by Kosh on 30 Mar 2017, 6:44 PM
|
||||
*/
|
||||
|
||||
@ -50,19 +50,19 @@ public class ReactionsProvider {
|
||||
switch (reactionType) {
|
||||
case COMMENT:
|
||||
observable = RestProvider.getReactionsService(isEnterprise)
|
||||
.postIssueCommentReaction(new PostReactionModel(reactionTypes.getContent()), login, repoId, idOrNumber);
|
||||
.postIssueCommentReaction(new PostReactionModel(reactionTypes.getPostContent()), login, repoId, idOrNumber);
|
||||
break;
|
||||
case HEADER:
|
||||
observable = RestProvider.getReactionsService(isEnterprise)
|
||||
.postIssueReaction(new PostReactionModel(reactionTypes.getContent()), login, repoId, idOrNumber);
|
||||
.postIssueReaction(new PostReactionModel(reactionTypes.getPostContent()), login, repoId, idOrNumber);
|
||||
break;
|
||||
case REVIEW_COMMENT:
|
||||
observable = RestProvider.getReactionsService(isEnterprise)
|
||||
.postCommentReviewReaction(new PostReactionModel(reactionTypes.getContent()), login, repoId, idOrNumber);
|
||||
.postCommentReviewReaction(new PostReactionModel(reactionTypes.getPostContent()), login, repoId, idOrNumber);
|
||||
break;
|
||||
case COMMIT:
|
||||
observable = RestProvider.getReactionsService(isEnterprise)
|
||||
.postCommitReaction(new PostReactionModel(reactionTypes.getContent()), login, repoId, idOrNumber);
|
||||
.postCommitReaction(new PostReactionModel(reactionTypes.getPostContent()), login, repoId, idOrNumber);
|
||||
break;
|
||||
}
|
||||
if (observable == null) return null;
|
||||
@ -91,7 +91,7 @@ public class ReactionsProvider {
|
||||
return false;
|
||||
}
|
||||
ReactionTypes type = ReactionTypes.get(vId);
|
||||
return type != null && type.getContent().equals(reactionsModel.getContent());
|
||||
return type != null && (type.getContent().equals(reactionsModel.getContent()) || type.getPostContent().equals(reactionsModel.getContent()));
|
||||
}
|
||||
|
||||
public boolean isCallingApi(long id, int vId) {
|
||||
@ -100,7 +100,8 @@ public class ReactionsProvider {
|
||||
return false;
|
||||
}
|
||||
ReactionTypes type = ReactionTypes.get(vId);
|
||||
return type != null && type.getContent().equals(reactionsModel.getContent()) && reactionsModel.isCallingApi();
|
||||
return type != null && (type.getContent().equals(reactionsModel.getContent()) || type.getPostContent().equals(reactionsModel.getContent()))
|
||||
&& reactionsModel.isCallingApi();
|
||||
}
|
||||
|
||||
@NonNull private Map<Long, ReactionsModel> getReactionsMap() {
|
||||
|
||||
@ -8,19 +8,20 @@
|
||||
<body id="preview">
|
||||
<h1 class="code-line" data-line-start=0 data-line-end=1 ><a id="Whats_new_0"></a>What’s new?</h1>
|
||||
<ul>
|
||||
<li class="has-line-data" data-line-start="1" data-line-end="2">Fix Trending (Finally, I KNOW!)</li>
|
||||
<li class="has-line-data" data-line-start="2" data-line-end="3">Fix Wiki (I know, I know…)</li>
|
||||
<li class="has-line-data" data-line-start="3" data-line-end="4">Migrate to Androidx</li>
|
||||
<li class="has-line-data" data-line-start="1" data-line-end="2">Added private Gist creation</li>
|
||||
<li class="has-line-data" data-line-start="2" data-line-end="3">Added Rocket & Eyes reactions</li>
|
||||
<li class="has-line-data" data-line-start="3" data-line-end="4">Added show file history to file menu (in addition to long click)</li>
|
||||
<li class="has-line-data" data-line-start="4" data-line-end="5">Fixed Downloading files on Android 9+</li>
|
||||
<li class="has-line-data" data-line-start="5" data-line-end="6">Fixed Thumbs up & down reaction listing</li>
|
||||
<li class="has-line-data" data-line-start="6" data-line-end="7">Fixed as a collaborator now you can add comments on locked issues/prs</li>
|
||||
<li class="has-line-data" data-line-start="7" data-line-end="8">Fixed crash in editing a comment in a gist</li>
|
||||
<li class="has-line-data" data-line-start="8" data-line-end="9">Remove shrug from empty states</li>
|
||||
<li class="has-line-data" data-line-start="9" data-line-end="10">Remove redundant unsubscribe button from notifications screen</li>
|
||||
<li class="has-line-data" data-line-start="10" data-line-end="11">Replace Send Feedback with a button to FastHub Repo (Issue Tab)</li>
|
||||
<li class="has-line-data" data-line-start="11" data-line-end="12">alot of other stuff I can’t remember!</li>
|
||||
</ul>
|
||||
<h1 class="code-line" data-line-start=6 data-line-end=7 ><a id="I_hear_you_asking_So_what_happened_6"></a>I hear you asking (So what happened)?</h1>
|
||||
<p class="has-line-data" data-line-start="7" data-line-end="8">Well, I was pretty much busy with life and work, but that’s not an excuse, I
|
||||
know!. TBH with you all, I started working on FastHub v5 beginning of last year and I did actually made a good progress but then crisis
|
||||
landed on me when my mom diagnosed with cancer and that really stroke me hard and demotivated me to even care about my own health, it
|
||||
took awhile for me to recover and start accepting this fact and i’m still trying to figure out ways to motivate myself more to progress
|
||||
on FastHub or anything in the Open Source Community.</p>
|
||||
<p class="has-line-data" data-line-start="9" data-line-end="10"><strong>TL;DR:</strong> this is just a bug fix version and I will continue to fix bugs until V5 is ready for shipment.</p>
|
||||
|
||||
<p>Thank you to all who have contributed either via reporting bugs or via code contribution.</p>
|
||||
|
||||
<h1 class="code-line" data-line-start=14 data-line-end=15 ><a id="I_hear_you_asking_So_what_happened_14"></a>I hear you asking (So what happened)?</h1>
|
||||
<p class="has-line-data" data-line-start="15" data-line-end="16">Well, I was pretty much busy with life and work, but that’s not an excuse, I know!. TBH with you all, I started working on FastHub v5 beginning of last year and I did actually made a good progress but then crisis landed on me when my mom diagnostic with cancer and that really stroke me hard and demotivated me to even care about my own health, it took awhile for me to recover and start accepting this fact and i’m still trying to figure out way to motivate myself more to progress on FastHub or anything in the Open Source Community.</p>
|
||||
<p class="has-line-data" data-line-start="17" data-line-end="18"><strong>TL;DR:</strong> this is just a bug fix version and I will continue to fix bugs until V5 is ready for shipment.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user