Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

♻️ migrate codebase to nullsafety #548

Merged
merged 12 commits into from
Jan 5, 2022
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"image": "cirrusci/flutter:beta",
"forwardPorts": [ 5000 ]
}
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"name": "dev-okuna-app",
"request": "launch",
"type": "dart",
"args": ["--flavor", "development"]
"args": ["--flavor", "development", "--no-sound-null-safety"]
},
{
"name": "prod-okuna-app",
"request": "launch",
"type": "dart",
"args": ["--flavor", "production"]
"args": ["--flavor", "production", "--no-sound-null-safety"]
}
]
}
3 changes: 1 addition & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,4 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.onesignal:OneSignal:[3.11.2, 3.99.99]'
}
}
Empty file modified android/gradle/wrapper/gradle-wrapper.jar
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
6 changes: 3 additions & 3 deletions bin/split_locales.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void main() {
translationStrings[mainKey] = {};
}

translationStrings[mainKey][translationKey] = json[key];
translationStrings[mainKey]![translationKey] = json[key];

if (!mainKey.startsWith('@') && !mainKeys.contains(mainKey)) {
mainKeys.add(mainKey);
Expand All @@ -30,9 +30,9 @@ void main() {
var output = {};
var current = translationStrings[mainKey];

current.keys.forEach((key) {
current?.keys.forEach((key) {
output[key] = current[key];
output['@$key'] = translationStrings['@$mainKey'][key];
output['@$key'] = translationStrings['@$mainKey']![key];
});

var str = jsonEncoder.convert(output);
Expand Down
4 changes: 1 addition & 3 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ end
install! 'cocoapods', :deterministic_uuids => false

target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 2.9.5', '< 3.0'
use_frameworks!
pod 'OneSignalXCFramework', '>= 3.4.3', '< 4.0'
end

post_install do |installer|
Expand Down Expand Up @@ -72,4 +71,3 @@ config.name == "Debug-development"
end
end
end

45 changes: 30 additions & 15 deletions lib/delegates/es_es_localizations_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ class MaterialLocalizationEsES extends MaterialLocalizationEs {

const MaterialLocalizationEsES({
String localeName = 'es-ES',
@required intl.DateFormat fullYearFormat,
@required intl.DateFormat mediumDateFormat,
@required intl.DateFormat longDateFormat,
@required intl.DateFormat yearMonthFormat,
@required intl.NumberFormat decimalFormat,
@required intl.NumberFormat twoDigitZeroPaddedFormat,
required intl.DateFormat fullYearFormat,
required intl.DateFormat shortDateFormat,
required intl.DateFormat mediumDateFormat,
required intl.DateFormat longDateFormat,
required intl.DateFormat compactDateFormat,
required intl.DateFormat yearMonthFormat,
required intl.DateFormat shortMonthDayFormat,
required intl.NumberFormat decimalFormat,
required intl.NumberFormat twoDigitZeroPaddedFormat,
}) : super(
localeName: localeName,
fullYearFormat: fullYearFormat,
shortDateFormat: shortDateFormat,
mediumDateFormat: mediumDateFormat,
longDateFormat: longDateFormat,
compactDateFormat: compactDateFormat,
yearMonthFormat: yearMonthFormat,
shortMonthDayFormat: shortMonthDayFormat,
decimalFormat: decimalFormat,
twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat,
);
Expand All @@ -37,23 +43,32 @@ class MaterialLocalizationEsESDelegate extends LocalizationsDelegate<MaterialLoc
@override
Future<MaterialLocalizationEsES> load(Locale locale) {
intl.DateFormat fullYearFormat;
intl.DateFormat shortDateFormat;
intl.DateFormat mediumDateFormat;
intl.DateFormat longDateFormat;
intl.DateFormat compactDateFormat;
intl.DateFormat yearMonthFormat;
intl.DateFormat shortMonthDayFormat;
intl.NumberFormat decimalFormat;
intl.NumberFormat twoDigitZeroPaddedFormat;
decimalFormat = intl.NumberFormat.decimalPattern(locale.languageCode);
twoDigitZeroPaddedFormat = intl.NumberFormat('00', locale.languageCode);
fullYearFormat = intl.DateFormat.y(locale.languageCode);
shortDateFormat = intl.DateFormat.MEd(locale.languageCode);
mediumDateFormat = intl.DateFormat.MMMEd(locale.languageCode);
longDateFormat = intl.DateFormat.yMMMMEEEEd(locale.languageCode);
compactDateFormat = intl.DateFormat.MEd(locale.languageCode);
yearMonthFormat = intl.DateFormat.yMMMM(locale.languageCode);
shortMonthDayFormat = intl.DateFormat.Md(locale.languageCode);

return SynchronousFuture(MaterialLocalizationEsES(
fullYearFormat: fullYearFormat,
shortDateFormat: shortDateFormat,
mediumDateFormat: mediumDateFormat,
longDateFormat: longDateFormat,
compactDateFormat: compactDateFormat,
yearMonthFormat: yearMonthFormat,
shortMonthDayFormat: shortMonthDayFormat,
decimalFormat: decimalFormat,
twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat
));
Expand All @@ -66,14 +81,14 @@ class CupertinoLocalizationEsES extends CupertinoLocalizationEs {

const CupertinoLocalizationEsES({
String localeName = 'es-ES',
@required intl.DateFormat fullYearFormat,
@required intl.DateFormat dayFormat,
@required intl.DateFormat mediumDateFormat,
@required intl.DateFormat singleDigitHourFormat,
@required intl.DateFormat singleDigitMinuteFormat,
@required intl.DateFormat doubleDigitMinuteFormat,
@required intl.DateFormat singleDigitSecondFormat,
@required intl.NumberFormat decimalFormat,
required intl.DateFormat fullYearFormat,
required intl.DateFormat dayFormat,
required intl.DateFormat mediumDateFormat,
required intl.DateFormat singleDigitHourFormat,
required intl.DateFormat singleDigitMinuteFormat,
required intl.DateFormat doubleDigitMinuteFormat,
required intl.DateFormat singleDigitSecondFormat,
required intl.NumberFormat decimalFormat,
}) : super(
localeName: localeName,
fullYearFormat: fullYearFormat,
Expand Down Expand Up @@ -131,4 +146,4 @@ class CupertinoLocalizationEsESDelegate extends LocalizationsDelegate<CupertinoL
@override
bool shouldReload(CupertinoLocalizationEsESDelegate old) => false;

}
}
45 changes: 30 additions & 15 deletions lib/delegates/pt_br_localizations_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ class MaterialLocalizationPtBR extends MaterialLocalizationPt {

const MaterialLocalizationPtBR({
String localeName = 'pt-BR',
@required intl.DateFormat fullYearFormat,
@required intl.DateFormat mediumDateFormat,
@required intl.DateFormat longDateFormat,
@required intl.DateFormat yearMonthFormat,
@required intl.NumberFormat decimalFormat,
@required intl.NumberFormat twoDigitZeroPaddedFormat,
required intl.DateFormat fullYearFormat,
required intl.DateFormat shortDateFormat,
required intl.DateFormat mediumDateFormat,
required intl.DateFormat longDateFormat,
required intl.DateFormat compactDateFormat,
required intl.DateFormat yearMonthFormat,
required intl.DateFormat shortMonthDayFormat,
required intl.NumberFormat decimalFormat,
required intl.NumberFormat twoDigitZeroPaddedFormat,
}) : super(
localeName: localeName,
fullYearFormat: fullYearFormat,
shortDateFormat: shortDateFormat,
mediumDateFormat: mediumDateFormat,
longDateFormat: longDateFormat,
compactDateFormat: compactDateFormat,
yearMonthFormat: yearMonthFormat,
shortMonthDayFormat: shortMonthDayFormat,
decimalFormat: decimalFormat,
twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat,
);
Expand All @@ -37,23 +43,32 @@ class MaterialLocalizationPtBRDelegate extends LocalizationsDelegate<MaterialLoc
@override
Future<MaterialLocalizationPtBR> load(Locale locale) {
intl.DateFormat fullYearFormat;
intl.DateFormat shortDateFormat;
intl.DateFormat mediumDateFormat;
intl.DateFormat longDateFormat;
intl.DateFormat compactDateFormat;
intl.DateFormat yearMonthFormat;
intl.DateFormat shortMonthDayFormat;
intl.NumberFormat decimalFormat;
intl.NumberFormat twoDigitZeroPaddedFormat;
decimalFormat = intl.NumberFormat.decimalPattern(locale.languageCode);
twoDigitZeroPaddedFormat = intl.NumberFormat('00', locale.languageCode);
fullYearFormat = intl.DateFormat.y(locale.languageCode);
shortDateFormat = intl.DateFormat.MEd(locale.languageCode);
mediumDateFormat = intl.DateFormat.MMMEd(locale.languageCode);
longDateFormat = intl.DateFormat.yMMMMEEEEd(locale.languageCode);
compactDateFormat = intl.DateFormat.MEd(locale.languageCode);
yearMonthFormat = intl.DateFormat.yMMMM(locale.languageCode);
shortMonthDayFormat = intl.DateFormat.Md(locale.languageCode);

return SynchronousFuture(MaterialLocalizationPtBR(
fullYearFormat: fullYearFormat,
shortDateFormat: shortDateFormat,
mediumDateFormat: mediumDateFormat,
longDateFormat: longDateFormat,
compactDateFormat: compactDateFormat,
yearMonthFormat: yearMonthFormat,
shortMonthDayFormat: shortMonthDayFormat,
decimalFormat: decimalFormat,
twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat
));
Expand All @@ -66,14 +81,14 @@ class CupertinoLocalizationPtBR extends CupertinoLocalizationPt {

const CupertinoLocalizationPtBR({
String localeName = 'pt-BR',
@required intl.DateFormat fullYearFormat,
@required intl.DateFormat dayFormat,
@required intl.DateFormat mediumDateFormat,
@required intl.DateFormat singleDigitHourFormat,
@required intl.DateFormat singleDigitMinuteFormat,
@required intl.DateFormat doubleDigitMinuteFormat,
@required intl.DateFormat singleDigitSecondFormat,
@required intl.NumberFormat decimalFormat,
required intl.DateFormat fullYearFormat,
required intl.DateFormat dayFormat,
required intl.DateFormat mediumDateFormat,
required intl.DateFormat singleDigitHourFormat,
required intl.DateFormat singleDigitMinuteFormat,
required intl.DateFormat doubleDigitMinuteFormat,
required intl.DateFormat singleDigitSecondFormat,
required intl.NumberFormat decimalFormat,
}) : super(
localeName: localeName,
fullYearFormat: fullYearFormat,
Expand Down Expand Up @@ -130,4 +145,4 @@ class CupertinoLocalizationPtBRDelegate extends LocalizationsDelegate<CupertinoL
}
@override
bool shouldReload(CupertinoLocalizationPtBRDelegate old) => false;
}
}
45 changes: 30 additions & 15 deletions lib/delegates/sv_se_localizations_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ class MaterialLocalizationSvSE extends MaterialLocalizationSv {

const MaterialLocalizationSvSE({
String localeName = 'sv-SE',
@required intl.DateFormat fullYearFormat,
@required intl.DateFormat mediumDateFormat,
@required intl.DateFormat longDateFormat,
@required intl.DateFormat yearMonthFormat,
@required intl.NumberFormat decimalFormat,
@required intl.NumberFormat twoDigitZeroPaddedFormat,
required intl.DateFormat fullYearFormat,
required intl.DateFormat shortDateFormat,
required intl.DateFormat mediumDateFormat,
required intl.DateFormat longDateFormat,
required intl.DateFormat compactDateFormat,
required intl.DateFormat yearMonthFormat,
required intl.DateFormat shortMonthDayFormat,
required intl.NumberFormat decimalFormat,
required intl.NumberFormat twoDigitZeroPaddedFormat,
}) : super(
localeName: localeName,
fullYearFormat: fullYearFormat,
shortDateFormat: shortDateFormat,
mediumDateFormat: mediumDateFormat,
longDateFormat: longDateFormat,
compactDateFormat: compactDateFormat,
yearMonthFormat: yearMonthFormat,
shortMonthDayFormat: shortMonthDayFormat,
decimalFormat: decimalFormat,
twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat,
);
Expand All @@ -37,23 +43,32 @@ class MaterialLocalizationSvSEDelegate extends LocalizationsDelegate<MaterialLoc
@override
Future<MaterialLocalizationSvSE> load(Locale locale) {
intl.DateFormat fullYearFormat;
intl.DateFormat shortDateFormat;
intl.DateFormat mediumDateFormat;
intl.DateFormat longDateFormat;
intl.DateFormat compactDateFormat;
intl.DateFormat yearMonthFormat;
intl.DateFormat shortMonthDayFormat;
intl.NumberFormat decimalFormat;
intl.NumberFormat twoDigitZeroPaddedFormat;
decimalFormat = intl.NumberFormat.decimalPattern(locale.languageCode);
twoDigitZeroPaddedFormat = intl.NumberFormat('00', locale.languageCode);
fullYearFormat = intl.DateFormat.y(locale.languageCode);
shortDateFormat = intl.DateFormat.MEd(locale.languageCode);
mediumDateFormat = intl.DateFormat.MMMEd(locale.languageCode);
longDateFormat = intl.DateFormat.yMMMMEEEEd(locale.languageCode);
compactDateFormat = intl.DateFormat.MEd(locale.languageCode);
yearMonthFormat = intl.DateFormat.yMMMM(locale.languageCode);
shortMonthDayFormat = intl.DateFormat.Md(locale.languageCode);

return SynchronousFuture(MaterialLocalizationSvSE(
fullYearFormat: fullYearFormat,
shortDateFormat: shortDateFormat,
mediumDateFormat: mediumDateFormat,
longDateFormat: longDateFormat,
compactDateFormat: compactDateFormat,
yearMonthFormat: yearMonthFormat,
shortMonthDayFormat: shortMonthDayFormat,
decimalFormat: decimalFormat,
twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat
));
Expand All @@ -66,14 +81,14 @@ class CupertinoLocalizationSvSE extends CupertinoLocalizationSv {

const CupertinoLocalizationSvSE({
String localeName = 'sv-SE',
@required intl.DateFormat fullYearFormat,
@required intl.DateFormat dayFormat,
@required intl.DateFormat mediumDateFormat,
@required intl.DateFormat singleDigitHourFormat,
@required intl.DateFormat singleDigitMinuteFormat,
@required intl.DateFormat doubleDigitMinuteFormat,
@required intl.DateFormat singleDigitSecondFormat,
@required intl.NumberFormat decimalFormat,
required intl.DateFormat fullYearFormat,
required intl.DateFormat dayFormat,
required intl.DateFormat mediumDateFormat,
required intl.DateFormat singleDigitHourFormat,
required intl.DateFormat singleDigitMinuteFormat,
required intl.DateFormat doubleDigitMinuteFormat,
required intl.DateFormat singleDigitSecondFormat,
required intl.NumberFormat decimalFormat,
}) : super(
localeName: localeName,
fullYearFormat: fullYearFormat,
Expand Down Expand Up @@ -130,4 +145,4 @@ class CupertinoLocalizationSvSEDelegate extends LocalizationsDelegate<CupertinoL
}
@override
bool shouldReload(CupertinoLocalizationSvSEDelegate old) => false;
}
}
4 changes: 2 additions & 2 deletions lib/libs/pretty_count.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:Okuna/services/localization.dart';

String getPrettyCount(int value, LocalizationService localizationService) {
String postfix;
double finalValue;
late String postfix;
late double finalValue;

if (value < 0) {
throw 'Invalid value';
Expand Down
4 changes: 2 additions & 2 deletions lib/locale/messages_all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Map<String, LibraryLoader> _deferredLibraries = {
'tr': () => new Future.value(null),
};

MessageLookupByLibrary _findExact(String localeName) {
MessageLookupByLibrary? _findExact(String localeName) {
switch (localeName) {
case 'da':
return messages_da.messages;
Expand Down Expand Up @@ -95,7 +95,7 @@ bool _messagesExistFor(String locale) {
}
}

MessageLookupByLibrary _findGeneratedMessagesFor(String locale) {
MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
onFailure: (_) => null);
if (actualLocale == null) return null;
Expand Down
Loading