Skip to content
Open
10 changes: 5 additions & 5 deletions lib/app/advertise_director.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class AdvertiseDirector {
AdvertiseDirector(this.ref);

static Future<bool> shouldUseInternalAds(WidgetRef ref) async {
final String currentTimeZone = await FlutterTimezone.getLocalTimezone();
final currentTimeZone = await FlutterTimezone.getLocalTimezone();

final adversies =
await ref.read(secureStorageProvider).readMap(apiAvertiseKey);

if (adversies['api_advertise'] != null) {
final advertiseMap = adversies['api_advertise'] as Map<String, dynamic>;
return advertiseMap.containsKey(currentTimeZone);
return advertiseMap.containsKey(currentTimeZone.identifier);
}

return false;
Expand All @@ -34,15 +34,15 @@ class AdvertiseDirector {
}

static Future<Map<String, String>> getRandomCustomAd(WidgetRef ref) async {
final String currentTimeZone = await FlutterTimezone.getLocalTimezone();
final currentTimeZone = await FlutterTimezone.getLocalTimezone();

final adversies =
await ref.read(secureStorageProvider).readMap(apiAvertiseKey);

if (adversies['api_advertise'] != null) {
final advertiseMap = adversies['api_advertise'] as Map<String, dynamic>;
if (advertiseMap.containsKey(currentTimeZone)) {
final adsData = advertiseMap[currentTimeZone] as List<dynamic>;
if (advertiseMap.containsKey(currentTimeZone.identifier)) {
final adsData = advertiseMap[currentTimeZone.identifier] as List<dynamic>;
if (adsData.isNotEmpty) {
final random = Random();
final randomIndex = random.nextInt(adsData.length);
Expand Down
17 changes: 13 additions & 4 deletions lib/app/router/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,18 @@ final routerProvider = Provider<GoRouter>((ref) {
);
});

class RouteInformationNotifier extends Notifier<GoRouteInformationProvider> {
@override
GoRouteInformationProvider build() {
return ref.watch(routerProvider).routeInformationProvider;
}
}

final routeInformationProvider =
ChangeNotifierProvider<GoRouteInformationProvider>(
(ref) => ref.watch(routerProvider).routeInformationProvider);
NotifierProvider<RouteInformationNotifier, GoRouteInformationProvider>(
RouteInformationNotifier.new,
);

final currentRouteProvider =
Provider((ref) => ref.watch(routeInformationProvider).value.uri.toString());
final currentRouteProvider = Provider(
(ref) => ref.watch(routeInformationProvider).value.uri.toString(),
);
8 changes: 4 additions & 4 deletions lib/common/dtos/app_api_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ part 'app_api_response.freezed.dart';
part 'app_api_response.g.dart';

@freezed
class AppApiResponse with _$AppApiResponse {
abstract class AppApiResponse with _$AppApiResponse {
const factory AppApiResponse({
@JsonKey(name: "version") required Version version,
@JsonKey(name: "forceUpdate") required Map<String, bool> forceUpdate,
Expand All @@ -18,7 +18,7 @@ class AppApiResponse with _$AppApiResponse {
}

@freezed
class AppApiResponseFlowLine with _$AppApiResponseFlowLine {
abstract class AppApiResponseFlowLine with _$AppApiResponseFlowLine {
const factory AppApiResponseFlowLine({
@JsonKey(name: "startLine") required int startLine,
@JsonKey(name: "flowLine") required List<FlowLineElement> flowLine,
Expand All @@ -29,7 +29,7 @@ class AppApiResponseFlowLine with _$AppApiResponseFlowLine {
}

@freezed
class FlowLineElement with _$FlowLineElement {
abstract class FlowLineElement with _$FlowLineElement {
const factory FlowLineElement({
@JsonKey(name: "enabled") required bool enabled,
@JsonKey(name: "type") required String type,
Expand All @@ -50,7 +50,7 @@ class FlowLineElement with _$FlowLineElement {
}

@freezed
class Version with _$Version {
abstract class Version with _$Version {
const factory Version({
@JsonKey(name: "github") required String github,
@JsonKey(name: "testFlight") required String testFlight,
Expand Down
Loading