-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
184 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
import 'dart:io'; | ||
// import 'dart:io'; | ||
|
||
import 'package:install_referrer/install_referrer.dart'; | ||
// import 'package:install_referrer/install_referrer.dart'; | ||
|
||
import 'package:adguard_home_manager/functions/compare_versions.dart'; | ||
import 'package:adguard_home_manager/services/external_requests.dart'; | ||
import 'package:adguard_home_manager/models/github_release.dart'; | ||
// import 'package:adguard_home_manager/functions/compare_versions.dart'; | ||
// import 'package:adguard_home_manager/services/external_requests.dart'; | ||
// import 'package:adguard_home_manager/models/github_release.dart'; | ||
|
||
Future<GitHubRelease?> checkAppUpdates({ | ||
required String currentBuildNumber, | ||
required void Function(GitHubRelease?) setUpdateAvailable, | ||
required InstallationAppReferrer? installationSource, | ||
required bool isBeta | ||
}) async { | ||
var result = isBeta | ||
? await ExternalRequests.getReleasesGitHub() | ||
: await ExternalRequests.getReleaseData(); | ||
// Future<GitHubRelease?> checkAppUpdates({ | ||
// required String currentBuildNumber, | ||
// required void Function(GitHubRelease?) setUpdateAvailable, | ||
// required InstallationAppReferrer? installationSource, | ||
// required bool isBeta | ||
// }) async { | ||
// var result = isBeta | ||
// ? await ExternalRequests.getReleasesGitHub() | ||
// : await ExternalRequests.getReleaseData(); | ||
|
||
if (result.successful == true) { | ||
late GitHubRelease gitHubRelease; | ||
if (isBeta) { | ||
gitHubRelease = (result.content as List<GitHubRelease>).firstWhere((r) => r.prerelease == true); | ||
} | ||
else { | ||
gitHubRelease = result.content as GitHubRelease; | ||
} | ||
// if (result.successful == true) { | ||
// late GitHubRelease gitHubRelease; | ||
// if (isBeta) { | ||
// gitHubRelease = (result.content as List<GitHubRelease>).firstWhere((r) => r.prerelease == true); | ||
// } | ||
// else { | ||
// gitHubRelease = result.content as GitHubRelease; | ||
// } | ||
|
||
final update = gitHubUpdateExists( | ||
currentBuildNumber: currentBuildNumber, | ||
gitHubRelease: gitHubRelease, | ||
isBeta: isBeta | ||
); | ||
// final update = gitHubUpdateExists( | ||
// currentBuildNumber: currentBuildNumber, | ||
// gitHubRelease: gitHubRelease, | ||
// isBeta: isBeta | ||
// ); | ||
|
||
if (update == true) { | ||
setUpdateAvailable(gitHubRelease); | ||
// if (update == true) { | ||
// setUpdateAvailable(gitHubRelease); | ||
|
||
if (Platform.isAndroid) { | ||
if (installationSource == InstallationAppReferrer.androidManually) { | ||
return gitHubRelease; | ||
} | ||
else { | ||
return null; | ||
} | ||
} | ||
else if (Platform.isIOS) { | ||
return null; | ||
} | ||
else { | ||
return gitHubRelease; | ||
} | ||
} | ||
else { | ||
setUpdateAvailable(null); | ||
} | ||
} | ||
return null; | ||
} | ||
// if (Platform.isAndroid) { | ||
// if (installationSource == InstallationAppReferrer.androidManually) { | ||
// return gitHubRelease; | ||
// } | ||
// else { | ||
// return null; | ||
// } | ||
// } | ||
// else if (Platform.isIOS) { | ||
// return null; | ||
// } | ||
// else { | ||
// return gitHubRelease; | ||
// } | ||
// } | ||
// else { | ||
// setUpdateAvailable(null); | ||
// } | ||
// } | ||
// return null; | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.