Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use androidx namespace #44

Merged
merged 7 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
run: ./gradlew :parsely:assembleDebug
- name: Build example app
run: ./gradlew :example:assembleDebug
- name: Android Lint
run: ./gradlew lintDebug
- name: Validate Maven publication
run: ./gradlew :parsely:publishReleasePublicationToMavenLocal
env:
Expand Down
15 changes: 4 additions & 11 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ plugins {
}

android {
compileSdkVersion 28
compileSdkVersion 32

defaultConfig {
applicationId "com.parsely.example.parselyexample"
minSdkVersion 21
targetSdkVersion 28
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question (❓): Why did you chose to completely remove the targetSdkVersion from both, the parsely library and the example app module?

I built and then run the example app. Then, on launching the HiParsely app, I got a permission screen first, and following that, a version dialog afterwards. I think this is done because of the fact that when targetSdkVersion is not set, the default value equals that given to minSdkVersion (see docs).

Permission Screen Version Dialog
before after

I then tried to point both, the parsely and example modules, both, their compileSdkVersion and targetSdkVersion values, to 32. Everything started working as expected. I also built the release build type (./gradlew assembleRelease) and it worked this time. Mind the fact, that this doesn't work as at its current state. Then, I triggered Lint for the release build type and it too worked okay (./gradlew lintRelease). 🎉

I wonder now... can't we use targetSdkVersion 32, is something blocking us to do so? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good point! Yes, let's specify targetSdkVersion to 32. I went too far with removing configuration code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, due to the permission issue you've pointed out, I've reverted my previous change of minSdk from 21 to 23 (as it was before).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, nicely done! 🥇

minSdkVersion 23
targetSdkVersion 32
versionCode 1
versionName "1.0"
}
Expand All @@ -21,12 +21,5 @@ android {

dependencies {
implementation project(':parsely')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'org.codehaus.jackson:jackson-mapper-lgpl:1.9.13'
implementation 'org.codehaus.jackson:jackson-core-lgpl:1.9.13'
implementation 'com.google.android.gms:play-services-ads:17.1.3'
Comment on lines -24 to -31
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused dependencies

implementation 'androidx.appcompat:appcompat:1.4.2'
}
4 changes: 2 additions & 2 deletions example/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
android:value="ca-app-pub-3940256099942544~3347511713"/>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
android:theme="@style/AppTheme.NoActionBar"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
6 changes: 0 additions & 6 deletions example/src/main/java/com/example/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ public void run() {

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
Comment on lines -79 to -83
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The menu was not used


@Override
protected void onDestroy() {
ParselyTracker.sharedInstance().flushEventQueue();
Expand Down
9 changes: 0 additions & 9 deletions example/src/main/res/menu/main.xml

This file was deleted.

6 changes: 0 additions & 6 deletions example/src/main/res/menu/menu_main.xml

This file was deleted.

4 changes: 0 additions & 4 deletions example/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
<resources>

<string name="app_name">HiParsely</string>
<string name="action_settings">Settings</string>
<string name="parsely">Parsely</string>
<string name="button_track_url">Track URL</string>
<string name="button_track_pid">Track ID</string>
<string name="button_start_engagement">Start Engagement</string>
<string name="button_stop_engagement">Stop Engagement</string>
<string name="button_track_video">Track Video</string>
<string name="button_pause_video">Pause Video</string>
<string name="button_reset_video">Reset Video</string>
<string name="button_flush_event_queue">Flush Event Queue</string>
<string name="button_toggle_connection">Lose Connection</string>

</resources>
2 changes: 0 additions & 2 deletions example/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

android.disableAutomaticComponentCreation=true
android.disableAutomaticComponentCreation=true
android.useAndroidX=true
9 changes: 5 additions & 4 deletions parsely/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ plugins {
ext.VERSION = '3.0.2'

android {
compileSdkVersion 28
compileSdkVersion 32

defaultConfig {
minSdkVersion 21
targetSdkVersion 28
minSdkVersion 23
targetSdkVersion 32
}
buildTypes {
release {
Expand All @@ -31,8 +31,9 @@ android {
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'org.codehaus.jackson:jackson-mapper-lgpl:1.9.13'
implementation 'com.google.android.gms:play-services-ads:17.1.3'
implementation 'com.google.android.gms:play-services-ads:21.0.0'
}

apply from: "${rootProject.projectDir}/publication.gradle"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.parsely.parselyandroid;

import android.support.annotation.Nullable;
import androidx.annotation.Nullable;

import java.util.ArrayList;
import java.util.Calendar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import android.os.AsyncTask;
import android.os.Build;
import android.provider.Settings.Secure;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
Expand Down Expand Up @@ -551,7 +551,6 @@ private void expelStoredEvent() {
*
* @param o Object to store.
*/
@TargetApi(Build.VERSION_CODES.CUPCAKE)
private void persistObject(Object o) {
try {
FileOutputStream fos = this.context.getApplicationContext().openFileOutput(
Expand Down Expand Up @@ -679,7 +678,6 @@ public int storedEventsCount() {
return 0;
}

@TargetApi(Build.VERSION_CODES.CUPCAKE)
private class QueueManager extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.parsely.parselyandroid;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.ArrayList;
import java.util.Calendar;
Expand Down