Skip to content
Open
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [0.7.3] - 2024/05/11
* upgrade packages

## [0.7.2] - 2024/01/15
* add optional show dialog
* fix pass static analysis

## [0.7.1] - 2024/01/01
* upgrade packages

Expand Down
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ linter:
- avoid_print
- avoid_redundant_argument_values
- avoid_relative_lib_imports
- avoid_returning_null_for_future
- avoid_type_to_string
- avoid_void_async
- cancel_subscriptions
Expand Down
24 changes: 10 additions & 14 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
Expand All @@ -21,12 +22,9 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
namespace "com.mix1009.example"
compileSdk 34
ndkVersion flutter.ndkVersion

compileOptions {
Expand All @@ -45,7 +43,7 @@ android {
defaultConfig {
applicationId "com.mix1009.example"
minSdkVersion 21
targetSdkVersion 33
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand All @@ -61,6 +59,4 @@ flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
dependencies {}
15 changes: 1 addition & 14 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
Expand All @@ -28,4 +15,4 @@ subprojects {

tasks.register("clean", Delete) {
delete rootProject.buildDir
}
}
30 changes: 22 additions & 8 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.9.10" apply false
}

include ":app"
14 changes: 9 additions & 5 deletions example/console/android.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import 'package:html/parser.dart' show parse;
import 'package:http/http.dart' as http;

void main() async {
final String? version = await getAndroidStoreVersion('com.tachyonfactory.icon_finder');
final String? version =
await getAndroidStoreVersion('com.tachyonfactory.icon_finder');
print(version);
}

Expand All @@ -17,7 +18,8 @@ Future<String?> getAndroidStoreVersion(String packageName) async {
uri,
headers: {
'Referer': 'http://www.google.com',
'User-Agent': 'Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6',
'User-Agent':
'Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6',
},
);

Expand All @@ -28,14 +30,15 @@ Future<String?> getAndroidStoreVersion(String packageName) async {
try {
final elements = doc.querySelectorAll('.hAyfc .BgcNfc');

final cv = elements.firstWhere((element) => element.text == 'Current Version');
final cv =
elements.firstWhere((element) => element.text == 'Current Version');
return cv.nextElementSibling!.text;
} catch (_) {}
try {
final elements = doc.getElementsByTagName('script');

for (final e in elements) {
final match = new RegExp('\"(\\d+\\.\\d+\\.\\d+)\"').firstMatch(e.text);
final match = RegExp('"(\\d+\\.\\d+\\.\\d+)"').firstMatch(e.text);
if (match != null) {
return match.group(1);
}
Expand All @@ -44,7 +47,8 @@ Future<String?> getAndroidStoreVersion(String packageName) async {
try {
final elements = doc.querySelectorAll('div');

final cv = elements.firstWhere((element) => element.text == 'Current Version');
final cv =
elements.firstWhere((element) => element.text == 'Current Version');
return cv.nextElementSibling!.text;
} catch (_) {}
}
Expand Down
3 changes: 2 additions & 1 deletion example/console/ios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import 'dart:convert';
import 'package:http/http.dart' as http;

void main() async {
final String? version = await getIOSStoreVersion('com.tachyonfactory.iconFinder');
final String? version =
await getIOSStoreVersion('com.tachyonfactory.iconFinder');
print(version);
}

Expand Down
14 changes: 9 additions & 5 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import 'package:flutter/material.dart';
import 'package:version_check/version_check.dart';

void main() {
runApp(MyApp());
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
Expand All @@ -17,18 +19,18 @@ class MyApp extends StatelessWidget {
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'version_check demo'),
home: const MyHomePage(title: 'version_check demo'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, this.title}) : super(key: key);
const MyHomePage({super.key, this.title});

final String? title;

@override
_MyHomePageState createState() => _MyHomePageState();
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
Expand All @@ -38,7 +40,9 @@ class _MyHomePageState extends State<MyHomePage> {
String? packageName = '';

final versionCheck = VersionCheck(
packageName: Platform.isIOS ? 'com.tachyonfactory.iconFinder' : 'com.tachyonfactory.icon_finder',
packageName: Platform.isIOS
? 'com.tachyonfactory.iconFinder'
: 'com.tachyonfactory.icon_finder',
packageVersion: '1.0.1',
showUpdateDialog: customShowUpdateDialog,
country: 'kr',
Expand Down
Loading