Add a separate package for the independent track

This commit is contained in:
Vishnu Mohandas 2021-05-22 23:27:20 +05:30
parent 354b6640f3
commit d3d4cf2515
3 changed files with 21 additions and 6 deletions

View file

@ -59,7 +59,15 @@ android {
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
}
flavorDimensions "default"
productFlavors {
independent {
dimension "default"
applicationIdSuffix ".independent"
}
}
buildTypes {
release {

View file

@ -9,10 +9,11 @@ class Network {
Future<void> init() async {
await FlutterUserAgent.init();
final version = await _getAppVersion();
final packageInfo = await PackageInfo.fromPlatform();
_dio = Dio(BaseOptions(headers: {
HttpHeaders.userAgentHeader: FlutterUserAgent.userAgent,
'X-Client-Version': version,
'X-Client-Version': packageInfo.version,
'X-Package-Name': packageInfo.packageName,
}));
}

View file

@ -1,5 +1,7 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:logging/logging.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:photos/core/network.dart';
@ -10,12 +12,16 @@ class UpdateService {
LatestVersionInfo _latestVersion;
Future<bool> shouldUpdate() async {
final platform = await PackageInfo.fromPlatform();
Logger("UpdateService").info(platform.packageName);
if (Platform.isIOS) {
return false;
}
if (!kDebugMode && platform.packageName != "io.ente.photos.independent") {
return false;
}
_latestVersion = await _getLatestVersionInfo();
final currentVersionCode =
int.parse((await PackageInfo.fromPlatform()).buildNumber);
final currentVersionCode = int.parse(platform.buildNumber);
return currentVersionCode < _latestVersion.code;
}
@ -26,7 +32,7 @@ class UpdateService {
Future<LatestVersionInfo> _getLatestVersionInfo() async {
final response = await Network.instance
.getDio()
.get("https://android.ente.io/release-info.json");
.get("https://ente-android-releases.netlify.app/release-info.json");
return LatestVersionInfo.fromMap(response.data["latestVersion"]);
}
}