Skip to content

Commit

Permalink
Merge pull request #55 from TomerPacific/feature/dart-3
Browse files Browse the repository at this point in the history
Feature/dart 3
TomerPacific authored Feb 2, 2024
2 parents ef0548c + 4bfdeb4 commit 13bd05b
Showing 12 changed files with 266 additions and 309 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/flutter_build.yml
Original file line number Diff line number Diff line change
@@ -7,16 +7,18 @@ jobs:
name: flutter build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '12.x'
- uses: subosito/flutter-action@v1
- uses: subosito/flutter-action@v2
with:
flutter-version: '2.8.0'
flutter-version: '3.10.4'
channel: 'stable'
- uses: dart-lang/setup-dart@v1
with:
sdk: '2.15.0'
sdk: '3.0.0'

- run: dart pub get

4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -39,8 +39,8 @@ android {
}

defaultConfig {
applicationId "com.tomerpacific.birthday_calendar"
minSdkVersion 16
namespace "com.tomerpacific.birthday_calendar"
minSdkVersion 19
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
10 changes: 5 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
buildscript {
ext.kotlin_version = '1.5.31'
ext.kotlin_version = '1.9.0'
repositories {
google()
jcenter()
mavenCentral()
}

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

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

@@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
4 changes: 2 additions & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017
#Tue Jan 30 21:25:35 IST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
8 changes: 5 additions & 3 deletions lib/page/birthday/birthday_manager.dart
Original file line number Diff line number Diff line change
@@ -32,9 +32,11 @@ class BirthdayManager extends ChangeNotifier {
}

void handleCallButtonPressed(String phoneNumber) async {
String phoneUrl = 'tel://' + phoneNumber;
if (await canLaunch(phoneUrl)) {
launch(phoneUrl);
Uri phoneUri = Uri.parse('tel:$phoneNumber');
if (await canLaunchUrl(phoneUri)) {
launchUrl(phoneUri);
} else {
print("Cannot call $phoneUri");
}
}

2 changes: 1 addition & 1 deletion lib/service/update_service/update_service_impl.dart
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ class UpdateServiceImpl extends UpdateService {
onSuccess()
}
}).catchError((onError) {
onFailure(onError);
return onFailure(onError);
});
}

4 changes: 2 additions & 2 deletions lib/widget/add_birthday_form.dart
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ class AddBirthdayFormState extends State<AddBirthdayForm> {
),
actions: [
TextButton(
style: TextButton.styleFrom(primary: Colors.green),
style: TextButton.styleFrom(foregroundColor: Colors.green),
onPressed: () {
if (_formKey.currentState != null && _formKey.currentState!.validate()) {
_formKey.currentState!.save();
@@ -119,7 +119,7 @@ class AddBirthdayFormState extends State<AddBirthdayForm> {
child: new Text("OK")
),
TextButton(
style: TextButton.styleFrom(primary: Colors.red),
style: TextButton.styleFrom(foregroundColor: Colors.red),
onPressed: () {
_birthdayPersonController.clear();
_phoneNumberController.clear();
498 changes: 225 additions & 273 deletions pubspec.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.3.4+16

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
flutter:
@@ -32,9 +32,9 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
intl_phone_number_input: ^0.7.0+2
intl_phone_number_input: ^0.7.3
url_launcher: ^6.0.17
package_info_plus: ^1.4.0
package_info_plus: ^3.1.2
permission_handler: ^10.2.0
contacts_service: ^0.6.3
get_it: ^6.0.0
3 changes: 2 additions & 1 deletion test/birthday_widget_test.dart
Original file line number Diff line number Diff line change
@@ -70,7 +70,8 @@ void main() {
await tester.pump();

expect(printLog.length, 1);
expect(printLog[0], contains('Deleted'));
bool sawDeletedMessage = printLog[0].toString().contains('Deleted');
expect(sawDeletedMessage, true);
});

testWidgets("BirthdayWidget press on call button", (WidgetTester tester) async {
14 changes: 7 additions & 7 deletions test/date_service_test.dart
Original file line number Diff line number Diff line change
@@ -14,42 +14,42 @@ void main() {
test("DateService convert month number 8 to August", () {
final int monthNumber = 8;
final String monthName = _dateService.convertMonthToWord(monthNumber);
expect(monthName, equals("August"));
expect(monthName, "August");
});

test("DateService invalid month number returns empty string", () {
final int monthNumber = 14;
final String monthName = _dateService.convertMonthToWord(monthNumber);
expect(monthName, isEmpty);
expect(monthName, "");
});

test("DateService get amount of days in month with 30 days", () {
final String monthName = "September";
final int amountOfDays = _dateService.amountOfDaysInMonth(monthName);
expect(amountOfDays, equals(30));
expect(amountOfDays, 30);
});

test("DateService get amount of days in invalid month will be equal to zero", () {
final String monthName = "New Month";
final int amountOfDays = _dateService.amountOfDaysInMonth(monthName);
expect(amountOfDays, equals(0));
expect(amountOfDays, 0);
});

test("DateService for the date of 5/12/21 we should get the day as Sunday", () {
final DateTime dateTime = DateTime(2021, 12, 5);
final String day = _dateService.getWeekdayNameFromDate(dateTime);
expect(day, equals("Sunday"));
expect(day, "Sunday");
});

test("DateService convert String representing actual date", () {
final String date = "2020-01-04";
final bool isAValidDate = _dateService.isADate(date);
expect(isAValidDate, equals(true));
expect(isAValidDate, true);
});

test("DateService convert String NOT representing date", () {
final String date = "Hello World!";
final bool isAValidDate = _dateService.isADate(date);
expect(isAValidDate, equals(false));
expect(isAValidDate, false);
});
}
10 changes: 5 additions & 5 deletions test/shared_preferences_test.dart
Original file line number Diff line number Diff line change
@@ -34,9 +34,9 @@ void main() {

final storedBirthdays = await _storageService.getBirthdaysForDate(dateTime, false);
expect(storedBirthdays.length, 1);
expect(storedBirthdays[0].name, equals(userBirthday.name));
expect(storedBirthdays[0].birthdayDate, equals(userBirthday.birthdayDate));
expect(storedBirthdays[0].hasNotification, equals(userBirthday.hasNotification));
expect(storedBirthdays[0].name, userBirthday.name);
expect(storedBirthdays[0].birthdayDate, userBirthday.birthdayDate);
expect(storedBirthdays[0].hasNotification, userBirthday.hasNotification);

});

@@ -63,12 +63,12 @@ void main() {
test("SharedPreferences set ThemeMode to dark mode", () async {
await _storageService.saveThemeModeSetting(true);
bool isDarkModeEnabled = await _storageService.getThemeModeSetting();
expect(isDarkModeEnabled, equals(true));
expect(isDarkModeEnabled, true);
});

test("SharedPreferences default contact permission status is not permanently denied", () async {
bool isContactsPermissionStatusPermanentlyDenied = await _storageService.getIsContactPermissionPermanentlyDenied();
expect(isContactsPermissionStatusPermanentlyDenied, equals(false));
expect(isContactsPermissionStatusPermanentlyDenied, false);
});

}

0 comments on commit 13bd05b

Please sign in to comment.