Skip to content

Commit

Permalink
๐Ÿ”€ :: ์ธ์•ฑ ์—…๋ฐ์ดํŠธ API ์—ฐ๋™ #196
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoochanhong authored Mar 2, 2024
2 parents 8cc2dc6 + 3abe2db commit bc59a2d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 33 deletions.
17 changes: 9 additions & 8 deletions lib/presentation/splash_page/ui/view/splash_page.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:http/http.dart' as http;
import 'package:lotura/data/dto/request/get_apply_list_request.dart';
import 'package:lotura/presentation/app_update_page/ui/app_update_page.dart';
import 'package:lotura/presentation/apply_page/bloc/apply_bloc.dart';
Expand All @@ -13,6 +14,7 @@ import 'package:lotura/presentation/laundry_room_page/bloc/laundry_bloc.dart';
import 'package:lotura/presentation/laundry_room_page/bloc/laundry_event.dart';
import 'package:lotura/presentation/utils/bottom_navi.dart';
import 'package:lotura/presentation/utils/lotura_colors.dart';
import 'package:lotura/secret.dart';
import 'package:package_info_plus/package_info_plus.dart';

class SplashPage extends StatefulWidget {
Expand All @@ -26,16 +28,15 @@ class SplashPage extends StatefulWidget {

class _SplashPageState extends State<SplashPage> {
Future<void> checkAppVersion() async {
final remoteConfig = FirebaseRemoteConfig.instance;
await remoteConfig.fetchAndActivate();

String firebaseVersion = remoteConfig.getString(
Platform.isAndroid ? "ANDROID_APP_VERSION" : "iOS_APP_VERSION");

PackageInfo packageInfo = await PackageInfo.fromPlatform();
String appVersion = packageInfo.version;

if (firebaseVersion != appVersion) {
final res = await http.get(Uri.parse(
"$baseurl/app_ver_${Platform.isAndroid ? "android" : "ios"}"));

final newestAppVersion = jsonDecode(res.body)['version'];

if (newestAppVersion != appVersion) {
Future.delayed(Duration.zero).then((value) =>
Navigator.pushAndRemoveUntil(
context,
Expand Down
24 changes: 0 additions & 24 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -193,30 +193,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.5.18"
firebase_remote_config:
dependency: "direct main"
description:
name: firebase_remote_config
sha256: "60fc92273d1db338a6fad1839c42dedc4ad64f812043acad0cbb200702f5c9ce"
url: "https://pub.dev"
source: hosted
version: "4.3.8"
firebase_remote_config_platform_interface:
dependency: transitive
description:
name: firebase_remote_config_platform_interface
sha256: "41813ef8dfbc40ef7a59a73f9e5acef2608dbcb2933241b6c03d52e90677040f"
url: "https://pub.dev"
source: hosted
version: "1.4.16"
firebase_remote_config_web:
dependency: transitive
description:
name: firebase_remote_config_web
sha256: "089e92f333c2fb2c05c640c80fecea9d1e06dada0ba85efe34a580987ef94a0a"
url: "https://pub.dev"
source: hosted
version: "1.4.16"
flutter:
dependency: "direct main"
description: flutter
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ dependencies:
http: ^1.1.0
web_socket_channel: ^2.4.0
package_info_plus: ^4.2.0
firebase_remote_config: ^4.3.8


dev_dependencies:
Expand Down

0 comments on commit bc59a2d

Please sign in to comment.