Skip to content

Commit 92d1e29

Browse files
authored
Merge pull request #63 from stanwood/develop
Master merge 1.4
2 parents f128074 + 7bf8d08 commit 92d1e29

File tree

129 files changed

+3426
-336
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+3426
-336
lines changed

Dangerfile

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
2+
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"
3+
4+
# Warn when there is a big PR
5+
warn "Big PR" if git.lines_of_code > 500
6+
# Check added files - for performance reasons bundle all added file checks in this loop!
7+
git.added_files.each do |file|
8+
# Check whether Java files are in the java source directory
9+
if file =~ /\.(java)$/
10+
warn "#{file}: New Java class isn't in java source directory!" unless file =~ /\/(java)\//
11+
end
12+
# Check whether new classes are implemented in Kotlin
13+
warn "#{file}: Try to implement new classes in Kotlin if possible." if file =~ /\.java$/
14+
end
15+
# Check modified files - for performance reasons bundle all file checks in this loop!
16+
modifiedWithoutDeleted = (git.modified_files - git.deleted_files)
17+
modifiedWithoutDeleted.each do |file|
18+
linenumber = 0
19+
# Check lines in modified files - for performance reasons bundle all line checks in this loop!
20+
# Note, that we also check unmodified lines here!
21+
File.open(file).each_line do |li|
22+
linenumber += 1
23+
# Java/Kotlin checks
24+
if file =~ /\.(kt|java)$/
25+
# Check whether there is an usage of unsecured ExifInterface constructor in .kt or .java files
26+
fail "#{file}:#{linenumber}: usage of ExifInterface - please use SecureExifInterface instead!" if li[/android\.media\.ExifInterface( )*\(|[\s\t]ExifInterface( )*\(/]
27+
# Check whether there is an if NOT followed by a space
28+
warn "#{file}:#{linenumber}: No space following if - please also correct in unchanged code!" if li[/([\s|\t]if\()+/]
29+
# Check whether there are TODOs or FIXMEs
30+
warn "#{file}:#{linenumber}: Don't commit code which includes TODOs or FIXMEs! Fix them or they will stay forever! ;)" if
31+
li[/\/\/TODO|\/\/ TODO|@TODO|\/\/FIXME|\/\/ FIXME/]
32+
# Check whether there are DEBUG lines
33+
fail "#{file}:#{linenumber}: Don't commit code which includes DEBUG code!" if li[/\/\/DEBUG|\/\/ DEBUG|@DEBUG/]
34+
end
35+
if file =~ /\.(kt)$/
36+
warn "#{file}:#{linenumber}: Check whether you really need !! or if you can replace it by ? or similar." if li[/!!/]
37+
end
38+
# translation check
39+
if file =~ /strings\.xml$/
40+
warn "#{file}:#{linenumber}: Could it be that formatted='false' is missing." if li[/^(?:(?!formatted="false").)+(%\w*%)+/]
41+
warn "#{file}:#{linenumber}: Could it be that formatted='false' is not needed." if li[/(formatted="false")+(?:(?!(%.*%)).)+$/]
42+
warn "#{file}:#{linenumber}: Multiple spaces." if li[/<string.* {2,}.*string>/]
43+
end
44+
end
45+
end

Gemfile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6+
7+
# gem "rails"
8+
gem 'danger'

Gemfile.lock

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
addressable (2.5.2)
5+
public_suffix (>= 2.0.2, < 4.0)
6+
claide (1.0.2)
7+
claide-plugins (0.9.2)
8+
cork
9+
nap
10+
open4 (~> 1.3)
11+
colored2 (3.1.2)
12+
cork (0.3.0)
13+
colored2 (~> 3.1)
14+
danger (5.6.6)
15+
claide (~> 1.0)
16+
claide-plugins (>= 0.9.2)
17+
colored2 (~> 3.1)
18+
cork (~> 0.1)
19+
faraday (~> 0.9)
20+
faraday-http-cache (~> 1.0)
21+
git (~> 1.5)
22+
kramdown (~> 1.5)
23+
no_proxy_fix
24+
octokit (~> 4.7)
25+
terminal-table (~> 1)
26+
faraday (0.15.2)
27+
multipart-post (>= 1.2, < 3)
28+
faraday-http-cache (1.3.1)
29+
faraday (~> 0.8)
30+
git (1.5.0)
31+
kramdown (1.17.0)
32+
multipart-post (2.0.0)
33+
nap (1.1.0)
34+
no_proxy_fix (0.1.2)
35+
octokit (4.11.0)
36+
sawyer (~> 0.8.0, >= 0.5.3)
37+
open4 (1.3.4)
38+
public_suffix (3.0.3)
39+
sawyer (0.8.1)
40+
addressable (>= 2.3.5, < 2.6)
41+
faraday (~> 0.8, < 1.0)
42+
terminal-table (1.8.0)
43+
unicode-display_width (~> 1.1, >= 1.1.1)
44+
unicode-display_width (1.4.0)
45+
46+
PLATFORMS
47+
ruby
48+
49+
DEPENDENCIES
50+
danger
51+
52+
BUNDLED WITH
53+
1.16.4

app/build.gradle

+29-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
1+
/*
2+
* Copyright (c) 2018 stanwood Gmbh
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*/
22+
123
apply plugin: 'com.android.application'
24+
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
225
apply plugin: 'kotlin-android'
326
apply plugin: 'kotlin-kapt'
427
apply plugin: 'project-report'
@@ -19,7 +42,7 @@ android {
1942
minSdkVersion 21
2043
targetSdkVersion sdk_version
2144
versionCode 1
22-
versionName "1.3"
45+
versionName "1.4"
2346
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
2447
multiDexEnabled true
2548

@@ -29,6 +52,7 @@ android {
2952
buildConfigField "String", "BITRISE_API_TOKEN", properties.containsKey('bitrise.api.token')? "\"$bitriseApiToken\"" : "null"
3053
buildConfigField "String", "API_DATE_TIME_FORMAT", "\"yyyy-MM-dd'T'HH:mm:ss'Z'\""
3154
buildConfigField "long", "DOWNLOAD_STATUS_REFRESH_DELAY", "500L"
55+
buildConfigField "String", "REPO_URL", "\"https://github.com/stanwood/Bitrise_Android\""
3256
manifestPlaceholders.appName = "@string/app_name"
3357
}
3458
kotlin {
@@ -80,17 +104,18 @@ dependencies {
80104
implementation "com.android.support.constraint:constraint-layout:$constraint_layout_version"
81105
implementation "com.android.support:support-v4:$support_version"
82106
implementation "com.android.support:recyclerview-v7:$support_version"
107+
implementation "com.android.support:preference-v7:$support_version"
108+
implementation "com.google.android.gms:play-services-oss-licenses:$oss_version"
83109

84110
// Glide
85111
implementation "com.github.bumptech.glide:glide:$glide"
86112
annotationProcessor "com.github.bumptech.glide:compiler:$glide"
87113

88114
// Other
89-
implementation "ru.terrakok.cicerone:cicerone:$cicerone_version"
90115
implementation "com.jakewharton.timber:timber:$timber_version"
91-
implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'
116+
implementation "org.ocpsoft.prettytime:prettytime:$pretty_time_version"
92117
implementation "joda-time:joda-time:$joda_version"
93118
implementation "org.koin:koin-android:$koin_version"
94119

95-
kapt "com.android.databinding:compiler:$android_plugin_version"
120+
implementation "android.arch.navigation:navigation-fragment:$navigation_version"
96121
}

app/src/androidTest/java/io/stanwood/bitrise/ExampleInstrumentedTest.kt

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/*
2+
* Copyright (c) 2018 stanwood Gmbh
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*/
22+
123
package io.stanwood.bitrise
224

325
import android.support.test.InstrumentationRegistry

app/src/main/AndroidManifest.xml

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
<!--
2+
~ Copyright (c) 2018 stanwood Gmbh
3+
~
4+
~ Permission is hereby granted, free of charge, to any person obtaining a copy
5+
~ of this software and associated documentation files (the "Software"), to deal
6+
~ in the Software without restriction, including without limitation the rights
7+
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
~ copies of the Software, and to permit persons to whom the Software is
9+
~ furnished to do so, subject to the following conditions:
10+
~
11+
~ The above copyright notice and this permission notice shall be included in all
12+
~ copies or substantial portions of the Software.
13+
~
14+
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
~ SOFTWARE.
21+
-->
22+
123
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
224
package="io.stanwood.bitrise">
325

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package io.stanwood.bitrise
2+
3+
4+
object Arguments {
5+
const val ACTIVITY = "activity"
6+
const val BUILD = "build"
7+
const val APP = "arg_app"
8+
const val FRAGMENT_MANAGER = "fragment_manager"
9+
const val BRANCH = "branch"
10+
const val WORKFLOW = "workflow"
11+
const val FAVORITE_APPS = "fav_apps"
12+
const val MESSAGE = "arg_message"
13+
const val TOKEN = "arg_token"
14+
}

app/src/main/java/io/stanwood/bitrise/MainActivity.kt

+26-21
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
11

2+
/*
3+
* Copyright (c) 2018 stanwood Gmbh
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy
6+
* of this software and associated documentation files (the "Software"), to deal
7+
* in the Software without restriction, including without limitation the rights
8+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
* copies of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
* SOFTWARE.
22+
*/
23+
224
package io.stanwood.bitrise
325

26+
import android.content.SharedPreferences
427
import android.os.Bundle
5-
import android.support.v7.app.AppCompatActivity
628
import io.stanwood.bitrise.di.Properties
729
import io.stanwood.bitrise.di.applicationModule
8-
import io.stanwood.bitrise.navigation.Navigator
9-
import io.stanwood.bitrise.navigation.SCREEN_LOGIN
1030
import io.stanwood.bitrise.ui.artifacts.di.artifactsModule
1131
import io.stanwood.bitrise.ui.build.di.buildModule
1232
import io.stanwood.bitrise.ui.builds.di.buildsModule
@@ -20,44 +40,29 @@ import org.koin.android.ext.android.setProperty
2040
import org.koin.android.ext.koin.with
2141
import org.koin.error.AlreadyStartedException
2242
import org.koin.standalone.StandAloneContext
23-
import ru.terrakok.cicerone.NavigatorHolder
24-
import ru.terrakok.cicerone.Router
2543
import timber.log.Timber
26-
import timber.log.Timber.DebugTree
2744

2845

2946
class MainActivity: PermissionActivity() {
3047

31-
private val navigator: Navigator by inject()
32-
private val navigatorHolder: NavigatorHolder by inject()
33-
private val router: Router by inject()
48+
private val sharedPreferences: SharedPreferences by inject()
3449

3550
override fun onCreate(savedInstanceState: Bundle?) {
3651
super.onCreate(savedInstanceState)
3752
if (BuildConfig.DEBUG) {
38-
Timber.plant(DebugTree())
53+
Timber.plant(Timber.DebugTree())
3954
}
4055
startKoin()
4156
setProperty(Properties.ACTIVITY, this)
57+
setProperty(Properties.TOKEN, sharedPreferences.getString(Properties.TOKEN, BuildConfig.BITRISE_API_TOKEN) ?: "")
4258
setContentView(R.layout.activity_main)
43-
router.newRootScreen(SCREEN_LOGIN, true)
4459
}
4560

4661
override fun onDestroy() {
4762
super.onDestroy()
4863
StandAloneContext.closeKoin()
4964
}
5065

51-
override fun onResumeFragments() {
52-
super.onResumeFragments()
53-
navigatorHolder.setNavigator(navigator)
54-
}
55-
56-
override fun onPause() {
57-
super.onPause()
58-
navigatorHolder.removeNavigator()
59-
}
60-
6166
private fun startKoin() {
6267
try {
6368
StandAloneContext.startKoin(listOf(

app/src/main/java/io/stanwood/bitrise/PermissionActivity.kt

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/*
2+
* Copyright (c) 2018 stanwood Gmbh
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*/
22+
123
package io.stanwood.bitrise
224

325
import android.annotation.SuppressLint

app/src/main/java/io/stanwood/bitrise/ViewModel.kt

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/*
2+
* Copyright (c) 2018 stanwood Gmbh
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*/
22+
123
package io.stanwood.bitrise
224

325
import android.arch.lifecycle.Lifecycle

0 commit comments

Comments
 (0)