Skip to content

Commit d8c4754

Browse files
committed
# 0.5.1
- Migrate to AGP 7.0.3 - Migrate sample App to Android 12 - Switch to Maven-Publish plugin - Fix some Lint issues - Disable log by default (may be enable in the Plugin constructor) - Add Jitpack file for Java11
1 parent 7556657 commit d8c4754

File tree

16 files changed

+92
-72
lines changed

16 files changed

+92
-72
lines changed

Diff for: CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 0.5.1
2+
- Migrate to AGP 7.0.3
3+
- Migrate sample App to Android 12
4+
- Switch to Maven-Publish plugin
5+
- Fix some Lint issues
6+
- Disable log by default (may be enable in the Plugin constructor)
7+
18
# 0.5.0
29
- Add Legacy back-stack support, via fragment-manager (only for activity)
310
- Migrate code to Rx to enable background thread

Diff for: CONTRIBUTE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ yarn install
3636

3737
## Update version on JitPack
3838

39-
- Update version number on build.gradle
39+
- Update version number on build.gradle ()
4040
- Git commit, push
4141

4242
## Update version on Npm

Diff for: README.md

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ It enable to see the "big internal picture" of your running app in a side tool.
1313
The plugin is under development
1414
Name is not sealed (ideas are welcome)
1515

16+
## Availability
17+
18+
You can get the Android plugin with the Gradle dependency from Jitpack
19+
- https://jitpack.io/#afaucogney/flipper-backstack
20+
1621
## Content
1722

1823
![alt text](./screenshot/flipper_android_lifecyle_4.1.0.png)

Diff for: app/build.gradle

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
plugins {
2-
id 'com.android.application'
3-
id 'kotlin-android'
2+
id "com.android.application"
3+
id "kotlin-android"
44
}
55

66
android {
7-
compileSdkVersion 30
7+
compileSdkVersion 31
88
buildToolsVersion "30.0.3"
99

1010
defaultConfig {
1111
applicationId "fr.afaucogney.mobile.flipper.android.lifecycle.sample"
1212
minSdkVersion 21
13-
targetSdkVersion 30
13+
targetSdkVersion 31
1414
versionCode 1
1515
versionName "1.0"
1616
}
1717

1818
buildTypes {
1919
release {
2020
minifyEnabled false
21-
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21+
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
2222
}
2323
}
2424
compileOptions {
@@ -32,24 +32,24 @@ android {
3232

3333
dependencies {
3434

35-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
36-
implementation 'androidx.core:core-ktx:1.3.2'
37-
implementation 'androidx.appcompat:appcompat:1.2.0'
38-
implementation 'com.google.android.material:material:1.3.0'
39-
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
40-
implementation 'androidx.navigation:navigation-fragment:2.3.3'
41-
implementation 'androidx.navigation:navigation-ui:2.3.3'
42-
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0'
43-
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0'
44-
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.3'
45-
implementation 'androidx.navigation:navigation-ui-ktx:2.3.3'
46-
testImplementation 'junit:junit:4.+'
47-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
48-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
35+
// Android
36+
implementation "androidx.core:core-ktx:1.6.0"
37+
implementation "androidx.appcompat:appcompat:1.3.1"
38+
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
39+
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
40+
41+
// Ui
42+
implementation "com.google.android.material:material:1.4.0"
43+
implementation "androidx.constraintlayout:constraintlayout:2.1.1"
44+
45+
// Navigation
46+
implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
47+
implementation "androidx.navigation:navigation-ui-ktx:2.3.5"
4948

5049
// Flipper
51-
implementation deps.flipper_core
52-
implementation deps.flipper_soloader
53-
implementation deps.flipper_reflect
54-
implementation project(':flipper-backstack')
50+
implementation "com.facebook.flipper:flipper:0.104.0"
51+
implementation "com.facebook.soloader:soloader:0.10.1"
52+
53+
// Flipper plugin
54+
implementation project(":flipper-backstack")
5555
}

Diff for: app/src/main/AndroidManifest.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
</activity>
2626

27-
<activity android:name=".OldSchoolActivity">
27+
<activity android:name=".OldSchoolActivity"
28+
android:exported="true">
2829
<intent-filter>
2930
<action android:name="android.intent.action.MAIN" />
3031

Diff for: app/src/main/java/fr/afaucogney/mobile/android/flipper/flipperandroidbackstack/App.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import com.facebook.flipper.plugins.inspector.DescriptorMapping
77
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin
88
import com.facebook.soloader.SoLoader
99
import fr.afaucogney.mobile.flipper.BackStackFlipperPlugin
10-
import fr.afaucogney.mobile.flipper.internal.util.rx.HyperlinkedDebugTree
1110

1211
class App : Application() {
1312
override fun onCreate() {
@@ -25,10 +24,10 @@ class App : Application() {
2524
)
2625
)
2726
/**
28-
* initialisation of KtpFlipperPlugin with its default constructor
27+
* initialisation of AndroidObjectsLifecycleFlipperPlugin with its default constructor
2928
*/
30-
addPlugin(BackStackFlipperPlugin(this@App))
29+
addPlugin(BackStackFlipperPlugin(this@App, false))
3130
start()
3231
}
33-
}
32+
}
3433
}

