Skip to content

Commit

Permalink
Add apple push notification config (#45)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: cp-sneha-s <[email protected]>
  • Loading branch information
3 people authored Jun 18, 2024
1 parent 1a09dfa commit 1556f35
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest

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

- uses: subosito/[email protected]
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/android_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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:
Expand All @@ -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: |
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/ios_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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: |
Expand Down
1 change: 0 additions & 1 deletion khelo/android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 23 additions & 6 deletions khelo/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
203168372BBFD3E7005953C0 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
20E4EAC22BB7FBF4001FD0E5 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
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 = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
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 = "<group>"; };
5795302B2BF60A4D006B7A32 /* RunnerRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RunnerRelease.entitlements; sourceTree = "<group>"; };
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 = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
Expand All @@ -65,6 +63,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9B3323CC2C1C61D20053F1A5 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -207,6 +205,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
48DBE20C4FFA0C6093DF577D /* [CP] Embed Pods Frameworks */,
C7BD899DCC0D6933A79BD0BB /* FlutterFire: "flutterfire upload-crashlytics-symbols" */,
);
buildRules = (
);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 0 additions & 16 deletions khelo/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
import UIKit
import Flutter
import Firebase
import FirebaseAuth

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ 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
}
}
}
5 changes: 4 additions & 1 deletion khelo/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
<key>CFBundleURLSchemes</key>
<array>
<string>app-1-753506519474-ios-8cd38557e090c0b51e7cab</string>
<string>com.googleusercontent.apps.753506519474-6qolf71653023s197ur4ag97q2lvaf9r</string>
</array>
</dict>
</array>
Expand All @@ -46,6 +45,10 @@
<string>Select a profile image from your device's gallery to showcase your preferred photo in moments of your choice.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand Down
5 changes: 4 additions & 1 deletion khelo/ios/Runner/Runner.entitlements
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>
8 changes: 0 additions & 8 deletions khelo/ios/Runner/RunnerRelease.entitlements

This file was deleted.

19 changes: 19 additions & 0 deletions khelo/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
33CC10EB2044A3C60003C045 /* Resources */,
33CC110E2044A8840003C045 /* Bundle Framework */,
3399D490228B24CF009A79C7 /* ShellScript */,
2FDA20EBF7F7D70742815D1A /* FlutterFire: "flutterfire upload-crashlytics-symbols" */,
);
buildRules = (
);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1556f35

Please sign in to comment.