Skip to content

replace kIsWeb with its definition #415

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

Merged
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
1 change: 0 additions & 1 deletion lib/parse_server_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'dart:typed_data';
import 'dart:ui' as ui;

import 'package:devicelocale/devicelocale.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:http/http.dart';
import 'package:http/io_client.dart';
import 'package:meta/meta.dart';
Expand Down
2 changes: 2 additions & 0 deletions lib/src/base/parse_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,5 @@ const String keyVarInstallationId = 'installationId';
// Error
const String keyError = 'error';
const String keyCode = 'code';

const bool parseIsWeb = identical(0, 0.0);
2 changes: 1 addition & 1 deletion lib/src/data/parse_core_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ParseCoreData {
if (liveListRetryIntervals != null) {
_instance.liveListRetryIntervals = liveListRetryIntervals;
} else {
_instance.liveListRetryIntervals = kIsWeb
_instance.liveListRetryIntervals = parseIsWeb
? <int>[0, 500, 1000, 2000, 5000]
: <int>[0, 500, 1000, 2000, 5000, 10000];
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/data/parse_subclass_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ParseSubClassHandler {
Map<String, ParseObjectConstructor> _subClassMap;
ParseUserConstructor _parseUserConstructor;
ParseFileConstructor _parseFileConstructor = ({String name, String url}) {
if (kIsWeb) {
if (parseIsWeb) {
return ParseWebFile(null, name: name, url: url);
} else {
return ParseFile(null, name: name, url: url);
Expand Down
8 changes: 5 additions & 3 deletions lib/src/objects/parse_installation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ParseInstallation extends ParseObject {
/// Updates the installation with current device data
Future<void> _updateInstallation() async {
//Device type
if (kIsWeb) {
if (parseIsWeb) {
set<String>(keyDeviceType, 'web');
} else if (Platform.isAndroid) {
set<String>(keyDeviceType, 'android');
Expand All @@ -83,15 +83,17 @@ class ParseInstallation extends ParseObject {
}

//Locale
final String locale = kIsWeb ? ui.window.locale.toString() : await Devicelocale.currentLocale;
final String locale = parseIsWeb
? ui.window.locale.toString()
: await Devicelocale.currentLocale;
if (locale != null && locale.isNotEmpty) {
set<String>(keyLocaleIdentifier, locale);
}

//Timezone

//App info
if (!kIsWeb) {
if (!parseIsWeb) {
final PackageInfo packageInfo = await PackageInfo.fromPlatform();
set<String>(keyAppName, packageInfo.appName);
set<String>(keyAppVersion, packageInfo.version);
Expand Down
3 changes: 2 additions & 1 deletion lib/src/storage/core_store_sem_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class CoreStoreSembastImp implements CoreStore {
factory ??= databaseFactoryIo;
final SembastCodec codec = getXXTeaSembastCodec(password: password);
String dbDirectory = '';
if (!kIsWeb && (Platform.isIOS || Platform.isAndroid || Platform.isMacOS))
if (!parseIsWeb &&
(Platform.isIOS || Platform.isAndroid || Platform.isMacOS))
dbDirectory = (await getApplicationDocumentsDirectory()).path;
final String dbPath = path.join('$dbDirectory/parse', 'parse.db');
final Database db = await factory.openDatabase(dbPath, codec: codec);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/utils/parse_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ String removeTrailingSlash(String serverUrl) {
}
}

Future<ParseResponse> batchRequest(List<dynamic> requests,
List<ParseObject> objects,
Future<ParseResponse> batchRequest(
List<dynamic> requests, List<ParseObject> objects,
{ParseHTTPClient client, bool debug}) async {
debug = isDebugEnabled(objectLevelDebug: debug);
client = client ??
Expand Down