From 1556f35f9ec9f29c54ba2be745419c0598508b0f Mon Sep 17 00:00:00 2001 From: Jimmy Sanghani Date: Tue, 18 Jun 2024 16:50:24 +0530 Subject: [PATCH] Add apple push notification config (#45) * Add apple push notification config * install flutterfire in ci * Minor changes * Configure project * Minor changes * Possible fix for phone authentication * Possible fix for phone authentication in android * Possible fix for build in ios * Possible fix for build in android * Possible fix for build in ios * Fix lint error * Fix lint error * upload artifact * Minor changes * list files available * provide exact path for artifact * provide exact path for artifact * change path * root directory file * move file to root * move file to root * move file to root * remove unused code * change aab path * change aab path * change action * add distribution * run job on main * change java version * run on push * change java version * run on main * rm flutter fire cli * run on main --------- Co-authored-by: sidhdhi canopas Co-authored-by: cp-sneha-s --- .github/workflows/analyze.yml | 2 +- .github/workflows/android_build.yml | 13 +++++---- .github/workflows/android_deploy.yml | 9 +++--- .github/workflows/ios_deploy.yml | 11 ++++++-- khelo/android/fastlane/Fastfile | 1 - khelo/ios/Runner.xcodeproj/project.pbxproj | 29 ++++++++++++++++---- khelo/ios/Runner/AppDelegate.swift | 16 ----------- khelo/ios/Runner/Info.plist | 5 +++- khelo/ios/Runner/Runner.entitlements | 5 +++- khelo/ios/Runner/RunnerRelease.entitlements | 8 ------ khelo/macos/Runner.xcodeproj/project.pbxproj | 19 +++++++++++++ 11 files changed, 73 insertions(+), 45 deletions(-) delete mode 100644 khelo/ios/Runner/RunnerRelease.entitlements diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml index 91ca1b9a..68d244f7 100644 --- a/.github/workflows/analyze.yml +++ b/.github/workflows/analyze.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: Checkout - uses: subosito/flutter-action@v2.12.0 diff --git a/.github/workflows/android_build.yml b/.github/workflows/android_build.yml index 2c258aa6..080c37bf 100644 --- a/.github/workflows/android_build.yml +++ b/.github/workflows/android_build.yml @@ -14,11 +14,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: 'oracle' java-version: 17.0.6 cache: 'gradle' @@ -32,7 +33,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: 3.3.0 - bundle-cache: true + bundler-cache: true - name: Retrieve the secret and decode it to file env: @@ -72,10 +73,12 @@ jobs: buildName="${versionValue[0]}.${versionValue[1]}.${{ github.run_number }}" echo "Generating android build $buildName $buildNumber" flutter build apk --release --build-number=$buildNumber --build-name=$buildName - mv build/app/outputs/apk/release/Khelo*.apk . + + cd .. + mv khelo/build/app/outputs/apk/release/Khelo*.apk . - name: Upload APK Artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Khelo APK path: Khelo*.apk diff --git a/.github/workflows/android_deploy.yml b/.github/workflows/android_deploy.yml index 89feb390..5492c253 100644 --- a/.github/workflows/android_deploy.yml +++ b/.github/workflows/android_deploy.yml @@ -14,11 +14,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: 'oracle' java-version: 17.0.6 cache: 'gradle' @@ -32,7 +33,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: 3.3.0 - bundle-cache: true + bundler-cache: true - name: Retrieve the secret and decode it to file env: @@ -43,7 +44,7 @@ jobs: cd khelo echo $FIREBASE_OPTIONS_BASE64 | base64 -di > lib/firebase_options.dart echo $GOOGLE_SERVICES_JSON_BASE64 | base64 -di > android/app/google-services.json - + - name: Install Dependencies run: | diff --git a/.github/workflows/ios_deploy.yml b/.github/workflows/ios_deploy.yml index 920bcade..e2136c06 100644 --- a/.github/workflows/ios_deploy.yml +++ b/.github/workflows/ios_deploy.yml @@ -8,7 +8,7 @@ on: jobs: build: - runs-on: macos-13 + runs-on: macos-latest env: APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} @@ -21,7 +21,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + + - name: Set up Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.4' - name: Set up Flutter uses: subosito/flutter-action@v2 @@ -34,10 +39,12 @@ jobs: env: FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }} GOOGLE_SERVICE_INFO_PLIST_BASE64: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_BASE64 }} + FIREBASE_JSON_BASE64: ${{ secrets.FIREBASE_JSON_BASE64 }} run: | cd khelo echo $FIREBASE_OPTIONS_BASE64 | base64 --decode > lib/firebase_options.dart echo $GOOGLE_SERVICE_INFO_PLIST_BASE64 | base64 --decode > ios/Runner/GoogleService-Info.plist + echo $FIREBASE_JSON_BASE64 | base64 --decode > firebase.json - name: Install Dependencies run: | diff --git a/khelo/android/fastlane/Fastfile b/khelo/android/fastlane/Fastfile index 89c8016e..2ed3b2df 100644 --- a/khelo/android/fastlane/Fastfile +++ b/khelo/android/fastlane/Fastfile @@ -32,7 +32,6 @@ platform :android do skip_upload_metadata: true, skip_upload_images: true, skip_upload_apk: true, - release_status: 'draft', aab: '../build/app/outputs/bundle/release/app-release.aab', skip_upload_screenshots: true) end diff --git a/khelo/ios/Runner.xcodeproj/project.pbxproj b/khelo/ios/Runner.xcodeproj/project.pbxproj index 02cbcd14..785aed4f 100644 --- a/khelo/ios/Runner.xcodeproj/project.pbxproj +++ b/khelo/ios/Runner.xcodeproj/project.pbxproj @@ -45,14 +45,12 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 203168372BBFD3E7005953C0 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; 20E4EAC22BB7FBF4001FD0E5 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 36A9CDDD30BEEFAAB87A6822 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 3D888651C4C3408C09E3A9AD /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; - 5795302B2BF60A4D006B7A32 /* RunnerRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RunnerRelease.entitlements; sourceTree = ""; }; 6FD9FFBCB662585BD6C8FCE0 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 71018C381C9FB1881222C2AE /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; @@ -65,6 +63,7 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9B3323CC2C1C61D20053F1A5 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; AEF4D4C9FDEA72B8A3FCA32B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; B19091D2B4A27468EAE2E443 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; BDAD34F0A6EFF59B2672A5ED /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; @@ -137,8 +136,7 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( - 5795302B2BF60A4D006B7A32 /* RunnerRelease.entitlements */, - 203168372BBFD3E7005953C0 /* Runner.entitlements */, + 9B3323CC2C1C61D20053F1A5 /* Runner.entitlements */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, @@ -207,6 +205,7 @@ 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 48DBE20C4FFA0C6093DF577D /* [CP] Embed Pods Frameworks */, + C7BD899DCC0D6933A79BD0BB /* FlutterFire: "flutterfire upload-crashlytics-symbols" */, ); buildRules = ( ); @@ -349,6 +348,24 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + C7BD899DCC0D6933A79BD0BB /* FlutterFire: "flutterfire upload-crashlytics-symbols" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "FlutterFire: \"flutterfire upload-crashlytics-symbols\""; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\n#!/bin/bash\nPATH=${PATH}:$FLUTTER_ROOT/bin:$HOME/.pub-cache/bin\nflutterfire upload-crashlytics-symbols --upload-symbols-script-path=$PODS_ROOT/FirebaseCrashlytics/upload-symbols --platform=ios --apple-project-path=${SRCROOT} --env-platform-name=${PLATFORM_NAME} --env-configuration=${CONFIGURATION} --env-project-dir=${PROJECT_DIR} --env-built-products-dir=${BUILT_PRODUCTS_DIR} --env-dwarf-dsym-folder-path=${DWARF_DSYM_FOLDER_PATH} --env-dwarf-dsym-file-name=${DWARF_DSYM_FILE_NAME} --env-infoplist-path=${INFOPLIST_PATH} --default-config=default\n"; + }; FE21343C7A9976ADFB4BEB1B /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -698,12 +715,12 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = Runner/RunnerRelease.entitlements; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 4; - DEVELOPMENT_TEAM = S985H2T7J8; + DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = S985H2T7J8; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; diff --git a/khelo/ios/Runner/AppDelegate.swift b/khelo/ios/Runner/AppDelegate.swift index e087d038..70693e4a 100644 --- a/khelo/ios/Runner/AppDelegate.swift +++ b/khelo/ios/Runner/AppDelegate.swift @@ -1,7 +1,5 @@ import UIKit import Flutter -import Firebase -import FirebaseAuth @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { @@ -9,21 +7,7 @@ import FirebaseAuth _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - FirebaseApp.configure() GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } - - override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { - let firebaseAuth = Auth.auth() - firebaseAuth.setAPNSToken(deviceToken, type: AuthAPNSTokenType.unknown) - } - - override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { - let firebaseAuth = Auth.auth() - if (firebaseAuth.canHandleNotification(userInfo)){ - print(userInfo) - return - } - } } diff --git a/khelo/ios/Runner/Info.plist b/khelo/ios/Runner/Info.plist index 22703378..7cd7f4ad 100644 --- a/khelo/ios/Runner/Info.plist +++ b/khelo/ios/Runner/Info.plist @@ -30,7 +30,6 @@ CFBundleURLSchemes app-1-753506519474-ios-8cd38557e090c0b51e7cab - com.googleusercontent.apps.753506519474-6qolf71653023s197ur4ag97q2lvaf9r @@ -46,6 +45,10 @@ Select a profile image from your device's gallery to showcase your preferred photo in moments of your choice. UIApplicationSupportsIndirectInputEvents + UIBackgroundModes + + fetch + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile diff --git a/khelo/ios/Runner/Runner.entitlements b/khelo/ios/Runner/Runner.entitlements index 0c67376e..903def2a 100644 --- a/khelo/ios/Runner/Runner.entitlements +++ b/khelo/ios/Runner/Runner.entitlements @@ -1,5 +1,8 @@ - + + aps-environment + development + diff --git a/khelo/ios/Runner/RunnerRelease.entitlements b/khelo/ios/Runner/RunnerRelease.entitlements deleted file mode 100644 index 98ff2408..00000000 --- a/khelo/ios/Runner/RunnerRelease.entitlements +++ /dev/null @@ -1,8 +0,0 @@ - - - - - aps-environment - unknown - - diff --git a/khelo/macos/Runner.xcodeproj/project.pbxproj b/khelo/macos/Runner.xcodeproj/project.pbxproj index 12667444..1916d982 100644 --- a/khelo/macos/Runner.xcodeproj/project.pbxproj +++ b/khelo/macos/Runner.xcodeproj/project.pbxproj @@ -212,6 +212,7 @@ 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, + 2FDA20EBF7F7D70742815D1A /* FlutterFire: "flutterfire upload-crashlytics-symbols" */, ); buildRules = ( ); @@ -294,6 +295,24 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 2FDA20EBF7F7D70742815D1A /* FlutterFire: "flutterfire upload-crashlytics-symbols" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "FlutterFire: \"flutterfire upload-crashlytics-symbols\""; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\n#!/bin/bash\nPATH=${PATH}:$FLUTTER_ROOT/bin:$HOME/.pub-cache/bin\nflutterfire upload-crashlytics-symbols --upload-symbols-script-path=$PODS_ROOT/FirebaseCrashlytics/upload-symbols --platform=macos --apple-project-path=${SRCROOT} --env-platform-name=${PLATFORM_NAME} --env-configuration=${CONFIGURATION} --env-project-dir=${PROJECT_DIR} --env-built-products-dir=${BUILT_PRODUCTS_DIR} --env-dwarf-dsym-folder-path=${DWARF_DSYM_FOLDER_PATH} --env-dwarf-dsym-file-name=${DWARF_DSYM_FILE_NAME} --env-infoplist-path=${INFOPLIST_PATH} --default-config=default\n"; + }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1;