Merge pull request #2837 from k0shk0sh/development

Master merge
This commit is contained in:
Kosh Sergani 2019-12-27 12:22:55 +01:00 committed by GitHub
commit 1b90197d4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
665 changed files with 7498 additions and 6397 deletions

View File

@ -1,62 +1,89 @@
# How to submit Issue/Feature Request to *FastHub*
# Contributing to FastHub
- Make sure the included template is filled ( using FastHub will fill them up automatically ).
- If you planning to report multiple FRs/Issues that falls under the same feature __PLEASE REPORT THEM IN ONE TICKET__.
- Make sure you are always on latest (FastHub/About & Click on version name).
- Make sure the issue doesn't exists, lets keep things clean & tidy here :).
**Updated: 19 Jan 2018**
## Table of contents
# How to contribute & build *FastHub*
1. [Submitting Issues](#submitting-issues)
1. [How to contribute. Importing and assembling](#how-to-contribute-importing-and-assembling)
1. [Custom keys *(optional)*](#custom-keys-optional)
1. [Before importing into Android Studio](#before-importing-into-android-studio)
1. [Before import](#before-importation)
1. [Importing Android Studio project](#importing-android-studio-project)
1. [Submitting Pull Request](#submitting-pull-request)
1. [Working with translations](#working-with-translations)
1. [Translations Contributors](#translations-contributors)
If you have a question in mind, feel free to come our public [Slack](http://rebrand.ly/fasthub) channel.
## Submitting Issues
### Optional
- Let's keep everything clean and tidy here :)
- Make sure that similar Issues are not exist. Reopen an Issue if exists but closed.
- If things you want to submit are related to each other, submit them in one Issue.
- None of the forked Repositories' Issues will be accepted!
- Forks are developed separately from the origin Repository.
- Make sure you are running latest version (to check it out withing the FastHub head to About and tap on the section with application's version).
- Make sure the included template is filled in (submitting an Issue within FastHub will do it automatically).
- Please update debug_gradle.properties file and change below if you like to use your own keys otherwise keep them as they're debug keys:
- github_client_id= your github clientId
- github_secret= your github secret
- redirect_url= (redirect_url must match the url defined in `AndroidManifest` under `LoginView`)
## How to contribute. Importing and assembling
### Before you import the project to Android Studio:
If you have any questions, feel free to join our public [Slack](http://rebrand.ly/fasthub) channel.
- Make sure you have Android Studio 3.0 C4 & above.
- Import Android Studio Settings (to ensure same code formatting) from this link [Click here](https://raw.githubusercontent.com/k0shk0sh/FastHub/master/fasthub_as_settings.jar)
- Install Lombok Plugin from Android Studio Plugins & enable Annotations Processors from (Android Studio Preference).
### Custom keys *(optional)*
### After above steps:
- Please update `debug_gradle.properties` file if you want to use your own keys:
- `github_client_id=` -- your GitHub clientId;
- `github_secret=` -- your GitHub secret;
- `redirect_url=` -- the url defined in `AndroidManifest` under `LoginView`.
- Fork the project.
- Clone it to your desktop.
- Open the project from Android Studio.
- Let it build & Start coding.
### Before importation
### Submitting PR
- Make sure you are running *Android Studio 3.0 C4* or above;
- Import *Android Studio Settings* (to follow project's code style) from [this file](https://raw.githubusercontent.com/k0shk0sh/FastHub/master/fasthub_as_settings.jar);
- Install *Lombok Plugin* from Android Studio Plugins and enable Annotations Processors in Android Studio Preferences.
> Please make sure your commit messages are meaningful.
- Create new Branch with the feature or fix you made.
- Submit your PR with an explanation of what you did & why (~~if applicable~~).
### Importing Android Studio project
- Fork the Repository.
- Clone it to your workstation.
- Open the project in Android Studio.
- Compile the project for the first time. Then you can start coding.
### Submitting Pull Request
> Please use meaningful commit messages.
- Create a new Branch with the changes you made.
- Submit your Pull Request with an explanation of what have you done and why.
> I really appreciate your efforts on contributing to this project.
# Contribute Translations
## Working with translations
1. First fork the repository by clicking **Fork** button.
1. Clone your own forked repository to your computer.
1. Create and switch branch by typing `git checkout -b <language>` where `<language>` is the language you want to translate to.
1. Create a folder named `values-<language-code>`, where `<language-code>` is your 2 letter code for your language. For example `values-es` for Spanish, `values-fr` for French.
1. Copy `values/strings.xml` to inside `values-??` folder with `cp values/strings.xml values-??/`.
1. Open `values-??/strings.xml` on your editor of choice.
1. Translate and keep in mind those important points.
1. Obey XML format. So, `<string name="do-not-change">ONLY TRANSLATE HERE</string>`.
1. Don't translate Git terms. Such as *pull request, push, commit, branch*...
1. There are special characters and variables. Such as `\n` for newline, `\t` for tab. Keep them in the same position in your sentences. Do not delete them!
1. Don't translate lines that contain `translatable="false"` statement.
1. Don't add extra spaces or periods anywhere. Don't delete current ones. Keep them as is.
1. Once finished the translations, add files to the git index with `git add values-??/strings.xml` and commit it with `git commit -m 'Language: Strings translated'`.
1. Then push your local changes to your forked repository branch by typing `git push origin <language>`.
1. Finally, create a pull request from your branch to our *master* with **Pull Request** button.
1. Firstly, you have to fork the repository by clicking the **Fork** button.
1. Clone your own forked repository to your workstation.
1. Create and switch Branch by typing `git checkout -b <new branch>` where `<new branch>` is the name of the Branch you want to work with. We recommend you to name it into the language you want to translate in.
1. Create a new directory named like `values-<language code>`, where `<language code>` is a 2 letter ISO code of the language. For example `values-es` for Spanish, `values-fr` for French.
1. Copy `values/strings.xml` into the directory you have created (`values-??`).
1. Open `values-??/strings.xml` in your editor of choice.
1. Translate and keep in mind these important things.
1. Obey the XML format. So, `<string name="do-not-change">ONLY TRANSLATE HERE</string>`.
1. Don't translate lines which contain `translatable="false"`.
1. Don't translate Git and GitHub terms, such as *Pull Request*, *Push*, *Commit*, *Branch*, etc.
1. There are some escape sequences used in translations (e.g. `\n` as a line feed (new line), `\t` as a tabulator. Don't delete them!
*For the full list you can see this [Wiki article](https://en.wikipedia.org/wiki/Control_character#In_ASCII).*
1. There are some characters which **must be escaped** in translations.
# Translators
| `"` | `&quot;` |
|-----|----------|
| `'` | `&apos;` |
| `&` | `&amp;` |
| `>` | `&gt;` |
| `<` | `&lt;` |
1. Don't add extra spaces or periods. Don't delete existent ones.
1. Once you finished translating, add new files to the Git index using `git add values-??/strings.xml` command and commit the changes using `git commit -m '<commit message>'`, where `<commit message>` is a short description of changes you made.
1. Push your local changes into your forked repository by typing `git push origin <new branch>`.
1. Finally, create a Pull Request from your Branch to our main Branch *development*.
- **English**: Default
## Translations Contributors
- *See [README.md](https://github.com/k0shk0sh/FastHub#language-contributors)*

12
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: FastHub
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://paypal.me/imkosh

View File

@ -13,7 +13,7 @@
- Make sure the issue doesn't exists, lets keep things clean & tidy here :).
-->
**FastHub Version:** <!-- Don't forget to mention "Enterprise" here if needed. --> <>
**FastHub Version:** <!-- Don't forget to mention "Enterprise" here if needed. -->
**Android Version:**
**Device Information:**
- MANUFACTURER: <!-- e.g. Yota Devices Limited -->

13
.github/workflows/greetings.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: Greetings
on: [pull_request, issues]
jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Horray🎉🎉,you've made you first issue, Thanks for contributing❤'' first issue'
pr-message: 'Horray🎉🎉,you've made you first issue, Thanks for contributing❤'' first pr'

View File

@ -1 +1,7 @@
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
include-labels=Status: Completed
bug-labels=Type: Bug
enhancement-labels=Type: Enhancement,Type: Feature Request

5
.gitignore vendored
View File

@ -3,9 +3,10 @@
/local.properties
.DS_Store
/build
/gradle.properties
/release_gradle.properties
/.idea/
/app/google-services.json
/app/build/
/app/src/main/res/values/secrets.xml
/app/fastaccess-key
/app/fastaccess-key
/changelog_generator

View File

@ -1,44 +0,0 @@
language: android
android:
components:
- tools
- platform-tools
- tools # Upgrade again after upgrading platform-tools.
jdk: oraclejdk8
sudo: required
before_install:
# Skip build if the commit message contains [skip travis] or [travis skip]
- >
echo "$TRAVIS_COMMIT_MESSAGE"
| grep -E '\[(skip travis|travis skip)\]'
&& echo "[skip travis] has been found, exiting."
&& exit 0 || true
before_script:
- mkdir -p $ANDROID_HOME/licenses
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > $ANDROID_HOME/licenses/android-sdk-license
- echo -e "d56f5187479451eabf01fb78af6dfcb131a6481e" >> $ANDROID_HOME/licenses/android-sdk-license
- echo -e "\n504667f4c0de7af1a06de9f4b1727b84351f2910" > $ANDROID_HOME/licenses/android-sdk-preview-license
script:
- ./gradlew clean assembleDebug --no-daemon --stacktrace
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
after_success:
- bash <(curl -s https://codecov.io/bash)
notifications:
email: false

View File

@ -1,5 +1,10 @@
[![Build Status](https://travis-ci.org/k0shk0sh/FastHub.svg?branch=master)](https://travis-ci.org/k0shk0sh/FastHub)
#### FastHub is currently under a huge refactoring, please make sure to submit an issue only if necessary.
##### You could follow the development on V5 in this [PR](https://github.com/k0shk0sh/FastHub/pull/2599)
[![Build Status](https://app.bitrise.io/app/abd1afbd2a03e0e4/status.svg?token=txykViMUFzx1WkvjixD01A&branch=development)](https://app.bitrise.io/app/abd1afbd2a03e0e4)
[![Releases](https://img.shields.io/github/release/k0shk0sh/FastHub.svg)](https://github.com/k0shk0sh/FastHub/releases/latest) [![Slack](https://img.shields.io/badge/slack-join-e01563.svg)](http://rebrand.ly/fasthub)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
![Logo](/.github/assets/feature_graphic.png?raw=true "Logo")
@ -95,7 +100,7 @@ _Ads currently not available._
- [**Stream API**](https://github.com/aNNiMON/Lightweight-Stream-API) for dealing with `Collections`
- [**ButterKnife**](https://github.com/JakeWharton/butterknife) for view binding
- [**Android State**](https://github.com/evernote/android-state) for saving instance states
- [**Lombok**](https://projectlombok.github.io) for getters and setters
- [**Lombok**](https://projectlombok.org/) for getters and setters
- [**Material-BottomNavigation**](https://github.com/sephiroth74/Material-BottomNavigation) for `BottomBar` tabs
- [**Glide**](https://github.com/bumptech/glide) for loading images
- [**commonmark**](https://github.com/atlassian/commonmark-java) for _Markdown_ conversion to html
@ -103,6 +108,7 @@ _Ads currently not available._
- [**ShapedImageView**](https://github.com/gavinliu/ShapedImageView) for round avatars
- [**Material-About-Library**](https://github.com/daniel-stoneuk/material-about-library) for the about screen
- [**Fabric**](https://fabric.io/kits/android/crashlytics) analytics & crash reporting.
- [**Lottie**](https://github.com/airbnb/lottie-android) for animations
- **Android Support Libraries**, the almighty ;-)
## Contribution
@ -165,12 +171,6 @@ Read the [**contribution guide**](.github/CONTRIBUTING.md) for more detailed inf
<p>Head to https://github.com/k0shk0sh/FastHub/issues/new and create new issue for bugs or feature requests. I really encourage you to search before opening a ticket. Any duplicate request will result in it being closed immediately.</p>
</details>
<details>
<summary>How do I get PROMO CODE?</summary>
<p>Please refer to the in-app FAQ for details.</p>
</details>
## License
> Copyright (C) 2017 Kosh.
@ -190,10 +190,10 @@ Read the [**contribution guide**](.github/CONTRIBUTING.md) for more detailed inf
## FastHub Logo
**FastHub** logo is designed by **Cookicons**.
[Google+](https://plus.google.com/+CookiconsDesign) | [Twitter](https://twitter.com/mcookie)
[Twitter](https://twitter.com/mcookie)
Designer website [Cookicons](https://cookicons.co/).
**OLD FastHub** logo was designed by **Kevin Aguilar**.
[Google+](https://plus.google.com/+KevinAguilarC) | [Twitter](https://twitter.com/kevttob)
[Twitter](https://twitter.com/kevttob)
Designer at [Kevin Aguilar](http://kevaguilar.com/).
Laus Deo Semper

View File

@ -1,8 +1,9 @@
apply plugin: 'com.android.application'
apply plugin: 'com.apollographql.android'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.apollographql.android'
apply plugin: 'com.novoda.build-properties'
apply plugin: 'jacoco-android'
apply plugin: 'io.fabric'
buildProperties {
@ -10,7 +11,7 @@ buildProperties {
file rootProject.file('debug_gradle.properties')
}
secrets {
file rootProject.file('gradle.properties')
file rootProject.file('release_gradle.properties')
}
}
@ -23,14 +24,13 @@ android {
storePassword((buildProperties.secrets['android_store_password'] | buildProperties.notThere['android_store_password']).string)
}
}
compileSdkVersion 27
buildToolsVersion '27.0.1'
compileSdkVersion 29
defaultConfig {
applicationId "com.fastaccess.github"
minSdkVersion 21
targetSdkVersion 27
versionCode 457
versionName "4.5.7"
targetSdkVersion 29
versionCode 469
versionName "4.6.9"
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
@ -38,7 +38,7 @@ android {
buildConfigField "String", "REST_URL", '"https://api.github.com/"'
buildConfigField "String", "IMGUR_URL", '"https://api.imgur.com/3/"'
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
@ -89,7 +89,8 @@ android {
}
configurations {
all*.exclude module: 'annotations'
all*.exclude module: 'javax.annotation'
all*.exclude group: 'org.jetbrains', module: 'annotations-java5'
}
packagingOptions { exclude 'META-INF/rxjava.properties' }
@ -117,25 +118,28 @@ repositories {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:${supportVersion}"
implementation "com.android.support:design:${supportVersion}"
implementation "com.android.support:cardview-v7:${supportVersion}"
implementation "com.android.support:recyclerview-v7:${supportVersion}"
implementation "com.android.support:preference-v14:${supportVersion}"
implementation "com.android.support:customtabs:${supportVersion}"
implementation "com.android.support:palette-v7:${supportVersion}"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.core:core:1.1.0'
implementation "net.grandcentrix.thirtyinch:thirtyinch:${thirtyinchVersion}"
implementation "net.grandcentrix.thirtyinch:thirtyinch-rx2:${thirtyinchVersion}"
implementation "com.squareup.retrofit2:retrofit:${retrofit}"
implementation "com.squareup.retrofit2:converter-gson:${retrofit}"
implementation "com.squareup.retrofit2:adapter-rxjava2:${retrofit}"
implementation "com.squareup.retrofit2:converter-scalars:${retrofit}"
implementation "com.github.bumptech.glide:glide:${glideVersion}"
implementation 'cn.gavinliu.android.lib:ShapedImageView:0.8.3'
implementation 'cn.gavinliu:ShapedImageView:0.8.7'
implementation "com.jakewharton:butterknife:${butterKnifeVersion}"
implementation 'it.sephiroth.android.library.bottomnavigation:bottom-navigation:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.5'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.15'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.1'
implementation 'com.annimon:stream:1.1.9'
implementation 'com.github.GrenderG:Toasty:1.1.3'
implementation 'com.github.k0shk0sh:RetainedDateTimePickers:1.0.2'
@ -152,41 +156,36 @@ dependencies {
implementation "com.atlassian.commonmark:commonmark-ext-gfm-tables:${commonmark}"
implementation "com.atlassian.commonmark:commonmark-ext-ins:${commonmark}"
implementation "com.atlassian.commonmark:commonmark-ext-yaml-front-matter:${commonmark}"
implementation "com.google.firebase:firebase-core:${gms}"
implementation "com.google.firebase:firebase-messaging:${gms}"
implementation "com.google.firebase:firebase-database:${gms}"
implementation "com.google.android.gms:play-services-base:${gms}"
implementation "com.google.firebase:firebase-core:17.2.1"
implementation "com.google.firebase:firebase-messaging:20.1.0"
implementation "com.google.firebase:firebase-database:19.2.0"
implementation "com.google.android.gms:play-services-base:17.1.0"
implementation('com.github.b3er.rxfirebase:firebase-database-kotlin:11.2.0') { transitive = false }
implementation('com.github.b3er.rxfirebase:firebase-database:11.2.0') { transitive = false }
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') { transitive = true }
implementation('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') { transitive = true }
implementation "com.github.miguelbcr:RxBillingService:0.0.3"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:${kotlin_version}"
implementation 'org.jsoup:jsoup:1.10.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"
implementation 'org.jsoup:jsoup:1.12.1'
implementation "com.evernote:android-state:${state_version}"
implementation "petrov.kristiyan:colorpicker-library:1.1.4"
implementation 'com.apollographql.apollo:apollo-rx2-support:0.4.1'
implementation 'com.apollographql.apollo:apollo-rx2-support:1.2.2'
implementation("com.apollographql.apollo:apollo-runtime:1.2.2")
implementation 'com.jaredrummler:android-device-names:1.1.5'
implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
implementation 'com.airbnb.android:lottie:2.2.5'
implementation 'com.airbnb.android:lottie:3.0.7'
implementation 'com.firebase:firebase-jobdispatcher:0.8.2'
debugImplementation 'com.github.whataa:pandora:2.0.6'
releaseImplementation 'com.github.whataa:pandora-no-op:2.0.3'
compileOnly "org.projectlombok:lombok:${lombokVersion}"
kapt "org.projectlombok:lombok:${lombokVersion}"
kapt "com.evernote:android-state-processor:${state_version}"
kapt "com.jakewharton:butterknife-compiler:${butterKnifeVersion}"
kapt 'com.github.matthiasrobbers:shortbread-compiler:1.0.1'
kapt "org.projectlombok:lombok:${lombokVersion}"
kapt "io.requery:requery-processor:${requery}"
// testImplementation "net.grandcentrix.thirtyinch:thirtyinch-test:$thirtyinchVersion"
testImplementation "junit:junit:${junitVersion}"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testImplementation "org.assertj:assertj-core:${assertjVersion}"
androidTestImplementation "com.android.support:support-annotations:${supportVersion}"
androidTestImplementation "org.mockito:mockito-core:${mockitoVersion}"
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
androidTestImplementation "com.android.support.test.espresso:espresso-intents:${espresseVersion}"
androidTestImplementation "com.android.support.test.espresso:espresso-core:${espresseVersion}"
kapt "com.github.bumptech.glide:compiler:$glideVersion"
}
apply plugin: 'ManifestClasspath'
apply plugin: 'com.google.gms.google-services'

View File

@ -78,6 +78,8 @@
public *;
}
-keep class com.google.android.gms.** { *; }
-dontwarn com.github.b3er.**
-dontwarn com.memoizrlabs.**
-dontwarn java.lang.FunctionalInterface
@ -131,4 +133,8 @@
-dontwarn com.octo.android.robospice.retrofit.RetrofitJackson**
-dontwarn retrofit.appengine.UrlFetchClient
-dontwarn icepick.**
-dontwarn com.fastaccess.ui.modules.repos.**
-dontwarn com.fastaccess.ui.modules.repos.**
-dontwarn org.apache.xerces.parsers.**
-dontwarn oracle.xml.**
-dontwarn org.jdom.**
-dontwarn okhttp3.internal.**

View File

@ -1,77 +0,0 @@
package com.fastaccess.helper;
import android.support.annotation.IntRange;
import android.support.design.widget.TextInputLayout;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
import android.view.View;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import it.sephiroth.android.library.bottomnavigation.BottomNavigation;
import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
/**
* Created by Kosh on 05 May 2017, 9:23 PM
*/
public class TestHelper {
public static Matcher<View> textInputLayoutHasHint(final String expectedErrorText) {
return new TypeSafeMatcher<View>() {
@Override public boolean matchesSafely(View view) {
if (!(view instanceof TextInputLayout)) {
return false;
}
CharSequence error = ((TextInputLayout) view).getHint();
return error != null && expectedErrorText.equals(error.toString());
}
@Override public void describeTo(Description description) {}
};
}
public static Matcher<View> textInputLayoutHasError(final String expectedErrorText) {
return new TypeSafeMatcher<View>() {
@Override public boolean matchesSafely(View view) {
if (!(view instanceof TextInputLayout)) {
return false;
}
CharSequence error = ((TextInputLayout) view).getError();
return error != null && expectedErrorText.equals(error.toString());
}
@Override public void describeTo(Description description) {}
};
}
public static Matcher<View> bottomNavSelection(@IntRange(from = 0, to = 3) final int position) {
return new TypeSafeMatcher<View>() {
@Override public boolean matchesSafely(View view) {
return view instanceof BottomNavigation && position == ((BottomNavigation) view).getSelectedIndex();
}
@Override public void describeTo(Description description) {}
};
}
public static ViewAction bottomNavAction(@IntRange(from = 0, to = 3) final int index) {
return new ViewAction() {
@Override public Matcher<View> getConstraints() {
return isAssignableFrom(BottomNavigation.class);
}
@Override public String getDescription() {
return "BottomNavigation";
}
@Override public void perform(UiController uiController, View view) {
((BottomNavigation) view).setSelectedIndex(index, false);
}
};
}
}

View File

@ -1,54 +0,0 @@
package com.fastaccess.ui.modules.login;
import android.support.test.filters.LargeTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import com.fastaccess.R;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static com.fastaccess.helper.TestHelper.textInputLayoutHasError;
import static org.hamcrest.core.IsNot.not;
@RunWith(AndroidJUnit4.class) @LargeTest
public class LoginActivityTest {
@Rule public ActivityTestRule<LoginActivity> testRule = new ActivityTestRule<>(LoginActivity.class);
@Test public void successLoginClickSuccessTest() {
String username = "username";
String password = "password";
onView(withId(R.id.usernameEditText)).perform(typeText(username), closeSoftKeyboard());
onView(withId(R.id.passwordEditText)).perform(typeText(password), closeSoftKeyboard());
onView(withId(R.id.login)).perform(click());
onView(withId(R.id.progress)).check(matches(isDisplayed()));
}
@Test public void usernameErrorTest() {
String password = "password";
onView(withId(R.id.passwordEditText)).perform(typeText(password), closeSoftKeyboard());
onView(withId(R.id.login)).perform(click());
onView(withId(R.id.progress)).check(matches(not(isDisplayed())));
onView(withId(R.id.username)).check(matches(textInputLayoutHasError(testRule.getActivity().getString(R.string.required_field))));
}
@Test public void passwordErrorTest() {
String username = "username";
onView(withId(R.id.usernameEditText)).perform(typeText(username), closeSoftKeyboard());
onView(withId(R.id.login)).perform(click());
onView(withId(R.id.progress)).check(matches(not(isDisplayed())));
onView(withId(R.id.password)).check(matches(textInputLayoutHasError(testRule.getActivity().getString(R.string.required_field))));
}
}

View File

@ -1,39 +0,0 @@
package com.fastaccess.ui.modules.login;
import android.support.test.espresso.intent.rule.IntentsTestRule;
import android.support.test.filters.LargeTest;
import android.support.test.runner.AndroidJUnit4;
import com.fastaccess.R;
import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static com.fastaccess.helper.TestHelper.textInputLayoutHasHint;
@RunWith(AndroidJUnit4.class) @LargeTest
public class LoginChooserActivityTest {
@Rule public IntentsTestRule<LoginChooserActivity> intentTestRule = new IntentsTestRule<>(LoginChooserActivity.class);
@Test public void basicAuthButtonTest() {
onView(withId(R.id.basicAuth)).perform(click());
intended(hasComponent(LoginActivity.class.getName()));
onView(withId(R.id.password)).check(matches(textInputLayoutHasHint(intentTestRule.getActivity().getString(R.string.password))));
}
@Test public void accessTokenButtonTest() {
onView(withId(R.id.accessToken)).perform(click());
intended(hasComponent(LoginActivity.class.getName()));
onView(withId(R.id.password)).check(matches(textInputLayoutHasHint(intentTestRule.getActivity().getString(R.string.access_token))));
}
}

View File

@ -1,69 +0,0 @@
package com.fastaccess.ui.modules.main;
import android.support.test.espresso.intent.rule.IntentsTestRule;
import com.fastaccess.R;
import com.fastaccess.helper.AppHelper;
import com.fastaccess.ui.modules.feeds.FeedsFragment;
import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity;
import com.fastaccess.ui.modules.main.issues.pager.MyIssuesPagerFragment;
import com.fastaccess.ui.modules.main.pullrequests.pager.MyPullsPagerFragment;
import com.fastaccess.ui.modules.notification.NotificationActivity;
import com.fastaccess.ui.modules.search.SearchActivity;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static com.fastaccess.helper.TestHelper.bottomNavAction;
import static com.fastaccess.helper.TestHelper.bottomNavSelection;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* Created by Kosh on 06 May 2017, 2:11 AM
*/
public class MainActivityTest {
@Rule public IntentsTestRule<MainActivity> testRule = new IntentsTestRule<>(MainActivity.class);
@Test public void noUserTest() {
assertEquals(testRule.getActivity().isLoggedIn(), false);
intended(hasComponent(LoginChooserActivity.class.getName()));
}
@Test public void onInitTest() {
assertEquals(testRule.getActivity().isLoggedIn(), true);
onView(withId(R.id.bottomNavigation)).check(matches(bottomNavSelection(0)));
assertNotNull(AppHelper.getFragmentByTag(testRule.getActivity().getSupportFragmentManager(), FeedsFragment.TAG));
}
@Test public void onSelectIssuesTabTest() {
assertEquals(testRule.getActivity().isLoggedIn(), true);
onView(withId(R.id.bottomNavigation)).perform(bottomNavAction(1))
.check(matches(bottomNavSelection(1)));
assertNotNull(AppHelper.getFragmentByTag(testRule.getActivity().getSupportFragmentManager(), MyIssuesPagerFragment.TAG));
}
@Test public void onSelectPullRequestsTabTest() {
assertEquals(testRule.getActivity().isLoggedIn(), true);
onView(withId(R.id.bottomNavigation)).perform(bottomNavAction(2))
.check(matches(bottomNavSelection(2)));
assertNotNull(AppHelper.getFragmentByTag(testRule.getActivity().getSupportFragmentManager(), MyPullsPagerFragment.TAG));
}
@Test public void startNotificationsIntentTest() {
onView(withId(R.id.notifications)).perform(click());
intended(hasComponent(NotificationActivity.class.getName()));
}
@Test public void startSearchIntentTest() {
onView(withId(R.id.search)).perform(click());
intended(hasComponent(SearchActivity.class.getName()));
}
}

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.fastaccess"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.fastaccess"
android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="com.android.vending.BILLING"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
tools:node="remove" />
<application
android:name=".App"
@ -29,15 +29,15 @@
<activity
android:name=".ui.modules.main.donation.CheckPurchaseActivity"
android:configChanges="keyboard|orientation|screenSize"
android:theme="@style/ThemeTranslucent"/>
android:theme="@style/ThemeTranslucent" />
<activity
android:name=".ui.modules.main.MainActivity"
android:launchMode="singleTask"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
@ -48,14 +48,14 @@
android:screenOrientation="portrait"
android:theme="@style/LoginTheme">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="login"
android:scheme="fasthub"/>
android:scheme="fasthub" />
</intent-filter>
</activity>
<activity
@ -64,14 +64,14 @@
android:label="@string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/LoginTheme"/>
android:theme="@style/LoginTheme" />
<activity
android:name=".ui.modules.user.UserPagerActivity"
android:label="@string/user"
android:parentActivityName=".ui.modules.main.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.main.MainActivity"/>
android:value=".ui.modules.main.MainActivity" />
</activity>
<activity
android:name=".ui.modules.repos.RepoPagerActivity"
@ -79,7 +79,7 @@
android:parentActivityName=".ui.modules.main.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.main.MainActivity"/>
android:value=".ui.modules.main.MainActivity" />
</activity>
<activity
android:name=".ui.modules.repos.issues.issue.details.IssuePagerActivity"
@ -88,19 +88,19 @@
android:windowSoftInputMode="stateAlwaysHidden">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.repos.RepoPagerActivity"/>
android:value=".ui.modules.repos.RepoPagerActivity" />
</activity>
<activity
android:name=".ui.modules.repos.issues.create.CreateIssueActivity"
android:configChanges="keyboard|orientation|screenSize"
android:label="@string/create_issue"/>
android:label="@string/create_issue" />
<activity
android:name=".ui.modules.repos.pull_requests.pull_request.details.PullRequestPagerActivity"
android:label="@string/pull_request"
android:parentActivityName=".ui.modules.repos.RepoPagerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.repos.RepoPagerActivity"/>
android:value=".ui.modules.repos.RepoPagerActivity" />
</activity>
<activity
android:name=".ui.modules.repos.code.commit.details.CommitPagerActivity"
@ -109,21 +109,21 @@
android:windowSoftInputMode="stateAlwaysHidden">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.repos.RepoPagerActivity"/>
android:value=".ui.modules.repos.RepoPagerActivity" />
</activity>
<activity
android:name=".ui.modules.code.CodeViewerActivity"
android:configChanges="keyboard|orientation|screenSize"
android:label="@string/viewer"/>
android:label="@string/viewer" />
<activity
android:name=".ui.modules.editor.EditorActivity"
android:configChanges="keyboard|orientation|screenSize"
android:label="@string/markdown"
android:windowSoftInputMode="adjustResize"/>
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.modules.gists.create.CreateGistActivity"
android:configChanges="keyboard|orientation|screenSize"
android:label="@string/create_gist"/>
android:label="@string/create_gist" />
<activity
android:name=".ui.modules.gists.gist.GistActivity"
android:label="@string/gist"
@ -131,14 +131,14 @@
android:windowSoftInputMode="stateAlwaysHidden">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.main.MainActivity"/>
android:value=".ui.modules.main.MainActivity" />
</activity>
<activity
android:name=".ui.modules.search.SearchActivity"
android:parentActivityName=".ui.modules.main.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.main.MainActivity"/>
android:value=".ui.modules.main.MainActivity" />
</activity>
<activity
android:name=".ui.modules.notification.NotificationActivity"
@ -146,48 +146,48 @@
android:parentActivityName=".ui.modules.main.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.main.MainActivity"/>
android:value=".ui.modules.main.MainActivity" />
</activity>
<activity
android:name=".ui.modules.about.FastHubAboutActivity"
android:theme="@style/AppTheme.AboutActivity.Light"/>
android:theme="@style/AppTheme.AboutActivity.Light" />
<activity
android:name=".ui.modules.pinned.PinnedReposActivity"
android:label="@string/pinned"/>
android:label="@string/pinned" />
<activity
android:name=".ui.modules.gists.GistsListActivity"
android:label="@string/public_gists"/>
<activity android:name=".ui.modules.profile.org.teams.details.TeamPagerActivity"/>
android:label="@string/public_gists" />
<activity android:name=".ui.modules.profile.org.teams.details.TeamPagerActivity" />
<activity
android:name=".ui.modules.repos.code.files.activity.RepoFilesActivity"
android:parentActivityName=".ui.modules.repos.RepoPagerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.repos.RepoPagerActivity"/>
android:value=".ui.modules.repos.RepoPagerActivity" />
</activity>
<activity android:name=".ui.modules.filter.issues.FilterIssuesActivity"/>
<activity android:name=".ui.modules.main.donation.DonationActivity"/>
<activity android:name=".ui.modules.repos.code.commit.viewer.FullCommitFileActivity"/>
<activity android:name=".ui.modules.filter.issues.FilterIssuesActivity" />
<activity android:name=".ui.modules.main.donation.DonationActivity" />
<activity android:name=".ui.modules.repos.code.commit.viewer.FullCommitFileActivity" />
<activity
android:name=".ui.modules.search.repos.files.SearchFileActivity"
android:parentActivityName=".ui.modules.repos.RepoPagerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.repos.RepoPagerActivity"/>
android:value=".ui.modules.repos.RepoPagerActivity" />
</activity>
<activity
android:name=".ui.modules.settings.SettingsActivity"
android:configChanges="keyboard|orientation|screenSize"/>
android:configChanges="keyboard|orientation|screenSize" />
<activity
android:name=".ui.modules.settings.category.SettingsCategoryActivity"
android:configChanges="keyboard|orientation|screenSize"/>
android:configChanges="keyboard|orientation|screenSize" />
<activity
android:name=".ui.modules.repos.code.releases.ReleasesListActivity"
android:label="@string/releases"
android:parentActivityName=".ui.modules.repos.RepoPagerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.repos.RepoPagerActivity"/>
android:value=".ui.modules.repos.RepoPagerActivity" />
</activity>
<activity
android:name=".ui.modules.trending.TrendingActivity"
@ -196,41 +196,41 @@
android:windowSoftInputMode="stateAlwaysHidden">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.main.MainActivity"/>
android:value=".ui.modules.main.MainActivity" />
</activity>
<activity android:name=".ui.modules.theme.ThemeActivity"/>
<activity android:name=".ui.modules.theme.ThemeActivity" />
<activity
android:name=".ui.modules.theme.code.ThemeCodeActivity"
android:label="@string/theme_title"/>
android:label="@string/theme_title" />
<activity
android:name=".ui.modules.main.donation.DonateActivity"
android:configChanges="keyboard|orientation|screenSize"
android:theme="@style/ThemeTranslucent"/>
android:theme="@style/ThemeTranslucent" />
<activity
android:name=".ui.modules.repos.wiki.WikiActivity"
android:label="@string/gollum"
android:parentActivityName=".ui.modules.repos.RepoPagerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.repos.RepoPagerActivity"/>
android:value=".ui.modules.repos.RepoPagerActivity" />
</activity>
<activity
android:name=".ui.modules.main.premium.PremiumActivity"
android:configChanges="keyboard|orientation|screenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden"/>
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name=".ui.modules.repos.git.EditRepoFileActivity"
android:configChanges="keyboard|orientation|screenSize"
android:label="@string/markdown"
android:windowSoftInputMode="adjustResize"/>
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.modules.repos.code.commit.history.FileCommitHistoryActivity"
android:label="@string/commits"
android:parentActivityName=".ui.modules.repos.RepoPagerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.repos.RepoPagerActivity"/>
android:value=".ui.modules.repos.RepoPagerActivity" />
</activity>
<activity
android:name=".ui.modules.repos.projects.details.ProjectPagerActivity"
@ -238,7 +238,7 @@
android:parentActivityName=".ui.modules.repos.RepoPagerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.repos.RepoPagerActivity"/>
android:value=".ui.modules.repos.RepoPagerActivity" />
</activity>
<activity
android:name=".ui.modules.profile.org.project.OrgProjectActivity"
@ -246,16 +246,16 @@
android:parentActivityName=".ui.modules.user.UserPagerActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.modules.user.UserPagerActivity"/>
android:value=".ui.modules.user.UserPagerActivity" />
</activity>
<activity android:name=".ui.modules.main.playstore.PlayStoreWarningActivity"/>
<activity android:name=".ui.modules.main.playstore.PlayStoreWarningActivity" />
<activity
android:name=".ui.modules.repos.pull_requests.pull_request.details.files.fullscreen.FullScreenFileChangeActivity"
android:configChanges="keyboard|orientation|screenSize"/>
android:configChanges="keyboard|orientation|screenSize" />
<activity android:name=".ui.modules.search.SearchUserActivity"/>
<activity android:name=".ui.modules.search.SearchUserActivity" />
<activity
android:name=".ui.modules.parser.LinksParserActivity"
@ -263,37 +263,37 @@
android:noHistory="true"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.VIEW" />
<data
android:host="github.com"
android:scheme="http"/>
android:scheme="http" />
<data
android:host="github.com"
android:scheme="https"/>
android:scheme="https" />
<data
android:host="gist.github.com"
android:scheme="http"/>
android:scheme="http" />
<data
android:host="gist.github.com"
android:scheme="https"/>
android:scheme="https" />
<data
android:host="raw.githubusercontent.com"
android:scheme="https"/>
android:scheme="https" />
<data
android:host="gist.githubusercontent.com"
android:scheme="https"/>
<data android:pathPattern=".*"/>
android:scheme="https" />
<data android:pathPattern=".*" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="text/plain"/>
<data android:mimeType="text/plain" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
@ -301,25 +301,29 @@
android:name=".provider.tasks.notification.NotificationSchedulerJobTask"
android:exported="false">
<intent-filter>
<action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE"/>
<action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE" />
</intent-filter>
</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 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
android:name=".provider.fcm.PushNotificationService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<meta-data
android:name="io.fabric.ApiKey"
android:value="6ed82b6e0756853d7d782a3f547f84f9ecba217e"/>
android:value="6ed82b6e0756853d7d782a3f547f84f9ecba217e" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification" />
</application>
</manifest>

View File

@ -5,10 +5,10 @@ query getPinnedRepos($login: String!) {
node {
name
url
issues(states: OPEN) {
issues(states: [OPEN]) {
totalCount
}
pullRequests(states: OPEN) {
pullRequests(states: [OPEN]) {
totalCount
}
stargazers {

View File

@ -1,6 +1,6 @@
query repoProjectsOpen($owner: String!, $name: String!, $page: String) {
repository(owner: $owner, name: $name) {
projects(first: 30, states: OPEN, after: $page, orderBy: {field: CREATED_AT, direction: DESC}) {
projects(first: 30, states: [OPEN], after: $page, orderBy: {field: CREATED_AT, direction: DESC}) {
totalCount
edges {
cursor
@ -27,7 +27,7 @@ repository(owner: $owner, name: $name) {
}
query repoProjectsClosed($owner: String!, $name: String!, $page: String) {
repository(owner: $owner, name: $name) {
projects(first: 30, states: CLOSED, after: $page, orderBy: {field: CREATED_AT, direction: DESC}) {
projects(first: 30, states: [CLOSED], after: $page, orderBy: {field: CREATED_AT, direction: DESC}) {
totalCount
edges {
cursor
@ -55,7 +55,7 @@ repository(owner: $owner, name: $name) {
query orgProjectsOpen($owner: String!, $page: String) {
organization(login: $owner) {
projects(first: 30, states: OPEN, after: $page, orderBy: {field: CREATED_AT, direction: DESC}) {
projects(first: 30, states: [OPEN], after: $page, orderBy: {field: CREATED_AT, direction: DESC}) {
totalCount
edges {
cursor
@ -82,7 +82,7 @@ organization(login: $owner) {
}
query orgProjectsClosed($owner: String!, $page: String) {
organization(login: $owner) {
projects(first: 30, states: CLOSED, after: $page, orderBy: {field: CREATED_AT, direction: DESC}) {
projects(first: 30, states: [CLOSED], after: $page, orderBy: {field: CREATED_AT, direction: DESC}) {
totalCount
edges {
cursor

View File

@ -1,8 +1,8 @@
package com.fastaccess;
import android.app.Application;
import android.support.annotation.NonNull;
import android.support.v7.preference.PreferenceManager;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;
import com.fastaccess.data.dao.model.Models;
import com.fastaccess.helper.DeviceNameGetter;
@ -72,7 +72,7 @@ public class App extends Application {
public ReactiveEntityStore<Persistable> getDataStore() {
if (dataStore == null) {
EntityModel model = Models.DEFAULT;
DatabaseSource source = new DatabaseSource(this, model, "FastHub-DB", 17);
DatabaseSource source = new DatabaseSource(this, model, "FastHub-DB", 18);
Configuration configuration = source.getConfiguration();
if (BuildConfig.DEBUG) {
source.setTableCreationMode(TableCreationMode.CREATE_NOT_EXISTS);

View File

@ -0,0 +1,8 @@
package com.fastaccess
import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.module.AppGlideModule
@GlideModule
class GlideModule : AppGlideModule()

View File

@ -2,8 +2,8 @@ package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.annimon.stream.Stream;
@ -73,4 +73,11 @@ import lombok.Setter;
int size = parcel.dataSize();
return size < 600000;
}
@Override public String toString() {
return "CommitFileChanges{" +
"linesModel=" + linesModel +
", commitFileModel=" + commitFileModel +
'}';
}
}

View File

@ -2,8 +2,8 @@ package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.helper.InputHelper;

View File

@ -9,11 +9,13 @@ public class CommitRequestModel {
private String message;
private String content;
private String sha;
private String branch;
public CommitRequestModel(String message, String content, String sha) {
public CommitRequestModel(String message, String content, String sha, String branch) {
this.message = message;
this.content = content;
this.sha = sha;
this.branch = branch;
}
public String getSha() {
@ -39,4 +41,12 @@ public class CommitRequestModel {
public void setContent(String content) {
this.content = content;
}
public String getBranch() {
return branch;
}
public void setBranch(String branch) {
this.branch = branch;
}
}

View File

@ -14,5 +14,5 @@ import lombok.Setter;
public class CreateMilestoneModel {
private String title;
private String description;
@SerializedName("due_one") private String dueOn;
@SerializedName("due_on") private String dueOn;
}

View File

@ -1,51 +1,44 @@
package com.fastaccess.data.dao
import android.os.Parcel
import android.os.Parcelable
import com.fastaccess.helper.*
/**
* Created by Hashemsergani on 01/09/2017.
*/
data class EditRepoFileModel(val login: String,
val repoId: String,
val path: String?,
val ref: String,
val sha: String?,
val contentUrl: String?,
val fileName: String?,
val isEdit: Boolean) : Parcelable {
data class EditRepoFileModel(
val login: String,
val repoId: String,
val path: String?,
val ref: String,
val sha: String?,
val contentUrl: String?,
val fileName: String?,
val isEdit: Boolean
) : KotlinParcelable {
constructor(parcel: Parcel) : this(
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readByte() != 0.toByte())
parcel.readString() ?: "",
parcel.readString() ?: "",
parcel.readString() ?: "",
parcel.readString() ?: "",
parcel.readString() ?: "",
parcel.readString() ?: "",
parcel.readString() ?: "",
parcel.readBooleanCompat()
)
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeString(login)
parcel.writeString(repoId)
parcel.writeString(path)
parcel.writeString(ref)
parcel.writeString(sha)
parcel.writeString(contentUrl)
parcel.writeString(fileName)
parcel.writeByte(if (isEdit) 1 else 0)
override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
writeString(login)
writeString(repoId)
writeString(path)
writeString(ref)
writeString(sha)
writeString(contentUrl)
writeString(fileName)
writeBooleanCompat(isEdit)
}
override fun describeContents(): Int {
return 0
companion object {
@JvmField val CREATOR = parcelableCreator(::EditRepoFileModel)
}
companion object CREATOR : Parcelable.Creator<EditRepoFileModel> {
override fun createFromParcel(parcel: Parcel): EditRepoFileModel {
return EditRepoFileModel(parcel)
}
override fun newArray(size: Int): Array<EditRepoFileModel?> {
return arrayOfNulls(size)
}
}
}
}

View File

@ -0,0 +1,36 @@
package com.fastaccess.data.dao
data class FirebaseTrendingConfigModel(
var pathUrl: String = "https://github.com/trending/",
var description: String = ".Box-row > p",
var forks: String = ".f6 > a[href*=/network]",
var language: String = ".f6 span[itemprop=programmingLanguage]",
var languageFallback: String = ".f6 span[itemprop=programmingLanguage]",
var listName: String = ".Box",
var listNameSublistTag: String = "article",
var stars: String = ".f6 > a[href*=/stargazers]",
var title: String = ".Box-row > h1 > a",
var todayStars: String = ".f6 > span.float-sm-right",
var todayStarsFallback: String = ".f6 > span.float-sm-right"
) {
companion object {
fun map(map: HashMap<String, String>?): FirebaseTrendingConfigModel {
val trendingModel = FirebaseTrendingConfigModel()
map?.let {
trendingModel.description = it.getOrElse("description") { trendingModel.description }
trendingModel.forks = it.getOrElse("forks") { trendingModel.forks }
trendingModel.language = it.getOrElse("language") { trendingModel.language }
trendingModel.languageFallback = it.getOrElse("language_fallback") { trendingModel.languageFallback }
trendingModel.listName = it.getOrElse("list_name") { trendingModel.listName }
trendingModel.listNameSublistTag = it.getOrElse("list_name_sublist_tag") { trendingModel.listNameSublistTag }
trendingModel.stars = it.getOrElse("stars") { trendingModel.stars }
trendingModel.title = it.getOrElse("title") { trendingModel.title }
trendingModel.todayStars = it.getOrElse("today_stars") { trendingModel.title }
trendingModel.todayStarsFallback = it.getOrElse("today_stars_fallback") { trendingModel.title }
trendingModel.pathUrl = it.getOrElse("path_url") { trendingModel.pathUrl }
}
return trendingModel
}
}
}

View File

@ -1,9 +1,9 @@
package com.fastaccess.data.dao;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.annimon.stream.Collectors;
import com.annimon.stream.Stream;
@ -18,6 +18,9 @@ import com.fastaccess.ui.modules.feeds.FeedsFragment;
import com.fastaccess.ui.modules.gists.GistsFragment;
import com.fastaccess.ui.modules.gists.gist.comments.GistCommentsFragment;
import com.fastaccess.ui.modules.gists.gist.files.GistFilesListFragment;
import com.fastaccess.ui.modules.gists.starred.StarredGistsFragment;
import com.fastaccess.ui.modules.main.drawer.AccountDrawerFragment;
import com.fastaccess.ui.modules.main.drawer.MainDrawerFragment;
import com.fastaccess.ui.modules.main.issues.MyIssuesFragment;
import com.fastaccess.ui.modules.main.pullrequests.MyPullRequestFragment;
import com.fastaccess.ui.modules.notification.all.AllNotificationsFragment;
@ -180,9 +183,9 @@ import lombok.Setter;
}
@NonNull public static List<FragmentPagerAdapterModel> buildForGists(@NonNull Context context) {
return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.my_gists), ProfileGistsFragment.newInstance(Login.getUser()
.getLogin())),
return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.my_gists), ProfileGistsFragment
.newInstance(Login.getUser().getLogin())),
new FragmentPagerAdapterModel(context.getString(R.string.starred), StarredGistsFragment.newInstance()),
new FragmentPagerAdapterModel(context.getString(R.string.public_gists), GistsFragment.newInstance()))
.collect(Collectors.toList());
}
@ -262,7 +265,6 @@ import lombok.Setter;
.toList();
}
@NonNull public static List<FragmentPagerAdapterModel> buildForPinned(@NonNull Context context) {
return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.repos), PinnedReposFragment.newInstance()),
new FragmentPagerAdapterModel(context.getString(R.string.issues), PinnedIssueFragment.newInstance()),
@ -271,6 +273,12 @@ import lombok.Setter;
.collect(Collectors.toList());
}
@NonNull public static List<FragmentPagerAdapterModel> buildForDrawer(@NonNull Context context) {
return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.menu_label), new MainDrawerFragment()),
new FragmentPagerAdapterModel(context.getString(R.string.profile), new AccountDrawerFragment()))
.toList();
}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

View File

@ -1,52 +0,0 @@
package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Date;
/**
* Created by Hashemsergani on 18.10.17.
*/
public class GitHubStatusModel implements Parcelable {
private String status;
private String body;
private Date createdOn;
public String getStatus() { return status;}
public void setStatus(String status) { this.status = status;}
public String getBody() { return body;}
public void setBody(String body) { this.body = body;}
public Date getCreatedOn() { return createdOn;}
public void setCreatedOn(Date createdOn) { this.createdOn = createdOn;}
@Override public int describeContents() { return 0; }
@Override public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.status);
dest.writeString(this.body);
dest.writeLong(this.createdOn != null ? this.createdOn.getTime() : -1);
}
public GitHubStatusModel() {}
protected GitHubStatusModel(Parcel in) {
this.status = in.readString();
this.body = in.readString();
long tmpCreatedOn = in.readLong();
this.createdOn = tmpCreatedOn == -1 ? null : new Date(tmpCreatedOn);
}
public static final Parcelable.Creator<GitHubStatusModel> CREATOR = new Parcelable.Creator<GitHubStatusModel>() {
@Override public GitHubStatusModel createFromParcel(Parcel source) {return new GitHubStatusModel(source);}
@Override public GitHubStatusModel[] newArray(int size) {return new GitHubStatusModel[size];}
};
}

View File

@ -0,0 +1,15 @@
package com.fastaccess.data.dao
import com.google.gson.annotations.SerializedName
/**
* Created by Hashemsergani on 18.10.17.
*/
data class GitHubStatusModel(
@SerializedName("status") var status: GithubStatus? = null
)
data class GithubStatus(
@SerializedName("description") var description: String? = null,
@SerializedName("indicator") var indicator: String? = null
)

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.dao;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import com.annimon.stream.Collectors;
import com.annimon.stream.Stream;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import com.annimon.stream.Stream;
import com.fastaccess.data.dao.model.Issue;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.annimon.stream.Collectors;
import com.annimon.stream.Stream;

View File

@ -0,0 +1,14 @@
package com.fastaccess.data.dao;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Created by Kosh on 10.02.18.
*/
@NoArgsConstructor @AllArgsConstructor @Getter @Setter public class LockIssuePrModel {
private boolean locked;
private String activeLockReason;
}

View File

@ -1,7 +1,7 @@
package com.fastaccess.data.dao;
import android.net.Uri;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import com.fastaccess.helper.InputHelper;
import com.fastaccess.provider.scheme.LinkParserHelper;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import com.annimon.stream.Stream;
import com.fastaccess.data.dao.model.IssueEvent;

View File

@ -25,6 +25,7 @@ import lombok.Setter;
private String url;
private boolean mergable;
private Date createdAt;
private String mergeableState;
public PullRequestStatusModel() {}
@ -39,9 +40,10 @@ import lombok.Setter;
dest.writeString(this.url);
dest.writeByte(this.mergable ? (byte) 1 : (byte) 0);
dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1);
dest.writeString(this.mergeableState);
}
private PullRequestStatusModel(Parcel in) {
protected PullRequestStatusModel(Parcel in) {
int tmpState = in.readInt();
this.state = tmpState == -1 ? null : StatusStateType.values()[tmpState];
this.sha = in.readString();
@ -52,6 +54,7 @@ import lombok.Setter;
this.mergable = in.readByte() != 0;
long tmpCreatedAt = in.readLong();
this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt);
this.mergeableState = in.readString();
}
public static final Creator<PullRequestStatusModel> CREATOR = new Creator<PullRequestStatusModel>() {

View File

@ -3,7 +3,7 @@ package com.fastaccess.data.dao;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.helper.InputHelper;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import com.fastaccess.data.dao.model.User;
import com.google.gson.annotations.SerializedName;

View File

@ -1,7 +1,7 @@
package com.fastaccess.data.dao;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.data.dao.model.RepoFile;

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.dao;
import android.support.annotation.IntDef;
import androidx.annotation.IntDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.DrawableRes;
import androidx.annotation.DrawableRes;
import java.io.Serializable;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import com.fastaccess.data.dao.model.Comment;
import com.fastaccess.data.dao.model.Issue;

View File

@ -1,39 +1,36 @@
package com.fastaccess.data.dao
import android.os.Parcel
import android.os.Parcelable
import com.fastaccess.helper.KotlinParcelable
import com.fastaccess.helper.parcelableCreator
data class TrendingModel(
val title: String? = null,
val description: String? = null,
val language: String? = null,
val stars: String? = null,
val forks: String? = null,
val todayStars: String? = null) : Parcelable {
val title: String? = null,
val description: String? = null,
val language: String? = null,
val stars: String? = null,
val forks: String? = null,
val todayStars: String? = null
) : KotlinParcelable {
companion object {
@JvmField val CREATOR: Parcelable.Creator<TrendingModel> = object : Parcelable.Creator<TrendingModel> {
override fun createFromParcel(source: Parcel): TrendingModel = TrendingModel(source)
override fun newArray(size: Int): Array<TrendingModel?> = arrayOfNulls(size)
}
@JvmField val CREATOR = parcelableCreator(::TrendingModel)
}
constructor(source: Parcel) : this(
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString()
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString(),
source.readString()
)
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int) {
dest.writeString(title)
dest.writeString(description)
dest.writeString(language)
dest.writeString(stars)
dest.writeString(forks)
dest.writeString(todayStars)
override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
writeString(title)
writeString(description)
writeString(language)
writeString(stars)
writeString(forks)
writeString(todayStars)
}
}
}

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.ReactionsModel;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.CommitFileListModel;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.text.TextUtils;
import com.fastaccess.App;
@ -42,7 +42,7 @@ import lombok.NoArgsConstructor;
@Nullable String login;
@NonNull
public static Disposable save(@android.support.annotation.Nullable List<Event> events, @android.support.annotation.Nullable String user) {
public static Disposable save(@androidx.annotation.Nullable List<Event> events, @androidx.annotation.Nullable String user) {
return RxHelper.getSingle(Single.fromPublisher(s -> {
try {
Login login = Login.getUser();

View File

@ -2,14 +2,13 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import java.util.Date;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.reactivex.Observable;
import io.requery.Column;
import io.requery.Entity;
@ -33,11 +32,11 @@ import lombok.NoArgsConstructor;
@io.requery.Nullable String title;
@io.requery.Nullable NotificationType type;
public static void update(@Nonnull FastHubNotification notification) {
public static void update(@NonNull FastHubNotification notification) {
App.getInstance().getDataStore().toBlocking().update(notification);
}
public static void save(@Nonnull FastHubNotification notification) {
public static void save(@NonNull FastHubNotification notification) {
App.getInstance().getDataStore().toBlocking().insert(notification);
}
@ -51,7 +50,7 @@ import lombok.NoArgsConstructor;
.firstOrNull();
}
@Nonnull public static Observable<FastHubNotification> getNotifications() {
@NonNull public static Observable<FastHubNotification> getNotifications() {
return App.getInstance().getDataStore()
.select(FastHubNotification.class)
.orderBy(FastHubNotification.DATE.desc())

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.annimon.stream.Collectors;
import com.annimon.stream.LongStream;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.LabelListModel;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.LabelModel;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.helper.PrefGetter;

View File

@ -72,7 +72,7 @@ import lombok.NoArgsConstructor;
})).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace);
}
public static Disposable save(@android.support.annotation.Nullable List<Notification> models) {
public static Disposable save(@androidx.annotation.Nullable List<Notification> models) {
if (models == null || models.isEmpty()) {
return Observable.empty().subscribe();
}
@ -92,7 +92,7 @@ import lombok.NoArgsConstructor;
})).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace);
}
public static Single<Boolean> saveAsSingle(@android.support.annotation.Nullable List<Notification> models) {
public static Single<Boolean> saveAsSingle(@androidx.annotation.Nullable List<Notification> models) {
if (models == null || models.isEmpty()) {
return Single.just(true);
}

View File

@ -2,6 +2,7 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.helper.RxHelper;
@ -9,8 +10,6 @@ import com.fastaccess.helper.RxHelper;
import java.util.Date;
import java.util.List;
import javax.annotation.Nullable;
import io.reactivex.Observable;
import io.requery.BlockingEntityStore;
import io.requery.Entity;

View File

@ -1,18 +1,14 @@
package com.fastaccess.data.dao.model;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.data.dao.converters.GistConverter;
import com.fastaccess.data.dao.converters.IssueConverter;
import com.fastaccess.helper.RxHelper;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.disposables.Disposable;
import io.requery.Convert;
import io.requery.Entity;
import io.requery.Generated;
@ -36,17 +32,17 @@ import static com.fastaccess.data.dao.model.PinnedGists.LOGIN;
@io.requery.Nullable long gistId;
public static void pinUpin(@NonNull Gist gist) {
PinnedGists pinnedIssues = get(gist.getId());
PinnedGists pinnedIssues = get(gist.getGistId().hashCode());
if (pinnedIssues == null) {
PinnedGists pinned = new PinnedGists();
pinned.setLogin(Login.getUser().getLogin());
pinned.setGist(gist);
pinned.setGistId(gist.getId());
pinned.setGistId(gist.getGistId().hashCode());
try {
App.getInstance().getDataStore().toBlocking().insert(pinned);
} catch (Exception ignored) {}
} else {
delete(gist.getId());
delete(gist.getGistId().hashCode());
}
}
@ -64,18 +60,6 @@ import static com.fastaccess.data.dao.model.PinnedGists.LOGIN;
.value();
}
@NonNull public static Disposable updateEntry(long gistId) {
return RxHelper.getObservable(Observable.fromPublisher(e -> {
PinnedGists pinned = get(gistId);
if (pinned != null) {
pinned.setEntryCount(pinned.getEntryCount() + 1);
App.getInstance().getDataStore().toBlocking().update(pinned);
e.onNext("");
}
e.onComplete();
})).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace);
}
@NonNull public static Single<List<Gist>> getMyPinnedGists() {
return App.getInstance().getDataStore().select(PinnedGists.class)
.where(LOGIN.eq(Login.getUser().getLogin()).or(LOGIN.isNull()))
@ -89,5 +73,4 @@ import static com.fastaccess.data.dao.model.PinnedGists.LOGIN;
public static boolean isPinned(long gistId) {
return get(gistId) != null;
}
}

View File

@ -1,7 +1,7 @@
package com.fastaccess.data.dao.model;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.data.dao.converters.IssueConverter;

View File

@ -1,7 +1,7 @@
package com.fastaccess.data.dao.model;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.data.dao.converters.PullRequestConverter;

View File

@ -1,8 +1,8 @@
package com.fastaccess.data.dao.model;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.data.dao.converters.RepoConverter;

View File

@ -3,7 +3,7 @@ package com.fastaccess.data.dao.model;
import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.R;
@ -79,6 +79,7 @@ import static com.fastaccess.data.dao.model.PullRequest.UPDATED_AT;
int reviewComments;
String repoId;
String login;
String mergeableState;
@Convert(UsersConverter.class) UsersListModel assignees;
@Convert(UserConverter.class) User mergedBy;
@Convert(UserConverter.class) User closedBy;
@ -262,6 +263,7 @@ import static com.fastaccess.data.dao.model.PullRequest.UPDATED_AT;
dest.writeInt(this.reviewComments);
dest.writeString(this.repoId);
dest.writeString(this.login);
dest.writeString(this.mergeableState);
dest.writeList(this.assignees);
dest.writeParcelable(this.mergedBy, flags);
dest.writeParcelable(this.closedBy, flags);
@ -309,6 +311,7 @@ import static com.fastaccess.data.dao.model.PullRequest.UPDATED_AT;
this.reviewComments = in.readInt();
this.repoId = in.readString();
this.login = in.readString();
this.mergeableState = in.readString();
this.assignees = new UsersListModel();
in.readList(this.assignees, this.assignees.getClass().getClassLoader());
this.mergedBy = in.readParcelable(User.class.getClassLoader());

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.ReleasesAssetsListModel;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.LicenseModel;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.data.dao.types.FilesType;

View File

@ -2,8 +2,8 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.helper.RxHelper;

View File

@ -2,7 +2,7 @@ package com.fastaccess.data.dao.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.App;
import com.fastaccess.helper.RxHelper;

View File

@ -1,169 +0,0 @@
package com.fastaccess.data.dao.timeline;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.fastaccess.data.dao.ReactionsModel;
import com.fastaccess.helper.Logger;
import com.fastaccess.helper.ParseDateFormat;
import java.util.ArrayList;
import java.util.List;
import github.PullRequestTimelineQuery;
import github.type.PullRequestReviewState;
/**
* Created by kosh on 20/08/2017.
*/
public class PullRequestReviewModel {
private PullRequestTimelineQuery.AsReviewDismissedEvent reviewDismissedEvent;
private PullRequestTimelineQuery.AsReviewRequestedEvent reviewRequestedEvent;
private PullRequestTimelineQuery.AsReviewRequestRemovedEvent reviewRequestRemovedEvent;
private PullRequestTimelineQuery.Node2 node;
private List<ReactionsModel> reaction;
private List<PullRequestReviewModel> comments;
private String id;
private String url;
private PullRequestTimelineQuery.Author2 author;
private String bodyHTML;
private String createdAt;
private PullRequestReviewState state;
@Nullable public static PullRequestReviewModel build(@NonNull PullRequestTimelineQuery.Node node) {
PullRequestReviewModel model = new PullRequestReviewModel();
if (node.asReviewRequestRemovedEvent() != null) {
model.reviewRequestRemovedEvent = node.asReviewRequestRemovedEvent();
} else if (node.asReviewDismissedEvent() != null) {
model.reviewDismissedEvent = node.asReviewDismissedEvent();
} else if (node.asReviewRequestedEvent() != null) {
model.reviewRequestedEvent = node.asReviewRequestedEvent();
} else {
PullRequestTimelineQuery.AsPullRequestReview pullRequestReview = node.asPullRequestReview();
if (pullRequestReview != null) {
model.state = pullRequestReview.state();
model.url = pullRequestReview.url().toString();
model.author = pullRequestReview.author();
model.bodyHTML = pullRequestReview.bodyHTML().toString();
model.createdAt = ParseDateFormat.getTimeAgo(pullRequestReview.createdAt().toString()).toString();
model.id = pullRequestReview.id();
model.url = pullRequestReview.url().toString();
List<PullRequestTimelineQuery.Edge2> edges = pullRequestReview.comments().edges();
if (edges != null && !edges.isEmpty()) {
List<PullRequestReviewModel> comments = new ArrayList<>();
for (PullRequestTimelineQuery.Edge2 edge : edges) {
PullRequestTimelineQuery.Node2 node2 = edge.node();
if (node2 != null) {
PullRequestReviewModel comment = new PullRequestReviewModel();
comment.node = node2;
comment.reaction = ReactionsModel.getReaction(node2.reactionGroups());
comments.add(comment);
}
}
Logger.e(comments.size());
model.comments = comments;
}
} else {
return null;
}
}
return model;
}
public PullRequestTimelineQuery.AsReviewDismissedEvent getReviewDismissedEvent() {
return reviewDismissedEvent;
}
public void setReviewDismissedEvent(PullRequestTimelineQuery.AsReviewDismissedEvent reviewDismissedEvent) {
this.reviewDismissedEvent = reviewDismissedEvent;
}
public PullRequestTimelineQuery.AsReviewRequestedEvent getReviewRequestedEvent() {
return reviewRequestedEvent;
}
public void setReviewRequestedEvent(PullRequestTimelineQuery.AsReviewRequestedEvent reviewRequestedEvent) {
this.reviewRequestedEvent = reviewRequestedEvent;
}
public PullRequestTimelineQuery.AsReviewRequestRemovedEvent getReviewRequestRemovedEvent() {
return reviewRequestRemovedEvent;
}
public void setReviewRequestRemovedEvent(PullRequestTimelineQuery.AsReviewRequestRemovedEvent reviewRequestRemovedEvent) {
this.reviewRequestRemovedEvent = reviewRequestRemovedEvent;
}
public PullRequestTimelineQuery.Node2 getNode() {
return node;
}
public void setNode(PullRequestTimelineQuery.Node2 node) {
this.node = node;
}
public List<ReactionsModel> getReaction() {
return reaction;
}
public void setReaction(List<ReactionsModel> reaction) {
this.reaction = reaction;
}
public List<PullRequestReviewModel> getComments() {
return comments;
}
public void setComments(List<PullRequestReviewModel> comments) {
this.comments = comments;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public PullRequestTimelineQuery.Author2 getAuthor() {
return author;
}
public void setAuthor(PullRequestTimelineQuery.Author2 author) {
this.author = author;
}
public String getBodyHTML() {
return bodyHTML;
}
public void setBodyHTML(String bodyHTML) {
this.bodyHTML = bodyHTML;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public PullRequestReviewState getState() {
return state;
}
public void setState(PullRequestReviewState state) {
this.state = state;
}
}

View File

@ -1,85 +0,0 @@
package com.fastaccess.data.dao.timeline;
import com.fastaccess.data.dao.ReactionsModel;
import com.fastaccess.data.dao.model.PullRequest;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import github.PullRequestTimelineQuery;
/**
* Created by kosh on 02/08/2017.
*/
@Getter @Setter public class PullRequestTimelineModel {
public static final int HEADER = 1;
public static final int EVENT = 2;
public static final int COMMENT = 3;
public static final int STATUS = 4;
public static final int REVIEW = 5;
public static final int COMMIT_COMMENTS = 6;
public PullRequestTimelineQuery.Node node;
public PullRequest pullRequest;
public PullRequestTimelineQuery.Status status;
public List<ReactionsModel> reactions;
public boolean isMergeable;
public PullRequestCommitModel commitThread;
public PullRequestReviewModel reviewModel;
public PullRequestTimelineModel(PullRequest pullRequest) {
this.pullRequest = pullRequest;
}
public PullRequestTimelineModel(PullRequestTimelineQuery.Node node) {
this.node = node;
if (this.node.asCommitCommentThread() != null) {
} else {
if (node.asPullRequestReview() != null || node.asReviewDismissedEvent() != null
|| node.asReviewRequestedEvent() != null || node.asReviewRequestRemovedEvent() != null) {
reviewModel = PullRequestReviewModel.build(node);
}
}
}
public PullRequestTimelineModel(PullRequestTimelineQuery.Status status, boolean isMergeable) {
this.status = status;
this.isMergeable = isMergeable;
}
public int getType() {
if (pullRequest != null) return HEADER;
if (node != null) {
if (node.asAssignedEvent() != null || node.asClosedEvent() != null
|| node.asDemilestonedEvent() != null || node.asHeadRefDeletedEvent() != null
|| node.asLabeledEvent() != null || node.asLockedEvent() != null
|| node.asMergedEvent() != null || node.asMilestonedEvent() != null
|| node.asReferencedEvent() != null || node.asRenamedTitleEvent() != null
|| node.asReopenedEvent() != null || node.asUnassignedEvent() != null
|| node.asUnlabeledEvent() != null || node.asUnlockedEvent() != null
|| node.asCommit() != null || node.asHeadRefRestoredEvent() != null) {
return EVENT;
} else if (node.asIssueComment() != null) {
if (reactions == null) {
//noinspection ConstantConditions
setReactions(ReactionsModel.getReaction2(node.asIssueComment().reactionGroups()));
}
return COMMENT;
} else if (reviewModel != null) {
return REVIEW;
} else if (commitThread != null) {
return COMMIT_COMMENTS;
}
} else if (status != null) {
return STATUS;
}
return 0;
}
@Override public String toString() {
return String.valueOf(getType());
}
}

View File

@ -1,8 +1,8 @@
package com.fastaccess.data.dao.types;
import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;
import com.fastaccess.R;

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.dao.types;
import android.support.annotation.DrawableRes;
import androidx.annotation.DrawableRes;
import com.fastaccess.R;

View File

@ -1,7 +1,7 @@
package com.fastaccess.data.dao.types;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.annimon.stream.Stream;
import com.fastaccess.R;
@ -37,7 +37,8 @@ public enum IssueEventType {
reviewed(R.drawable.ic_eye),
changes_requested(R.drawable.ic_eye),
added_to_project(R.drawable.ic_add),
GROUPED(R.drawable.ic_eye);
GROUPED(R.drawable.ic_eye),
deployed(R.drawable.ic_rocket);
int iconResId;

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.dao.types;
import android.support.annotation.StringRes;
import androidx.annotation.StringRes;
import com.fastaccess.R;

View File

@ -1,7 +1,7 @@
package com.fastaccess.data.dao.types;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import androidx.annotation.IdRes;
import androidx.annotation.Nullable;
import com.annimon.stream.Stream;
import com.fastaccess.R;

View File

@ -1,9 +1,9 @@
package com.fastaccess.data.dao.types;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import com.annimon.stream.Stream;
import com.fastaccess.R;

View File

@ -1,8 +1,8 @@
package com.fastaccess.data.dao.types;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.annimon.stream.Stream;
import com.fastaccess.R;

View File

@ -0,0 +1,31 @@
package com.fastaccess.data.dao.wiki
data class FirebaseWikiConfigModel(
var sideBarListTitle: String = "a",
var sideBarUl: String = ".js-wiki-sidebar-toggle-display > ul",
var sideBarList: String = "li",
var wikiWrapper: String = "#wiki-wrapper",
var wikiHeader: String = ".gh-header > h1.gh-header-title",
var sideBarListLink: String = "href",
var wikiBody: String = "#wiki-body",
var wikiSubHeader: String = ".gh-header-meta",
var wikiContent: String = "#wiki-content"
) {
companion object {
fun map(map: HashMap<String, String>?): FirebaseWikiConfigModel {
val model = FirebaseWikiConfigModel()
map?.let {
model.sideBarListTitle = it.getOrElse("sideBarListTitle") { model.sideBarListTitle }
model.sideBarUl = it.getOrElse("sideBarUl") { model.sideBarUl }
model.sideBarList = it.getOrElse("sideBarList") { model.sideBarList }
model.wikiWrapper = it.getOrElse("wikiWrapper") { model.wikiWrapper }
model.wikiHeader = it.getOrElse("wikiHeader") { model.wikiHeader }
model.sideBarListLink = it.getOrElse("sideBarListLink") { model.sideBarListLink }
model.wikiBody = it.getOrElse("wikiBody") { model.wikiBody }
model.wikiSubHeader = it.getOrElse("wikiSubHeader") { model.wikiSubHeader }
model.wikiContent = it.getOrElse("wikiContent") { model.wikiContent }
}
return model
}
}
}

View File

@ -1,31 +1,30 @@
package com.fastaccess.data.dao.wiki
import android.os.Parcel
import android.os.Parcelable
import com.fastaccess.helper.KotlinParcelable
import com.fastaccess.helper.parcelableCreator
/**
* Created by Kosh on 13 Jun 2017, 8:06 PM
*/
data class WikiContentModel(val content: String? = null, private val footer: String? = null,
val sidebar: ArrayList<WikiSideBarModel>) : Parcelable {
data class WikiContentModel(
val content: String? = null,
private val footer: String? = null,
val sidebar: List<WikiSideBarModel>
) : KotlinParcelable {
companion object {
@JvmField val CREATOR: Parcelable.Creator<WikiContentModel> = object : Parcelable.Creator<WikiContentModel> {
override fun createFromParcel(source: Parcel): WikiContentModel = WikiContentModel(source)
override fun newArray(size: Int): Array<WikiContentModel?> = arrayOfNulls(size)
}
@JvmField val CREATOR = parcelableCreator(::WikiContentModel)
}
constructor(source: Parcel) : this(
source.readString(),
source.readString(),
source.createTypedArrayList(WikiSideBarModel.CREATOR)
source.readString(),
source.readString(),
source.createTypedArrayList(WikiSideBarModel.CREATOR) ?: arrayListOf()
)
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int) {
dest.writeString(content)
dest.writeString(footer)
dest.writeTypedList(sidebar)
override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
writeString(content)
writeString(footer)
writeTypedList(sidebar)
}
}
}

View File

@ -1,28 +1,27 @@
package com.fastaccess.data.dao.wiki
import android.os.Parcel
import android.os.Parcelable
import com.fastaccess.helper.KotlinParcelable
import com.fastaccess.helper.parcelableCreator
/**
* Created by Kosh on 13 Jun 2017, 8:03 PM
*/
data class WikiSideBarModel(val title: String? = null, val link: String? = null) : Parcelable {
data class WikiSideBarModel(
val title: String? = null,
val link: String? = null
) : KotlinParcelable {
companion object {
@JvmField val CREATOR: Parcelable.Creator<WikiSideBarModel> = object : Parcelable.Creator<WikiSideBarModel> {
override fun createFromParcel(source: Parcel): WikiSideBarModel = WikiSideBarModel(source)
override fun newArray(size: Int): Array<WikiSideBarModel?> = arrayOfNulls(size)
}
@JvmField val CREATOR = parcelableCreator(::WikiSideBarModel)
}
constructor(source: Parcel) : this(
source.readString(),
source.readString()
source.readString(),
source.readString()
)
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int) {
dest.writeString(title)
dest.writeString(link)
override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
writeString(title)
writeString(link)
}
}
}

View File

@ -25,6 +25,6 @@ interface ContentService {
@Query("branch") branch: String,
@Body body: CommitRequestModel): Observable<GitCommitModel>
@GET("api/last-message.json")
@GET("api/v2/status.json")
fun checkStatus(): Observable<GitHubStatusModel>
}

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.service;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.data.dao.CommentRequestModel;
import com.fastaccess.data.dao.CreateGistModel;
@ -73,4 +73,6 @@ public interface GistService {
@POST("gists/{gist_id}/forks")
Observable<Response<Gist>> forkGist(@Path("gist_id") @NonNull String gistId);
@GET("/gists/starred") Observable<Pageable<Gist>> getStarredGists(@Query("page") int page);
}

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.service;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import com.fastaccess.data.dao.ImgurReponseModel;

View File

@ -1,7 +1,7 @@
package com.fastaccess.data.service;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.data.dao.AssigneesRequestModel;
import com.fastaccess.data.dao.CommentRequestModel;
@ -9,6 +9,7 @@ import com.fastaccess.data.dao.CreateIssueModel;
import com.fastaccess.data.dao.IssueRequestModel;
import com.fastaccess.data.dao.IssuesPageable;
import com.fastaccess.data.dao.LabelModel;
import com.fastaccess.data.dao.LockIssuePrModel;
import com.fastaccess.data.dao.Pageable;
import com.fastaccess.data.dao.model.Comment;
import com.fastaccess.data.dao.model.Issue;
@ -68,9 +69,10 @@ public interface IssueService {
@Path("number") int number,
@Body IssueRequestModel issue);
@Headers("Content-Length: 0")
@Headers("Accept: application/vnd.github.sailor-v-preview+json")
@PUT("repos/{owner}/{repo}/issues/{number}/lock")
Observable<Response<Boolean>> lockIssue(@Path("owner") String owner, @Path("repo") String repo, @Path("number") int number);
Observable<Response<Boolean>> lockIssue(@Body LockIssuePrModel body, @Path("owner") String owner,
@Path("repo") String repo, @Path("number") int number);
@DELETE("repos/{owner}/{repo}/issues/{number}/lock")
Observable<Response<Boolean>> unlockIssue(@Path("owner") String owner, @Path("repo") String repo, @Path("number") int number);

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.service;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.data.dao.AccessTokenModel;
import com.fastaccess.data.dao.AuthModel;

View File

@ -1,8 +1,8 @@
package com.fastaccess.data.service;
import android.support.annotation.NonNull;
import android.support.annotation.StringDef;
import androidx.annotation.NonNull;
import androidx.annotation.StringDef;
import com.fastaccess.data.dao.NotificationSubscriptionBodyModel;
import com.fastaccess.data.dao.Pageable;

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.service;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.data.dao.Pageable;
import com.fastaccess.data.dao.TeamsModel;

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.service;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.data.dao.AssigneesRequestModel;
import com.fastaccess.data.dao.CommitFileModel;

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.service;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.data.dao.Pageable;
import com.fastaccess.data.dao.PostReactionModel;

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.service;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.data.dao.BranchesModel;
import com.fastaccess.data.dao.CommentRequestModel;

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.service;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.data.dao.CommentRequestModel;
import com.fastaccess.data.dao.Pageable;

View File

@ -2,6 +2,7 @@ package com.fastaccess.data.service
import io.reactivex.Observable
import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query
@ -12,7 +13,7 @@ import retrofit2.http.Query
interface ScrapService {
@GET("{lan}") fun getTrending(@Path("lan") lan: String?, @Query("since") since: String?): Observable<String>
@GET("{lan}") fun getTrending(@Path("lan") lan: String?, @Query("since") since: String?): Observable<Response<String>>
@GET("{path}") fun getWiki(@Path(value = "path", encoded = true) path: String?): Observable<String>
}

View File

@ -1,6 +1,6 @@
package com.fastaccess.data.service;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import com.fastaccess.data.dao.Pageable;
import com.fastaccess.data.dao.model.Event;
@ -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

@ -12,20 +12,22 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.customtabs.CustomTabsIntent;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.ShareCompat;
import android.support.v4.util.Pair;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.app.ActivityCompat;
import androidx.core.app.ActivityOptionsCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.core.app.ShareCompat;
import androidx.core.util.Pair;
import android.view.View;
import android.widget.Toast;
import com.fastaccess.App;
import com.fastaccess.R;
import com.fastaccess.ui.modules.main.drawer.AccountDrawerFragment;
import com.fastaccess.ui.modules.main.drawer.MainDrawerFragment;
import com.fastaccess.ui.modules.parser.LinksParserActivity;
import java.util.ArrayList;
@ -175,7 +177,8 @@ public class ActivityHelper {
List<Fragment> fragments = manager.getFragments();
if (fragments != null && !fragments.isEmpty()) {
for (Fragment fragment : fragments) {
if (fragment != null && fragment.isVisible()) {
if (fragment != null && fragment.isVisible() &&
!(fragment instanceof MainDrawerFragment || fragment instanceof AccountDrawerFragment)) {
return fragment;
}
}

View File

@ -5,14 +5,14 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.app.Dialog;
import android.graphics.Rect;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.DialogFragment;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.animation.FastOutLinearInInterpolator;
import android.support.v4.view.animation.LinearOutSlowInInterpolator;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.fragment.app.DialogFragment;
import androidx.core.view.ViewCompat;
import androidx.interpolator.view.animation.FastOutLinearInInterpolator;
import androidx.interpolator.view.animation.LinearOutSlowInInterpolator;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.ViewPropertyAnimator;

View File

@ -11,10 +11,10 @@ import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.os.Build;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

View File

@ -1,6 +1,6 @@
package com.fastaccess.helper;
import android.support.annotation.StringDef;
import androidx.annotation.StringDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -4,7 +4,7 @@ import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.util.SparseArray;
import java.io.Serializable;

View File

@ -8,8 +8,8 @@ import android.net.Uri;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.R;
import com.fastaccess.data.dao.NotificationSoundModel;

View File

@ -1,8 +1,8 @@
package com.fastaccess.helper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.textfield.TextInputLayout;
import android.text.TextUtils;
import android.widget.EditText;
import android.widget.TextView;
@ -67,13 +67,12 @@ public class InputHelper {
public static long toLong(@NonNull String text) {
if (!isEmpty(text)) {
try {
return Long.valueOf(text.replace(".", "").replaceAll(",", ""));
return Long.valueOf(text.replaceAll("[^0-9]", ""));
} catch (NumberFormatException ignored) {}
}
return 0;
}
public static int getSafeIntId(long id) {
return id > Integer.MAX_VALUE ? (int) (id - Integer.MAX_VALUE) : (int) id;
}

View File

@ -1,7 +1,7 @@
package com.fastaccess.helper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.util.Log;
import com.fastaccess.BuildConfig;

View File

@ -1,6 +1,6 @@
package com.fastaccess.helper;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
/**
* Created by Kosh on 18 Apr 2017, 10:57 PM

View File

@ -0,0 +1,18 @@
package com.fastaccess.helper
import android.os.Parcel
import android.os.Parcelable
interface KotlinParcelable : Parcelable {
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int)
}
inline fun <reified T> parcelableCreator(crossinline create: (Parcel) -> T) = object : Parcelable.Creator<T> {
override fun createFromParcel(source: Parcel) = create(source)
override fun newArray(size: Int) = arrayOfNulls<T>(size)
}
fun Parcel.readBooleanCompat() = readInt() != 0
fun Parcel.writeBooleanCompat(value: Boolean) = writeInt(if (value) 1 else 0)

View File

@ -1,7 +1,7 @@
package com.fastaccess.helper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.text.format.DateUtils;
import java.text.DateFormat;

View File

@ -4,9 +4,9 @@ import android.content.Context;
import android.content.res.Resources;
import android.media.RingtoneManager;
import android.net.Uri;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;
import com.fastaccess.BuildConfig;
@ -86,6 +86,7 @@ public class PrefGetter {
private static final String MARKDOWNDOWN_GUIDE = "markdowndown_guide";
private static final String HOME_BUTTON_GUIDE = "home_button_guide";
private static final String NAV_DRAWER_GUIDE = "nav_drawer_guide";
private static final String ACC_NAV_DRAWER_GUIDE = "acc_nav_drawer_guide";
private static final String FAB_LONG_PRESS_REPO_GUIDE = "fab_long_press_repo_guide";
private static final String WRAP_CODE = "wrap_code";
private static final String OTP_CODE = "otp_code";
@ -197,6 +198,12 @@ public class PrefGetter {
return isShowed;
}
public static boolean isAccountNavDrawerHintShowed() {
boolean isShowed = PrefHelper.getBoolean(ACC_NAV_DRAWER_GUIDE);
PrefHelper.set(ACC_NAV_DRAWER_GUIDE, true);
return isShowed;
}
public static boolean isRepoFabHintShowed() {
boolean isShowed = PrefHelper.getBoolean(FAB_LONG_PRESS_REPO_GUIDE);
PrefHelper.set(FAB_LONG_PRESS_REPO_GUIDE, true);

View File

@ -3,8 +3,8 @@ package com.fastaccess.helper;
import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.fastaccess.App;

Some files were not shown because too many files have changed in this diff Show More