Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…obile into feat/#69

t
 the commit.
  • Loading branch information
hfjxjjd123 committed Nov 7, 2023
2 parents 51a1323 + a9b57d4 commit dfb1fcf
Show file tree
Hide file tree
Showing 49 changed files with 102 additions and 107 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy

on:
pull_request:
branches:
- main

jobs:
url_change:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Replace URLs
run: |
sed -i 's|www.dev.uspray.kr|www.uspray.kr|g' ios/Runner/Runner.entitlements
sed -i 's|www.dev.uspray.kr|www.uspray.kr|g' android/app/src/main/AndroidManifest.xml
sed -i 's|www.dev.uspray.kr|www.uspray.kr|g' lib/bloc/notification/fcm_setting.dart
sed -i 's|www.dev.uspray.kr|www.uspray.kr|g' lib/bloc/notification/local_notification_setting.dart
sed -i 's|www.dev.uspray.kr|www.uspray.kr|g' lib/controller/webview_controller.dart
sed -i 's|www.dev.uspray.kr|www.uspray.kr|g' lib/screen/webview_screen.dart
- name: Commit and Push Changes
run: |
git config --global user.email ${{ secrets.GIT_USER_EMAIL }}
git config --global user.name ${{ secrets.GIT_USER_NAME }}
git add .
git commit -m "URL changed: dev.uspray -> uspray"
git push origin HEAD:${{ github.head_ref }}
20 changes: 16 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ if (localPropertiesFile.exists()) {
}
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('app/key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
Expand Down Expand Up @@ -44,7 +50,6 @@ android {
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.prayhelper.uspray"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
Expand All @@ -54,11 +59,18 @@ android {
versionName flutterVersionName
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}
Expand Down
20 changes: 7 additions & 13 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
package="com.prayhelper.uspray">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />

<application
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:label="Uspray"
android:label="유스프레이"
android:usesCleartextTraffic="true">
<activity
android:name="com.prayhelper.uspray.MainActivity"
Expand All @@ -17,7 +21,8 @@
android:showWhenLocked="true"
android:theme="@style/LaunchTheme"
android:turnScreenOn="true"
android:windowSoftInputMode="adjustResize">
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait">

<meta-data
android:name="flutter_deeplinking_enabled"
Expand All @@ -33,15 +38,9 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="www.dev.uspray.kr"
android:scheme="https" />
<data
android:host="www.uspray.kr"
android:scheme="https" />
<data
android:host="www.intg.uspray.kr"
android:scheme="https" />
</intent-filter>

<intent-filter>
Expand Down Expand Up @@ -71,9 +70,4 @@
android:value="high_importance_channel" />
</application>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
</manifest>
Binary file modified android/app/src/main/res/drawable/notification_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified assets/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
4 changes: 3 additions & 1 deletion ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Uspray</string>
<string>유스프레이</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand All @@ -22,6 +22,8 @@
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>UIInterfaceOrientation</key>
<string>UIInterfaceOrientationPortrait</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand Down
2 changes: 0 additions & 2 deletions ios/Runner/Runner.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:www.uspray.kr</string>
<string>applinks:www.dev.uspray.kr</string>
<string>applinks:www.intg.uspray.kr</string>
</array>
</dict>
</plist>
3 changes: 0 additions & 3 deletions lib/bloc/link_sharing/deeplinking.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:com.prayhelper.uspray/controller/webview_controller.dart';
import 'package:uni_links/uni_links.dart';

import '../../debug/logger.dart';

Future<void> initDeepLinks() async {
// Listen for incoming deep links
try {
Expand All @@ -23,7 +21,6 @@ Future<void> initDeepLinks() async {
void handleDeepLink(Uri? uri) {
//핸들링 코드정의
if (uri != null) {
logger.d(uri);
//TODO Can handling specific path
WebviewMainController.to.loadUrl(uri.toString());

Expand Down
4 changes: 0 additions & 4 deletions lib/bloc/link_sharing/invokeDefault.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import 'dart:io';

import 'package:com.prayhelper.uspray/debug/logger.dart';
import 'package:flutter/services.dart';

class InvokeDefault {
Expand All @@ -13,9 +11,7 @@ class InvokeDefault {
await channel.invokeMethod('openManageDefaultAppsSettings');
}
} on PlatformException catch (e) {
logger.d('Error: $e');
} catch (e){
logger.d('Error: $e');
}
}
}
7 changes: 1 addition & 6 deletions lib/bloc/notification/fcm_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import 'dart:io';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:com.prayhelper.uspray/controller/webview_controller.dart';

import '../../debug/logger.dart';
import 'local_notification_setting.dart';

void fcmSetting() async{
Expand Down Expand Up @@ -51,10 +49,7 @@ void fcmSetting() async{

// Listen to the onMessageOpenedApp stream
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
WebviewMainController.to.loadUrl("https://www.naver.com/");
//TODO REAL
// final url = message.data['url'];
// if (url != null) {}
WebviewMainController.to.loadUrl("https://www.dev.uspray.kr/main/");
});

}
Expand Down
2 changes: 1 addition & 1 deletion lib/bloc/notification/local_notification_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Future<void> notificationSetting() async {
initializationSettings,
onDidReceiveNotificationResponse: (payload) async {
//TODO loadUrl(payload.input!)
WebviewMainController.to.loadUrl("https://www.naver.com/");
WebviewMainController.to.loadUrl("https://www.dev.uspray.kr/main/");
}
);
}
Expand Down
20 changes: 15 additions & 5 deletions lib/controller/webview_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import 'package:com.prayhelper.uspray/controller/token_controller.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:webview_flutter/webview_flutter.dart';

import '../debug/logger.dart';
import 'package:webview_flutter_android/webview_flutter_android.dart';
import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart';

class WebviewMainController extends GetxController {
static WebviewMainController get to => Get.find();

static var controller = WebViewController()
..enableZoom(false)
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
Expand All @@ -27,7 +26,7 @@ class WebviewMainController extends GetxController {
},
),
)
//JavaScriptChannel을 웹뷰 컨트롤러에 더한다
..enableZoom(false)
..addJavaScriptChannel(
//JavaScriptChannel 이름
"FlutterGetDeviceToken",
Expand All @@ -53,7 +52,6 @@ class WebviewMainController extends GetxController {
..addJavaScriptChannel(
"FlutterShareLink",
onMessageReceived: (JavaScriptMessage message) async {
logger.d("SHARED IS CONNECTED");
Map<String, dynamic> data = jsonDecode(message.message);
shareLinkForAOS(data['url']);
},
Expand All @@ -75,6 +73,18 @@ class WebviewMainController extends GetxController {
controller.loadRequest(Uri.parse(url));
}

void setPlatformSpecifics(WebViewController controller){
if (controller.platform is AndroidWebViewController) {
(controller.platform as AndroidWebViewController)
..setTextZoom(100)
..enableZoom(false);
} else if (controller.platform is WebKitWebViewController) {
(controller.platform as WebKitWebViewController);
// .allowsBackForwardNavigationGestures = true;
}
}


}


9 changes: 0 additions & 9 deletions lib/debug/logger.dart

This file was deleted.

8 changes: 2 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'package:com.prayhelper.uspray/bloc/link_sharing/invokeDefault.dart';
import 'package:com.prayhelper.uspray/debug/logger.dart';
import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:get/get.dart';
Expand All @@ -10,7 +8,6 @@ import 'bloc/link_sharing/deeplinking.dart';
import 'bloc/notification/init_notification.dart';
import 'controller/webview_controller.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/services.dart';

late AndroidNotificationChannel channel;

Expand All @@ -21,7 +18,6 @@ void main() async {

await initNotification();
await initDeepLinks();
// await InvokeDefault.openManageDefaultAppsSettings();

runApp(PrayHelperApp());

runApp(const PrayHelperApp());
}
12 changes: 2 additions & 10 deletions lib/pray_helper_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:uni_links/uni_links.dart';
import 'controller/token_controller.dart';
import 'controller/webview_controller.dart';
import 'package:webview_flutter_android/webview_flutter_android.dart';
import 'debug/logger.dart';

bool _initialUriIsHandled = false;

Expand All @@ -24,18 +23,16 @@ class _PrayHelperAppState extends State<PrayHelperApp> {
Object? _err;
StreamSubscription? _sub;

// 앱 정보 저장
@override
Widget build(BuildContext context) {
final controller = WebviewMainController.to.getController();
WebviewMainController.to.setPlatformSpecifics(controller);
if (controller.platform is AndroidWebViewController) {
AndroidWebViewController.enableDebugging(true);
}

return FutureBuilder<List<String>?>(
future: Future.wait(
[getFcmToken(), SplashDelay.waiting() ],
),
future: Future.wait([getFcmToken(), SplashDelay.waiting()]),
builder: (context, AsyncSnapshot<List<String>?> snapshot) {
return (snapshot.hasData)
? MaterialApp(
Expand Down Expand Up @@ -67,21 +64,16 @@ class _PrayHelperAppState extends State<PrayHelperApp> {
if (!_initialUriIsHandled) {
_initialUriIsHandled = true;

logger.d('_handleInitialUri called');
try {
final uri = await getInitialUri();
if (uri == null) {
logger.d('no initial uri');
} else {
logger.d('got initial uri: $uri');
}
if (!mounted) return;
setState(() => _initialUri = uri);
} on PlatformException {
logger.d('falied to get initial uri');
} on FormatException catch (err) {
if (!mounted) return;
logger.d('malformed initial uri');
setState(() => _err = err);
}
}
Expand Down
17 changes: 8 additions & 9 deletions lib/screen/webview_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

import '../debug/logger.dart';

class WebViewScreen extends StatefulWidget {
WebViewScreen({super.key, required this.controller});

Expand All @@ -30,7 +28,6 @@ class _WebViewScreenState extends State<WebViewScreen> {
);
}

//TODO 이후 나가는 창 커스터마이징
Future<bool> showExitPopup() async {
return await showDialog(
context: context,
Expand Down Expand Up @@ -65,12 +62,14 @@ class _WebViewScreenState extends State<WebViewScreen> {
}

Future<bool> onGoBack() async {
//TODO URL CHANGE
if (await widget.controller.canGoBack() &&
await widget.controller.currentUrl() !=
'https://www.dev.uspray.kr/main') {
widget.controller.goBack();
return Future.value(false);
if (await widget.controller.currentUrl() != 'https://www.dev.uspray.kr/main') {
if(!await widget.controller.canGoBack()){
Future<bool> dialogResult = showExitPopup();
return Future.value(dialogResult);
}else {
widget.controller.goBack();
return Future.value(false);
}
} else {
Future<bool> dialogResult = showExitPopup();
return Future.value(dialogResult);
Expand Down
Loading

0 comments on commit dfb1fcf

Please sign in to comment.