Skip to content
Open
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
8 changes: 4 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply from: project(':flutter_config').projectDir.getPath() + "/dotenv.gradle"

android {
compileSdkVersion 31
buildToolsVersion '29.0.0'
compileSdkVersion 32
buildToolsVersion '33.0.0'

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -37,7 +37,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.beacon"
minSdkVersion 23
targetSdkVersion 30
targetSdkVersion 32
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand All @@ -58,5 +58,5 @@ flutter {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.android.support:multidex:1.0.3"
implementation "androidx.multidex:multidex:2.0.1"
}
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.6.10'
ext.kotlin_version = '1.7.10'
repositories {
google()
jcenter()
mavenCentral()
}

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

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
configurations.all {
resolutionStrategy {
Expand All @@ -31,6 +31,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
20 changes: 10 additions & 10 deletions lib/components/active_beacon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,44 @@ class BlinkIcon extends StatefulWidget {
}

class _BlinkIconState extends State<BlinkIcon> with TickerProviderStateMixin {
AnimationController _controller;
Animation<Color> _colorAnimation;
AnimationController? _controller;
Animation<Color?>? _colorAnimation;
@override
void initState() {
_controller =
AnimationController(vsync: this, duration: Duration(milliseconds: 700));
_colorAnimation = ColorTween(
begin: Color(0xFF30c295), end: Colors.transparent)
.animate(CurvedAnimation(parent: _controller, curve: Curves.linear));
_controller.addStatusListener((status) {
.animate(CurvedAnimation(parent: _controller!, curve: Curves.linear));
_controller!.addStatusListener((status) {
if (status == AnimationStatus.completed) {
_controller.reverse();
_controller!.reverse();
} else if (status == AnimationStatus.dismissed) {
_controller.forward();
_controller!.forward();
}
setState(() {});
});
_controller.forward();
_controller!.forward();
super.initState();
}

@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: _controller,
animation: _controller!,
builder: (context, child) {
return Icon(
Icons.circle,
size: 10,
color: _colorAnimation.value,
color: _colorAnimation!.value,
);
},
);
}

@override
void dispose() {
_controller.dispose();
_controller!.dispose();
super.dispose();
}
}
49 changes: 24 additions & 25 deletions lib/components/beacon_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,42 @@ class BeaconCustomWidgets {
bool hasEnded;
bool willStart;
hasStarted = DateTime.now()
.isAfter(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt));
.isAfter(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!));
hasEnded = DateTime.now()
.isAfter(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt));
.isAfter(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt!));
willStart = DateTime.now()
.isBefore(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt));
.isBefore(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!));
return GestureDetector(
onTap: () async {
bool isJoinee = false;
for (var i in beacon.followers) {
for (var i in beacon.followers!) {
if (i.id == userConfig.currentUser.id) {
isJoinee = true;
}
}
if (!hasStarted) {
navigationService.showSnackBar(
'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}',
'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}',
);
return;
}
if (hasStarted &&
(beacon.leader.id == userConfig.currentUser.id || isJoinee)) {
(beacon.leader?.id == userConfig.currentUser.id || isJoinee)) {
navigationService.pushScreen('/hikeScreen',
arguments: HikeScreen(
beacon,
isLeader: (beacon.leader.id == userConfig.currentUser.id),
isLeader: (beacon.leader!.id == userConfig.currentUser.id),
));
} else {
await databaseFunctions.init();
final Beacon _beacon =
await databaseFunctions.joinBeacon(beacon.shortcode);
await databaseFunctions.joinBeacon(beacon.shortcode!);
if (!hasStarted) {
navigationService.showSnackBar(
'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}',
'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}',
);
return;
}
if (hasStarted && _beacon != null) {
if (hasStarted) {
navigationService.pushScreen('/hikeScreen',
arguments: HikeScreen(beacon, isLeader: false));
}
Expand All @@ -80,7 +79,7 @@ class BeaconCustomWidgets {
Container(
width: 70.w,
child: Text(
'${beacon?.title} by ${beacon.leader.name} ',
'${beacon.title} by ${beacon.leader!.name!} ',
style: Style.titleTextStyle,
),
),
Expand Down Expand Up @@ -108,18 +107,18 @@ class BeaconCustomWidgets {
),
),
SizedBox(height: 4.0),
Text('Passkey: ${beacon?.shortcode}',
Text('Passkey: ${beacon.shortcode}',
style: Style.commonTextStyle),
SizedBox(height: 4.0),
(beacon.startsAt != null)
? Text(
'Started At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}',
'Started At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}',
style: Style.commonTextStyle)
: Container(),
SizedBox(height: 4.0),
(beacon.expiresAt != null)
? Text(
'Expires At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt)).toString()}',
'Expires At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt!)).toString()}',
style: Style.commonTextStyle)
: Container(),
],
Expand All @@ -134,7 +133,7 @@ class BeaconCustomWidgets {
Container(
width: 70.w,
child: Text(
'${beacon?.title} by ${beacon.leader.name} ',
'${beacon.title} by ${beacon.leader!.name} ',
style: Style.titleTextStyle,
),
),
Expand Down Expand Up @@ -179,25 +178,25 @@ class BeaconCustomWidgets {
),
CountdownTimerPage(
dateTime: DateTime.fromMillisecondsSinceEpoch(
beacon.startsAt),
name: beacon?.title,
beacon.startsAt!),
name: beacon.title,
beacon: beacon,
)
],
),
SizedBox(height: 4.0),
Text('Passkey: ${beacon?.shortcode}',
Text('Passkey: ${beacon.shortcode}',
style: Style.commonTextStyle),
SizedBox(height: 4.0),
(beacon.startsAt != null)
? Text(
'Starts At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}',
'Starts At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}',
style: Style.commonTextStyle)
: Container(),
SizedBox(height: 4.0),
(beacon.expiresAt != null)
? Text(
'Expires At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt)).toString()}',
'Expires At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt!)).toString()}',
style: Style.commonTextStyle)
: Container(),
],
Expand All @@ -208,7 +207,7 @@ class BeaconCustomWidgets {
Container(
width: 70.w,
child: Text(
'${beacon?.title} by ${beacon.leader.name} ',
'${beacon.title} by ${beacon.leader!.name} ',
style: Style.titleTextStyle,
),
),
Expand All @@ -230,18 +229,18 @@ class BeaconCustomWidgets {
),
),
SizedBox(height: 4.0),
Text('Passkey: ${beacon?.shortcode}',
Text('Passkey: ${beacon.shortcode}',
style: Style.commonTextStyle),
SizedBox(height: 4.0),
(beacon.startsAt != null)
? Text(
'Started At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}',
'Started At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}',
style: Style.commonTextStyle)
: Container(),
SizedBox(height: 4.0),
(beacon.expiresAt != null)
? Text(
'Expired At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt)).toString()}',
'Expired At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt!)).toString()}',
style: Style.commonTextStyle)
: Container(),
],
Expand Down
26 changes: 13 additions & 13 deletions lib/components/create_join_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CreateJoinGroupDialog {
child: TextFormField(
style: TextStyle(fontSize: 22.0),
validator: (value) =>
Validator.validateBeaconTitle(value),
Validator.validateBeaconTitle(value!),
onChanged: (name) {
model.title = name;
},
Expand Down Expand Up @@ -109,7 +109,7 @@ class CreateJoinGroupDialog {
keyboardType: TextInputType.text,
textCapitalization: TextCapitalization.characters,
style: TextStyle(fontSize: 22.0),
validator: (value) => Validator.validatePasskey(value),
validator: (value) => Validator.validatePasskey(value!),
onChanged: (key) {
model.enteredGroupCode = key.toUpperCase();
},
Expand Down Expand Up @@ -186,7 +186,7 @@ class CreateJoinBeaconDialog {
child: TextFormField(
style: TextStyle(fontSize: 22.0),
validator: (value) =>
Validator.validateBeaconTitle(value),
Validator.validateBeaconTitle(value!),
onChanged: (name) {
model.title = name;
},
Expand Down Expand Up @@ -231,7 +231,7 @@ class CreateJoinBeaconDialog {
surface: kBlue,
),
),
child: child),
child: child!),
);
model.startsAtDate.text = model.startingdate
.toString()
Expand Down Expand Up @@ -302,7 +302,7 @@ class CreateJoinBeaconDialog {
),
),
// This will change to light theme.
child: child,
child: child!,
);
},
);
Expand Down Expand Up @@ -352,7 +352,7 @@ class CreateJoinBeaconDialog {
await showDurationPicker(
context: context,
initialTime: model.resultingDuration != null
? model.resultingDuration
? model.resultingDuration!
: Duration(minutes: 30),
decoration: BoxDecoration(
color: Colors.white,
Expand Down Expand Up @@ -414,14 +414,14 @@ class CreateJoinBeaconDialog {
return;
}
model.startsAt = DateTime(
model.startingdate.year,
model.startingdate.month,
model.startingdate.day,
model.startingTime.hour,
model.startingTime.minute,
model.startingdate!.year,
model.startingdate!.month,
model.startingdate!.day,
model.startingTime!.hour,
model.startingTime!.minute,
);
// localNotif.scheduleNotification();
if (model.startsAt.isBefore(DateTime.now())) {
if (model.startsAt!.isBefore(DateTime.now())) {
navigationService.showSnackBar(
"Enter a valid date and time!!");
return;
Expand Down Expand Up @@ -465,7 +465,7 @@ class CreateJoinBeaconDialog {
keyboardType: TextInputType.text,
textCapitalization: TextCapitalization.characters,
style: TextStyle(fontSize: 22.0),
validator: (value) => Validator.validatePasskey(value),
validator: (value) => Validator.validatePasskey(value!),
onChanged: (key) {
model.enteredPasskey = key.toUpperCase();
},
Expand Down
Loading