Skip to content

Commit

Permalink
Merge branch 'release/v1.0.2'
Browse files Browse the repository at this point in the history
* release/v1.0.2:
  Updates readme
  Updates readme and adds notification channel support
  Updates gradle version
  Updates build version and removes committed binary
  • Loading branch information
7LPdWcaW authored and 7LPdWcaW committed Mar 9, 2019
2 parents 6a34544 + 3798536 commit a4f9802
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This addon periodically (1 day, only checks when using GrowTracker) checks for u

Downloaded updates are saved in `/sdcard/Download/`

[Latest APK: (MD5) 41aad07b513ebdb052b36a14689b3eb7 v1.0.1](https://github.com/7LPdWcaW/GrowUpdater-Android/releases/download/v1.0.1/v1.0.1.apk)
[Latest APK: (MD5) cca4af53d1b2624ca9e19b36838fb3c0 v1.0.2](https://github.com/7LPdWcaW/GrowUpdater-Android/releases/download/v1.0.2/v1.0.2.apk)

# Installation

Expand All @@ -20,7 +20,7 @@ Install the APK. You must have Grow Tracker version 2.2 or above, inside the Gro

#License

Copyright 2014-2016 7LPdWcaW
Copyright 2014-2019 7LPdWcaW

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Binary file removed app/app-release.apk
Binary file not shown.
21 changes: 11 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
applicationId "me.anon.grow.updater"

minSdkVersion 17
targetSdkVersion 25
targetSdkVersion 28

versionCode 2
versionName "v1.0.1"
versionCode 3
versionName "v1.0.2"

manifestPlaceholders = [versionName: versionName]
}
Expand All @@ -23,10 +23,11 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.loopj.android:android-async-http:1.4.9'
testCompile 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.loopj.android:android-async-http:1.4.9'
testImplementation 'junit:junit:4.12'
}
10 changes: 7 additions & 3 deletions app/src/main/assets/readme.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<html>
<body>
<h1>Read me</h1>
<div>
Welcome to grow updater. This is a simple addon for Grow Tracker that periodically checks the Releases page on github for updates and automatically downloads ans prompts for install. This app does not do any other website requests.
</div>
<p>
Welcome to grow updater. This is a simple addon for Grow Tracker that periodically checks the Releases page on github for updates and automatically downloads and prompts for install. This app does not do any other website requests.
</p>

<p>
Note: this plugin will not work if you originally installed from f-droid.
</p>
</body>
</html>
25 changes: 21 additions & 4 deletions app/src/main/java/me/anon/grow/updater/CheckUpdateReceiver.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.anon.grow.updater;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
Expand All @@ -9,7 +10,9 @@
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat;
import android.widget.Toast;

import com.google.gson.JsonArray;
Expand Down Expand Up @@ -181,9 +184,14 @@ private boolean checkPreReleaseNewer(Version otherVersion)
return major + "." + minor + additional;
}

public boolean equals(Version other)
@Override public boolean equals(Object o)
{
return toString().equals(other.toString());
return toString().equals(o.toString());
}

@Override public int hashCode()
{
return toString().hashCode();
}
}

Expand Down Expand Up @@ -331,15 +339,24 @@ public boolean equals(Version other)

private void sendUpdateNotification(Context context, Version release)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
{
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel("updater", "Updater", importance);
channel.setDescription("Displays notification when there is an update available");
NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}

Intent downloadActivity = new Intent(context, DownloadActivity.class);
downloadActivity.putExtra("version", release);

PendingIntent downloadIntent = PendingIntent.getActivity(context, 0, downloadActivity, PendingIntent.FLAG_CANCEL_CURRENT);

Notification notification = new Notification.Builder(context)
Notification notification = new NotificationCompat.Builder(context, "updater")
.setContentTitle("There is an update available")
.setContentText("A newer version of GrowTracker is available to download")
.setStyle(new Notification.BigTextStyle()
.setStyle(new NotificationCompat.BigTextStyle()
.bigText("A newer version of GrowTracker is available to download"))
.setSmallIcon(R.mipmap.ic_notification)
.addAction(0, "Download & update", downloadIntent)
Expand Down
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:3.2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -14,6 +16,8 @@ buildscript {

allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Mon Oct 22 13:42:28 BST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

0 comments on commit a4f9802

Please sign in to comment.