Diff for: build.gradle

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
3-
apply from: 'deps.gradle'
4-
ext.kotlinVersion = "1.4.32"
3+
ext.kotlinVersion = "1.5.31"
54
repositories {
65
google()
76
mavenCentral()
87
jcenter()
98
}
109
dependencies {
11-
classpath 'com.android.tools.build:gradle:4.1.3'
10+
classpath 'com.android.tools.build:gradle:7.0.3'
1211
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
1312

1413
// NOTE: Do not place your application dependencies here; they belong
@@ -17,7 +16,6 @@ buildscript {
1716
// Jitpack
1817
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
1918
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.18"
20-
classpath deps.dokkaPlugin
2119
}
2220
}
2321

Diff for: flipper-backstack/build.gradle

+34-27
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
11
plugins {
2-
id 'com.android.library'
3-
id 'kotlin-android'
2+
id "com.android.library"
3+
id "kotlin-android"
44
id "org.jetbrains.dokka"
5-
id "com.github.dcendents.android-maven"
5+
id 'maven-publish'
66
}
77

88
android {
9-
compileSdkVersion 30
10-
buildToolsVersion "31.0.0"
9+
compileSdkVersion 31
1110

1211
defaultConfig {
1312
minSdkVersion 21
14-
targetSdkVersion 30
15-
versionCode 1
16-
versionName "0.4.1"
17-
18-
consumerProguardFiles "consumer-rules.pro"
19-
}
20-
21-
buildTypes {
22-
release {
23-
minifyEnabled false
24-
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
25-
}
2613
}
2714
compileOptions {
2815
sourceCompatibility JavaVersion.VERSION_11
@@ -36,26 +23,46 @@ android {
3623
dependencies {
3724

3825
// Kotlin
26+
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
3927

4028
// Flipper
41-
implementation deps.flipper_core
42-
implementation deps.flipper_soloader
43-
implementation deps.flipper_reflect
29+
implementation "com.facebook.flipper:flipper:0.104.0"
30+
implementation "com.facebook.soloader:soloader:0.10.1"
4431

4532
// Android
46-
implementation 'androidx.core:core-ktx:1.6.0'
47-
implementation 'androidx.appcompat:appcompat:1.3.1'
48-
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
49-
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
33+
implementation "androidx.core:core-ktx:1.6.0"
34+
implementation "androidx.appcompat:appcompat:1.3.1"
35+
implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
36+
implementation "androidx.navigation:navigation-ui-ktx:2.3.5"
5037

5138
// Rx
5239
implementation "io.reactivex.rxjava3:rxjava:3.0.12"
53-
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
40+
implementation "io.reactivex.rxjava3:rxandroid:3.0.0"
5441
implementation "io.reactivex.rxjava3:rxkotlin:3.0.1"
5542

56-
implementation "com.jakewharton.timber:timber:4.7.1"
43+
// Debug
44+
implementation "com.jakewharton.timber:timber:5.0.1"
5745

5846
// Test
59-
testImplementation deps.junit4
47+
testImplementation "junit:junit:4.13.2"
6048
testImplementation "org.json:json:20180813"
49+
}
50+
51+
// Because the components are created only during the afterEvaluate phase, you must
52+
// configure your publications using the afterEvaluate() lifecycle method.
53+
afterEvaluate {
54+
publishing {
55+
publications {
56+
// Creates a Maven publication called "release".
57+
release(MavenPublication) {
58+
// Applies the component for the release build variant.
59+
from components.release
60+
61+
// You can then customize attributes of the publication as shown below.
62+
groupId = 'fr.afaucogney.mobile.flipper'
63+
artifactId = 'android-objects-lifecycle'
64+
version = '0.5.1'
65+
}
66+
}
67+
}
6168
}

Diff for: flipper-backstack/src/main/java/fr/afaucogney/mobile/flipper/BackStackFlipperPlugin.kt

+7-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import io.reactivex.rxjava3.subjects.BehaviorSubject
2222
import timber.log.Timber
2323
import java.util.concurrent.TimeUnit
2424

25-
class BackStackFlipperPlugin(app: Application) :
25+
class BackStackFlipperPlugin(app: Application, showLog: Boolean = false) :
2626
FlipperActivityCallback.IActivityLifeCycleCallbackFlipperHandler,
2727
FlipperFragmentCallback.IFragmentLifeCycleCallbackFlipperHandler,
2828
FlipperPlugin {
@@ -53,7 +53,7 @@ class BackStackFlipperPlugin(app: Application) :
5353
///////////////////////////////////////////////////////////////////////////
5454

5555
init {
56-
Timber.plant(HyperlinkedDebugTree())
56+
if (showLog) Timber.plant(HyperlinkedDebugTree())
5757
app.registerActivityLifecycleCallbacks(activityCallback)
5858
}
5959

@@ -86,7 +86,7 @@ class BackStackFlipperPlugin(app: Application) :
8686
dataStream
8787
.subscribeOn(Schedulers.io())
8888
.map { it.build().applyFilters() }
89-
//.distinctUntilChanged()
89+
//.distinctUntilChanged()
9090
.throttleFirst(DEBOUNCE_DELAY, TimeUnit.MILLISECONDS)
9191
.doOnNext { connection?.send(NEW_DATA_KEY, it) }
9292
.doOnSubscribe { buildObjectTreeMessage().sendObjectTree() }
@@ -155,11 +155,11 @@ class BackStackFlipperPlugin(app: Application) :
155155
}
156156

157157
private fun FlipperArray.Builder.sendEvent() {
158-
this .run { eventStream.onNext(this) }
158+
this.run { eventStream.onNext(this) }
159159
}
160160

161161
private fun FlipperObject.Builder.sendObjectsFilters() {
162-
this .run { objectFilterStream.onNext(this) }
162+
this.run { objectFilterStream.onNext(this) }
163163
}
164164

165165
///////////////////////////////////////////////////////////////////////////
@@ -195,7 +195,8 @@ class BackStackFlipperPlugin(app: Application) :
195195

196196
override fun pushFragmentManagerEvent(
197197
fragment: Fragment,
198-
fm: FragmentManager) {
198+
fm: FragmentManager
199+
) {
199200
fragment
200201
.activity
201202
?.saveAndMapToFlipperObjectBuilder()

Diff for: flipper-backstack/src/main/java/fr/afaucogney/mobile/flipper/internal/model/ActivityExt.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ internal val Activity.type: String
4444
get() = FlipperObjectType.ACTIVITY.key
4545

4646
internal val ActivityLifeCycle.key: String
47-
get() = this.toString().toLowerCase(Locale.getDefault())
47+
get() = this.toString().lowercase(Locale.getDefault())
4848

4949
internal fun Activity.storeActivityToMapIfNecessary(event: ActivityLifeCycle?) {
5050
if (!activityMap.containsKey(this.fid)) {

Diff for: flipper-backstack/src/main/java/fr/afaucogney/mobile/flipper/internal/model/FragmentExt.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ internal val Fragment.type: String
5252
get() = FlipperObjectType.FRAGMENT.key
5353

5454
internal val FragmentLifeCycle.key: String
55-
get() = this.toString().toLowerCase(Locale.getDefault())
55+
get() = this.toString().lowercase(Locale.getDefault())
5656

5757
internal fun Fragment.storeFragmentToMapIfNecessary(event: FragmentLifeCycle?) {
5858
this.toFlipperObjectBuilder()

Diff for: flipper-backstack/src/main/java/fr/afaucogney/mobile/flipper/internal/model/LifeCycleExt.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ internal enum class FlipperObjectType {
1010
}
1111

1212
internal val FlipperObjectType.key: String
13-
get() = this.toString().toLowerCase(Locale.getDefault())
13+
get() = this.toString().lowercase(Locale.getDefault())
1414

1515

1616
internal fun FlipperObject.Builder.addLifeCycleEvent(event: FragmentLifeCycle?): FlipperObject.Builder {

Diff for: flipper-backstack/src/main/java/fr/afaucogney/mobile/flipper/internal/model/ViewModelExt.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ internal enum class ViewModelLifeCycle {
3333
}
3434

3535
internal val ViewModelLifeCycle.key: String
36-
get() = this.toString().toLowerCase(Locale.getDefault())
36+
get() = this.toString().lowercase(Locale.getDefault())
3737

3838
// ACTIVITY
3939
internal fun FlipperObject.Builder.addViewModelInfo(activity: Activity): FlipperObject.Builder {

Diff for: flipper-backstack/src/main/java/fr/afaucogney/mobile/flipper/internal/util/Reflexion.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ inline fun <reified T : Any, R> T.getPrivateProperty(name: String): R? =
1212
?.apply { isAccessible = true }
1313
?.get(this) as? R
1414

15-
inline fun <reified T : Any, R> T.getPrivateFunction(name: String, vararg args: Any?): R? =
15+
inline fun <reified T : Any, R> T.getPrivateFunction(name: String): R? =
1616
T::class
1717
.memberFunctions
1818
.firstOrNull { it.name == name }

Diff for: gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

Diff for: jitpack.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
jdk:
2+
- openjdk11

0 commit comments

Comments
 (0)