Skip to content

Commit

Permalink
Merge pull request #102 from PrayHelper/feat/#69
Browse files Browse the repository at this point in the history
Feat/#69
  • Loading branch information
hfjxjjd123 authored Nov 24, 2023
2 parents 61be3c2 + d899574 commit 33a9af1
Show file tree
Hide file tree
Showing 11 changed files with 220 additions and 22 deletions.
10 changes: 9 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.prayhelper.uspray">

<queries>
<package android:name="com.kakao.talk" />
</queries>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
Expand Down Expand Up @@ -35,13 +40,16 @@
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="www.uspray.kr"
android:scheme="https" />
<data
android:host="plusfriend"
android:scheme="kakaoplus" />

</intent-filter>

</activity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ class MainActivity : FlutterActivity() {
val intent = Intent(Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS)
startActivity(intent)
}

}
28 changes: 20 additions & 8 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ PODS:
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (7.12.0):
- GoogleUtilities/Logger
- nanopb (2.30909.1):
- nanopb/decode (= 2.30909.1)
- nanopb/encode (= 2.30909.1)
- nanopb/decode (2.30909.1)
- nanopb/encode (2.30909.1)
- kakao_flutter_sdk_common (1.5.0):
- Flutter
- nanopb (2.30909.0):
- nanopb/decode (= 2.30909.0)
- nanopb/encode (= 2.30909.0)
- nanopb/decode (2.30909.0)
- nanopb/encode (2.30909.0)
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
Expand All @@ -71,6 +73,8 @@ PODS:
- FlutterMacOS
- uni_links (0.0.1):
- Flutter
- url_launcher_ios (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
- Flutter

Expand All @@ -79,10 +83,12 @@ DEPENDENCIES:
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- Flutter (from `Flutter`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- kakao_flutter_sdk_common (from `.symlinks/plugins/kakao_flutter_sdk_common/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- uni_links (from `.symlinks/plugins/uni_links/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

SPEC REPOS:
Expand All @@ -106,6 +112,8 @@ EXTERNAL SOURCES:
:path: Flutter
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
kakao_flutter_sdk_common:
:path: ".symlinks/plugins/kakao_flutter_sdk_common/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/ios"
share_plus:
Expand All @@ -114,6 +122,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
uni_links:
:path: ".symlinks/plugins/uni_links/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

Expand All @@ -127,14 +137,16 @@ SPEC CHECKSUMS:
FirebaseMessaging: bb2c4f6422a753038fe137d90ae7c1af57251316
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2
GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34
nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5
GoogleDataTransport: f0308f5905a745f94fb91fea9c6cbaf3831cb1bd
GoogleUtilities: c63691989bf362ba0505507da00eeb326192e83e
kakao_flutter_sdk_common: ceb36a134b53ae973da184f67f39993142377af4
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a

PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d
Expand Down
30 changes: 21 additions & 9 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,31 @@
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>uspraymobile</string>
<key>CFBundleURLSchemes</key>
<array>
<string>uspraymobile</string>
</array>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>uspraymobile</string>
<key>CFBundleURLSchemes</key>
<array>
<string>uspraymobile</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>kakao123456789</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>KakaoSDKShare</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
Expand Down Expand Up @@ -67,7 +81,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion lib/bloc/notification/fcm_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void fcmSetting() async{

// Listen to the onMessageOpenedApp stream
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
WebviewMainController.to.loadUrl("https://www.uspray.kr/main/");
WebviewMainController.to.loadUrl("https://www.dev.uspray.kr/main/");
});

}
Expand Down
16 changes: 14 additions & 2 deletions lib/controller/webview_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import 'package:com.prayhelper.uspray/controller/sharing_controller.dart';
import 'package:com.prayhelper.uspray/controller/token_controller.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:kakao_flutter_sdk/kakao_flutter_sdk.dart';
import 'package:webview_flutter/webview_flutter.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();

Expand All @@ -21,7 +23,10 @@ class WebviewMainController extends GetxController {
onPageFinished: (String url) {},
onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) async{
//TODO 특정 url을 따른 로직을 핸들링할 수 있음
if(request.url == "https://pf.kakao.com/_UgxhYxj"){
await _launchKakaoplusUrl();
return NavigationDecision.prevent;
}
return NavigationDecision.navigate;
},
),
Expand Down Expand Up @@ -87,4 +92,11 @@ class WebviewMainController extends GetxController {

}


Future<void> _launchKakaoplusUrl() async {
Uri url = await TalkApi.instance.addChannelUrl("_UgxhYxj");
try {
await launchBrowserTab(url);
} catch (e) {
print("카톡 채널 추가 실패 에러 : $e");
}
}
5 changes: 5 additions & 0 deletions lib/logger.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'package:logger/logger.dart';

var logger = Logger(
printer: PrettyPrinter(),
);
9 changes: 9 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,28 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:com.prayhelper.uspray/pray_helper_app.dart';
import 'package:kakao_flutter_sdk_share/kakao_flutter_sdk_share.dart';
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 'logger.dart';

late AndroidNotificationChannel channel;

void main() async {
Get.put(WebviewMainController());
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();

KakaoSdk.init(
nativeAppKey:"80bf50fbdfeae9aa0acf19984aef9165",
javaScriptAppKey:"06f05fc4656e611107402eb16961d5ff"
);

await initNotification();
await initDeepLinks();

runApp(const PrayHelperApp());
}
2 changes: 1 addition & 1 deletion lib/screen/webview_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class _WebViewScreenState extends State<WebViewScreen> {
}

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

0 comments on commit 33a9af1

Please sign in to comment.