diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 88de491..2d242d5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,6 +2,7 @@ on: push: paths: - 'plugins/**' + repository_dispatch: env: releaseName: v${{ github.run_number }} @@ -24,6 +25,7 @@ jobs: ( if [ ! -d "$platform" ] ; then continue ; fi cd "$platform" + if ! ls * &> /dev/null ; then continue ; fi COPYFILE_DISABLE=true tar -czvf ../../"$build-$platform.tgz" --exclude=".*" * ) done @@ -37,4 +39,16 @@ jobs: tag_name: ${{ env.releaseName }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + - name: Directory update request + run: | + [ -z "${{ secrets.ISSUE_PAT }}" ] && echo "Skipping, no ISSUE_PAT" && exit 0 + curl --request POST \ + --url https://api.github.com/repos/solar2d/plugins.solar2d.com/dispatches \ + --header 'authorization: Bearer ${{ secrets.ISSUE_PAT }}' \ + --header 'content-type: application/json' \ + --data '{ + "event_type": "repo_updated", + "client_payload": { + "repo": "${{ github.repository }}" + } + }' diff --git a/README.md b/README.md index fedf820..71b7127 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -Sources for the plugin `plugin.notifications.v2`. +Sources for the plugin `plugin.notifications.v2` and `plugin.notifications.v2.firebase` Add following to your `build.settings` to use: ```lua { plugins = { - "plugin.notifications.v2" = { + "[plugin.notifications.v2]" = { publisherId = "com.coronalabs", }, }, diff --git a/plugins/2020.3569/android/corona.gradle b/plugins/2020.3569/android/corona.gradle new file mode 100644 index 0000000..ac7b5c4 --- /dev/null +++ b/plugins/2020.3569/android/corona.gradle @@ -0,0 +1,4 @@ +android.defaultConfig { + minSdkVersion Math.max(minSdkVersion?.apiLevel ?: 15, 16) +} +ext["minSdkVersion"] = Math.max(ext.find("minSdkVersion")?:15, 16) diff --git a/plugins/2020.3569/android/metadata.lua b/plugins/2020.3569/android/metadata.lua index 4b19de8..8fd0005 100644 --- a/plugins/2020.3569/android/metadata.lua +++ b/plugins/2020.3569/android/metadata.lua @@ -19,13 +19,6 @@ local metadata = - - - - - - ]] } } diff --git a/plugins/2020.3569/android/plugin.notifications.v2.jar b/plugins/2020.3569/android/plugin.notifications.v2.jar index a3afedc..f960d19 100644 Binary files a/plugins/2020.3569/android/plugin.notifications.v2.jar and b/plugins/2020.3569/android/plugin.notifications.v2.jar differ diff --git a/plugins/2020.3569/iphone-sim/FirebaseCore.framework/FirebaseCore b/plugins/2020.3569/iphone-sim/FirebaseCore.framework/FirebaseCore deleted file mode 100755 index 1fa6b5b..0000000 Binary files a/plugins/2020.3569/iphone-sim/FirebaseCore.framework/FirebaseCore and /dev/null differ diff --git a/plugins/2020.3569/iphone-sim/FirebaseInstallations.framework/FirebaseInstallations b/plugins/2020.3569/iphone-sim/FirebaseInstallations.framework/FirebaseInstallations deleted file mode 100755 index 06ea3dc..0000000 Binary files a/plugins/2020.3569/iphone-sim/FirebaseInstallations.framework/FirebaseInstallations and /dev/null differ diff --git a/plugins/2020.3569/iphone-sim/FirebaseInstanceID.framework/FirebaseInstanceID b/plugins/2020.3569/iphone-sim/FirebaseInstanceID.framework/FirebaseInstanceID deleted file mode 100755 index 241e4d8..0000000 Binary files a/plugins/2020.3569/iphone-sim/FirebaseInstanceID.framework/FirebaseInstanceID and /dev/null differ diff --git a/plugins/2020.3569/iphone-sim/FirebaseMessaging.framework/FirebaseMessaging b/plugins/2020.3569/iphone-sim/FirebaseMessaging.framework/FirebaseMessaging deleted file mode 100755 index 37e7ba6..0000000 Binary files a/plugins/2020.3569/iphone-sim/FirebaseMessaging.framework/FirebaseMessaging and /dev/null differ diff --git a/plugins/2020.3569/iphone-sim/libNotificationsV2Plugin.a b/plugins/2020.3569/iphone-sim/libNotificationsV2Plugin.a index 913027e..d5aa91e 100644 Binary files a/plugins/2020.3569/iphone-sim/libNotificationsV2Plugin.a and b/plugins/2020.3569/iphone-sim/libNotificationsV2Plugin.a differ diff --git a/plugins/2020.3569/iphone-sim/metadata.lua b/plugins/2020.3569/iphone-sim/metadata.lua index 399101f..0d8628f 100644 --- a/plugins/2020.3569/iphone-sim/metadata.lua +++ b/plugins/2020.3569/iphone-sim/metadata.lua @@ -4,7 +4,7 @@ local metadata = { format = "staticLibrary", staticLibs = { 'NotificationsV2Plugin', }, - frameworks = { 'GoogleUtilities', 'protobuf', 'FBLPromises', 'FirebaseInstanceID', 'FirebaseMessaging', 'FirebaseInstallations', 'FirebaseCore', }, + frameworks = { }, frameworksOptional = { "UserNotifications", "UserNotificationsUI" }, delegates = { "CoronaNotificationsDelegate" } } diff --git a/plugins/2020.3569/iphone-sim/resources/Frameworks/FBLPromises.framework/FBLPromises b/plugins/2020.3569/iphone-sim/resources/Frameworks/FBLPromises.framework/FBLPromises deleted file mode 100755 index eb2e6c9..0000000 Binary files a/plugins/2020.3569/iphone-sim/resources/Frameworks/FBLPromises.framework/FBLPromises and /dev/null differ diff --git a/plugins/2020.3569/iphone-sim/resources/Frameworks/GoogleUtilities.framework/GoogleUtilities b/plugins/2020.3569/iphone-sim/resources/Frameworks/GoogleUtilities.framework/GoogleUtilities deleted file mode 100755 index a6a90df..0000000 Binary files a/plugins/2020.3569/iphone-sim/resources/Frameworks/GoogleUtilities.framework/GoogleUtilities and /dev/null differ diff --git a/plugins/2020.3569/iphone-sim/resources/Frameworks/protobuf.framework/protobuf b/plugins/2020.3569/iphone-sim/resources/Frameworks/protobuf.framework/protobuf deleted file mode 100755 index 0430705..0000000 Binary files a/plugins/2020.3569/iphone-sim/resources/Frameworks/protobuf.framework/protobuf and /dev/null differ diff --git a/plugins/2020.3569/iphone/FirebaseCore.framework/FirebaseCore b/plugins/2020.3569/iphone/FirebaseCore.framework/FirebaseCore deleted file mode 100755 index 12a00eb..0000000 Binary files a/plugins/2020.3569/iphone/FirebaseCore.framework/FirebaseCore and /dev/null differ diff --git a/plugins/2020.3569/iphone/FirebaseInstallations.framework/FirebaseInstallations b/plugins/2020.3569/iphone/FirebaseInstallations.framework/FirebaseInstallations deleted file mode 100755 index 255f2b3..0000000 Binary files a/plugins/2020.3569/iphone/FirebaseInstallations.framework/FirebaseInstallations and /dev/null differ diff --git a/plugins/2020.3569/iphone/FirebaseInstanceID.framework/FirebaseInstanceID b/plugins/2020.3569/iphone/FirebaseInstanceID.framework/FirebaseInstanceID deleted file mode 100755 index 41d097f..0000000 Binary files a/plugins/2020.3569/iphone/FirebaseInstanceID.framework/FirebaseInstanceID and /dev/null differ diff --git a/plugins/2020.3569/iphone/FirebaseMessaging.framework/FirebaseMessaging b/plugins/2020.3569/iphone/FirebaseMessaging.framework/FirebaseMessaging deleted file mode 100755 index 616c3b1..0000000 Binary files a/plugins/2020.3569/iphone/FirebaseMessaging.framework/FirebaseMessaging and /dev/null differ diff --git a/plugins/2020.3569/iphone/libNotificationsV2Plugin.a b/plugins/2020.3569/iphone/libNotificationsV2Plugin.a index aa2819d..455b780 100644 Binary files a/plugins/2020.3569/iphone/libNotificationsV2Plugin.a and b/plugins/2020.3569/iphone/libNotificationsV2Plugin.a differ diff --git a/plugins/2020.3569/iphone/metadata.lua b/plugins/2020.3569/iphone/metadata.lua index 399101f..0d8628f 100644 --- a/plugins/2020.3569/iphone/metadata.lua +++ b/plugins/2020.3569/iphone/metadata.lua @@ -4,7 +4,7 @@ local metadata = { format = "staticLibrary", staticLibs = { 'NotificationsV2Plugin', }, - frameworks = { 'GoogleUtilities', 'protobuf', 'FBLPromises', 'FirebaseInstanceID', 'FirebaseMessaging', 'FirebaseInstallations', 'FirebaseCore', }, + frameworks = { }, frameworksOptional = { "UserNotifications", "UserNotificationsUI" }, delegates = { "CoronaNotificationsDelegate" } } diff --git a/plugins/2020.3569/iphone/resources/Frameworks/FBLPromises.framework/FBLPromises b/plugins/2020.3569/iphone/resources/Frameworks/FBLPromises.framework/FBLPromises deleted file mode 100755 index a28ab20..0000000 Binary files a/plugins/2020.3569/iphone/resources/Frameworks/FBLPromises.framework/FBLPromises and /dev/null differ diff --git a/plugins/2020.3569/iphone/resources/Frameworks/GoogleUtilities.framework/GoogleUtilities b/plugins/2020.3569/iphone/resources/Frameworks/GoogleUtilities.framework/GoogleUtilities deleted file mode 100755 index a5aa6a5..0000000 Binary files a/plugins/2020.3569/iphone/resources/Frameworks/GoogleUtilities.framework/GoogleUtilities and /dev/null differ diff --git a/plugins/2020.3569/iphone/resources/Frameworks/protobuf.framework/protobuf b/plugins/2020.3569/iphone/resources/Frameworks/protobuf.framework/protobuf deleted file mode 100755 index 1a2ea73..0000000 Binary files a/plugins/2020.3569/iphone/resources/Frameworks/protobuf.framework/protobuf and /dev/null differ diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..fb15021 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,8 @@ +*xcuser* +build/ +BuiltPlugin/ +ios/libNotificationsV2Plugin.a +ios/libNotificationsV2Plugin.firebase.a +.gradle/ +build/ +.idea/ diff --git a/src/Corona/.atom-build.json b/src/Corona/.atom-build.json new file mode 100644 index 0000000..fc9c543 --- /dev/null +++ b/src/Corona/.atom-build.json @@ -0,0 +1,7 @@ +{ + "cmd": "/Applications/Corona/Corona\\ Simulator.app/Contents/MacOS/Corona\\ Simulator", + "args": ["main.lua"], + "name": "Corona SDK", + "cwd": "{PROJECT_PATH}", + "sh": true +} diff --git a/src/Corona/AndroidResources/res/mipmap-anydpi-v26/ic_launcher.xml b/src/Corona/AndroidResources/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..036d09b --- /dev/null +++ b/src/Corona/AndroidResources/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/Corona/AndroidResources/res/mipmap-hdpi/ic_launcher.png b/src/Corona/AndroidResources/res/mipmap-hdpi/ic_launcher.png new file mode 100755 index 0000000..00d8155 Binary files /dev/null and b/src/Corona/AndroidResources/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/Corona/AndroidResources/res/mipmap-hdpi/ic_launcher_foreground.png b/src/Corona/AndroidResources/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100755 index 0000000..e59e834 Binary files /dev/null and b/src/Corona/AndroidResources/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/src/Corona/AndroidResources/res/mipmap-mdpi/ic_launcher.png b/src/Corona/AndroidResources/res/mipmap-mdpi/ic_launcher.png new file mode 100755 index 0000000..b698936 Binary files /dev/null and b/src/Corona/AndroidResources/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/Corona/AndroidResources/res/mipmap-mdpi/ic_launcher_foreground.png b/src/Corona/AndroidResources/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100755 index 0000000..0248230 Binary files /dev/null and b/src/Corona/AndroidResources/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/src/Corona/AndroidResources/res/mipmap-xhdpi/ic_launcher.png b/src/Corona/AndroidResources/res/mipmap-xhdpi/ic_launcher.png new file mode 100755 index 0000000..de9b007 Binary files /dev/null and b/src/Corona/AndroidResources/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/Corona/AndroidResources/res/mipmap-xhdpi/ic_launcher_foreground.png b/src/Corona/AndroidResources/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100755 index 0000000..1b524ae Binary files /dev/null and b/src/Corona/AndroidResources/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/src/Corona/AndroidResources/res/mipmap-xxhdpi/ic_launcher.png b/src/Corona/AndroidResources/res/mipmap-xxhdpi/ic_launcher.png new file mode 100755 index 0000000..d09f0d9 Binary files /dev/null and b/src/Corona/AndroidResources/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/Corona/AndroidResources/res/mipmap-xxhdpi/ic_launcher_foreground.png b/src/Corona/AndroidResources/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100755 index 0000000..79e5a74 Binary files /dev/null and b/src/Corona/AndroidResources/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/src/Corona/AndroidResources/res/mipmap-xxxhdpi/ic_launcher.png b/src/Corona/AndroidResources/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100755 index 0000000..850ddc2 Binary files /dev/null and b/src/Corona/AndroidResources/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/Corona/AndroidResources/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/src/Corona/AndroidResources/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100755 index 0000000..76b589b Binary files /dev/null and b/src/Corona/AndroidResources/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/src/Corona/AndroidResources/res/values/values.xml b/src/Corona/AndroidResources/res/values/values.xml new file mode 100644 index 0000000..3533153 --- /dev/null +++ b/src/Corona/AndroidResources/res/values/values.xml @@ -0,0 +1,4 @@ + + + #e2e2e2 + diff --git a/src/Corona/Default-568h.png b/src/Corona/Default-568h.png new file mode 100644 index 0000000..eb781f6 Binary files /dev/null and b/src/Corona/Default-568h.png differ diff --git a/src/Corona/GoogleService-Info.plist b/src/Corona/GoogleService-Info.plist new file mode 100644 index 0000000..ba59400 --- /dev/null +++ b/src/Corona/GoogleService-Info.plist @@ -0,0 +1,40 @@ + + + + + AD_UNIT_ID_FOR_BANNER_TEST + ca-app-pub-3940256099942544/2934735716 + AD_UNIT_ID_FOR_INTERSTITIAL_TEST + ca-app-pub-3940256099942544/4411468910 + CLIENT_ID + 532108303969-411utnrj5qonacu8ecghpd4q392qlur7.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.532108303969-411utnrj5qonacu8ecghpd4q392qlur7 + API_KEY + AIzaSyCNNa0PFeXPtX5QZnIux9uD92VYljHtB_0 + GCM_SENDER_ID + 532108303969 + PLIST_VERSION + 1 + BUNDLE_ID + com.coronalabs.firebase.messaging + PROJECT_ID + fir-cloud-messaging-16d9a + STORAGE_BUCKET + fir-cloud-messaging-16d9a.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:532108303969:ios:a7f606ca19b0b13b + DATABASE_URL + https://fir-cloud-messaging-16d9a.firebaseio.com + + \ No newline at end of file diff --git a/src/Corona/Icon.png b/src/Corona/Icon.png new file mode 100644 index 0000000..e2c413b Binary files /dev/null and b/src/Corona/Icon.png differ diff --git a/src/Corona/Images.xcassets/AppIcon.appiconset/Contents.json b/src/Corona/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..477b25b --- /dev/null +++ b/src/Corona/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,108 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-40.png", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-58.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-87.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-80.png", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-120.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-180.png", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-76.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-152.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-167.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-1024.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-1024.png b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-1024.png new file mode 100755 index 0000000..f62c818 Binary files /dev/null and b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-1024.png differ diff --git a/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-120.png b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-120.png new file mode 100755 index 0000000..9272f16 Binary files /dev/null and b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-120.png differ diff --git a/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-152.png b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-152.png new file mode 100755 index 0000000..df58a7b Binary files /dev/null and b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-152.png differ diff --git a/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-167.png b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-167.png new file mode 100755 index 0000000..137dbac Binary files /dev/null and b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-167.png differ diff --git a/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-180.png b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-180.png new file mode 100755 index 0000000..40fa8e3 Binary files /dev/null and b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-180.png differ diff --git a/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-40.png b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-40.png new file mode 100755 index 0000000..a53cda3 Binary files /dev/null and b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-40.png differ diff --git a/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-58.png b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-58.png new file mode 100755 index 0000000..76ef3f6 Binary files /dev/null and b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-58.png differ diff --git a/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-76.png b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-76.png new file mode 100755 index 0000000..7fed12e Binary files /dev/null and b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-76.png differ diff --git a/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-80.png b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-80.png new file mode 100755 index 0000000..b06a11f Binary files /dev/null and b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-80.png differ diff --git a/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-87.png b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-87.png new file mode 100755 index 0000000..ea59b45 Binary files /dev/null and b/src/Corona/Images.xcassets/AppIcon.appiconset/Icon-87.png differ diff --git a/src/Corona/Images.xcassets/Contents.json b/src/Corona/Images.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/src/Corona/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/Corona/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib b/src/Corona/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib new file mode 100644 index 0000000..351e482 Binary files /dev/null and b/src/Corona/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib differ diff --git a/src/Corona/LaunchScreen.storyboardc/Info.plist b/src/Corona/LaunchScreen.storyboardc/Info.plist new file mode 100644 index 0000000..32288e8 Binary files /dev/null and b/src/Corona/LaunchScreen.storyboardc/Info.plist differ diff --git a/src/Corona/LaunchScreen.storyboardc/UIViewController-01J-lp-oVM.nib b/src/Corona/LaunchScreen.storyboardc/UIViewController-01J-lp-oVM.nib new file mode 100644 index 0000000..48a7d93 Binary files /dev/null and b/src/Corona/LaunchScreen.storyboardc/UIViewController-01J-lp-oVM.nib differ diff --git a/src/Corona/LaunchScreen.storyboardc/designable.storyboard b/src/Corona/LaunchScreen.storyboardc/designable.storyboard new file mode 100644 index 0000000..cca8ab4 --- /dev/null +++ b/src/Corona/LaunchScreen.storyboardc/designable.storyboard @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Corona/build.settings b/src/Corona/build.settings new file mode 100644 index 0000000..7aebca9 --- /dev/null +++ b/src/Corona/build.settings @@ -0,0 +1,31 @@ +settings = +{ + orientation = + { + default = "portrait", + supported = { "portrait" } + }, + + iphone = + { + useGoogleServicesJson = true, + xcassets = "Images.xcassets", + plist = + { + UIBackgroundModes = {"remote-notification"}, + FirebaseAppDelegateProxyEnabled = false, + } + }, + + android = + { + minSDKVersion = 16, + useGoogleServicesJson = true, + }, + + plugins = + { + ["plugin.notifications.v2.firebase"] = { publisherId = "com.coronalabs", }, + -- ["plugin.notifications.v2"] = { publisherId = "com.coronalabs", }, + } +} diff --git a/src/Corona/config.lua b/src/Corona/config.lua new file mode 100644 index 0000000..80d2c83 --- /dev/null +++ b/src/Corona/config.lua @@ -0,0 +1,18 @@ +application = +{ + content = { + width = 320, + height = 480, + scale = "letterbox" + }, + + notification = { + iphone = { + types = { + "badge", + "sound", + "alert" + } + } + } +} diff --git a/src/Corona/firebaselogo.png b/src/Corona/firebaselogo.png new file mode 100644 index 0000000..7bdceef Binary files /dev/null and b/src/Corona/firebaselogo.png differ diff --git a/src/Corona/google-services.json b/src/Corona/google-services.json new file mode 100644 index 0000000..87aba3d --- /dev/null +++ b/src/Corona/google-services.json @@ -0,0 +1,42 @@ +{ + "project_info": { + "project_number": "532108303969", + "firebase_url": "https://fir-cloud-messaging-16d9a.firebaseio.com", + "project_id": "fir-cloud-messaging-16d9a", + "storage_bucket": "fir-cloud-messaging-16d9a.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:532108303969:android:a7f606ca19b0b13b", + "android_client_info": { + "package_name": "com.coronalabs.firebase.messaging" + } + }, + "oauth_client": [ + { + "client_id": "532108303969-6hgarnooc5dclgmb7q9lu4f2k5l6qs9p.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyAdBEHHph7nxPlcAtpAkMXhIS5cSpOhcK8" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 2 + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/src/Corona/main.lua b/src/Corona/main.lua new file mode 100644 index 0000000..6eee5c7 --- /dev/null +++ b/src/Corona/main.lua @@ -0,0 +1,374 @@ +-- -- Project: GooglePushNotifications +-- -- +-- -- File name: main.lua +-- -- +-- -- Author: Corona Labs Inc. +-- -- +-- -- This sample app demonstrates how to send and receive push notifications via the +-- -- Google Cloud Messaging service (aka: GCM). +-- -- See the "build.settings" file to see what Android permissions are required. +-- -- See the "config.lua" file on how to register for push notifications with Google. +-- -- See the following website on how to set up your app for Google's push notification system. +-- -- http://developer.android.com/google/gcm/gs.html +-- -- +-- -- Limitations: This sample app only works on an Android device with "Google Play" installed. +-- -- +-- -- Sample code is MIT licensed, see http://www.coronalabs.com/links/code/license +-- -- Copyright (C) 2012 Corona Labs Inc. All Rights Reserved. +-- -- +-- -- Supports Graphics 2.0 +-- --------------------------------------------------------------------------------------- + +-- local notifications = require( "plugin.notifications.v2" ) + +-- local centerX = display.contentCenterX +-- local centerY = display.contentCenterY +-- local _W = display.contentWidth +-- local _H = display.contentHeight + +-- -- A Google API Key is needed to send push notifications. It is not needed to receive notifications. +-- -- This key can be obtained from the Google API Console here: https://code.google.com/apis/console +-- -- +-- -- firebase FCM: +-- local googleServerKey = "AAAAe-QgXmE:APA91bGQpiOHzzKqtyhsaxSxbjGXlKp0Rdo1oa47q2rFhQVW4wbBk1gTHq-vADrAH3C0oDADJbda89pYxMQMWPVRwHs2iEGLTgm2rtXA0kq6SlzyM3DY15NV6NdWtH-OIqX6lsKtkApF" + +-- -- A Google registration ID is also needed to send push notifications. +-- -- This key will be obtained by the notification listener below after this app has successfully +-- -- registered with Google. See the "config.lua" file on how to register this app with Google. +-- local googleRegistrationId = nil + +-- local messageCounter = 0 + + +-- -- Show the status bar so that we can easily access the received notifications. +-- display.setStatusBar(display.DefaultStatusBar) + +-- -- Set up the background. +-- local background = display.newRect(centerX, centerY, display.contentWidth, display.contentHeight) +-- background:setFillColor(0.5, 0, 0) + +-- -- Display instructions. +-- local message = "Tap the screen to push a notification" +-- local textField = display.newText(message, 0, centerY, native.systemFont, 18) +-- textField:setFillColor(1, 1, 1) +-- textField.x = centerX + + +-- -- Called when a sent notification has succeeded or failed. +-- local function onSendNotification(event) +-- local errorMessage = nil + +-- -- Determine if we have successfully sent the notification to Google's server. +-- if event.isError then +-- -- Failed to connect to the server. +-- -- This typically happens due to lack of Internet access. +-- errorMessage = "Failed to connect to the server." + +-- elseif event.status == 200 then +-- -- A status code of 200 means that the notification was sent succcessfully. +-- print("Notification was sent successfully.") + +-- elseif event.status == 400 then +-- -- There was an error in the sent notification's JSON data. +-- errorMessage = event.response + +-- elseif event.status == 401 then +-- -- There was a user authentication error. +-- errorMessage = "Failed to authenticate the sender's Google Play account." + +-- elseif (event.status >= 500) and (event.status <= 599) then +-- -- The Google Cloud Messaging server failed to process the given notification. +-- -- This indicates an internal error on the server side or the server is temporarily unavailable. +-- -- In this case, we are supposed to silently fail and try again later. +-- errorMessage = "Server failed to process the request. Please try again later." +-- end + +-- -- Display an error message if there was a failure. +-- if errorMessage then +-- native.showAlert("Notification Error", errorMessage, { "OK" }) +-- end +-- end + +-- -- Sends the given JSON message to the Google Cloud Messaging server to be pushed to Android devices. +-- local function sendNotification(jsonMessage) +-- -- Do not continue if a Google API Key was not provided. +-- if not googleServerKey then +-- return +-- end + +-- -- Print the JSON message to the log. +-- print("--- Sending Notification ----") +-- print(jsonMessage) + +-- -- Send the push notification to this app. +-- local url = "https://fcm.googleapis.com/fcm/send" +-- local parameters = +-- { +-- headers = +-- { +-- ["Authorization"] = "key=" .. googleServerKey, +-- ["Content-Type"] = "application/json", +-- }, +-- body = jsonMessage, +-- } +-- network.request(url, "POST", onSendNotification, parameters) +-- end + +-- -- Sends a push notification when the screen has been tapped. +-- local function onTap(event) +-- -- Do not continue if this app has not been registered for push notifications yet. +-- if not googleRegistrationId then +-- return +-- end + +-- messageCounter = messageCounter + 1 + +-- -- Set up a JSON message to send a push notification to this app. +-- -- The "registration_ids" tells Google to whom this push notification should be delivered to. +-- -- The "alert" field sets the message to be displayed when the notification has been received. +-- -- The "sound" field is optional and will play a sound file in the app's ResourceDirectory. +-- -- The "custom" field is optional and will be delivered by the notification event's "event.custom" property. + +-- local jsonGcmMessage = +-- [[ +-- { +-- "registration_ids": ["]] .. tostring(googleRegistrationId) .. [["], +-- "data": +-- { +-- "alert": +-- { +-- "title": "My Title", +-- "body": "My body text ]] .. tostring(messageCounter) .. [[", +-- "number": 123 +-- }, +-- "sound": "notification.wav", +-- "notification_id": "Hello Vlad", +-- "name": "My Name", +-- "tag": "mytag", +-- "custom": +-- { +-- "boolean": true, +-- "number": 123.456, +-- "string": "Custom data test.", +-- "array": [ true, false, 0, 1, "", "This is a test." ], +-- "table": { "x": 1, "y": 2 } +-- } +-- } +-- } +-- ]] + +-- local jsonFcmMessage = +-- [[ +-- { +-- "registration_ids": ["]] .. tostring(googleRegistrationId) .. [["], +-- "data": { +-- "boolean": true, +-- "number": 123.456, +-- "string": "Custom data test.", +-- "array": [ true, false, 0, 1, "", "This is a test." ], +-- "table": { "x": 1, "y": 2 } +-- } +-- "notification": { +-- "title": "My Title", +-- "body": "My body text ]] .. tostring(messageCounter) .. [[", +-- "sound": "notification.wav", +-- "tag": "myTag" +-- } +-- } +-- ]] + +-- sendNotification(jsonGcmMessage) +-- end +-- Runtime:addEventListener("tap", onTap) + +-- -- Prints all contents of a Lua table to the log. +-- local function printTable(table, stringPrefix) +-- if not stringPrefix then +-- stringPrefix = "### " +-- end +-- if type(table) == "table" then +-- for key, value in pairs(table) do +-- if type(value) == "table" then +-- print(stringPrefix .. tostring(key)) +-- print(stringPrefix .. "{") +-- printTable(value, stringPrefix .. " ") +-- print(stringPrefix .. "}") +-- else +-- print(stringPrefix .. tostring(key) .. ": " .. tostring(value)) +-- end +-- end +-- end +-- end + +-- -- Called when a notification event has been received. +-- local function onNotification(event) +-- if event.type == "remoteRegistration" then +-- if event.token ~= "unknown" then +-- -- This device has just been registered for Google Cloud Messaging (GCM) push notifications. +-- -- Store the Registration ID that was assigned to this application by Google. +-- googleRegistrationId = event.token + +-- -- Display a message indicating that registration was successful. +-- local message = "This app has successfully registered for Google push notifications." +-- native.showAlert("Information", message, { "OK" }) + +-- -- Print the registration event to the log. +-- print("### --- Registration Event ---") +-- printTable(event) +-- end +-- else +-- -- A push notification has just been received. Print it to the log. +-- print("### --- Notification Event ---") +-- printTable(event) +-- end +-- end + +-- -- Set up a notification listener. +-- Runtime:addEventListener("notification", onNotification) + +-- -- iOS only +-- notifications.registerForPushNotifications{ useFCM=true } + +-- -- get device token on app launch (must do this as token is automatically reported on first launch only) +-- timer.performWithDelay(2500, function() +-- notifications.getDeviceToken() +-- end) + +-- -- Print this app's launch arguments to the log. +-- -- This allows you to view what these arguments provide when this app is started by tapping a notification. +-- local launchArgs = ... +-- if ( launchArgs and launchArgs.notification ) then +-- print(">>>> launching app from a notification...") +-- onNotification( launchArgs.notification ) +-- end +-- +-- main.lua +-- Firebase Messaging Sample App +-- +-- Copyright (c) 2017 Corona Labs Inc. All rights reserved. +-- + +-- ============================================================================================================ + +-- use launch args for detecting app launch from tapping a notification (local notifications only) +local launchArgs = ... + +local notifications = require("plugin.notifications.v2") +local widget = require("widget") +local json = require("json") + +-------------------------------------------------------------------------- +-- set up UI +-------------------------------------------------------------------------- + +display.setStatusBar( display.HiddenStatusBar ) +display.setDefault( "background", 1 ) + +local firebaseLogo = display.newImage( "firebaselogo.png" ) +firebaseLogo.anchorY = 0 +firebaseLogo:scale( 0.5, 0.5 ) +firebaseLogo.x, firebaseLogo.y = display.contentCenterX, -5 + +local subTitle = display.newText { + text = "Notifications V2 plugin for Corona SDK", + font = display.systemFont, + fontSize = 14 +} +subTitle:setTextColor( 0.2, 0.2, 0.2 ) +subTitle.x, subTitle.y = display.contentCenterX, 60 + +eventDataTextBox = native.newTextBox( display.contentCenterX, display.contentHeight - 50, display.contentWidth - 10, 100) +eventDataTextBox.placeholder = "Event data will appear here" +eventDataTextBox.hasBackground = false + +local processEventTable = function(event) + local logString = json.prettify(event):gsub("\\","") + print(logString) + eventDataTextBox.text = logString .. eventDataTextBox.text +end + +-- -------------------------------------------------------------------------- +-- -- plugin implementation +-- -------------------------------------------------------------------------- + +local localNotification + +-- Listen for notifications +local notificationsListener = function( event ) + processEventTable(event) +end + +print("token", notifications.getDeviceToken()) + +notifications.registerForPushNotifications( {useFCM=true}) + +-- use runtime listener for both local and Firebase notifications +Runtime:addEventListener( "notification", notificationsListener ) + +local subscribeToNewsTopic = widget.newButton { + label = "Subscribe to News", + width = 200, + height = 40, + labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, + onRelease = function(event) + notifications.subscribe("news") + end +} +subscribeToNewsTopic.x, subscribeToNewsTopic.y = display.contentCenterX, 150 + +local unsubscribeFromNewsTopic = widget.newButton { + label = "Unsubscribe from News", + width = 200, + height = 40, + labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, + onRelease = function(event) + notifications.unsubscribe("news") + end +} +unsubscribeFromNewsTopic.x, unsubscribeFromNewsTopic.y = display.contentCenterX, subscribeToNewsTopic.y + 40 + +local scheduleLocalNotification = widget.newButton { + label = "Local notification (in 10s)", + width = 200, + height = 40, + labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, + onRelease = function(event) + local options = { + alert = "Wake up!", + sound = "notification.wav", + badge = 2, + custom = { foo = "bar" } + } + + localNotification = notifications.scheduleNotification( 10, options ) + end +} +scheduleLocalNotification.x, scheduleLocalNotification.y = display.contentCenterX, unsubscribeFromNewsTopic.y + 60 + +local cancelLocalNotification = widget.newButton { + label = "Cancel Local Notification", + width = 200, + height = 40, + labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, + onRelease = function(event) + notifications.cancelNotification(localNotification) + end +} +cancelLocalNotification.x, cancelLocalNotification.y = display.contentCenterX, scheduleLocalNotification.y + 40 + +local getDeviceTokenButton = widget.newButton { + label = "Get device token", + width = 200, + height = 40, + labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, + onRelease = function(event) + print("token", notifications.getDeviceToken()) + end +} +getDeviceTokenButton.x, getDeviceTokenButton.y = display.contentCenterX, cancelLocalNotification.y + 60 + +-- local notifications: check for launch args and call listener +if ( launchArgs and launchArgs.notification ) then + print(">>>> launching app from notification...") + notificationsListener( launchArgs.notification ) +end diff --git a/src/Corona/notification.wav b/src/Corona/notification.wav new file mode 100644 index 0000000..622431c Binary files /dev/null and b/src/Corona/notification.wav differ diff --git a/src/android/.gitignore b/src/android/.gitignore new file mode 100644 index 0000000..fda1920 --- /dev/null +++ b/src/android/.gitignore @@ -0,0 +1,5 @@ +*.iml +/local.properties +**/.idea/** +.DS_Store +**/build/** diff --git a/src/android/app/_corona_splash_screen.png b/src/android/app/_corona_splash_screen.png new file mode 100644 index 0000000..a1b6a32 Binary files /dev/null and b/src/android/app/_corona_splash_screen.png differ diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts new file mode 100644 index 0000000..9abf285 --- /dev/null +++ b/src/android/app/build.gradle.kts @@ -0,0 +1,1089 @@ +import com.android.ide.common.util.toPathString +import com.beust.klaxon.JsonArray +import com.beust.klaxon.JsonObject +import com.beust.klaxon.Klaxon +import com.beust.klaxon.Parser +import com.beust.klaxon.lookup +import org.apache.commons.io.output.ByteArrayOutputStream +import org.apache.tools.ant.filters.StringInputStream + +plugins { + id("com.android.application") +} + +// + +val coronaResourcesDir: String? by project +val coronaDstDir: String? by project +val coronaTmpDir: String? by project +val coronaAppFileName: String? by project +val coronaAppPackage = project.findProperty("coronaAppPackage") as? String ?: "com.coronalabs.firebase.messaging" +val coronaKeystore: String? by project +val coronaKeystorePassword: String? by project +val coronaKeyAlias: String? by project +val coronaKeyAliasPassword: String? by project +val configureCoronaPlugins: String? by project +val coronaBuild: String? by project +val (dailyBuildYear, dailyBuildRevision) = coronaBuild?.split('.') ?: listOf(null, null) +val coronaBuildData: String? by project +val coronaExpansionFileName: String? by project +val coronaCustomHome: String? by project +val coronaTargetStore = project.findProperty("coronaTargetStore") as? String ?: "none" +val isLiveBuild = project.findProperty("coronaLiveBuild") == "YES" +val isExpansionFileRequired = !coronaExpansionFileName.isNullOrEmpty() && !isLiveBuild +val coronaSrcDir = project.findProperty("coronaSrcDir") as? String + ?: if (file("$rootDir/../test/assets2").exists()) { + "$rootDir/../test/assets2" + } else { + "$rootDir/../Corona" + } +val coronaBuiltFromSource = file("CMakeLists.txt").exists() && file("../sdk").exists() +val windows = System.getProperty("os.name").toLowerCase().contains("windows") +val shortOsName = if (windows) "win" else "mac" +val nativeDir = if (windows) { + val resourceDir = coronaResourcesDir?.let { file("$it/../Native/").absolutePath }?.takeIf { file(it).exists() } + (resourceDir ?: "${System.getenv("CORONA_PATH")}/Native").replace("\\", "/") +} else { + val resourceDir = coronaResourcesDir?.let { file("$it/../../../Native/").absolutePath }?.takeIf { file(it).exists() } + resourceDir ?: "${System.getenv("HOME")}/Library/Application Support/Corona/Native/" +} + +val coronaPlugins = file("$buildDir/corona-plugins") +val luaCmd = "$nativeDir/Corona/$shortOsName/bin/lua" +val isSimulatorBuild = coronaTmpDir != null + +fun checkCoronaNativeInstallation() { + if (file("$nativeDir/Corona/android/resource/android-template.zip").exists()) + return + if (windows) { + throw InvalidUserDataException("Corona Native was not set-up properly. Re-install Corona to fix this issue.") + } else { + val setupNativeApp = File("/Applications").listFiles { f -> + f.isDirectory && f.name.startsWith("Corona") + }?.max()?.let { + "${it.absolutePath}/Native/Setup Corona Native.app" + } ?: "Native/Setup Corona Native.app" + throw InvalidUserDataException("Corona Native was not set-up properly. Launch '$setupNativeApp'.") + } +} + +val buildToolsDir = "$projectDir/buildTools".takeIf { file(it).exists() } + ?: "$projectDir/../template".takeIf { file(it).exists() } ?: { + checkCoronaNativeInstallation() + copy { + from(zipTree("$nativeDir/Corona/android/resource/android-template.zip")) + into("$buildDir/intermediates/corona-build-tools") + } + "$buildDir/intermediates/corona-build-tools/template/app/buildTools" + }() + +val generatedPluginsOutput = "$buildDir/generated/corona_plugins" +val generatedPluginAssetsDir = "$generatedPluginsOutput/assets" +val generatedPluginNativeLibsDir = "$generatedPluginsOutput/native" +val generatedBuildIdPath = "$generatedPluginsOutput/build" +val generatedPluginMegaJar = "$generatedPluginsOutput/plugins.jar" +val generatedMainIconsAndBannersDir = "$buildDir/generated/corona_icons" + +val parsedBuildProperties: JsonObject = run { + coronaTmpDir?.let { srcDir -> + file("$srcDir/build.properties").takeIf { it.exists() }?.let { f -> + return@run Parser.default().parse(f.absolutePath) as JsonObject + } + } + + val buildSettingsFile = file("$coronaSrcDir/build.settings") + if (!buildSettingsFile.exists()) { + return@run JsonObject(mapOf("buildSettings" to JsonObject(), "packageName" to coronaAppPackage, "targetedAppStore" to coronaTargetStore)) + } + + val output = ByteArrayOutputStream() + val execResult = exec { + setWorkingDir("$nativeDir/Corona/$shortOsName/bin") + commandLine(luaCmd, + "-e", + "package.path='$nativeDir/Corona/shared/resource/?.lua;'..package.path", + "-e", + """ + dofile('${buildSettingsFile.path.replace("\\", "\\\\")}') + if type(settings) == 'table' then + print(require('json').encode(settings)) + else + print('{}') + end + """.trimIndent() + ) + errorOutput = output + standardOutput = output + isIgnoreExitValue = true + } + if (execResult.exitValue != 0) { + throw InvalidUserDataException("Build.settings file could not be parsed: ${output.toString().replace(luaCmd, "")}") + } + val parsedBuildSettingsFile = Parser.default().parse(StringBuilder(output.toString())) as? JsonObject + return@run JsonObject(mapOf("buildSettings" to parsedBuildSettingsFile, "packageName" to coronaAppPackage, "targetedAppStore" to coronaTargetStore)) +} + +val coronaMinSdkVersion = parsedBuildProperties.lookup("buildSettings.android.minSdkVersion").firstOrNull()?.toString()?.toIntOrNull() + ?: 16 + +val coronaBuilder = if (windows) { + "$nativeDir/Corona/win/bin/CoronaBuilder.exe" +} else { + "$nativeDir/Corona/$shortOsName/bin/CoronaBuilder.app/Contents/MacOS/CoronaBuilder" +} + + +val coronaVersionName = + parsedBuildProperties.lookup("buildSettings.android.versionName").firstOrNull()?.toString() + ?: project.findProperty("coronaVersionName") as? String ?: "1.0" + +val coronaVersionCode: Int = + parsedBuildProperties.lookup("buildSettings.android.versionCode").firstOrNull()?.toString()?.toIntOrNull() + ?: (project.findProperty("coronaVersionCode") as? String)?.toIntOrNull() ?: 1 + +val androidDestPluginPlatform = if (coronaTargetStore.equals("amazon", ignoreCase = true)) { + "android-kindle" +} else { + "android" +} + +val coronaAndroidPluginsCache = file(if (windows) { + if (coronaCustomHome.isNullOrEmpty()) { + "${System.getenv("APPDATA")}/Corona Labs/Corona Simulator/build cache/$androidDestPluginPlatform" + } else { + "$coronaCustomHome/build cache/$androidDestPluginPlatform" + } +} else { + "${System.getenv("HOME")}/Library/Application Support/Corona/build cache/$androidDestPluginPlatform" +}) + +val pluginDisabledMetadata = mutableSetOf() +val pluginDisabledDependencies = mutableSetOf() +val pluginDisabledJar = mutableSetOf() +val pluginDisabledNative = mutableSetOf() +val pluginDisabledResources = mutableSetOf() +val pluginDisabledAssets = mutableSetOf() +val coronaProcessedScripts = mutableSetOf() +val excludePluginMap = mapOf( + "metadata" to pluginDisabledMetadata + , "dependencies" to pluginDisabledDependencies + , "jars" to pluginDisabledJar + , "native" to pluginDisabledNative + , "resources" to pluginDisabledResources + , "assets" to pluginDisabledAssets +) +extra["excludeMap"] = excludePluginMap + +if (configureCoronaPlugins == "YES") { + downloadAndProcessCoronaPlugins() +} + +// + +android { + compileSdkVersion(29) + defaultConfig { + applicationId = coronaAppPackage + targetSdkVersion(29) + minSdkVersion(coronaMinSdkVersion) + versionCode = coronaVersionCode + versionName = coronaVersionName + multiDexEnabled = true + } + + coronaKeystore?.let { keystore -> + signingConfigs { + create("release") { + storeFile = file(keystore) + storePassword = coronaKeystorePassword + keyAlias = coronaKeyAlias + keyPassword = coronaKeyAliasPassword + } + } + } + + buildTypes { + getByName("release") { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") + coronaKeystore?.let { signingConfig = signingConfigs.getByName("release") } + } + } + + applicationVariants.all { + generateBuildConfigProvider!!.configure { + enabled = false + } + } + testOptions { + testVariants.all { + generateBuildConfigProvider!!.configure { + enabled = false + } + } + } + val mainSourceSet = sourceSets["main"] + val pluginJniLibs = file(coronaPlugins).walk().maxDepth(2).filter { it.name == "jniLibs" }.toSet() + mainSourceSet.jniLibs.srcDirs(pluginJniLibs) + mainSourceSet.jniLibs.srcDir(generatedPluginNativeLibsDir) + mainSourceSet.res.srcDir(generatedMainIconsAndBannersDir) + mainSourceSet.assets.srcDir(generatedPluginAssetsDir) + file("$generatedPluginsOutput/resourceDirectories.json").takeIf { it.exists() }?.let { + val resourceDirs: List? = Klaxon().parseArray(it) + resourceDirs?.forEach { res -> + mainSourceSet.res.srcDir(res) + } + } + val extraPackages = mutableListOf(coronaAppPackage) + file("$generatedPluginsOutput/resourcePackages.txt").takeIf { it.exists() }?.let { + extraPackages += it.readText().trim() + } + aaptOptions { + additionalParameters("--extra-packages", extraPackages.filter { it.isNotBlank() }.joinToString(":")) + } + // This is dirty hack because Android Assets refuse to copy assets which start with . or _ + if (!isExpansionFileRequired) { + android.applicationVariants.all { + mergeAssetsProvider!!.configure { + val mergeTask = this + doLast { + copy { + from(generatedPluginAssetsDir) { + include(".corona-plugins/**") + } + into(mergeTask.outputDir) + } + } + } + } + } +} + +// + +fun processPluginGradleScripts() { + fileTree(coronaPlugins) { + include("**/corona.gradle", "**/corona.gradle.kts") + }.forEach { + if (coronaProcessedScripts.contains(it)) + return@forEach + coronaProcessedScripts.add(it) + + val pluginName = it.relativeTo(coronaPlugins).toPathString().segments.first() + try { + apply(from = it) + // Exclude plugin from following lists + if (project.extra.has("excludeCoronaPlugin")) { + when (val exclude = project.extra["excludeCoronaPlugin"]) { + true -> excludePluginMap.forEach { kv -> kv.value.add(pluginName) } + is String -> if (excludePluginMap.containsKey(exclude)) excludePluginMap[exclude]?.add(pluginName) + is Iterable<*> -> exclude.forEach { e -> if (excludePluginMap.containsKey(e)) excludePluginMap[e]?.add(pluginName) } + } + } + project.extra["excludeCoronaPlugin"] = null + // Undo exclude + if (project.extra.has("includeCoronaPlugin")) { + when (val include = project.extra["includeCoronaPlugin"]) { + is String -> if (excludePluginMap.containsKey(include)) excludePluginMap[include]?.remove(pluginName) + is Iterable<*> -> include.forEach { e -> if (excludePluginMap.containsKey(e)) excludePluginMap[e]?.remove(pluginName) } + } + } + project.extra["includeCoronaPlugin"] = null + } catch (ex: Throwable) { + logger.error("ERROR: configuring '$pluginName' failed!") + throw(ex) + } + } + fileTree("$coronaSrcDir/AndroidResources") { + include("**/corona.gradle", "**/corona.gradle.kts") + }.forEach { + try { + apply(from = it) + } catch (ex: Throwable) { + logger.error("ERROR: executing configuration from '${it.relativeTo(file(coronaSrcDir)).path}' failed!") + throw(ex) + } + } +} +processPluginGradleScripts() + + +fun coronaAssetsCopySpec(spec: CopySpec) { + with(spec) { + file("$coronaTmpDir/excludesfile.properties").takeIf { it.exists() }?.readLines()?.forEach { + exclude(it) + } + if (!isSimulatorBuild) { + // use build.settings properties only if this is not simulator build + parsedBuildProperties.lookup>("buildSettings.excludeFiles.all").firstOrNull()?.forEach { + exclude("**/$it") + } + parsedBuildProperties.lookup>("buildSettings.excludeFiles.android").firstOrNull()?.forEach { + exclude("**/$it") + } + } + exclude("**/Icon\r") + exclude("AndroidResources/**") + if (isLiveBuild) { + into("corona_live_build_app_") + } else { + exclude("**/*.lua", "build.settings") + } + } +} + +android.applicationVariants.all { + val baseName = this.baseName.toLowerCase() + val isRelease = (baseName == "release") + val generatedAssetsDir = "$buildDir/generated/corona_assets/$baseName" + val compiledLuaArchive = "$buildDir/intermediates/compiled_lua_archive/$baseName/resource.car" + + val compileLuaTask = tasks.create("compileLua${baseName.capitalize()}") { + description = "If required, compiles Lua and archives it into resource.car" + val luac = "$nativeDir/Corona/$shortOsName/bin/luac" + + val srcLuaFiles = fileTree(coronaSrcDir) { + include("**/*.lua") + } + val pluginLuaFiles = fileTree(coronaPlugins) { + include("**/*.lua") + exclude("*/metadata.lua") + } + + inputs.files(srcLuaFiles + pluginLuaFiles) + outputs.file(compiledLuaArchive) + doLast { + val rootFile = file(coronaSrcDir) + val compiledDir = "$buildDir/intermediates/compiled_lua/$baseName" + delete(compiledDir) + mkdir(compiledDir) + val luaFiles = if (isSimulatorBuild) { + pluginLuaFiles + } else { + srcLuaFiles + pluginLuaFiles + } + val outputsList = luaFiles.map { + val compiled = when { + it.canonicalPath.startsWith(rootFile.canonicalPath) -> it.relativeTo(rootFile) + .toPathString() + .segments + .joinToString(".") + .replaceAfterLast(".", "lu") + it.canonicalPath.startsWith(coronaPlugins.canonicalPath) -> it.relativeTo(coronaPlugins) + .toPathString() + .segments.drop(1) + .joinToString(".") + .replaceAfterLast(".", "lu") + .removePrefix("lua.") + .removePrefix("lua_51.") + else -> throw InvalidUserDataException("Unknown location of Lua file '$it'!") + } + exec { + val additionalArguments = mutableListOf() + if (isRelease) { + additionalArguments += "-s" + } + commandLine(luac, *additionalArguments.toTypedArray(), "-o", "$compiledDir/$compiled", "--", it) + } + compiled + } + if (isSimulatorBuild) { + fileTree(coronaTmpDir!!) { + include("*.lu") + } + } else { + files().asFileTree + } + val buildId = file(generatedBuildIdPath) + .takeIf { it.exists() }?.let { + file(generatedBuildIdPath).readText().trim() + } ?: coronaBuild ?: "unknown" + val metadataLuaStr = """ + if not application or type( application ) ~= "table" then + application = {} + end + application.metadata = { + appName = "$coronaAppFileName", + appVersion = "$coronaVersionName", + appPackageId = "${android.defaultConfig.applicationId}", + mode = "$baseName", + build = "$buildId", + coronaBuild = "$coronaBuild", + } + """.trimIndent() + val metadataConfig = file("$buildDir/tmp/config.$baseName.lua") + val metadataCompiled = file("$buildDir/tmp/config.$baseName.lu") + mkdir(metadataConfig.parent) + metadataConfig.writeText(metadataLuaStr) + val configEntries = outputsList.filter { file(it).name == "config.lu" } + metadataConfig + exec { + workingDir = file(compiledDir) + commandLine(luac, "-s", "-o", metadataCompiled, "--", *configEntries.toTypedArray()) + } + copy { + from(metadataCompiled) + into(compiledDir) + rename { "config.lu" } + } + delete(metadataConfig) + val toArchive = outputsList.filter { file(it).name != "config.lu" } + "config.lu" + mkdir(file(compiledLuaArchive).parent) + exec { + workingDir = file(compiledDir) + standardInput = StringInputStream(toArchive.joinToString("\n")) + commandLine(coronaBuilder, "car", "-f", "-", compiledLuaArchive) + } + } + } + + val taskCopyResources = tasks.create("packageCoronaApp${baseName.capitalize()}") { + description = "Copies all resources and compiled Lua to the project" + + dependsOn(compileLuaTask) + + into(generatedAssetsDir) + from("$coronaTmpDir/output/assets") + from(compiledLuaArchive) + + if (!isExpansionFileRequired) { + from(coronaSrcDir) { + coronaAssetsCopySpec(this) + } + } + + + doFirst { + delete(generatedAssetsDir) + mkdir(generatedAssetsDir) + } + doFirst { + if (!file(coronaSrcDir).isDirectory) { + throw InvalidUserDataException("Unable to find Corona project to build!") + } + } + } + + mergeAssetsProvider!!.configure { + dependsOn(taskCopyResources) + } + android.sourceSets[name].assets.srcDirs(generatedAssetsDir) +} + +fun downloadAndProcessCoronaPlugins(reDownloadPlugins: Boolean = true) { + + val luaVerbosityPlug = if (!logger.isLifecycleEnabled) { + arrayOf("-e", "printError=print;print=function()end") + } else { + arrayOf() + } + + // Download plugins + logger.lifecycle("Authorizing plugins") + if (reDownloadPlugins) { + + delete(coronaPlugins) + file(coronaPlugins).mkdirs() + + val buildDataStr = coronaBuildData?.let { file(it).readText() } ?: run { + val fakeBuildData = (parsedBuildProperties.obj("buildSettings") ?: JsonObject()) + fakeBuildData["targetAppStore"] = coronaTargetStore + fakeBuildData["dailyBuildYear"] = dailyBuildYear + fakeBuildData["dailyBuildRevision"] = dailyBuildRevision + fakeBuildData["appName"] = coronaAppFileName ?: "Corona App" + fakeBuildData.toJsonString() + } + val buildParams = JsonObject(mapOf( + "appName" to coronaAppFileName, + "appPackage" to coronaAppPackage, + "build" to dailyBuildRevision, + "buildData" to buildDataStr, + "modernPlatform" to "android", + "platform" to "android", + "pluginPlatform" to androidDestPluginPlatform, + "destinationDirectory" to coronaPlugins.absolutePath + )).toJsonString() + val builderInput = file("$buildDir/tmp/builderInput.json") + builderInput.parentFile.mkdirs() + builderInput.writeText(buildParams) + val builderOutput = ByteArrayOutputStream() + val execResult = exec { + commandLine(coronaBuilder, "plugins", "download", "--android-offline-plugins", "builderInput=${builderInput.absolutePath}") + standardOutput = builderOutput + errorOutput = builderOutput + isIgnoreExitValue = true + } + if (execResult.exitValue != 0) { + logger.error("Error while fetching plugins: $builderOutput") + throw InvalidPluginException("Error while fetching plugins: $builderOutput") + } + if((System.getenv("DEBUG_BUILD_PROCESS")?.toIntOrNull() ?: 0) > 0 ) { + logger.lifecycle("Plugins collector output: $builderOutput") + } + logger.lifecycle("Unpacking plugins") + fileTree(coronaPlugins) { + include("*/data.tgz") + }.forEach { data -> + copy { + from(tarTree(resources.gzip(data))) + into(data.parent) + } + data.delete() + } + } + processPluginGradleScripts() + + // Collect Assets + logger.lifecycle("Collecting plugin assets") + run { + delete(generatedPluginAssetsDir) + copy { + from(coronaPlugins) { + include("*/resources/assets/**/*") + pluginDisabledAssets.forEach { + exclude("**/$it/**") + } + } + into(generatedPluginAssetsDir) + eachFile { + path = File(path).toPathString().segments.drop(3).joinToString("/") + } + includeEmptyDirs = false + } + copy { + from(coronaPlugins) { + include("*/lua/lua_51/**/*") + include("*/lua_51/**/*") + exclude("**/*.lua") + } + into("$generatedPluginAssetsDir/.corona-plugins") + eachFile { + path = File(path).toPathString().segments.drop(2).dropWhile { it == "lua_51" }.joinToString("/") + } + includeEmptyDirs = false + } + } + + // Collect Resources + logger.lifecycle("Collecting plugin resources") + run { + file(generatedPluginsOutput).mkdirs() + val resourceDirectories = File(coronaPlugins.path) + .walk() + .maxDepth(2) + .filter { it.isDirectory } + .filter { it.name == "resources" } + .filter { !pluginDisabledResources.contains(it.parentFile.name) } + .flatMap { pr -> + pr.walk() + .filter { r -> r.isDirectory } + .filter { r -> + r == pr || r.name.startsWith("package") + } + }.toList() + val resDirectories = resourceDirectories.map { File(it, "res") } + .filter { it.exists() && it.isDirectory } + .map { it.absolutePath } + file("$generatedPluginsOutput/resourceDirectories.json").writeText(JsonArray(resDirectories).toJsonString()) + + val extraPackages = resourceDirectories.map { + val packageFile = File(it, "package.txt") + if (packageFile.exists()) { + packageFile.readText().trim() + } else { + "" + } + }.filter { it.isNotBlank() }.joinToString(":") + file("$generatedPluginsOutput/resourcePackages.txt").writeText(extraPackages) + } + + // Run `convert_metadata.lua` which collects plugin metadata into single file + logger.lifecycle("Collecting plugin metadata") + run { + file("$buildDir/intermediates").mkdirs() + val metadataFiles = fileTree(coronaPlugins) { + include("*/metadata.lua") + pluginDisabledMetadata.forEach { + exclude("**/$it/**") + } + }.map { it.absolutePath } + exec { + commandLine(luaCmd + , "-e" + , "package.path='$nativeDir/Corona/shared/resource/?.lua;'..package.path" + , *luaVerbosityPlug + , "$buildToolsDir/convert_metadata.lua" + , "$buildDir/intermediates/plugins_metadata.json" + , *metadataFiles.toTypedArray() + ) + } + } + + // Run `update_manifest.lua` which generates AndroidManifest.xml + logger.lifecycle("Creating AndroidManifest.xml") + run { + val buildPropsFile = file("$coronaTmpDir/build.properties") + val inputSettingsFile = if (buildPropsFile.exists()) { + buildPropsFile + } else { + val buildPropsOut = file("$buildDir/intermediates/corona.build.props") + buildPropsOut.writeText(parsedBuildProperties.toJsonString()) + buildPropsOut + } + + val manifestGenDir = "$buildDir/intermediates/corona_manifest_gen" + file(manifestGenDir).mkdirs() + exec { + commandLine(luaCmd + , "-e" + , "package.path='$nativeDir/Corona/shared/resource/?.lua;'..package.path" + , *luaVerbosityPlug + , "$buildToolsDir/update_manifest.lua" + , /*1*/ "$buildToolsDir/AndroidManifest.template.xml" + , /*2*/ inputSettingsFile + , /*3*/ coronaAppFileName ?: "Corona App" + , /*4*/ "$manifestGenDir/AndroidManifest.xml" + , /*5*/ "$buildDir/intermediates/plugins_metadata.json" + , /*6*/ "$buildToolsDir/strings.xml" + , /*7*/ "$manifestGenDir/strings.xml" + , /*8*/ "$manifestGenDir/CopyToApk.txt" + ) + } + copy { + from(manifestGenDir) { + include("AndroidManifest.xml") + } + into("$projectDir/src/main") + } + copy { + from(manifestGenDir) { + include("strings.xml") + } + into("$projectDir/src/main/res/values") + } + } + + logger.lifecycle("Collecting native libraries") + run { + delete(generatedPluginNativeLibsDir) + file(coronaPlugins).walk().maxDepth(1).forEach { + if (it == coronaPlugins) return@forEach + if (pluginDisabledNative.contains(it.name)) return@forEach + + val hasJniLibs = !fileTree(it) { + include("**/jniLibs/**/*.so") + }.isEmpty + val armeabiV7Libs = fileTree(it) { + include("**/*.so") + } + val hasArm32Libs = !armeabiV7Libs.isEmpty + if (!hasJniLibs && hasArm32Libs) { + logger.error("WARNING: Plugin '$it' contain native library for armeabi-v7a but not for arm64.") + copy { + from(armeabiV7Libs) + into(generatedPluginNativeLibsDir) + eachFile { + path = "armeabi-v7a/$name" + } + includeEmptyDirs = false + } + } + } + } + + logger.lifecycle("Collecting legacy jar libraries") + run { + val megaJarExtracted = "$buildDir/intermediates/corona-mega-jar" + delete(megaJarExtracted) + delete(generatedPluginMegaJar) + fileTree(coronaPlugins) { + include("*/*.jar") + pluginDisabledJar.forEach { + exclude("**/$it/**") + } + }.sortedBy { + it.parent.contains("shared.") + }.forEach { + copy { + from(zipTree(it)) + into(megaJarExtracted) + } + } + if (file(megaJarExtracted).exists()) { + ant.withGroovyBuilder { + "zip"("destfile" to generatedPluginMegaJar, "basedir" to megaJarExtracted) + } + } + } +} + +tasks.register("setUpCoronaAppAndPlugins") { + group = "Corona" + doLast { + downloadAndProcessCoronaPlugins() + } +} + +tasks.register("processPluginsNoDownload") { + if (coronaBuiltFromSource) group = "Corona" + doLast { + downloadAndProcessCoronaPlugins(false) + } +} + +// + + +// + +tasks.register("exportCoronaAppTemplate") { + if (coronaBuiltFromSource) group = "Corona-dev" + enabled = coronaBuiltFromSource + destinationDirectory.set(file("$buildDir/outputs")) + archiveFileName.set("android-template.zip") + from(rootDir) { + include("build.gradle.kts", "settings.gradle.kts", "gradle.properties") + include("gradlew", "gradlew.bat", "gradle/wrapper/**") + include("app/**") + exclude("app/build/**", "app/CMakeLists.txt") + exclude("**/*.iml", "**/\\.*") + include("setup.sh", "setup.bat") + into("template") + } + from(android.sdkDirectory) { + include("licenses/android-sdk-license") + into("sdk") + } + from("$projectDir/../template") { + include("AndroidManifest.template.xml", "convert_metadata.lua", "update_manifest.lua", "strings.xml") + into("template/app/buildTools") + } + from("$rootDir/../../plugins/build/licensing-google/android/bin") { + include("classes.jar") + into("template/app/libs") + rename("classes.jar", "licensing-google.jar") + } + doLast { + logger.lifecycle("Exported to '${archiveFile.get()}'") + } +} + +tasks.register("exportToNativeAppTemplate") { + if (coronaBuiltFromSource) group = "Corona-dev" + enabled = coronaBuiltFromSource + val templateDir = "$rootDir/../../subrepos/enterprise/contents/Project Template/App/android" + + into(templateDir) + from(rootDir) { + include("build.gradle.kts") + include("gradlew", "gradlew.bat", "gradle/wrapper/**") + include("app/**") + exclude("app/build/**", "app/CMakeLists.txt", "app/build.gradle.kts") + exclude("**/*.iml", "**/\\.*") + exclude("**/AndroidManifest.xml") + } + from(rootDir) { + include("app/build.gradle.kts") + filter { + it.replace("com.mycompany.app", "com.mycompany.app") + } + } + + doFirst { + delete(fileTree(templateDir) { + exclude("plugin/**") + exclude("settings.gradle") + exclude("**/AndroidManifest.xml") + exclude("**/*.java") + exclude("gradle.properties") + }) + } + doLast { + logger.lifecycle("Copied to ${file(templateDir).absolutePath}") + } +} + + +val coronaNativeOutputDir = project.findProperty("coronaNativeOutputDir") as? String + ?: "$nativeDir/Corona" + +tasks.register("installAppTemplateToNative") { + if (coronaBuiltFromSource) group = "Corona-dev" + enabled = coronaBuiltFromSource + dependsOn("exportCoronaAppTemplate") + from("$buildDir/outputs") { + include("android-template.zip") + } + into("$coronaNativeOutputDir/android/resource") +} + +tasks.register("installAppTemplateAndAARToNative") { + if (coronaBuiltFromSource) group = "Corona-dev" + enabled = coronaBuiltFromSource + dependsOn("installAppTemplateToNative") + dependsOn(":Corona:assembleRelease") + from("${findProject(":Corona")?.buildDir}/outputs/aar/") { + include("Corona-release.aar") + rename("Corona-release.aar", "Corona.aar") + } + into("$coronaNativeOutputDir/android/lib/gradle") +} + +fun copyWithAppFilename(dest: String, appName: String?) { + delete("$dest/$coronaAppFileName.apk") + delete("$dest/$coronaAppFileName.aab") + copy { + into(dest) + val copyTask = this + android.applicationVariants.matching { + it.name.equals("release", true) + }.all { + copyTask.from(packageApplicationProvider!!.get().outputDirectory) { + include("*.apk") + exclude("*unsigned*") + } + copyTask.from("$buildDir/outputs/bundle/$name") { + include("*.aab") + } + } + rename { + "$appName.${file(it).extension}" + } + } +} + +tasks.create("buildCoronaApp") { + description = "Used when Simulator invokes a build. It all project variables must be passed" + dependsOn("assembleRelease") + dependsOn("bundleRelease") + dependsOn("createExpansionFile") + + coronaDstDir?.let { + doLast { + try { + copyWithAppFilename(it, coronaAppFileName) + } catch (ignore: Throwable) { + try { + val defaultName = "App" + copyWithAppFilename(it, defaultName) + logger.error("WARNING: Used default filename '$defaultName' because original contains non-ASCII symbols.") + } catch (ex: Throwable) { + logger.error("ERROR: Unable to finalize build. Make sure path to destination doesn't contain non-ASCII symbols") + throw ex + } + } + delete("$it/$coronaExpansionFileName") + copy { + from("$buildDir/outputs/$coronaExpansionFileName") + into(it) + } + } + } +} + +// + + +// + +val cleanupIconsDir = tasks.create("cleanupIconsDirectory") { + delete(generatedMainIconsAndBannersDir) +} + +val copyCoronaIconFiles = tasks.create("copyCoronaIconFiles") { + description = "Copies icon files to appropriate resources location" + tasks.findByName("preBuild")?.dependsOn(this) +} + +tasks.create("copyAdaptiveIconResources") { + dependsOn(copyCoronaIconFiles, cleanupIconsDir) + + into(generatedMainIconsAndBannersDir) + from("$coronaSrcDir/AndroidResources/res") +} + +tasks.create("copyCoronaIcons") { + description = "Copies icon files to appropriate resources location" + tasks.findByName("preBuild")?.dependsOn(this) + dependsOn("copyAdaptiveIconResources") + dependsOn(copyCoronaIconFiles) +} + +tasks.create("copyMainApplicationIcon") { + copyCoronaIconFiles.dependsOn(this) + dependsOn(cleanupIconsDir) + + into(generatedMainIconsAndBannersDir) + rename { "ic_launcher.png" } + + val suffixes = listOf("ldpi", "mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi").reversed() + suffixes.forEach { dstSuffix -> + val fallbacks = listOf(dstSuffix) + suffixes.takeLastWhile { it != dstSuffix } + fallbacks.firstOrNull { + !fileTree(coronaSrcDir).matching { + include("Icon-$it*.png") + }.isEmpty + }?.let { + into("mipmap-$dstSuffix") { + from(coronaSrcDir) + include("Icon-$it*.png") + } + } + } + doFirst { + delete("$generatedMainIconsAndBannersDir/**/ic_launcher.png") + } +} + + +tasks.create("copyMainApplicationBanner") { + copyCoronaIconFiles.dependsOn(this) + dependsOn(cleanupIconsDir) + + from(coronaSrcDir) { + include("Banner-xhdpi.png") + } + into("$generatedMainIconsAndBannersDir/drawable-xhdpi") + rename { "banner.png" } + doFirst { + delete("$generatedMainIconsAndBannersDir/**/banner.png") + } +} + +tasks.create("copyOuyaApplicationIcon") { + copyCoronaIconFiles.dependsOn(this) + dependsOn(cleanupIconsDir) + + from(coronaSrcDir) { + include("Icon-ouya.png") + } + into("$generatedMainIconsAndBannersDir/drawable-xhdpi") + rename { "ouya_icon.png" } + doFirst { + delete("$generatedMainIconsAndBannersDir/**/ouya_icon.png") + } +} + +tasks.create("copyXiaomiApplicationIcon") { + copyCoronaIconFiles.dependsOn(this) + dependsOn(cleanupIconsDir) + + from(coronaSrcDir) { + include("Icon-ouya-xiaomi.png") + } + into("$generatedMainIconsAndBannersDir/drawable-xhdpi") + rename { "ouya_xiaomi_icon.png" } + doFirst { + delete("$generatedMainIconsAndBannersDir/**/ouya_xiaomi_icon.png") + } +} + +tasks.create("copyDefaultNotificationIcons") { + copyCoronaIconFiles.dependsOn(this) + dependsOn(cleanupIconsDir) + + into(generatedMainIconsAndBannersDir) + rename { "corona_statusbar_icon_default.png" } + + val suffixes = listOf("ldpi", "mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi").reversed() + suffixes.forEach { dstSuffix -> + val fallbacks = listOf(dstSuffix) + suffixes.takeLastWhile { it != dstSuffix } + fallbacks.firstOrNull { + !fileTree(coronaSrcDir).matching { + include("IconNotificationDefault-$it*.png") + }.isEmpty + }?.let { + into("drawable-$dstSuffix") { + from(coronaSrcDir) + include("IconNotificationDefault-$it*.png") + } + } + } + doFirst { + delete("$generatedMainIconsAndBannersDir/**/corona_statusbar_icon_default.png") + } +} + +tasks.create("copySplashScreen") { + copyCoronaIconFiles.dependsOn(this) + dependsOn(cleanupIconsDir) + + val enableSplash: Boolean = parsedBuildProperties.lookup("buildSettings.splashScreen.android.enable").firstOrNull() + ?: parsedBuildProperties.lookup("buildSettings.splashScreen.enable").firstOrNull() + ?: true + val image: String? = parsedBuildProperties.lookup("buildSettings.splashScreen.android.image").firstOrNull() + ?: parsedBuildProperties.lookup("buildSettings.splashScreen.image").firstOrNull() + + logger.info("Configured Splash Screen enable: $enableSplash, image: $image.") + if (enableSplash) { + if (image != null) { + from(coronaSrcDir) { + include(image) + } + if (inputs.sourceFiles.isEmpty) throw InvalidUserDataException("Custom Splash Screen file '$image' not found!") + } else { + from(projectDir) { + include("_corona_splash_screen.png") + } + if (inputs.sourceFiles.isEmpty) throw InvalidUserDataException("Splash screen was not disabled in build.settings but '$projectDir/_corona_splash_screen.png' was not found!") + } + } + + into("$generatedMainIconsAndBannersDir/drawable") + rename { + "_corona_splash_screen.${file(it).extension}" + } + doFirst { + delete("$generatedMainIconsAndBannersDir/**/_corona_splash_screen.png") + } +} + +tasks.register("createExpansionFile") { + enabled = isExpansionFileRequired + destinationDirectory.set(file("$buildDir/outputs")) + archiveFileName.set(coronaExpansionFileName) + + from(coronaSrcDir) { + coronaAssetsCopySpec(this) + into("") + } + from("$generatedPluginAssetsDir/.corona-plugins") { + into(".corona-plugins") + } + +} + +// + +dependencies { + if (coronaBuiltFromSource) { + implementation(project(":Corona")) + implementation(files("$rootDir/../../plugins/build/licensing-google/android/bin/classes.jar")) + } else { + val coronaLocal = file("libs/Corona.aar") + if (coronaLocal.exists()) { + implementation(files(coronaLocal)) + } else { + checkCoronaNativeInstallation() + implementation(":Corona@aar") + implementation(":licensing-google@jar") + } + implementation(fileTree("libs") { + include("**/*.jar") + }) + } + if (file(generatedPluginMegaJar).exists()) { + implementation(files(generatedPluginMegaJar)) + } + implementation(fileTree(coronaPlugins) { + include("**/*.aar") + }) + implementation(fileTree(coronaPlugins) { + include("*/jarLibs/*.jar") + }) + implementation(fileTree("$coronaSrcDir/AndroidResources") { + include("**/*.jar", "**/*.aar") + }) + if (file("../plugin").exists()) { + implementation(project(":plugin")) + } + implementation("androidx.multidex:multidex:2.0.1") +} diff --git a/src/android/app/proguard-rules.pro b/src/android/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/src/android/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/src/android/app/src/main/AndroidManifest.xml b/src/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..3ad616d --- /dev/null +++ b/src/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/src/android/app/src/main/java/com/mycompany/app/CoronaApplication.java b/src/android/app/src/main/java/com/mycompany/app/CoronaApplication.java new file mode 100644 index 0000000..5ab1b7e --- /dev/null +++ b/src/android/app/src/main/java/com/mycompany/app/CoronaApplication.java @@ -0,0 +1,86 @@ +// +// CoronaApplication.java +// TemplateApp +// +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +package com.mycompany.app; + +/** + * Extends the Application class to receive Corona runtime events and to extend the Lua API. + *

+ * Only one instance of this class will be created by the Android OS. It will be created before this application's + * activity is displayed and will persist after the activity is destroyed. The name of this class must be set in the + * AndroidManifest.xml file's "application" tag or else an instance of this class will not be created on startup. + */ +public class CoronaApplication extends android.app.Application { + /** Called when your application has started. */ + @Override + public void onCreate() { + super.onCreate(); + // Set up a Corona runtime listener used to add custom APIs to Lua. + com.ansca.corona.CoronaEnvironment.addRuntimeListener(new CoronaApplication.CoronaRuntimeEventHandler()); + } + + /** Receives and handles Corona runtime events. */ + private class CoronaRuntimeEventHandler implements com.ansca.corona.CoronaRuntimeListener { + /** + * Called after the Corona runtime has been created and just before executing the "main.lua" file. + * This is the application's opportunity to register custom APIs into Lua. + *

+ * Warning! This method is not called on the main thread. + * @param runtime Reference to the CoronaRuntime object that has just been loaded/initialized. + * Provides a LuaState object that allows the application to extend the Lua API. + */ + @Override + public void onLoaded(com.ansca.corona.CoronaRuntime runtime) { + } + + /** + * Called just after the Corona runtime has executed the "main.lua" file. + *

+ * Warning! This method is not called on the main thread. + * @param runtime Reference to the CoronaRuntime object that has just been started. + */ + @Override + public void onStarted(com.ansca.corona.CoronaRuntime runtime) { + } + + /** + * Called just after the Corona runtime has been suspended which pauses all rendering, audio, timers, + * and other Corona related operations. This can happen when another Android activity (ie: window) has + * been displayed, when the screen has been powered off, or when the screen lock is shown. + *

+ * Warning! This method is not called on the main thread. + * @param runtime Reference to the CoronaRuntime object that has just been suspended. + */ + @Override + public void onSuspended(com.ansca.corona.CoronaRuntime runtime) { + } + + /** + * Called just after the Corona runtime has been resumed after a suspend. + *

+ * Warning! This method is not called on the main thread. + * @param runtime Reference to the CoronaRuntime object that has just been resumed. + */ + @Override + public void onResumed(com.ansca.corona.CoronaRuntime runtime) { + } + + /** + * Called just before the Corona runtime terminates. + *

+ * This happens when the Corona activity is being destroyed which happens when the user presses the Back button + * on the activity, when the native.requestExit() method is called in Lua, or when the activity's finish() + * method is called. This does not mean that the application is exiting. + *

+ * Warning! This method is not called on the main thread. + * @param runtime Reference to the CoronaRuntime object that is being terminated. + */ + @Override + public void onExiting(com.ansca.corona.CoronaRuntime runtime) { + } + } +} diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..bffe513 --- /dev/null +++ b/src/android/app/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + + NotificationsV2 + diff --git a/src/android/build.gradle.kts b/src/android/build.gradle.kts new file mode 100644 index 0000000..c38406e --- /dev/null +++ b/src/android/build.gradle.kts @@ -0,0 +1,31 @@ +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath(kotlin("gradle-plugin", version = "1.3.70")) + classpath("com.android.tools.build:gradle:3.5.4") + classpath("com.beust:klaxon:5.0.1") + } +} + +allprojects { + repositories { + google() + jcenter() + // maven(url = "https:// some custom repo") + val nativeDir = if (System.getProperty("os.name").toLowerCase().contains("windows")) { + System.getenv("CORONA_ROOT") + } else { + "${System.getenv("HOME")}/Library/Application Support/Corona/Native/" + } + flatDir { + dirs("$nativeDir/Corona/android/lib/gradle", "$nativeDir/Corona/android/lib/Corona/libs") + } + } +} + +tasks.register("clean") { + delete(rootProject.buildDir) +} diff --git a/src/android/gradle.properties b/src/android/gradle.properties new file mode 100644 index 0000000..4366c84 --- /dev/null +++ b/src/android/gradle.properties @@ -0,0 +1,5 @@ +coronaTargetStore=google + +# Migrate To Android X +android.useAndroidX=true +android.enableJetifier=true diff --git a/src/android/gradle/wrapper/gradle-wrapper.jar b/src/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f6b961f Binary files /dev/null and b/src/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/src/android/gradle/wrapper/gradle-wrapper.properties b/src/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0068f95 --- /dev/null +++ b/src/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jul 24 23:06:14 EEST 2020 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/src/android/gradlew b/src/android/gradlew new file mode 100755 index 0000000..cccdd3d --- /dev/null +++ b/src/android/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/src/android/gradlew.bat b/src/android/gradlew.bat new file mode 100644 index 0000000..e95643d --- /dev/null +++ b/src/android/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/src/android/plugin/.gitignore b/src/android/plugin/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/src/android/plugin/.gitignore @@ -0,0 +1 @@ +/build diff --git a/src/android/plugin/build.gradle b/src/android/plugin/build.gradle new file mode 100644 index 0000000..96c5e53 --- /dev/null +++ b/src/android/plugin/build.gradle @@ -0,0 +1,34 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 29 + + defaultConfig { + minSdkVersion 15 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + } +} + +dependencies { + implementation 'com.google.firebase:firebase-messaging:' + '20.2.3' + implementation ':Corona@aar' +} + +task extractPluginJar() { + group "Solar2Dev" + dependsOn assemble + doLast { + copy { + from { + zipTree("$buildDir/outputs/aar/${project.name}-release.aar").matching { + include 'classes.jar' + }.singleFile + } + into "$buildDir/outputs/" + String packageName = new XmlSlurper().parse(file('src/main/AndroidManifest.xml')).@package.text() + rename "classes.jar", "${packageName}.jar" + } + } +} diff --git a/src/android/plugin/proguard-rules.pro b/src/android/plugin/proguard-rules.pro new file mode 100644 index 0000000..4989f1c --- /dev/null +++ b/src/android/plugin/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/ajaymccaleb/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/src/android/plugin/src/main/AndroidManifest.xml b/src/android/plugin/src/main/AndroidManifest.xml new file mode 100644 index 0000000..6557742 --- /dev/null +++ b/src/android/plugin/src/main/AndroidManifest.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/src/android/plugin/src/main/java/com/ansca/corona/Bridge.java b/src/android/plugin/src/main/java/com/ansca/corona/Bridge.java new file mode 100644 index 0000000..1c2e507 --- /dev/null +++ b/src/android/plugin/src/main/java/com/ansca/corona/Bridge.java @@ -0,0 +1,37 @@ +// +// Bridge.java +// Notifications V2 Plugin +// +// Copyright (c) 2017 CoronaLabs inc. All rights reserved. +// + +package com.ansca.corona; + +import android.content.Context; +import com.naef.jnlua.LuaState; + +/** + * Implements the Lua interface for a Corona plugin. + *

+ * Only one instance of this class will be created by Corona for the lifetime of the application. + * This instance will be re-used for every new Corona activity that gets created. + */ +public class Bridge extends NativeToJavaBridge { + public Bridge(Context context) { + super(context); + } + + public static int scheduleNotification(LuaState L, int index) { + int id = notificationSchedule(L, index); + L.pushInteger(id); + return 1; + } + + public static void cancelNotification(int id) { + callNotificationCancel(id); + } + + public static void cancelAllNotifications() { + callNotificationCancelAll(null); + } +} diff --git a/src/android/plugin/src/main/java/plugin/notifications/v2/CoronaFirebaseMessagingService.java b/src/android/plugin/src/main/java/plugin/notifications/v2/CoronaFirebaseMessagingService.java new file mode 100644 index 0000000..2716b46 --- /dev/null +++ b/src/android/plugin/src/main/java/plugin/notifications/v2/CoronaFirebaseMessagingService.java @@ -0,0 +1,40 @@ +// +// CoronaFirebaseMessagingService.java +// Notifications V2 Plugin +// +// Copyright (c) 2017 CoronaLabs inc. All rights reserved. +// + +// @formatter:off + +package plugin.notifications.v2; + +import com.ansca.corona.events.NotificationRegistrationTask; +import com.google.firebase.messaging.FirebaseMessagingService; +import com.google.firebase.messaging.RemoteMessage; + +// ------------------------------------------------------- +// Class definition +// ------------------------------------------------------- + +public class CoronaFirebaseMessagingService extends FirebaseMessagingService +{ + public CoronaFirebaseMessagingService() { + super(); + } + + @Override + public void onMessageReceived(RemoteMessage remoteMessage) { + super.onMessageReceived(remoteMessage); + NotificationsV2Helper.processRemoteMessage(remoteMessage, getApplicationContext()); + } + + @Override + public void onNewToken( String deviceToken ) { + super.onNewToken(deviceToken); + NotificationRegistrationTask registrationTask = new NotificationRegistrationTask(deviceToken); + for (com.ansca.corona.CoronaRuntime runtime : com.ansca.corona.CoronaRuntimeProvider.getAllCoronaRuntimes()) { + runtime.getTaskDispatcher().send(registrationTask); + } + } +} diff --git a/src/android/plugin/src/main/java/plugin/notifications/v2/LuaLoader.java b/src/android/plugin/src/main/java/plugin/notifications/v2/LuaLoader.java new file mode 100644 index 0000000..96ee97d --- /dev/null +++ b/src/android/plugin/src/main/java/plugin/notifications/v2/LuaLoader.java @@ -0,0 +1,564 @@ +// +// LuaLoader.java +// Notifications V2 Plugin +// +// Copyright (c) 2017 CoronaLabs inc. All rights reserved. +// + +package plugin.notifications.v2; + +import com.ansca.corona.CoronaActivity; +import com.ansca.corona.CoronaRuntimeTaskDispatcher; +import com.ansca.corona.CoronaEnvironment; +import com.ansca.corona.CoronaRuntime; +import com.ansca.corona.CoronaRuntimeListener; +import com.ansca.corona.Bridge; + +import com.naef.jnlua.LuaState; +import com.naef.jnlua.JavaFunction; +import com.naef.jnlua.LuaType; +import com.naef.jnlua.NamedJavaFunction; + +import android.util.Log; + +import com.google.firebase.messaging.FirebaseMessaging; +import com.google.firebase.iid.FirebaseInstanceId; + +/** + * Implements the Lua interface for the plugin. + *

+ * Only one instance of this class will be created by Corona for the lifetime of the application. + * This instance will be re-used for every new Corona activity that gets created. + */ +@SuppressWarnings({"unused", "RedundantSuppression"}) +public class LuaLoader implements JavaFunction, CoronaRuntimeListener { + private static final String PLUGIN_NAME = "plugin.notifications.v2"; + private static final String PLUGIN_VERSION = "1.0.1"; + + // message constants + private static final String CORONA_TAG = "Corona"; + private static final String ERROR_MSG = "ERROR: "; + private static final String WARNING_MSG = "WARNING: "; + + private static String functionSignature = ""; // used in error reporting functions + + public static CoronaRuntime coronaRuntime; + private static CoronaRuntimeTaskDispatcher coronaRuntimeTaskDispatcher = null; + + // ------------------------------------------------------- + // Plugin lifecycle events + // ------------------------------------------------------- + + /** + * Called after the Corona runtime has been created and just before executing the "main.lua" file. + *

+ * Warning! This method is not called on the main thread. + * + * @param runtime Reference to the CoronaRuntime object that has just been loaded/initialized. + * Provides a LuaState object that allows the application to extend the Lua API. + */ + @Override + public void onLoaded(CoronaRuntime runtime) { + // Note that this method will not be called the first time a Corona activity has been launched. + // This is because this listener cannot be added to the CoronaEnvironment until after + // this plugin has been required-in by Lua, which occurs after the onLoaded() event. + // However, this method will be called when a 2nd Corona activity has been created. + + if (coronaRuntimeTaskDispatcher == null) { + coronaRuntimeTaskDispatcher = new CoronaRuntimeTaskDispatcher(runtime); + coronaRuntime = runtime; + } + } + + /** + * Called just after the Corona runtime has executed the "main.lua" file. + *

+ * Warning! This method is not called on the main thread. + * + * @param runtime Reference to the CoronaRuntime object that has just been started. + */ + @Override + public void onStarted(CoronaRuntime runtime) { + NotificationsV2Helper.checkForMessageData(); + + // log plugin version to device log + Log.i(CORONA_TAG, PLUGIN_NAME + ": " + PLUGIN_VERSION); + } + + /** + * Called just after the Corona runtime has been suspended which pauses all rendering, audio, timers, + * and other Corona related operations. This can happen when another Android activity (ie: window) has + * been displayed, when the screen has been powered off, or when the screen lock is shown. + *

+ * Warning! This method is not called on the main thread. + * + * @param runtime Reference to the CoronaRuntime object that has just been suspended. + */ + @Override + public void onSuspended(CoronaRuntime runtime) { + } + + /** + * Called just after the Corona runtime has been resumed after a suspend. + *

+ * Warning! This method is not called on the main thread. + * + * @param runtime Reference to the CoronaRuntime object that has just been resumed. + */ + @Override + public void onResumed(CoronaRuntime runtime) { + NotificationsV2Helper.checkForMessageData(); + } + + /** + * Called just before the Corona runtime terminates. + *

+ * This happens when the Corona activity is being destroyed which happens when the user presses the Back button + * on the activity, when the native.requestExit() method is called in Lua, or when the activity's finish() + * method is called. This does not mean that the application is exiting. + *

+ * Warning! This method is not called on the main thread. + * + * @param runtime Reference to the CoronaRuntime object that is being terminated. + */ + @Override + public void onExiting(final CoronaRuntime runtime) { + coronaRuntime = null; + coronaRuntimeTaskDispatcher = null; + functionSignature = ""; + } + + // -------------------------------------------------------------------------- + // helper functions + // -------------------------------------------------------------------------- + + // log message to console + private void logMsg(String msgType, String errorMsg) { + String functionID = functionSignature; + if (!functionID.isEmpty()) { + functionID += ", "; + } + + Log.i(CORONA_TAG, msgType + functionID + errorMsg); + } + + // ------------------------------------------------------- + // plugin implementation + // ------------------------------------------------------- + + /** + *

+ * Note that a new LuaLoader instance will not be created for every CoronaActivity instance. + * That is, only one instance of this class will be created for the lifetime of the application process. + * This gives a plugin the option to do operations in the background while the CoronaActivity is destroyed. + */ + @SuppressWarnings("unused") + public LuaLoader() { + // Set up this plugin to listen for Corona runtime events to be received by methods + // onLoaded(), onStarted(), onSuspended(), onResumed(), and onExiting(). + + CoronaEnvironment.addRuntimeListener(this); + } + + /** + * Called when this plugin is being loaded via the Lua require() function. + *

+ * Note that this method will be called every time a new CoronaActivity has been launched. + * This means that you'll need to re-initialize this plugin here. + *

+ * Warning! This method is not called on the main UI thread. + * + * @param L Reference to the Lua state that the require() function was called from. + * @return Returns the number of values that the require() function will return. + *

+ * Expected to return 1, the library that the require() function is loading. + */ + @Override + public int invoke(LuaState L) { + // Register this plugin into Lua with the following functions. + NamedJavaFunction[] luaFunctions = new NamedJavaFunction[]{ + new RegisterForPushNotifications(), + new GetDeviceToken(), + new Subscribe(), + new Unsubscribe(), + new ScheduleNotification(), + new CancelNotification() + }; + String libName = L.toString(1); + L.register(libName, luaFunctions); + + // Returning 1 indicates that the Lua require() function will return the above Lua library + return 1; + } + + // [Lua] registerForPushNotifications( {options} ) + private class RegisterForPushNotifications implements NamedJavaFunction { + /** + * Gets the name of the Lua function as it would appear in the Lua script. + * + * @return Returns the name of the custom Lua function. + */ + @Override + public String getName() { + return "registerForPushNotifications"; + } + + /** + * This method is called when the Lua function is called. + *

+ * Warning! This method is not called on the main UI thread. + * + * @param luaState Reference to the Lua state. + * Needed to retrieve the Lua function's parameters and to return values back to Lua. + * @return Returns the number of values to be returned by the Lua function. + */ + @Override + public int invoke(final LuaState luaState) { + functionSignature = "notifications.registerForPushNotifications( options )"; + + // check number of args + int nargs = luaState.getTop(); + if (nargs > 1) { + logMsg(ERROR_MSG, "Expected 0 or 1 argument, got " + nargs); + return 0; + } + + // NOP + // iOS feature only + + return 0; + } + } + + // [Lua] GetDeviceToken() + private class GetDeviceToken implements NamedJavaFunction { + /** + * Gets the name of the Lua function as it would appear in the Lua script. + * + * @return Returns the name of the custom Lua function. + */ + @Override + public String getName() { + return "getDeviceToken"; + } + + /** + * This method is called when the Lua function is called. + *

+ * Warning! This method is not called on the main UI thread. + * + * @param luaState Reference to the Lua state. + * Needed to retrieve the Lua function's parameters and to return values back to Lua. + * @return Returns the number of values to be returned by the Lua function. + */ + @Override + public int invoke(final LuaState luaState) { + functionSignature = "notifications.getDeviceToken()"; + + // check number of args + int nargs = luaState.getTop(); + if (nargs != 0) { + logMsg(ERROR_MSG, "Expected no arguments, got " + nargs); + return 0; + } + + String deviceToken = FirebaseInstanceId.getInstance().getToken(); + + if (deviceToken == null) { + deviceToken = "unknown"; + } + + luaState.pushString(deviceToken); + + return 1; + } + } + + // [Lua] subscribe(topic) + private class Subscribe implements NamedJavaFunction { + /** + * Gets the name of the Lua function as it would appear in the Lua script. + * + * @return Returns the name of the custom Lua function. + */ + @Override + public String getName() { + return "subscribe"; + } + + /** + * This method is called when the Lua function is called. + *

+ * Warning! This method is not called on the main UI thread. + * + * @param luaState Reference to the Lua state. + * Needed to retrieve the Lua function's parameters and to return values back to Lua. + * @return Returns the number of values to be returned by the Lua function. + */ + @Override + public int invoke(final LuaState luaState) { + functionSignature = "notifications.subscribe(topic)"; + + // check number of args + int nargs = luaState.getTop(); + if (nargs != 1) { + logMsg(ERROR_MSG, "Expected 1 argument, got " + nargs); + return 0; + } + + final String topic; + + // check for topic + if (luaState.type(1) == LuaType.STRING) { + topic = luaState.toString(1); + } else { + logMsg(ERROR_MSG, "options.topic (string) expected, got " + luaState.typeName(1)); + return 0; + } + + final CoronaActivity coronaActivity = CoronaEnvironment.getCoronaActivity(); + if (coronaActivity != null) { + coronaActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + FirebaseMessaging.getInstance().subscribeToTopic(topic); + } + }); + } + + return 0; + } + } + + // [Lua] unsubscribe(topic) + private class Unsubscribe implements NamedJavaFunction { + /** + * Gets the name of the Lua function as it would appear in the Lua script. + * + * @return Returns the name of the custom Lua function. + */ + @Override + public String getName() { + return "unsubscribe"; + } + + /** + * This method is called when the Lua function is called. + *

+ * Warning! This method is not called on the main UI thread. + * + * @param luaState Reference to the Lua state. + * Needed to retrieve the Lua function's parameters and to return values back to Lua. + * @return Returns the number of values to be returned by the Lua function. + */ + @Override + public int invoke(final LuaState luaState) { + functionSignature = "notifications.unsubscribe(topic)"; + + // check number of args + int nargs = luaState.getTop(); + if (nargs != 1) { + logMsg(ERROR_MSG, "Expected 1 argument, got " + nargs); + return 0; + } + + final String topic; + + // check for topic + if (luaState.type(1) == LuaType.STRING) { + topic = luaState.toString(1); + } else { + logMsg(ERROR_MSG, "options.topic (string) expected, got " + luaState.typeName(1)); + return 0; + } + + final CoronaActivity coronaActivity = CoronaEnvironment.getCoronaActivity(); + + if (coronaActivity != null) { + coronaActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + FirebaseMessaging.getInstance().unsubscribeFromTopic(topic); + } + }); + } + + return 0; + } + } + + // [Lua] scheduleNotification(time [, options]) + private class ScheduleNotification implements NamedJavaFunction { + /** + * Gets the name of the Lua function as it would appear in the Lua script. + * + * @return Returns the name of the custom Lua function. + */ + @Override + public String getName() { + return "scheduleNotification"; + } + + /** + * This method is called when the Lua function is called. + *

+ * Warning! This method is not called on the main UI thread. + * + * @param luaState Reference to the Lua state. + * Needed to retrieve the Lua function's parameters and to return values back to Lua. + * @return Returns the number of values to be returned by the Lua function. + */ + @Override + public int invoke(final LuaState luaState) { + functionSignature = "notifications.scheduleNotification(time [, options])"; + + // check number of args + int nargs = luaState.getTop(); + if ((nargs < 1) || (nargs > 2)) { + logMsg(ERROR_MSG, "Expected 1 or 2 arguments, got " + nargs); + return 0; + } + + // check time parameter + //noinspection StatementWithEmptyBody + if (luaState.type(1) == LuaType.NUMBER) { + // time is a number + // will be handled by the Corona Core + } else if (luaState.type(1) == LuaType.TABLE) { + // traverse and validate all the options + for (luaState.pushNil(); luaState.next(2); luaState.pop(1)) { + String key = luaState.toString(-2); + + switch (key) { + case "year": + if (luaState.type(-1) != LuaType.NUMBER) { + logMsg(ERROR_MSG, "time.year (number) expected, got " + luaState.typeName(-1)); + } + break; + case "month": + if (luaState.type(-1) != LuaType.NUMBER) { + logMsg(ERROR_MSG, "time.month (number) expected, got " + luaState.typeName(-1)); + } + break; + case "day": + if (luaState.type(-1) != LuaType.NUMBER) { + logMsg(ERROR_MSG, "time.day (number) expected, got " + luaState.typeName(-1)); + } + break; + case "hour": + if (luaState.type(-1) != LuaType.NUMBER) { + logMsg(ERROR_MSG, "time.hour (number) expected, got " + luaState.typeName(-1)); + } + break; + case "min": + if (luaState.type(-1) != LuaType.NUMBER) { + logMsg(ERROR_MSG, "time.min (number) expected, got " + luaState.typeName(-1)); + } + break; + case "sec": + if (luaState.type(-1) != LuaType.NUMBER) { + logMsg(ERROR_MSG, "time.sec (number) expected, got " + luaState.typeName(-1)); + } + break; + default: + logMsg(WARNING_MSG, "Invalid option '" + key + "'"); + break; + } + } + } else { + logMsg(ERROR_MSG, "time (number or table) expected, got " + luaState.typeName(1)); + return 0; + } + + // check for options table + if (!luaState.isNoneOrNil(2)) { + if (luaState.type(2) == LuaType.TABLE) { + // traverse and validate all the options + for (luaState.pushNil(); luaState.next(2); luaState.pop(1)) { + String key = luaState.toString(-2); + switch (key) { + case "alert": + if (luaState.type(-1) != LuaType.STRING) { + logMsg(ERROR_MSG, "options.alert (string) expected, got " + luaState.typeName(-1)); + } + break; + case "badge": + if (luaState.type(-1) != LuaType.NUMBER) { + logMsg(ERROR_MSG, "options.badge (number) expected, got " + luaState.typeName(-1)); + } + break; + case "sound": + if (luaState.type(-1) != LuaType.STRING) { + logMsg(ERROR_MSG, "options.sound (string) expected, got " + luaState.typeName(-1)); + } + break; + case "custom": + if (luaState.type(-1) != LuaType.TABLE) { + logMsg(ERROR_MSG, "options.custom (table) expected, got " + luaState.typeName(-1)); + } + break; + default: + logMsg(WARNING_MSG, "Invalid option '" + key + "'"); + break; + } + } + } else { + logMsg(ERROR_MSG, "options table expected, got " + luaState.typeName(2)); + return 0; + } + } + + return Bridge.scheduleNotification(luaState, 1); + } + } + + // [Lua] cancelNotification( [notificationId] ) + private class CancelNotification implements NamedJavaFunction { + /** + * Gets the name of the Lua function as it would appear in the Lua script. + * + * @return Returns the name of the custom Lua function. + */ + @Override + public String getName() { + return "cancelNotification"; + } + + /** + * This method is called when the Lua function is called. + *

+ * Warning! This method is not called on the main UI thread. + * + * @param luaState Reference to the Lua state. + * Needed to retrieve the Lua function's parameters and to return values back to Lua. + * @return Returns the number of values to be returned by the Lua function. + */ + @Override + public int invoke(final LuaState luaState) { + functionSignature = "notifications.cancelNotification( [notificationId] )"; + + // check number of args + int nargs = luaState.getTop(); + if (nargs > 1) { + logMsg(ERROR_MSG, "Expected 0 or 1 arguments, got " + nargs); + return 0; + } + + // check the notificationId parameter + if (!luaState.isNoneOrNil(1)) { + if (luaState.type(1) != LuaType.NUMBER) { + logMsg(ERROR_MSG, "notificationId (number) expected, got " + luaState.typeName(1)); + } + } + + if (luaState.isNoneOrNil(1)) { + Bridge.cancelAllNotifications(); + } else { + int id = Double.valueOf(luaState.toNumber(1)).intValue(); + Bridge.cancelNotification(id); + } + + return 0; + } + } +} \ No newline at end of file diff --git a/src/android/plugin/src/main/java/plugin/notifications/v2/NotificationsV2Helper.java b/src/android/plugin/src/main/java/plugin/notifications/v2/NotificationsV2Helper.java new file mode 100644 index 0000000..8d3dd26 --- /dev/null +++ b/src/android/plugin/src/main/java/plugin/notifications/v2/NotificationsV2Helper.java @@ -0,0 +1,296 @@ +// +// NotificationsV2Helper.java +// Notifications V2 Plugin +// +// Copyright (c) 2017 CoronaLabs inc. All rights reserved. +// + +// @formatter:off + +package plugin.notifications.v2; + +import com.ansca.corona.CoronaActivity; +import com.ansca.corona.CoronaData; +import com.ansca.corona.CoronaEnvironment; +import com.ansca.corona.notifications.*; +import com.ansca.corona.events.*; + +import android.content.Context; +import android.os.Bundle; + +import java.util.Map; + +import com.google.firebase.messaging.RemoteMessage; + +final class NotificationsV2Helper +{ + // message constants + private static final String NOTIFICATION_SOURCE_NAME = "google"; + private static final String NOTIFICATION_SOURCE_DATA_NAME = "androidPayload"; + + private static String previousMessageId = null; + + // prevent the caller from creating objects of this class + public NotificationsV2Helper() { + throw new AssertionError(); + } + + static public void processRemoteMessage(RemoteMessage remoteMessage, Context context) + { + Bundle bundle = new Bundle(); + for (Map.Entry entry : remoteMessage.getData().entrySet()) { + bundle.putString(entry.getKey(), entry.getValue()); + } + + // get notification component + // note: data-only messages have no notification component + // Corona's legacy plugin uses data-only notifications + RemoteMessage.Notification notification = remoteMessage.getNotification(); + + + + // Set up a new status bar notification. + NotificationServices notificationServices = new NotificationServices(context); + StatusBarNotificationSettings settings = new StatusBarNotificationSettings(); + settings.setSourceName(NOTIFICATION_SOURCE_NAME); + settings.setSourceLocal(false); + + // Set the title to the application name by default. + String applicationName = com.ansca.corona.CoronaEnvironment.getApplicationName(); + settings.setContentTitle(applicationName); + settings.setTickerText(applicationName); + + if (notification != null) { + // alert text + settings.setContentText(notification.getBody()); + settings.setTickerText(notification.getBody()); + + // sound + android.net.Uri uri = null; + String sound = notification.getSound(); + String activeSound = sound; + try { + if (sound == null) { + // force sound file to nonexistent file + // must do this as otherwise default sound will play + activeSound = "doNotPlaySound"; + } + uri = com.ansca.corona.storage.FileContentProvider.createContentUriForFile(context, activeSound.trim()); + } + catch (Exception ex) { + ex.printStackTrace(); + } + // Firebase Notification Console sets the sound file to "default" which does not exist in the + // Corona file system. Ignore it so the default alert sound is played + if ((sound == null) || (! sound.equals("default"))) { + settings.setSoundFileUri(uri); + } + + // check for data component + if (remoteMessage.getData().size() > 0) { + CoronaData.Table notificationData = (CoronaData.Table) CoronaData.Table.from(remoteMessage.getData()); + if (! notificationData.isEmpty()) { + settings.setData(notificationData); + } + } + + // check for tag and set notification id + String notificationTag = notification.getTag(); + if (notificationTag != null) { + settings.setId(notificationTag.hashCode()); + } + else { + settings.setId(notificationServices.reserveId()); + } + + // add notification source data + CoronaData.Table sourceData = new CoronaData.Table(); + sourceData.put(new CoronaData.String("title"), CoronaData.from(notification.getTitle())); + sourceData.put(new CoronaData.String("title_loc_key"), CoronaData.from(notification.getTitleLocalizationKey())); + sourceData.put(new CoronaData.String("title_loc_args"), CoronaData.from(notification.getTitleLocalizationArgs())); + sourceData.put(new CoronaData.String("body"), CoronaData.from(notification.getBody())); + sourceData.put(new CoronaData.String("body_loc_key"), CoronaData.from(notification.getBodyLocalizationKey())); + sourceData.put(new CoronaData.String("body_loc_args"), CoronaData.from(notification.getBodyLocalizationArgs())); + sourceData.put(new CoronaData.String("icon"), CoronaData.from(notification.getIcon())); + sourceData.put(new CoronaData.String("sound"), CoronaData.from(sound)); + sourceData.put(new CoronaData.String("tag"), CoronaData.from(notificationTag)); + sourceData.put(new CoronaData.String("color"), CoronaData.from(notification.getColor())); + sourceData.put(new CoronaData.String("click_action"), CoronaData.from(notification.getClickAction())); + + sourceData.put(new CoronaData.String("from"), CoronaData.from(remoteMessage.getFrom())); + sourceData.put(new CoronaData.String("to"), CoronaData.from(remoteMessage.getTo())); + sourceData.put(new CoronaData.String("collapse_key"), CoronaData.from(remoteMessage.getCollapseKey())); + sourceData.put(new CoronaData.String("google.message_id"), CoronaData.from(remoteMessage.getMessageId())); + sourceData.put(new CoronaData.String("message_type"), CoronaData.from(remoteMessage.getMessageType())); + sourceData.put(new CoronaData.String("google.sent_time"), CoronaData.from(remoteMessage.getSentTime())); + sourceData.put(new CoronaData.String("time_to_live"), CoronaData.from(remoteMessage.getTtl())); + + settings.setSourceData(sourceData); + settings.setSourceDataName(NOTIFICATION_SOURCE_DATA_NAME); + } + else { + // Copy the alert information from the bundle. + Object value = bundle.get("alert"); + if (value instanceof String) { + // If the alert string is a JSON table, then fetch its fields. + String alertString = (String)value; + boolean isJson = false; + try { + org.json.JSONObject jsonObject = new org.json.JSONObject(alertString); + value = jsonObject.opt("title"); + if (value instanceof String) { + settings.setContentTitle((String)value); + } + value = jsonObject.opt("body"); + if (value instanceof String) { + settings.setContentText((String)value); + settings.setTickerText((String)value); + } + else { + value = jsonObject.opt("text"); + if (value instanceof String) { + settings.setContentText((String)value); + settings.setTickerText((String)value); + } + } + value = jsonObject.opt("number"); + if (value instanceof Number) { + settings.setBadgeNumber(((Number)value).intValue()); + } + isJson = true; + } + catch (Exception ex) { } + + // If the alert string is not JSON, then accept the string as is. + if (isJson == false) { + settings.setContentText(alertString); + settings.setTickerText(alertString); + } + } + else if (value == null) { + // If an alert field was not provided, then check the bundle itself. + // Note: This is how Fuse provides notifications. + value = bundle.get("title"); + if (value instanceof String) { + settings.setContentTitle((String)value); + } + value = bundle.get("body"); + if (value instanceof String) { + settings.setContentText((String)value); + settings.setTickerText((String)value); + } + else { + value = bundle.get("text"); + if (value instanceof String) { + settings.setContentText((String)value); + settings.setTickerText((String)value); + } + } + value = bundle.get("number"); + if (value instanceof Number) { + settings.setBadgeNumber(((Number)value).intValue()); + } + } + + // check for tag and set notification id + value = bundle.get("tag"); + if (value instanceof String) { + settings.setId(((String)value).hashCode()); + } + else { + settings.setId(notificationServices.reserveId()); + } + + // Set the path to a custom sound file, if provided. + value = bundle.get("sound"); + if (value instanceof String) { + android.net.Uri uri = null; + try { + uri = com.ansca.corona.storage.FileContentProvider.createContentUriForFile( + context, ((String)value).trim()); + } + catch (Exception ex) { + ex.printStackTrace(); + } + settings.setSoundFileUri(uri); + } + + // Copy the bundle's custom data, if provided. + com.ansca.corona.CoronaData.Table customData = null; + value = bundle.get("custom"); + if (value instanceof String) { + try { + customData = com.ansca.corona.CoronaData.Table.from(new org.json.JSONObject((String)value)); + } + catch (Exception ex) { } + } + else if (value instanceof android.os.Bundle) { + customData = com.ansca.corona.CoronaData.Table.from((android.os.Bundle)value); + } + if (customData != null) { + settings.setData(customData); + } + + settings.setSourceData(com.ansca.corona.CoronaData.from(bundle)); + settings.setSourceDataName(NOTIFICATION_SOURCE_DATA_NAME); + } + + // Post the notification to the status bar. + notificationServices.post(settings); + } + + // check for message data from a notification-activated app launch + // used by notification-type messages only. + // data-type messages are handled by Corona Core launch args + static void checkForMessageData() + { + final CoronaActivity coronaActivity = CoronaEnvironment.getCoronaActivity(); + + if (coronaActivity != null) { + Bundle extras = coronaActivity.getIntent().getExtras(); + + if (extras != null) { // send data from tapped notification + // prevent app resume from dispatching the same notification more than once + String currentMessageId = extras.getString("google.message_id"); + if ((currentMessageId != null) && (! currentMessageId.equals(previousMessageId))) { + previousMessageId = currentMessageId; + + // configure the notification + StatusBarNotificationSettings settings = new StatusBarNotificationSettings(); + + settings.setSourceName(NOTIFICATION_SOURCE_NAME); + settings.setSourceLocal(false); + + // Set the title to the application name by default + String applicationName = com.ansca.corona.CoronaEnvironment.getApplicationName(); + settings.setContentTitle(applicationName); + settings.setTickerText(applicationName); + + // process custom data + CoronaData.Table notificationData = new CoronaData.Table(); + for (String key: extras.keySet()) { + // filter system data from custom user data + if ((! key.equals("collapse_key")) && (! key.startsWith("google.")) && (! key.equals("from"))) { + Object value = extras.get(key); + notificationData.put(new CoronaData.String(key), CoronaData.from(value)); + } + } + if (notificationData.size() > 0) { + settings.setData(notificationData); + } + + // add notification source data + CoronaData.Table sourceData = CoronaData.Table.from(extras); + settings.setSourceData(sourceData); + settings.setSourceDataName(NOTIFICATION_SOURCE_DATA_NAME); + + // dispatch the event + for (com.ansca.corona.CoronaRuntime runtime : com.ansca.corona.CoronaRuntimeProvider.getAllCoronaRuntimes()) { + NotificationReceivedTask event = new NotificationReceivedTask("inactive", settings); + runtime.getTaskDispatcher().send(event); + } + } + } + } + } +} diff --git a/src/android/plugin/src/main/java/plugin/notifications/v2/firebase/LuaLoader.java b/src/android/plugin/src/main/java/plugin/notifications/v2/firebase/LuaLoader.java new file mode 100644 index 0000000..773a26c --- /dev/null +++ b/src/android/plugin/src/main/java/plugin/notifications/v2/firebase/LuaLoader.java @@ -0,0 +1,13 @@ +// +// LuaLoader.java +// Notifications V2 Plugin +// +// Copyright (c) 2017 CoronaLabs inc. All rights reserved. +// + +package plugin.notifications.v2.firebase; + +@SuppressWarnings({"unused", "RedundantSuppression"}) +public class LuaLoader extends plugin.notifications.v2.LuaLoader { + +} \ No newline at end of file diff --git a/src/android/settings.gradle b/src/android/settings.gradle new file mode 100644 index 0000000..1d6c6f9 --- /dev/null +++ b/src/android/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = "Notifications V2" +include("app", "plugin") diff --git a/src/ios/App-Info.plist b/src/ios/App-Info.plist new file mode 100644 index 0000000..6a749f4 --- /dev/null +++ b/src/ios/App-Info.plist @@ -0,0 +1,48 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + NSMainNibFile + MainWindow + NSMainNibFile~ipad + MainWindow-iPad + UILaunchStoryboardName + LaunchScreen + UIPrerenderedIcon + + UIRequiredDeviceCapabilities + + armv7 + + UIStatusBarStyle + UIStatusBarStyleBlackTranslucent + FirebaseAppDelegateProxyEnabled + + CoronaDelegates + + CoronaNotificationsDelegate + + + diff --git a/src/ios/App.entitlements b/src/ios/App.entitlements new file mode 100644 index 0000000..0c67376 --- /dev/null +++ b/src/ios/App.entitlements @@ -0,0 +1,5 @@ + + + + + diff --git a/src/ios/AppCoronaDelegate.h b/src/ios/AppCoronaDelegate.h new file mode 100644 index 0000000..e43f81b --- /dev/null +++ b/src/ios/AppCoronaDelegate.h @@ -0,0 +1,14 @@ +// +// AppCoronaDelegate.h +// TemplateApp +// +// Copyright (c) 2017 __MyCompanyName__. All rights reserved. +// + +#import + +#import + +@interface AppCoronaDelegate : NSObject< CoronaDelegate > + +@end diff --git a/src/ios/AppCoronaDelegate.mm b/src/ios/AppCoronaDelegate.mm new file mode 100644 index 0000000..e9611f4 --- /dev/null +++ b/src/ios/AppCoronaDelegate.mm @@ -0,0 +1,66 @@ +// +// AppCoronaDelegate.mm +// TemplateApp +// +// Copyright (c) 2017 __MyCompanyName__. All rights reserved. +// + +#import "AppCoronaDelegate.h" + +#import +#import + +@implementation AppCoronaDelegate + +- (void)willLoadMain:(id)runtime +{ +} + +- (void)didLoadMain:(id)runtime +{ +} + +#pragma mark UIApplicationDelegate methods + +// The following are stubs for common delegate methods. Uncomment and implement +// the ones you wish to be called. Or add additional delegate methods that +// you wish to be called. + +/* +- (void)applicationWillResignActive:(UIApplication *)application +{ + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} +*/ + +/* +- (void)applicationDidEnterBackground:(UIApplication *)application +{ + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} +*/ + +/* +- (void)applicationWillEnterForeground:(UIApplication *)application +{ + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} +*/ + +/* +- (void)applicationDidBecomeActive:(UIApplication *)application +{ + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} +*/ + +/* +- (void)applicationWillTerminate:(UIApplication *)application +{ + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} +*/ + +@end diff --git a/src/ios/CoronaApp.xcconfig b/src/ios/CoronaApp.xcconfig new file mode 100644 index 0000000..00f8ca4 --- /dev/null +++ b/src/ios/CoronaApp.xcconfig @@ -0,0 +1,7 @@ +// This file is generated by Corona. +// All changes is overwritten when Download Plugins target is built + +// import Corona native location and basic settings +#include "CoronaNative.xcconfig" + +OTHER_LDFLAGS = $(inherited) $(CORONA_CUSTOM_LDFLAGS) -all_load -lplayer diff --git a/src/ios/CoronaNative.xcconfig b/src/ios/CoronaNative.xcconfig new file mode 100644 index 0000000..7edf806 --- /dev/null +++ b/src/ios/CoronaNative.xcconfig @@ -0,0 +1,19 @@ +// This file contains basic setup for Corona Native apps and plugins + +CORONA_ROOT=$HOME/Library/Application Support/Corona/Native + +HEADER_SEARCH_PATHS = $(inherited) "$(CORONA_ROOT)/Corona/shared/include/Corona" "$(CORONA_ROOT)/Corona/shared/include/lua" "$(CORONA_ROOT)/Corona/ios/include/Corona" + +LIBRARY_SEARCH_PATHS = $(inherited) "$(CORONA_ROOT)/Corona/ios/lib" + +FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PROJECT_DIR)/EmbeddedFrameworks" + +ENABLE_BITCODE = no + +// Sometimes passing -all_load flag is not an option. In this case, manually load all libraries with -force_load: +//CORONA_FORCE_LOAD = --force-load +//CORONA_CUSTOM_LDFLAGS = -force_load "$(BUILT_PRODUCTS_DIR)/libplugin_library.a" +EXCLUDED_ARCHS[sdk=iphoneos*] = i386 x86_64 +EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64 arm64e armv7 armv7s + + diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/FBLPromises b/src/ios/EmbeddedFrameworks/FBLPromises.framework/FBLPromises new file mode 100755 index 0000000..e30e08e Binary files /dev/null and b/src/ios/EmbeddedFrameworks/FBLPromises.framework/FBLPromises differ diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+All.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+All.h new file mode 100644 index 0000000..9c0090e --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+All.h @@ -0,0 +1,63 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(AllAdditions) + +/** + Wait until all of the given promises are fulfilled. + If one of the given promises is rejected, then the returned promise is rejected with same error. + If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, + it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly. + Promises resolved with `nil` become `NSNull` instances in the resulting array. + + @param promises Promises to wait for. + @return Promise of an array containing the values of input promises in the same order. + */ ++ (FBLPromise *)all:(NSArray *)promises NS_SWIFT_UNAVAILABLE(""); + +/** + Wait until all of the given promises are fulfilled. + If one of the given promises is rejected, then the returned promise is rejected with same error. + If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, + it's implicitly considered a pre-fulfilled or pre-rejected FBLPromise correspondingly. + Promises resolved with `nil` become `NSNull` instances in the resulting array. + + @param queue A queue to dispatch on. + @param promises Promises to wait for. + @return Promise of an array containing the values of input promises in the same order. + */ ++ (FBLPromise *)onQueue:(dispatch_queue_t)queue + all:(NSArray *)promises NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `all` operators. + Usage: FBLPromise.all(@[ ... ]) + */ +@interface FBLPromise(DotSyntax_AllAdditions) + ++ (FBLPromise * (^)(NSArray *))all FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise * (^)(dispatch_queue_t, NSArray *))allOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Always.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Always.h new file mode 100644 index 0000000..13000f5 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Always.h @@ -0,0 +1,54 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(AlwaysAdditions) + +typedef void (^FBLPromiseAlwaysWorkBlock)(void) NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block that always executes, no matter if the receiver is rejected or fulfilled. + @return A new pending promise to be resolved with same resolution as the receiver. + */ +- (FBLPromise *)always:(FBLPromiseAlwaysWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to dispatch on. + @param work A block that always executes, no matter if the receiver is rejected or fulfilled. + @return A new pending promise to be resolved with same resolution as the receiver. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + always:(FBLPromiseAlwaysWorkBlock)work NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `always` operators. + Usage: promise.always(^{...}) + */ +@interface FBLPromise(DotSyntax_AlwaysAdditions) + +- (FBLPromise* (^)(FBLPromiseAlwaysWorkBlock))always FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise* (^)(dispatch_queue_t, FBLPromiseAlwaysWorkBlock))alwaysOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Any.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Any.h new file mode 100644 index 0000000..82875bf --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Any.h @@ -0,0 +1,69 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(AnyAdditions) + +/** + Waits until all of the given promises are either fulfilled or rejected. + If all promises are rejected, then the returned promise is rejected with same error + as the last one rejected. + If at least one of the promises is fulfilled, the resulting promise is fulfilled with an array of + values or `NSErrors`, matching the original order of fulfilled or rejected promises respectively. + If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, + it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly. + Promises resolved with `nil` become `NSNull` instances in the resulting array. + + @param promises Promises to wait for. + @return Promise of array containing the values or `NSError`s of input promises in the same order. + */ ++ (FBLPromise *)any:(NSArray *)promises NS_SWIFT_UNAVAILABLE(""); + +/** + Waits until all of the given promises are either fulfilled or rejected. + If all promises are rejected, then the returned promise is rejected with same error + as the last one rejected. + If at least one of the promises is fulfilled, the resulting promise is fulfilled with an array of + values or `NSError`s, matching the original order of fulfilled or rejected promises respectively. + If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, + it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly. + Promises resolved with `nil` become `NSNull` instances in the resulting array. + + @param queue A queue to dispatch on. + @param promises Promises to wait for. + @return Promise of array containing the values or `NSError`s of input promises in the same order. + */ ++ (FBLPromise *)onQueue:(dispatch_queue_t)queue + any:(NSArray *)promises NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `any` operators. + Usage: FBLPromise.any(@[ ... ]) + */ +@interface FBLPromise(DotSyntax_AnyAdditions) + ++ (FBLPromise * (^)(NSArray *))any FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise * (^)(dispatch_queue_t, NSArray *))anyOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Async.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Async.h new file mode 100644 index 0000000..0588a9e --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Async.h @@ -0,0 +1,60 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(AsyncAdditions) + +typedef void (^FBLPromiseFulfillBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseRejectBlock)(NSError *error) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseAsyncWorkBlock)(FBLPromiseFulfillBlock fulfill, + FBLPromiseRejectBlock reject) NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise and executes `work` block asynchronously. + + @param work A block to perform any operations needed to resolve the promise. + @return A new pending promise. + */ ++ (instancetype)async:(FBLPromiseAsyncWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise and executes `work` block asynchronously on the given queue. + + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @return A new pending promise. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue + async:(FBLPromiseAsyncWorkBlock)work NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `async` operators. + Usage: FBLPromise.async(^(FBLPromiseFulfillBlock fulfill, FBLPromiseRejectBlock reject) { ... }) + */ +@interface FBLPromise(DotSyntax_AsyncAdditions) + ++ (FBLPromise* (^)(FBLPromiseAsyncWorkBlock))async FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, FBLPromiseAsyncWorkBlock))asyncOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Await.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Await.h new file mode 100644 index 0000000..c97a1ba --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Await.h @@ -0,0 +1,32 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + Waits for promise resolution. The current thread blocks until the promise is resolved. + + @param promise Promise to wait for. + @param error Error the promise was rejected with, or `nil` if the promise was fulfilled. + @return Value the promise was fulfilled with. If the promise was rejected, the return value + is always `nil`, but the error out arg is not. + */ +FOUNDATION_EXTERN id __nullable FBLPromiseAwait(FBLPromise *promise, + NSError **error) NS_REFINED_FOR_SWIFT; + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Catch.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Catch.h new file mode 100644 index 0000000..a9ff170 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Catch.h @@ -0,0 +1,59 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(CatchAdditions) + +typedef void (^FBLPromiseCatchWorkBlock)(NSError *error) NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise which eventually gets resolved with same resolution as the receiver. + If receiver is rejected, then `reject` block is executed asynchronously. + + @param reject A block to handle the error that receiver was rejected with. + @return A new pending promise. + */ +- (FBLPromise *)catch:(FBLPromiseCatchWorkBlock)reject NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise which eventually gets resolved with same resolution as the receiver. + If receiver is rejected, then `reject` block is executed asynchronously on the given queue. + + @param queue A queue to invoke the `reject` block on. + @param reject A block to handle the error that receiver was rejected with. + @return A new pending promise. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + catch:(FBLPromiseCatchWorkBlock)reject NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `catch` operators. + Usage: promise.catch(^(NSError *error) { ... }) + */ +@interface FBLPromise(DotSyntax_CatchAdditions) + +- (FBLPromise* (^)(FBLPromiseCatchWorkBlock))catch FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise* (^)(dispatch_queue_t, FBLPromiseCatchWorkBlock))catchOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Delay.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Delay.h new file mode 100644 index 0000000..557df48 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Delay.h @@ -0,0 +1,59 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(DelayAdditions) + +/** + Creates a new pending promise that fulfills with the same value as `self` after the `delay`, or + rejects with the same error immediately. + + @param interval Time to wait in seconds. + @return A new pending promise that fulfills at least `delay` seconds later than `self`, or rejects + with the same error immediately. + */ +- (FBLPromise *)delay:(NSTimeInterval)interval NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a new pending promise that fulfills with the same value as `self` after the `delay`, or + rejects with the same error immediately. + + @param queue A queue to dispatch on. + @param interval Time to wait in seconds. + @return A new pending promise that fulfills at least `delay` seconds later than `self`, or rejects + with the same error immediately. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + delay:(NSTimeInterval)interval NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `delay` operators. + Usage: promise.delay(...) + */ +@interface FBLPromise(DotSyntax_DelayAdditions) + +- (FBLPromise * (^)(NSTimeInterval))delay FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise * (^)(dispatch_queue_t, NSTimeInterval))delayOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Do.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Do.h new file mode 100644 index 0000000..6838e0a --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Do.h @@ -0,0 +1,55 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(DoAdditions) + +typedef id __nullable (^FBLPromiseDoWorkBlock)(void) NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise and executes `work` block asynchronously. + + @param work A block that returns a value or an error used to resolve the promise. + @return A new pending promise. + */ ++ (instancetype)do:(FBLPromiseDoWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise and executes `work` block asynchronously on the given queue. + + @param queue A queue to invoke the `work` block on. + @param work A block that returns a value or an error used to resolve the promise. + @return A new pending promise. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue do:(FBLPromiseDoWorkBlock)work NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `do` operators. + Usage: FBLPromise.doOn(queue, ^(NSError *error) { ... }) + */ +@interface FBLPromise(DotSyntax_DoAdditions) + ++ (FBLPromise * (^)(dispatch_queue_t, FBLPromiseDoWorkBlock))doOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Race.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Race.h new file mode 100644 index 0000000..2f67258 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Race.h @@ -0,0 +1,62 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(RaceAdditions) + +/** + Wait until any of the given promises are fulfilled. + If one of the promises is rejected, then the returned promise is rejected with same error. + If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, + it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly. + + @param promises Promises to wait for. + @return A new pending promise to be resolved with the same resolution as the first promise, among + the given ones, which was resolved. + */ ++ (instancetype)race:(NSArray *)promises NS_SWIFT_UNAVAILABLE(""); + +/** + Wait until any of the given promises are fulfilled. + If one of the promises is rejected, then the returned promise is rejected with same error. + If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, + it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly. + + @param queue A queue to dispatch on. + @param promises Promises to wait for. + @return A new pending promise to be resolved with the same resolution as the first promise, among + the given ones, which was resolved. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue race:(NSArray *)promises NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `race` operators. + Usage: FBLPromise.race(@[ ... ]) + */ +@interface FBLPromise(DotSyntax_RaceAdditions) + ++ (FBLPromise * (^)(NSArray *))race FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise * (^)(dispatch_queue_t, NSArray *))raceOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Recover.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Recover.h new file mode 100644 index 0000000..bb7df7e --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Recover.h @@ -0,0 +1,60 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(RecoverAdditions) + +typedef id __nullable (^FBLPromiseRecoverWorkBlock)(NSError *error) NS_SWIFT_UNAVAILABLE(""); + +/** + Provides a new promise to recover in case the receiver gets rejected. + + @param recovery A block to handle the error that the receiver was rejected with. + @return A new pending promise to use instead of the rejected one that gets resolved with resolution + returned from `recovery` block. + */ +- (FBLPromise *)recover:(FBLPromiseRecoverWorkBlock)recovery NS_SWIFT_UNAVAILABLE(""); + +/** + Provides a new promise to recover in case the receiver gets rejected. + + @param queue A queue to dispatch on. + @param recovery A block to handle the error that the receiver was rejected with. + @return A new pending promise to use instead of the rejected one that gets resolved with resolution + returned from `recovery` block. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + recover:(FBLPromiseRecoverWorkBlock)recovery NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `recover` operators. + Usage: promise.recover(^id(NSError *error) {...}) + */ +@interface FBLPromise(DotSyntax_RecoverAdditions) + +- (FBLPromise * (^)(FBLPromiseRecoverWorkBlock))recover FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise * (^)(dispatch_queue_t, FBLPromiseRecoverWorkBlock))recoverOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Reduce.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Reduce.h new file mode 100644 index 0000000..5bb1eee --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Reduce.h @@ -0,0 +1,71 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(ReduceAdditions) + +typedef id __nullable (^FBLPromiseReducerBlock)(Value __nullable partial, id next) + NS_SWIFT_UNAVAILABLE(""); + +/** + Sequentially reduces a collection of values to a single promise using a given combining block + and the value `self` resolves with as initial value. + + @param items An array of values to process in order. + @param reducer A block to combine an accumulating value and an element of the sequence into + the new accumulating value or a promise resolved with it, to be used in the next + call of the `reducer` or returned to the caller. + @return A new pending promise returned from the last `reducer` invocation. + Or `self` if `items` is empty. + */ +- (FBLPromise *)reduce:(NSArray *)items + combine:(FBLPromiseReducerBlock)reducer NS_SWIFT_UNAVAILABLE(""); + +/** + Sequentially reduces a collection of values to a single promise using a given combining block + and the value `self` resolves with as initial value. + + @param queue A queue to dispatch on. + @param items An array of values to process in order. + @param reducer A block to combine an accumulating value and an element of the sequence into + the new accumulating value or a promise resolved with it, to be used in the next + call of the `reducer` or returned to the caller. + @return A new pending promise returned from the last `reducer` invocation. + Or `self` if `items` is empty. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + reduce:(NSArray *)items + combine:(FBLPromiseReducerBlock)reducer NS_SWIFT_UNAVAILABLE(""); + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `reduce` operators. + Usage: promise.reduce(values, ^id(id partial, id next) { ... }) + */ +@interface FBLPromise(DotSyntax_ReduceAdditions) + +- (FBLPromise * (^)(NSArray *, FBLPromiseReducerBlock))reduce FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise * (^)(dispatch_queue_t, NSArray *, FBLPromiseReducerBlock))reduceOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Retry.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Retry.h new file mode 100644 index 0000000..98ef558 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Retry.h @@ -0,0 +1,165 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +/** The default number of retry attempts is 1. */ +FOUNDATION_EXTERN NSInteger const FBLPromiseRetryDefaultAttemptsCount NS_REFINED_FOR_SWIFT; + +/** The default delay interval before making a retry attempt is 1.0 second. */ +FOUNDATION_EXTERN NSTimeInterval const FBLPromiseRetryDefaultDelayInterval NS_REFINED_FOR_SWIFT; + +@interface FBLPromise(RetryAdditions) + +typedef id __nullable (^FBLPromiseRetryWorkBlock)(void) NS_SWIFT_UNAVAILABLE(""); +typedef BOOL (^FBLPromiseRetryPredicateBlock)(NSInteger, NSError *) NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise that fulfills with the same value as the promise returned from `work` + block, which executes asynchronously, or rejects with the same error after all retry attempts have + been exhausted. Defaults to `FBLPromiseRetryDefaultAttemptsCount` attempt(s) on rejection where the + `work` block is retried after a delay of `FBLPromiseRetryDefaultDelayInterval` second(s). + + @param work A block that executes asynchronously on the default queue and returns a value or an + error used to resolve the promise. + @return A new pending promise that fulfills with the same value as the promise returned from `work` + block, or rejects with the same error after all retry attempts have been exhausted. + */ ++ (FBLPromise *)retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise that fulfills with the same value as the promise returned from `work` + block, which executes asynchronously on the given `queue`, or rejects with the same error after all + retry attempts have been exhausted. Defaults to `FBLPromiseRetryDefaultAttemptsCount` attempt(s) on + rejection where the `work` block is retried on the given `queue` after a delay of + `FBLPromiseRetryDefaultDelayInterval` second(s). + + @param queue A queue to invoke the `work` block on. + @param work A block that executes asynchronously on the given `queue` and returns a value or an + error used to resolve the promise. + @return A new pending promise that fulfills with the same value as the promise returned from `work` + block, or rejects with the same error after all retry attempts have been exhausted. + */ ++ (FBLPromise *)onQueue:(dispatch_queue_t)queue + retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise that fulfills with the same value as the promise returned from `work` + block, which executes asynchronously, or rejects with the same error after all retry attempts have + been exhausted. + + @param count Max number of retry attempts. The `work` block will be executed once if the specified + count is less than or equal to zero. + @param work A block that executes asynchronously on the default queue and returns a value or an + error used to resolve the promise. + @return A new pending promise that fulfills with the same value as the promise returned from `work` + block, or rejects with the same error after all retry attempts have been exhausted. + */ ++ (FBLPromise *)attempts:(NSInteger)count + retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise that fulfills with the same value as the promise returned from `work` + block, which executes asynchronously on the given `queue`, or rejects with the same error after all + retry attempts have been exhausted. + + @param queue A queue to invoke the `work` block on. + @param count Max number of retry attempts. The `work` block will be executed once if the specified + count is less than or equal to zero. + @param work A block that executes asynchronously on the given `queue` and returns a value or an + error used to resolve the promise. + @return A new pending promise that fulfills with the same value as the promise returned from `work` + block, or rejects with the same error after all retry attempts have been exhausted. + */ ++ (FBLPromise *)onQueue:(dispatch_queue_t)queue + attempts:(NSInteger)count + retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise that fulfills with the same value as the promise returned from `work` + block, which executes asynchronously, or rejects with the same error after all retry attempts have + been exhausted. On rejection, the `work` block is retried after the given delay `interval` and will + continue to retry until the number of specified attempts have been exhausted or will bail early if + the given condition is not met. + + @param count Max number of retry attempts. The `work` block will be executed once if the specified + count is less than or equal to zero. + @param interval Time to wait before the next retry attempt. + @param predicate Condition to check before the next retry attempt. The predicate block provides the + the number of remaining retry attempts and the error that the promise was rejected + with. + @param work A block that executes asynchronously on the default queue and returns a value or an + error used to resolve the promise. + @return A new pending promise that fulfills with the same value as the promise returned from `work` + block, or rejects with the same error after all retry attempts have been exhausted or if + the given condition is not met. + */ ++ (FBLPromise *)attempts:(NSInteger)count + delay:(NSTimeInterval)interval + condition:(nullable FBLPromiseRetryPredicateBlock)predicate + retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise that fulfills with the same value as the promise returned from `work` + block, which executes asynchronously on the given `queue`, or rejects with the same error after all + retry attempts have been exhausted. On rejection, the `work` block is retried after the given + delay `interval` and will continue to retry until the number of specified attempts have been + exhausted or will bail early if the given condition is not met. + + @param queue A queue to invoke the `work` block on. + @param count Max number of retry attempts. The `work` block will be executed once if the specified + count is less than or equal to zero. + @param interval Time to wait before the next retry attempt. + @param predicate Condition to check before the next retry attempt. The predicate block provides the + the number of remaining retry attempts and the error that the promise was rejected + with. + @param work A block that executes asynchronously on the given `queue` and returns a value or an + error used to resolve the promise. + @return A new pending promise that fulfills with the same value as the promise returned from `work` + block, or rejects with the same error after all retry attempts have been exhausted or if + the given condition is not met. + */ ++ (FBLPromise *)onQueue:(dispatch_queue_t)queue + attempts:(NSInteger)count + delay:(NSTimeInterval)interval + condition:(nullable FBLPromiseRetryPredicateBlock)predicate + retry:(FBLPromiseRetryWorkBlock)work NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise+Retry` operators. + Usage: FBLPromise.retry(^id { ... }) + */ +@interface FBLPromise(DotSyntax_RetryAdditions) + ++ (FBLPromise * (^)(FBLPromiseRetryWorkBlock))retry FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise * (^)(dispatch_queue_t, FBLPromiseRetryWorkBlock))retryOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise * (^)(NSInteger, NSTimeInterval, FBLPromiseRetryPredicateBlock __nullable, + FBLPromiseRetryWorkBlock))retryAgain FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise * (^)(dispatch_queue_t, NSInteger, NSTimeInterval, + FBLPromiseRetryPredicateBlock __nullable, + FBLPromiseRetryWorkBlock))retryAgainOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Testing.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Testing.h new file mode 100644 index 0000000..8478ae2 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Testing.h @@ -0,0 +1,57 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + Waits for all scheduled promises blocks. + + @param timeout Maximum time to wait. + @return YES if all promises blocks have completed before the timeout and NO otherwise. + */ +FOUNDATION_EXTERN BOOL FBLWaitForPromisesWithTimeout(NSTimeInterval timeout) NS_REFINED_FOR_SWIFT; + +@interface FBLPromise(TestingAdditions) + +/** + Dispatch group for promises that is typically used to wait for all scheduled blocks. + */ +@property(class, nonatomic, readonly) dispatch_group_t dispatchGroup NS_REFINED_FOR_SWIFT; + +/** + Properties to get the current state of the promise. + */ +@property(nonatomic, readonly) BOOL isPending NS_REFINED_FOR_SWIFT; +@property(nonatomic, readonly) BOOL isFulfilled NS_REFINED_FOR_SWIFT; +@property(nonatomic, readonly) BOOL isRejected NS_REFINED_FOR_SWIFT; + +/** + Value the promise was fulfilled with. + Can be nil if the promise is still pending, was resolved with nil or after it has been rejected. + */ +@property(nonatomic, readonly, nullable) Value value NS_REFINED_FOR_SWIFT; + +/** + Error the promise was rejected with. + Can be nil if the promise is still pending or after it has been fulfilled. + */ +@property(nonatomic, readonly, nullable) NSError *error NS_REFINED_FOR_SWIFT; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Then.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Then.h new file mode 100644 index 0000000..32027e6 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Then.h @@ -0,0 +1,63 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(ThenAdditions) + +typedef id __nullable (^FBLPromiseThenWorkBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise which eventually gets resolved with resolution returned from `work` + block: either value, error or another promise. The `work` block is executed asynchronously only + when the receiver is fulfilled. If receiver is rejected, the returned promise is also rejected with + the same error. + + @param work A block to handle the value that receiver was fulfilled with. + @return A new pending promise to be resolved with resolution returned from the `work` block. + */ +- (FBLPromise *)then:(FBLPromiseThenWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise which eventually gets resolved with resolution returned from `work` + block: either value, error or another promise. The `work` block is executed asynchronously when the + receiver is fulfilled. If receiver is rejected, the returned promise is also rejected with the same + error. + + @param queue A queue to invoke the `work` block on. + @param work A block to handle the value that receiver was fulfilled with. + @return A new pending promise to be resolved with resolution returned from the `work` block. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + then:(FBLPromiseThenWorkBlock)work NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `then` operators. + Usage: promise.then(^id(id value) { ... }) + */ +@interface FBLPromise(DotSyntax_ThenAdditions) + +- (FBLPromise* (^)(FBLPromiseThenWorkBlock))then FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise* (^)(dispatch_queue_t, FBLPromiseThenWorkBlock))thenOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Timeout.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Timeout.h new file mode 100644 index 0000000..184ba16 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Timeout.h @@ -0,0 +1,57 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(TimeoutAdditions) + +/** + Waits for a promise with the specified `timeout`. + + @param interval Time to wait in seconds. + @return A new pending promise that gets either resolved with same resolution as the receiver or + rejected with `FBLPromiseErrorCodeTimedOut` error code in `FBLPromiseErrorDomain`. + */ +- (FBLPromise *)timeout:(NSTimeInterval)interval NS_SWIFT_UNAVAILABLE(""); + +/** + Waits for a promise with the specified `timeout`. + + @param queue A queue to dispatch on. + @param interval Time to wait in seconds. + @return A new pending promise that gets either resolved with same resolution as the receiver or + rejected with `FBLPromiseErrorCodeTimedOut` error code in `FBLPromiseErrorDomain`. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + timeout:(NSTimeInterval)interval NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `timeout` operators. + Usage: promise.timeout(...) + */ +@interface FBLPromise(DotSyntax_TimeoutAdditions) + +- (FBLPromise* (^)(NSTimeInterval))timeout FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise* (^)(dispatch_queue_t, NSTimeInterval))timeoutOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Validate.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Validate.h new file mode 100644 index 0000000..9dfa2f1 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Validate.h @@ -0,0 +1,60 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(ValidateAdditions) + +typedef BOOL (^FBLPromiseValidateWorkBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE(""); + +/** + Validates a fulfilled value or rejects the value if it can not be validated. + + @param predicate An expression to validate. + @return A new pending promise that gets either resolved with same resolution as the receiver or + rejected with `FBLPromiseErrorCodeValidationFailure` error code in `FBLPromiseErrorDomain`. + */ +- (FBLPromise *)validate:(FBLPromiseValidateWorkBlock)predicate NS_SWIFT_UNAVAILABLE(""); + +/** + Validates a fulfilled value or rejects the value if it can not be validated. + + @param queue A queue to dispatch on. + @param predicate An expression to validate. + @return A new pending promise that gets either resolved with same resolution as the receiver or + rejected with `FBLPromiseErrorCodeValidationFailure` error code in `FBLPromiseErrorDomain`. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + validate:(FBLPromiseValidateWorkBlock)predicate NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `validate` operators. + Usage: promise.validate(^BOOL(id value) { ... }) + */ +@interface FBLPromise(DotSyntax_ValidateAdditions) + +- (FBLPromise * (^)(FBLPromiseValidateWorkBlock))validate FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise * (^)(dispatch_queue_t, FBLPromiseValidateWorkBlock))validateOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Wrap.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Wrap.h new file mode 100644 index 0000000..664e1bb --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise+Wrap.h @@ -0,0 +1,316 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + Different types of completion handlers available to be wrapped with promise. + */ +typedef void (^FBLPromiseCompletion)(void) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseObjectCompletion)(id __nullable) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseErrorCompletion)(NSError* __nullable) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseObjectOrErrorCompletion)(id __nullable, NSError* __nullable) + NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseErrorOrObjectCompletion)(NSError* __nullable, id __nullable) + NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromise2ObjectsOrErrorCompletion)(id __nullable, id __nullable, + NSError* __nullable) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseBoolCompletion)(BOOL) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseBoolOrErrorCompletion)(BOOL, NSError* __nullable) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseIntegerCompletion)(NSInteger) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseIntegerOrErrorCompletion)(NSInteger, NSError* __nullable) + NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseDoubleCompletion)(double) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseDoubleOrErrorCompletion)(double, NSError* __nullable) + NS_SWIFT_UNAVAILABLE(""); + +/** + Provides an easy way to convert methods that use common callback patterns into promises. + */ +@interface FBLPromise(WrapAdditions) + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with `nil` when completion handler is invoked. + */ ++ (instancetype)wrapCompletion:(void (^)(FBLPromiseCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with `nil` when completion handler is invoked. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue + wrapCompletion:(void (^)(FBLPromiseCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an object provided by completion handler. + */ ++ (instancetype)wrapObjectCompletion:(void (^)(FBLPromiseObjectCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an object provided by completion handler. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue + wrapObjectCompletion:(void (^)(FBLPromiseObjectCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an error provided by completion handler. + If error is `nil`, fulfills with `nil`, otherwise rejects with the error. + */ ++ (instancetype)wrapErrorCompletion:(void (^)(FBLPromiseErrorCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an error provided by completion handler. + If error is `nil`, fulfills with `nil`, otherwise rejects with the error. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue + wrapErrorCompletion:(void (^)(FBLPromiseErrorCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an object provided by completion handler if error is `nil`. + Otherwise, rejects with the error. + */ ++ (instancetype)wrapObjectOrErrorCompletion: + (void (^)(FBLPromiseObjectOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an object provided by completion handler if error is `nil`. + Otherwise, rejects with the error. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue + wrapObjectOrErrorCompletion:(void (^)(FBLPromiseObjectOrErrorCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an error or object provided by completion handler. If error + is not `nil`, rejects with the error. + */ ++ (instancetype)wrapErrorOrObjectCompletion: + (void (^)(FBLPromiseErrorOrObjectCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an error or object provided by completion handler. If error + is not `nil`, rejects with the error. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue + wrapErrorOrObjectCompletion:(void (^)(FBLPromiseErrorOrObjectCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an array of objects provided by completion handler in order + if error is `nil`. Otherwise, rejects with the error. + */ ++ (FBLPromise*)wrap2ObjectsOrErrorCompletion: + (void (^)(FBLPromise2ObjectsOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an array of objects provided by completion handler in order + if error is `nil`. Otherwise, rejects with the error. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrap2ObjectsOrErrorCompletion:(void (^)(FBLPromise2ObjectsOrErrorCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping YES/NO. + */ ++ (FBLPromise*)wrapBoolCompletion:(void (^)(FBLPromiseBoolCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping YES/NO. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrapBoolCompletion:(void (^)(FBLPromiseBoolCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping YES/NO when error is `nil`. + Otherwise rejects with the error. + */ ++ (FBLPromise*)wrapBoolOrErrorCompletion: + (void (^)(FBLPromiseBoolOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping YES/NO when error is `nil`. + Otherwise rejects with the error. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrapBoolOrErrorCompletion:(void (^)(FBLPromiseBoolOrErrorCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping an integer. + */ ++ (FBLPromise*)wrapIntegerCompletion:(void (^)(FBLPromiseIntegerCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping an integer. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrapIntegerCompletion:(void (^)(FBLPromiseIntegerCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping an integer when error is `nil`. + Otherwise rejects with the error. + */ ++ (FBLPromise*)wrapIntegerOrErrorCompletion: + (void (^)(FBLPromiseIntegerOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping an integer when error is `nil`. + Otherwise rejects with the error. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrapIntegerOrErrorCompletion:(void (^)(FBLPromiseIntegerOrErrorCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping a double. + */ ++ (FBLPromise*)wrapDoubleCompletion:(void (^)(FBLPromiseDoubleCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping a double. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrapDoubleCompletion:(void (^)(FBLPromiseDoubleCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping a double when error is `nil`. + Otherwise rejects with the error. + */ ++ (FBLPromise*)wrapDoubleOrErrorCompletion: + (void (^)(FBLPromiseDoubleOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping a double when error is `nil`. + Otherwise rejects with the error. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrapDoubleOrErrorCompletion:(void (^)(FBLPromiseDoubleOrErrorCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `wrap` operators. + Usage: FBLPromise.wrapCompletion(^(FBLPromiseCompletion handler) {...}) + */ +@interface FBLPromise(DotSyntax_WrapAdditions) + ++ (FBLPromise* (^)(void (^)(FBLPromiseCompletion)))wrapCompletion FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseCompletion)))wrapCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseObjectCompletion)))wrapObjectCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseObjectCompletion)))wrapObjectCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseErrorCompletion)))wrapErrorCompletion FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseErrorCompletion)))wrapErrorCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseObjectOrErrorCompletion)))wrapObjectOrErrorCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, + void (^)(FBLPromiseObjectOrErrorCompletion)))wrapObjectOrErrorCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseErrorOrObjectCompletion)))wrapErrorOrObjectCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, + void (^)(FBLPromiseErrorOrObjectCompletion)))wrapErrorOrObjectCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromise2ObjectsOrErrorCompletion))) + wrap2ObjectsOrErrorCompletion FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromise2ObjectsOrErrorCompletion))) + wrap2ObjectsOrErrorCompletionOn FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseBoolCompletion)))wrapBoolCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, + void (^)(FBLPromiseBoolCompletion)))wrapBoolCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseBoolOrErrorCompletion)))wrapBoolOrErrorCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, + void (^)(FBLPromiseBoolOrErrorCompletion)))wrapBoolOrErrorCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseIntegerCompletion)))wrapIntegerCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, + void (^)(FBLPromiseIntegerCompletion)))wrapIntegerCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseIntegerOrErrorCompletion))) + wrapIntegerOrErrorCompletion FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseIntegerOrErrorCompletion))) + wrapIntegerOrErrorCompletionOn FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseDoubleCompletion)))wrapDoubleCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, + void (^)(FBLPromiseDoubleCompletion)))wrapDoubleCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseDoubleOrErrorCompletion))) + wrapDoubleOrErrorCompletion FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseDoubleOrErrorCompletion))) + wrapDoubleOrErrorCompletionOn FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise.h new file mode 100644 index 0000000..b1380dc --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromise.h @@ -0,0 +1,93 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromiseError.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + Promises synchronization construct in Objective-C. + */ +@interface FBLPromise<__covariant Value> : NSObject + +/** + Default dispatch queue used for `FBLPromise`, which is `main` if a queue is not specified. + */ +@property(class) dispatch_queue_t defaultDispatchQueue NS_REFINED_FOR_SWIFT; + +/** + Creates a pending promise. + */ ++ (instancetype)pendingPromise NS_REFINED_FOR_SWIFT; + +/** + Creates a resolved promise. + + @param resolution An object to resolve the promise with: either a value or an error. + @return A new resolved promise. + */ ++ (instancetype)resolvedWith:(nullable id)resolution NS_REFINED_FOR_SWIFT; + +/** + Synchronously fulfills the promise with a value. + + @param value An arbitrary value to fulfill the promise with, including `nil`. + */ +- (void)fulfill:(nullable Value)value NS_REFINED_FOR_SWIFT; + +/** + Synchronously rejects the promise with an error. + + @param error An error to reject the promise with. + */ +- (void)reject:(NSError *)error NS_REFINED_FOR_SWIFT; + ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; +@end + +@interface FBLPromise() + +/** + Adds an object to the set of pending objects to keep strongly while the promise is pending. + Used by the Swift wrappers to keep them alive until the underlying ObjC promise is resolved. + + @param object An object to add. + */ +- (void)addPendingObject:(id)object NS_REFINED_FOR_SWIFT; + +@end + +#ifdef FBL_PROMISES_DOT_SYNTAX_IS_DEPRECATED +#define FBL_PROMISES_DOT_SYNTAX __attribute__((deprecated)) +#else +#define FBL_PROMISES_DOT_SYNTAX +#endif + +@interface FBLPromise(DotSyntaxAdditions) + +/** + Convenience dot-syntax wrappers for FBLPromise. + Usage: FBLPromise.pending() + FBLPromise.resolved(value) + + */ ++ (instancetype (^)(void))pending FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (instancetype (^)(id __nullable))resolved FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromiseError.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromiseError.h new file mode 100644 index 0000000..d37af53 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromiseError.h @@ -0,0 +1,43 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +FOUNDATION_EXTERN NSErrorDomain const FBLPromiseErrorDomain NS_REFINED_FOR_SWIFT; + +/** + Possible error codes in `FBLPromiseErrorDomain`. + */ +typedef NS_ENUM(NSInteger, FBLPromiseErrorCode) { + /** Promise failed to resolve in time. */ + FBLPromiseErrorCodeTimedOut = 1, + /** Validation predicate returned false. */ + FBLPromiseErrorCodeValidationFailure = 2, +} NS_REFINED_FOR_SWIFT; + +NS_INLINE BOOL FBLPromiseErrorIsTimedOut(NSError *error) NS_SWIFT_UNAVAILABLE("") { + return error.domain == FBLPromiseErrorDomain && + error.code == FBLPromiseErrorCodeTimedOut; +} + +NS_INLINE BOOL FBLPromiseErrorIsValidationFailure(NSError *error) NS_SWIFT_UNAVAILABLE("") { + return error.domain == FBLPromiseErrorDomain && + error.code == FBLPromiseErrorCodeValidationFailure; +} + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromises.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromises.h new file mode 100644 index 0000000..2d90bad --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/FBLPromises.h @@ -0,0 +1,32 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise+All.h" +#import "FBLPromise+Always.h" +#import "FBLPromise+Any.h" +#import "FBLPromise+Async.h" +#import "FBLPromise+Await.h" +#import "FBLPromise+Catch.h" +#import "FBLPromise+Delay.h" +#import "FBLPromise+Do.h" +#import "FBLPromise+Race.h" +#import "FBLPromise+Recover.h" +#import "FBLPromise+Reduce.h" +#import "FBLPromise+Retry.h" +#import "FBLPromise+Then.h" +#import "FBLPromise+Timeout.h" +#import "FBLPromise+Validate.h" +#import "FBLPromise+Wrap.h" diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/PromisesObjC-umbrella.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/PromisesObjC-umbrella.h new file mode 100644 index 0000000..5b014a8 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Headers/PromisesObjC-umbrella.h @@ -0,0 +1,36 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "FBLPromise+All.h" +#import "FBLPromise+Always.h" +#import "FBLPromise+Any.h" +#import "FBLPromise+Async.h" +#import "FBLPromise+Await.h" +#import "FBLPromise+Catch.h" +#import "FBLPromise+Delay.h" +#import "FBLPromise+Do.h" +#import "FBLPromise+Race.h" +#import "FBLPromise+Recover.h" +#import "FBLPromise+Reduce.h" +#import "FBLPromise+Retry.h" +#import "FBLPromise+Testing.h" +#import "FBLPromise+Then.h" +#import "FBLPromise+Timeout.h" +#import "FBLPromise+Validate.h" +#import "FBLPromise+Wrap.h" +#import "FBLPromise.h" +#import "FBLPromiseError.h" +#import "FBLPromises.h" + +FOUNDATION_EXPORT double FBLPromisesVersionNumber; +FOUNDATION_EXPORT const unsigned char FBLPromisesVersionString[]; + diff --git a/plugins/2020.3569/iphone/FirebaseCore.framework/Info.plist b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Info.plist similarity index 54% rename from plugins/2020.3569/iphone/FirebaseCore.framework/Info.plist rename to src/ios/EmbeddedFrameworks/FBLPromises.framework/Info.plist index 4c82c3c..f6da681 100644 Binary files a/plugins/2020.3569/iphone/FirebaseCore.framework/Info.plist and b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Modules/module.modulemap new file mode 100644 index 0000000..7d485cd --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FBLPromises { + umbrella header "PromisesObjC-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworks/FBLPromises.framework/PrivateHeaders/FBLPromisePrivate.h b/src/ios/EmbeddedFrameworks/FBLPromises.framework/PrivateHeaders/FBLPromisePrivate.h new file mode 100644 index 0000000..7a132f2 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FBLPromises.framework/PrivateHeaders/FBLPromisePrivate.h @@ -0,0 +1,66 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise+Testing.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + Miscellaneous low-level private interfaces available to extend standard FBLPromise functionality. + */ +@interface FBLPromise() + +typedef void (^FBLPromiseOnFulfillBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseOnRejectBlock)(NSError *error) NS_SWIFT_UNAVAILABLE(""); +typedef id __nullable (^__nullable FBLPromiseChainedFulfillBlock)(Value __nullable value) + NS_SWIFT_UNAVAILABLE(""); +typedef id __nullable (^__nullable FBLPromiseChainedRejectBlock)(NSError *error) + NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise. + */ +- (instancetype)initPending NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a resolved promise. + + @param resolution An object to resolve the promise with: either a value or an error. + @return A new resolved promise. + */ +- (instancetype)initWithResolution:(nullable id)resolution NS_SWIFT_UNAVAILABLE(""); + +/** + Invokes `fulfill` and `reject` blocks on `queue` when the receiver gets either fulfilled or + rejected respectively. + */ +- (void)observeOnQueue:(dispatch_queue_t)queue + fulfill:(FBLPromiseOnFulfillBlock)onFulfill + reject:(FBLPromiseOnRejectBlock)onReject NS_SWIFT_UNAVAILABLE(""); + +/** + Returns a new promise which gets resolved with the return value of `chainedFulfill` or + `chainedReject` blocks respectively. The blocks are invoked when the receiver gets either + fulfilled or rejected. If `nil` is passed to either block arg, the returned promise is resolved + with the same resolution as the receiver. + */ +- (FBLPromise *)chainOnQueue:(dispatch_queue_t)queue + chainedFulfill:(FBLPromiseChainedFulfillBlock)chainedFulfill + chainedReject:(FBLPromiseChainedRejectBlock)chainedReject NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/FirebaseCore b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/FirebaseCore new file mode 100755 index 0000000..0d24238 Binary files /dev/null and b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/FirebaseCore differ diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIRApp.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIRApp.h new file mode 100644 index 0000000..f5578c6 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIRApp.h @@ -0,0 +1,127 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FIROptions; + +NS_ASSUME_NONNULL_BEGIN + +/** A block that takes a BOOL and has no return value. */ +typedef void (^FIRAppVoidBoolCallback)(BOOL success) NS_SWIFT_NAME(FirebaseAppVoidBoolCallback); + +/** + * The entry point of Firebase SDKs. + * + * Initialize and configure FIRApp using +[FIRApp configure] + * or other customized ways as shown below. + * + * The logging system has two modes: default mode and debug mode. In default mode, only logs with + * log level Notice, Warning and Error will be sent to device. In debug mode, all logs will be sent + * to device. The log levels that Firebase uses are consistent with the ASL log levels. + * + * Enable debug mode by passing the -FIRDebugEnabled argument to the application. You can add this + * argument in the application's Xcode scheme. When debug mode is enabled via -FIRDebugEnabled, + * further executions of the application will also be in debug mode. In order to return to default + * mode, you must explicitly disable the debug mode with the application argument -FIRDebugDisabled. + * + * It is also possible to change the default logging level in code by calling setLoggerLevel: on + * the FIRConfiguration interface. + */ +NS_SWIFT_NAME(FirebaseApp) +@interface FIRApp : NSObject + +/** + * Configures a default Firebase app. Raises an exception if any configuration step fails. The + * default app is named "__FIRAPP_DEFAULT". This method should be called after the app is launched + * and before using Firebase services. This method should be called from the main thread and + * contains synchronous file I/O (reading GoogleService-Info.plist from disk). + */ ++ (void)configure; + +/** + * Configures the default Firebase app with the provided options. The default app is named + * "__FIRAPP_DEFAULT". Raises an exception if any configuration step fails. This method should be + * called from the main thread. + * + * @param options The Firebase application options used to configure the service. + */ ++ (void)configureWithOptions:(FIROptions *)options NS_SWIFT_NAME(configure(options:)); + +/** + * Configures a Firebase app with the given name and options. Raises an exception if any + * configuration step fails. This method should be called from the main thread. + * + * @param name The application's name given by the developer. The name should should only contain + Letters, Numbers and Underscore. + * @param options The Firebase application options used to configure the services. + */ +// clang-format off ++ (void)configureWithName:(NSString *)name + options:(FIROptions *)options NS_SWIFT_NAME(configure(name:options:)); +// clang-format on + +/** + * Returns the default app, or nil if the default app does not exist. + */ ++ (nullable FIRApp *)defaultApp NS_SWIFT_NAME(app()); + +/** + * Returns a previously created FIRApp instance with the given name, or nil if no such app exists. + * This method is thread safe. + */ ++ (nullable FIRApp *)appNamed:(NSString *)name NS_SWIFT_NAME(app(name:)); + +/** + * Returns the set of all extant FIRApp instances, or nil if there are no FIRApp instances. This + * method is thread safe. + */ +@property(class, readonly, nullable) NSDictionary *allApps; + +/** + * Cleans up the current FIRApp, freeing associated data and returning its name to the pool for + * future use. This method is thread safe. + */ +- (void)deleteApp:(FIRAppVoidBoolCallback)completion; + +/** + * FIRApp instances should not be initialized directly. Call +[FIRApp configure], + * +[FIRApp configureWithOptions:], or +[FIRApp configureWithNames:options:] directly. + */ +- (instancetype)init NS_UNAVAILABLE; + +/** + * Gets the name of this app. + */ +@property(nonatomic, copy, readonly) NSString *name; + +/** + * Gets a copy of the options for this app. These are non-modifiable. + */ +@property(nonatomic, copy, readonly) FIROptions *options; + +/** + * Gets or sets whether automatic data collection is enabled for all products. Defaults to `YES` + * unless `FirebaseDataCollectionDefaultEnabled` is set to `NO` in your app's Info.plist. This value + * is persisted across runs of the app so that it can be set once when users have consented to + * collection. + */ +@property(nonatomic, readwrite, getter=isDataCollectionDefaultEnabled) + BOOL dataCollectionDefaultEnabled; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIRConfiguration.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIRConfiguration.h new file mode 100644 index 0000000..2b8e678 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIRConfiguration.h @@ -0,0 +1,45 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "FIRLoggerLevel.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * This interface provides global level properties that the developer can tweak. + */ +NS_SWIFT_NAME(FirebaseConfiguration) +@interface FIRConfiguration : NSObject + +/** Returns the shared configuration object. */ +@property(class, nonatomic, readonly) FIRConfiguration *sharedInstance NS_SWIFT_NAME(shared); + +/** + * Sets the logging level for internal Firebase logging. Firebase will only log messages + * that are logged at or below loggerLevel. The messages are logged both to the Xcode + * console and to the device's log. Note that if an app is running from AppStore, it will + * never log above FIRLoggerLevelNotice even if loggerLevel is set to a higher (more verbose) + * setting. + * + * @param loggerLevel The maximum logging level. The default level is set to FIRLoggerLevelNotice. + */ +- (void)setLoggerLevel:(FIRLoggerLevel)loggerLevel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIRLoggerLevel.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIRLoggerLevel.h new file mode 100644 index 0000000..dca3aa0 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIRLoggerLevel.h @@ -0,0 +1,38 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Note that importing GULLoggerLevel.h will lead to a non-modular header +// import error. + +/** + * The log levels used by internal logging. + */ +typedef NS_ENUM(NSInteger, FIRLoggerLevel) { + /** Error level, matches ASL_LEVEL_ERR. */ + FIRLoggerLevelError = 3, + /** Warning level, matches ASL_LEVEL_WARNING. */ + FIRLoggerLevelWarning = 4, + /** Notice level, matches ASL_LEVEL_NOTICE. */ + FIRLoggerLevelNotice = 5, + /** Info level, matches ASL_LEVEL_INFO. */ + FIRLoggerLevelInfo = 6, + /** Debug level, matches ASL_LEVEL_DEBUG. */ + FIRLoggerLevelDebug = 7, + /** Minimum log level. */ + FIRLoggerLevelMin = FIRLoggerLevelError, + /** Maximum log level. */ + FIRLoggerLevelMax = FIRLoggerLevelDebug +} NS_SWIFT_NAME(FirebaseLoggerLevel); diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIROptions.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIROptions.h new file mode 100644 index 0000000..afabbf1 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIROptions.h @@ -0,0 +1,126 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * This class provides constant fields of Google APIs. + */ +NS_SWIFT_NAME(FirebaseOptions) +@interface FIROptions : NSObject + +/** + * Returns the default options. The first time this is called it synchronously reads + * GoogleService-Info.plist from disk. + */ ++ (nullable FIROptions *)defaultOptions NS_SWIFT_NAME(defaultOptions()); + +/** + * An iOS API key used for authenticating requests from your app, e.g. + * @"AIzaSyDdVgKwhZl0sTTTLZ7iTmt1r3N2cJLnaDk", used to identify your app to Google servers. + */ +@property(nonatomic, copy, nullable) NSString *APIKey NS_SWIFT_NAME(apiKey); + +/** + * The bundle ID for the application. Defaults to `[[NSBundle mainBundle] bundleID]` when not set + * manually or in a plist. + */ +@property(nonatomic, copy) NSString *bundleID; + +/** + * The OAuth2 client ID for iOS application used to authenticate Google users, for example + * @"12345.apps.googleusercontent.com", used for signing in with Google. + */ +@property(nonatomic, copy, nullable) NSString *clientID; + +/** + * The tracking ID for Google Analytics, e.g. @"UA-12345678-1", used to configure Google Analytics. + */ +@property(nonatomic, copy, nullable) NSString *trackingID; + +/** + * The Project Number from the Google Developer's console, for example @"012345678901", used to + * configure Google Cloud Messaging. + */ +@property(nonatomic, copy) NSString *GCMSenderID NS_SWIFT_NAME(gcmSenderID); + +/** + * The Project ID from the Firebase console, for example @"abc-xyz-123". + */ +@property(nonatomic, copy, nullable) NSString *projectID; + +/** + * The Android client ID used in Google AppInvite when an iOS app has its Android version, for + * example @"12345.apps.googleusercontent.com". + */ +@property(nonatomic, copy, nullable) NSString *androidClientID; + +/** + * The Google App ID that is used to uniquely identify an instance of an app. + */ +@property(nonatomic, copy) NSString *googleAppID; + +/** + * The database root URL, e.g. @"http://abc-xyz-123.firebaseio.com". + */ +@property(nonatomic, copy, nullable) NSString *databaseURL; + +/** + * The URL scheme used to set up Durable Deep Link service. + */ +@property(nonatomic, copy, nullable) NSString *deepLinkURLScheme; + +/** + * The Google Cloud Storage bucket name, e.g. @"abc-xyz-123.storage.firebase.com". + */ +@property(nonatomic, copy, nullable) NSString *storageBucket; + +/** + * The App Group identifier to share data between the application and the application extensions. + * The App Group must be configured in the application and on the Apple Developer Portal. Default + * value `nil`. + */ +@property(nonatomic, copy, nullable) NSString *appGroupID; + +/** + * Initializes a customized instance of FIROptions from the file at the given plist file path. This + * will read the file synchronously from disk. + * For example, + * NSString *filePath = + * [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]; + * FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath]; + * Returns nil if the plist file does not exist or is invalid. + */ +- (nullable instancetype)initWithContentsOfFile:(NSString *)plistPath NS_DESIGNATED_INITIALIZER; + +/** + * Initializes a customized instance of FIROptions with required fields. Use the mutable properties + * to modify fields for configuring specific services. + */ +// clang-format off +- (instancetype)initWithGoogleAppID:(NSString *)googleAppID + GCMSenderID:(NSString *)GCMSenderID + NS_SWIFT_NAME(init(googleAppID:gcmSenderID:)) NS_DESIGNATED_INITIALIZER; +// clang-format on + +/** Unavailable. Please use `init(contentsOfFile:)` or `init(googleAppID:gcmSenderID:)` instead. */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIRVersion.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIRVersion.h new file mode 100644 index 0000000..7fcca4b --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FIRVersion.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +NS_SWIFT_NAME(FirebaseVersion()) +NSString* FIRFirebaseVersion(void); + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FirebaseCore-umbrella.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FirebaseCore-umbrella.h new file mode 100644 index 0000000..0f96d94 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FirebaseCore-umbrella.h @@ -0,0 +1,22 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "FIRApp.h" +#import "FIRConfiguration.h" +#import "FirebaseCore.h" +#import "FIRLoggerLevel.h" +#import "FIROptions.h" +#import "FIRVersion.h" + +FOUNDATION_EXPORT double FirebaseCoreVersionNumber; +FOUNDATION_EXPORT const unsigned char FirebaseCoreVersionString[]; + diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FirebaseCore.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FirebaseCore.h new file mode 100644 index 0000000..680d604 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Headers/FirebaseCore.h @@ -0,0 +1,21 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "FIRApp.h" +#import "FIRConfiguration.h" +#import "FIRLoggerLevel.h" +#import "FIROptions.h" +#import "FIRVersion.h" diff --git a/plugins/2020.3569/iphone/resources/Frameworks/FBLPromises.framework/Info.plist b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Info.plist similarity index 56% rename from plugins/2020.3569/iphone/resources/Frameworks/FBLPromises.framework/Info.plist rename to src/ios/EmbeddedFrameworks/FirebaseCore.framework/Info.plist index 293a827..da5db30 100644 Binary files a/plugins/2020.3569/iphone/resources/Frameworks/FBLPromises.framework/Info.plist and b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Modules/module.modulemap new file mode 100644 index 0000000..4c38b87 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FirebaseCore { + umbrella header "FirebaseCore-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRAppInternal.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRAppInternal.h new file mode 100644 index 0000000..0f3decf --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRAppInternal.h @@ -0,0 +1,155 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FIRComponentContainer; +@protocol FIRLibrary; + +/** + * The internal interface to FIRApp. This is meant for first-party integrators, who need to receive + * FIRApp notifications, log info about the success or failure of their configuration, and access + * other internal functionality of FIRApp. + * + * TODO(b/28296561): Restructure this header. + */ +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSInteger, FIRConfigType) { + FIRConfigTypeCore = 1, + FIRConfigTypeSDK = 2, +}; + +extern NSString *const kFIRDefaultAppName; +extern NSString *const kFIRAppReadyToConfigureSDKNotification; +extern NSString *const kFIRAppDeleteNotification; +extern NSString *const kFIRAppIsDefaultAppKey; +extern NSString *const kFIRAppNameKey; +extern NSString *const kFIRGoogleAppIDKey; +extern NSString *const kFirebaseCoreErrorDomain; + +/** + * The format string for the User Defaults key used for storing the data collection enabled flag. + * This includes formatting to append the Firebase App's name. + */ +extern NSString *const kFIRGlobalAppDataCollectionEnabledDefaultsKeyFormat; + +/** + * The plist key used for storing the data collection enabled flag. + */ +extern NSString *const kFIRGlobalAppDataCollectionEnabledPlistKey; + +/** + * A notification fired containing diagnostic information when SDK errors occur. + */ +extern NSString *const kFIRAppDiagnosticsNotification; + +/** @var FIRAuthStateDidChangeInternalNotification + @brief The name of the @c NSNotificationCenter notification which is posted when the auth state + changes (e.g. a new token has been produced, a user logs in or out). The object parameter of + the notification is a dictionary possibly containing the key: + @c FIRAuthStateDidChangeInternalNotificationTokenKey (the new access token.) If it does not + contain this key it indicates a sign-out event took place. + */ +extern NSString *const FIRAuthStateDidChangeInternalNotification; + +/** @var FIRAuthStateDidChangeInternalNotificationTokenKey + @brief A key present in the dictionary object parameter of the + @c FIRAuthStateDidChangeInternalNotification notification. The value associated with this + key will contain the new access token. + */ +extern NSString *const FIRAuthStateDidChangeInternalNotificationTokenKey; + +/** @var FIRAuthStateDidChangeInternalNotificationAppKey + @brief A key present in the dictionary object parameter of the + @c FIRAuthStateDidChangeInternalNotification notification. The value associated with this + key will contain the FIRApp associated with the auth instance. + */ +extern NSString *const FIRAuthStateDidChangeInternalNotificationAppKey; + +/** @var FIRAuthStateDidChangeInternalNotificationUIDKey + @brief A key present in the dictionary object parameter of the + @c FIRAuthStateDidChangeInternalNotification notification. The value associated with this + key will contain the new user's UID (or nil if there is no longer a user signed in). + */ +extern NSString *const FIRAuthStateDidChangeInternalNotificationUIDKey; + +@interface FIRApp () + +/** + * A flag indicating if this is the default app (has the default app name). + */ +@property(nonatomic, readonly) BOOL isDefaultApp; + +/* + * The container of interop SDKs for this app. + */ +@property(nonatomic) FIRComponentContainer *container; + +/** + * Checks if the default app is configured without trying to configure it. + */ ++ (BOOL)isDefaultAppConfigured; + +/** + * Registers a given third-party library with the given version number to be reported for + * analytics. + * + * @param name Name of the library. + * @param version Version of the library. + */ ++ (void)registerLibrary:(nonnull NSString *)name withVersion:(nonnull NSString *)version; + +/** + * Registers a given internal library to be reported for analytics. + * + * @param library Optional parameter for component registration. + * @param name Name of the library. + */ ++ (void)registerInternalLibrary:(nonnull Class)library + withName:(nonnull NSString *)name; + +/** + * Registers a given internal library with the given version number to be reported for + * analytics. This should only be used for non-Firebase libraries that have their own versioning + * scheme. + * + * @param library Optional parameter for component registration. + * @param name Name of the library. + * @param version Version of the library. + */ ++ (void)registerInternalLibrary:(nonnull Class)library + withName:(nonnull NSString *)name + withVersion:(nonnull NSString *)version; + +/** + * A concatenated string representing all the third-party libraries and version numbers. + */ ++ (NSString *)firebaseUserAgent; + +/** + * Can be used by the unit tests in eack SDK to reset FIRApp. This method is thread unsafe. + */ ++ (void)resetApps; + +/** + * Can be used by the unit tests in each SDK to set customized options. + */ +- (instancetype)initInstanceWithName:(NSString *)name options:(FIROptions *)options; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRComponent.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRComponent.h new file mode 100644 index 0000000..cb51ee7 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRComponent.h @@ -0,0 +1,91 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FIRApp; +@class FIRComponentContainer; + +NS_ASSUME_NONNULL_BEGIN + +/// Provides a system to clean up cached instances returned from the component system. +NS_SWIFT_NAME(ComponentLifecycleMaintainer) +@protocol FIRComponentLifecycleMaintainer +/// The associated app will be deleted, clean up any resources as they are about to be deallocated. +- (void)appWillBeDeleted:(FIRApp *)app; +@end + +typedef _Nullable id (^FIRComponentCreationBlock)(FIRComponentContainer *container, + BOOL *isCacheable) + NS_SWIFT_NAME(ComponentCreationBlock); + +@class FIRDependency; + +/// Describes the timing of instantiation. Note: new components should default to lazy unless there +/// is a strong reason to be eager. +typedef NS_ENUM(NSInteger, FIRInstantiationTiming) { + FIRInstantiationTimingLazy, + FIRInstantiationTimingAlwaysEager, + FIRInstantiationTimingEagerInDefaultApp +} NS_SWIFT_NAME(InstantiationTiming); + +/// A component that can be used from other Firebase SDKs. +NS_SWIFT_NAME(Component) +@interface FIRComponent : NSObject + +/// The protocol describing functionality provided from the Component. +@property(nonatomic, strong, readonly) Protocol *protocol; + +/// The timing of instantiation. +@property(nonatomic, readonly) FIRInstantiationTiming instantiationTiming; + +/// An array of dependencies for the component. +@property(nonatomic, copy, readonly) NSArray *dependencies; + +/// A block to instantiate an instance of the component with the appropriate dependencies. +@property(nonatomic, copy, readonly) FIRComponentCreationBlock creationBlock; + +// There's an issue with long NS_SWIFT_NAMES that causes compilation to fail, disable clang-format +// for the next two methods. +// clang-format off + +/// Creates a component with no dependencies that will be lazily initialized. ++ (instancetype)componentWithProtocol:(Protocol *)protocol + creationBlock:(FIRComponentCreationBlock)creationBlock +NS_SWIFT_NAME(init(_:creationBlock:)); + +/// Creates a component to be registered with the component container. +/// +/// @param protocol - The protocol describing functionality provided by the component. +/// @param instantiationTiming - When the component should be initialized. Use .lazy unless there's +/// a good reason to be instantiated earlier. +/// @param dependencies - Any dependencies the `implementingClass` has, optional or required. +/// @param creationBlock - A block to instantiate the component with a container, and if +/// @return A component that can be registered with the component container. ++ (instancetype)componentWithProtocol:(Protocol *)protocol + instantiationTiming:(FIRInstantiationTiming)instantiationTiming + dependencies:(NSArray *)dependencies + creationBlock:(FIRComponentCreationBlock)creationBlock +NS_SWIFT_NAME(init(_:instantiationTiming:dependencies:creationBlock:)); + +// clang-format on + +/// Unavailable. +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRComponentContainer.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRComponentContainer.h new file mode 100644 index 0000000..af18a93 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRComponentContainer.h @@ -0,0 +1,41 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#import + +NS_ASSUME_NONNULL_BEGIN + +/// A type-safe macro to retrieve a component from a container. This should be used to retrieve +/// components instead of using the container directly. +#define FIR_COMPONENT(type, container) \ + [FIRComponentType> instanceForProtocol:@protocol(type) inContainer:container] + +@class FIRApp; + +/// A container that holds different components that are registered via the +/// `registerAsComponentRegistrant:` call. These classes should conform to `FIRComponentRegistrant` +/// in order to properly register components for Core. +NS_SWIFT_NAME(FirebaseComponentContainer) +@interface FIRComponentContainer : NSObject + +/// A weak reference to the app that an instance of the container belongs to. +@property(nonatomic, weak, readonly) FIRApp *app; + +/// Unavailable. Use the `container` property on `FIRApp`. +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRComponentType.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRComponentType.h new file mode 100644 index 0000000..6f2aca7 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRComponentType.h @@ -0,0 +1,34 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FIRComponentContainer; + +NS_ASSUME_NONNULL_BEGIN + +/// Do not use directly. A placeholder type in order to provide a macro that will warn users of +/// mis-matched protocols. +NS_SWIFT_NAME(ComponentType) +@interface FIRComponentType<__covariant T> : NSObject + +/// Do not use directly. A factory method to retrieve an instance that provides a specific +/// functionality. ++ (T)instanceForProtocol:(Protocol *)protocol inContainer:(FIRComponentContainer *)container; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRCoreDiagnosticsConnector.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRCoreDiagnosticsConnector.h new file mode 100644 index 0000000..76c0c05 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRCoreDiagnosticsConnector.h @@ -0,0 +1,35 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FIRDiagnosticsData; +@class FIROptions; + +NS_ASSUME_NONNULL_BEGIN + +/** Connects FIRCore with the CoreDiagnostics library. */ +@interface FIRCoreDiagnosticsConnector : NSObject + +/** Logs FirebaseCore related data. + * + * @param options The options object containing data to log. + */ ++ (void)logCoreTelemetryWithOptions:(FIROptions *)options; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRDependency.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRDependency.h new file mode 100644 index 0000000..46e9b7e --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRDependency.h @@ -0,0 +1,45 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/// A dependency on a specific protocol's functionality. +NS_SWIFT_NAME(Dependency) +@interface FIRDependency : NSObject + +/// The protocol describing functionality being depended on. +@property(nonatomic, strong, readonly) Protocol *protocol; + +/// A flag to specify if the dependency is required or not. +@property(nonatomic, readonly) BOOL isRequired; + +/// Initializes a dependency that is required. Calls `initWithProtocol:isRequired` with `YES` for +/// the required parameter. +/// Creates a required dependency on the specified protocol's functionality. ++ (instancetype)dependencyWithProtocol:(Protocol *)protocol; + +/// Creates a dependency on the specified protocol's functionality and specify if it's required for +/// the class's functionality. ++ (instancetype)dependencyWithProtocol:(Protocol *)protocol isRequired:(BOOL)required; + +/// Use `dependencyWithProtocol:isRequired:` instead. +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRHeartbeatInfo.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRHeartbeatInfo.h new file mode 100644 index 0000000..bfff73e --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRHeartbeatInfo.h @@ -0,0 +1,39 @@ +// Copyright 2019 Google +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface FIRHeartbeatInfo : NSObject + +// Enum representing the different heartbeat codes. +typedef NS_ENUM(NSInteger, FIRHeartbeatInfoCode) { + FIRHeartbeatInfoCodeNone = 0, + FIRHeartbeatInfoCodeSDK = 1, + FIRHeartbeatInfoCodeGlobal = 2, + FIRHeartbeatInfoCodeCombined = 3, +}; + +/** + * Get heartbeat code requred for the sdk. + * @param heartbeatTag String representing the sdk heartbeat tag. + * @return Heartbeat code indicating whether or not an sdk/global heartbeat + * needs to be sent + */ ++ (FIRHeartbeatInfoCode)heartbeatCodeForTag:(NSString *)heartbeatTag; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRLibrary.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRLibrary.h new file mode 100644 index 0000000..9575e94 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRLibrary.h @@ -0,0 +1,44 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FIRLibrary_h +#define FIRLibrary_h + +#import + +@class FIRApp; +@class FIRComponent; + +NS_ASSUME_NONNULL_BEGIN + +/// Provide an interface to register a library for userAgent logging and availability to others. +NS_SWIFT_NAME(Library) +@protocol FIRLibrary + +/// Returns one or more FIRComponents that will be registered in +/// FIRApp and participate in dependency resolution and injection. ++ (NSArray *)componentsToRegister; + +@optional +/// Implement this method if the library needs notifications for lifecycle events. This method is +/// called when the developer calls `FirebaseApp.configure()`. ++ (void)configureWithApp:(FIRApp *)app; + +@end + +NS_ASSUME_NONNULL_END + +#endif /* FIRLibrary_h */ diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRLogger.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRLogger.h new file mode 100644 index 0000000..f71c20d --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIRLogger.h @@ -0,0 +1,148 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * The Firebase services used in Firebase logger. + */ +typedef NSString *const FIRLoggerService; + +extern FIRLoggerService kFIRLoggerAnalytics; +extern FIRLoggerService kFIRLoggerCrash; +extern FIRLoggerService kFIRLoggerCore; +extern FIRLoggerService kFIRLoggerMLKit; +extern FIRLoggerService kFIRLoggerPerf; +extern FIRLoggerService kFIRLoggerRemoteConfig; + +/** + * The key used to store the logger's error count. + */ +extern NSString *const kFIRLoggerErrorCountKey; + +/** + * The key used to store the logger's warning count. + */ +extern NSString *const kFIRLoggerWarningCountKey; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/** + * Enables or disables Analytics debug mode. + * If set to YES, the logging level for Analytics will be set to FIRLoggerLevelDebug. + * Enabling the debug mode has no effect if the app is running from App Store. + * (required) analytics debug mode flag. + */ +void FIRSetAnalyticsDebugMode(BOOL analyticsDebugMode); + +/** + * Changes the default logging level of FIRLoggerLevelNotice to a user-specified level. + * The default level cannot be set above FIRLoggerLevelNotice if the app is running from App Store. + * (required) log level (one of the FIRLoggerLevel enum values). + */ +void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel); + +/** + * Checks if the specified logger level is loggable given the current settings. + * (required) log level (one of the FIRLoggerLevel enum values). + * (required) whether or not this function is called from the Analytics component. + */ +BOOL FIRIsLoggableLevel(FIRLoggerLevel loggerLevel, BOOL analyticsComponent); + +/** + * Logs a message to the Xcode console and the device log. If running from AppStore, will + * not log any messages with a level higher than FIRLoggerLevelNotice to avoid log spamming. + * (required) log level (one of the FIRLoggerLevel enum values). + * (required) service name of type FIRLoggerService. + * (required) message code starting with "I-" which means iOS, followed by a capitalized + * three-character service identifier and a six digit integer message ID that is unique + * within the service. + * An example of the message code is @"I-COR000001". + * (required) message string which can be a format string. + * (optional) variable arguments list obtained from calling va_start, used when message is a format + * string. + */ +extern void FIRLogBasic(FIRLoggerLevel level, + FIRLoggerService service, + NSString *messageCode, + NSString *message, +// On 64-bit simulators, va_list is not a pointer, so cannot be marked nullable +// See: http://stackoverflow.com/q/29095469 +#if __LP64__ && TARGET_OS_SIMULATOR || TARGET_OS_OSX + va_list args_ptr +#else + va_list _Nullable args_ptr +#endif +); + +/** + * The following functions accept the following parameters in order: + * (required) service name of type FIRLoggerService. + * (required) message code starting from "I-" which means iOS, followed by a capitalized + * three-character service identifier and a six digit integer message ID that is unique + * within the service. + * An example of the message code is @"I-COR000001". + * See go/firebase-log-proposal for details. + * (required) message string which can be a format string. + * (optional) the list of arguments to substitute into the format string. + * Example usage: + * FIRLogError(kFIRLoggerCore, @"I-COR000001", @"Configuration of %@ failed.", app.name); + */ +extern void FIRLogError(FIRLoggerService service, NSString *messageCode, NSString *message, ...) + NS_FORMAT_FUNCTION(3, 4); +extern void FIRLogWarning(FIRLoggerService service, NSString *messageCode, NSString *message, ...) + NS_FORMAT_FUNCTION(3, 4); +extern void FIRLogNotice(FIRLoggerService service, NSString *messageCode, NSString *message, ...) + NS_FORMAT_FUNCTION(3, 4); +extern void FIRLogInfo(FIRLoggerService service, NSString *messageCode, NSString *message, ...) + NS_FORMAT_FUNCTION(3, 4); +extern void FIRLogDebug(FIRLoggerService service, NSString *messageCode, NSString *message, ...) + NS_FORMAT_FUNCTION(3, 4); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +@interface FIRLoggerWrapper : NSObject + +/** + * Objective-C wrapper for FIRLogBasic to allow weak linking to FIRLogger + * (required) log level (one of the FIRLoggerLevel enum values). + * (required) service name of type FIRLoggerService. + * (required) message code starting with "I-" which means iOS, followed by a capitalized + * three-character service identifier and a six digit integer message ID that is unique + * within the service. + * An example of the message code is @"I-COR000001". + * (required) message string which can be a format string. + * (optional) variable arguments list obtained from calling va_start, used when message is a format + * string. + */ + ++ (void)logWithLevel:(FIRLoggerLevel)level + withService:(FIRLoggerService)service + withCode:(NSString *)messageCode + withMessage:(NSString *)message + withArgs:(va_list)args; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIROptionsInternal.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIROptionsInternal.h new file mode 100644 index 0000000..8efc5fc --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FIROptionsInternal.h @@ -0,0 +1,115 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/** + * Keys for the strings in the plist file. + */ +extern NSString *const kFIRAPIKey; +extern NSString *const kFIRTrackingID; +extern NSString *const kFIRGoogleAppID; +extern NSString *const kFIRClientID; +extern NSString *const kFIRGCMSenderID; +extern NSString *const kFIRAndroidClientID; +extern NSString *const kFIRDatabaseURL; +extern NSString *const kFIRStorageBucket; +extern NSString *const kFIRBundleID; +extern NSString *const kFIRProjectID; + +/** + * Keys for the plist file name + */ +extern NSString *const kServiceInfoFileName; + +extern NSString *const kServiceInfoFileType; + +/** + * This header file exposes the initialization of FIROptions to internal use. + */ +@interface FIROptions () + +/** + * resetDefaultOptions and initInternalWithOptionsDictionary: are exposed only for unit tests. + */ ++ (void)resetDefaultOptions; + +/** + * Initializes the options with dictionary. The above strings are the keys of the dictionary. + * This is the designated initializer. + */ +- (instancetype)initInternalWithOptionsDictionary:(NSDictionary *)serviceInfoDictionary + NS_DESIGNATED_INITIALIZER; + +/** + * defaultOptions and defaultOptionsDictionary are exposed in order to be used in FIRApp and + * other first party services. + */ ++ (FIROptions *)defaultOptions; + ++ (NSDictionary *)defaultOptionsDictionary; + +/** + * Indicates whether or not Analytics collection was explicitly enabled via a plist flag or at + * runtime. + */ +@property(nonatomic, readonly) BOOL isAnalyticsCollectionExplicitlySet; + +/** + * Whether or not Analytics Collection was enabled. Analytics Collection is enabled unless + * explicitly disabled in GoogleService-Info.plist. + */ +@property(nonatomic, readonly) BOOL isAnalyticsCollectionEnabled; + +/** + * Whether or not Analytics Collection was completely disabled. If YES, then + * isAnalyticsCollectionEnabled will be NO. + */ +@property(nonatomic, readonly) BOOL isAnalyticsCollectionDeactivated; + +/** + * The version ID of the client library, e.g. @"1100000". + */ +@property(nonatomic, readonly, copy) NSString *libraryVersionID; + +/** + * The flag indicating whether this object was constructed with the values in the default plist + * file. + */ +@property(nonatomic) BOOL usingOptionsFromDefaultPlist; + +/** + * Whether or not Measurement was enabled. Measurement is enabled unless explicitly disabled in + * GoogleService-Info.plist. + */ +@property(nonatomic, readonly) BOOL isMeasurementEnabled; + +/** + * Whether or not Analytics was enabled in the developer console. + */ +@property(nonatomic, readonly) BOOL isAnalyticsEnabled; + +/** + * Whether or not SignIn was enabled in the developer console. + */ +@property(nonatomic, readonly) BOOL isSignInEnabled; + +/** + * Whether or not editing is locked. This should occur after FIROptions has been set on a FIRApp. + */ +@property(nonatomic, getter=isEditingLocked) BOOL editingLocked; + +@end diff --git a/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FirebaseCoreInternal.h b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FirebaseCoreInternal.h new file mode 100644 index 0000000..88d012b --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCore.framework/PrivateHeaders/FirebaseCoreInternal.h @@ -0,0 +1,28 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// An umbrella header, for any other libraries in this repo to access Firebase Public and Private +// headers. Any package manager complexity should be handled here. + +#import + +#import "FirebaseCore/Sources/Private/FIRAppInternal.h" +#import "FirebaseCore/Sources/Private/FIRComponent.h" +#import "FirebaseCore/Sources/Private/FIRComponentContainer.h" +#import "FirebaseCore/Sources/Private/FIRComponentType.h" +#import "FirebaseCore/Sources/Private/FIRDependency.h" +#import "FirebaseCore/Sources/Private/FIRHeartbeatInfo.h" +#import "FirebaseCore/Sources/Private/FIRLibrary.h" +#import "FirebaseCore/Sources/Private/FIRLogger.h" +#import "FirebaseCore/Sources/Private/FIROptionsInternal.h" diff --git a/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics b/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics new file mode 100755 index 0000000..db877e4 Binary files /dev/null and b/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics differ diff --git a/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/Headers/FIRCoreDiagnostics.h b/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/Headers/FIRCoreDiagnostics.h new file mode 100644 index 0000000..5076d6b --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/Headers/FIRCoreDiagnostics.h @@ -0,0 +1,18 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// There are no actual public headers in the lib. This is a dummy public header to prevent Cocoapods +// from adding all internal headers as public. diff --git a/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/Headers/FirebaseCoreDiagnostics-umbrella.h b/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/Headers/FirebaseCoreDiagnostics-umbrella.h new file mode 100644 index 0000000..a27569f --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/Headers/FirebaseCoreDiagnostics-umbrella.h @@ -0,0 +1,17 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "FIRCoreDiagnostics.h" + +FOUNDATION_EXPORT double FirebaseCoreDiagnosticsVersionNumber; +FOUNDATION_EXPORT const unsigned char FirebaseCoreDiagnosticsVersionString[]; + diff --git a/plugins/2020.3569/iphone/FirebaseInstallations.framework/Info.plist b/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/Info.plist similarity index 52% rename from plugins/2020.3569/iphone/FirebaseInstallations.framework/Info.plist rename to src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/Info.plist index 26f2159..0195dd3 100644 Binary files a/plugins/2020.3569/iphone/FirebaseInstallations.framework/Info.plist and b/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/Modules/module.modulemap new file mode 100644 index 0000000..d9cad8b --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseCoreDiagnostics.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FirebaseCoreDiagnostics { + umbrella header "FirebaseCoreDiagnostics-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/FirebaseInstallations b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/FirebaseInstallations new file mode 100755 index 0000000..3d4147d Binary files /dev/null and b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/FirebaseInstallations differ diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FIRInstallations.h b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FIRInstallations.h new file mode 100644 index 0000000..fdb56c4 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FIRInstallations.h @@ -0,0 +1,123 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FIRApp; +@class FIRInstallationsAuthTokenResult; + +NS_ASSUME_NONNULL_BEGIN + +/** A notification with this name is sent each time an installation is created or deleted. */ +FOUNDATION_EXPORT const NSNotificationName FIRInstallationIDDidChangeNotification + NS_SWIFT_NAME(InstallationIDDidChange); +/** `userInfo` key for the `FirebaseApp.name` in `FIRInstallationIDDidChangeNotification`. */ +FOUNDATION_EXPORT NSString *const kFIRInstallationIDDidChangeNotificationAppNameKey + NS_SWIFT_NAME(InstallationIDDidChangeAppNameKey); + +/** + * An installation ID handler block. + * @param identifier The installation ID string if exists or `nil` otherwise. + * @param error The error when `identifier == nil` or `nil` otherwise. + */ +typedef void (^FIRInstallationsIDHandler)(NSString *__nullable identifier, + NSError *__nullable error) + NS_SWIFT_NAME(InstallationsIDHandler); + +/** + * An authorization token handler block. + * @param tokenResult An instance of `InstallationsAuthTokenResult` in case of success or `nil` + * otherwise. + * @param error The error when `tokenResult == nil` or `nil` otherwise. + */ +typedef void (^FIRInstallationsTokenHandler)( + FIRInstallationsAuthTokenResult *__nullable tokenResult, NSError *__nullable error) + NS_SWIFT_NAME(InstallationsTokenHandler); + +/** + * The class provides API for Firebase Installations. + * Each configured `FirebaseApp` has a corresponding single instance of `Installations`. + * An instance of the class provides access to the installation info for the `FirebaseApp` as well + * as the ability to delete it. A Firebase Installation is unique by `FirebaseApp.name` and + * `FirebaseApp.options.googleAppID` . + */ +NS_SWIFT_NAME(Installations) +@interface FIRInstallations : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +/** + * Returns a default instance of `Installations`. + * @returns An instance of `Installations` for `FirebaseApp.defaultApp(). + * @throw Throws an exception if the default app is not configured yet or required `FirebaseApp` + * options are missing. + */ ++ (FIRInstallations *)installations NS_SWIFT_NAME(installations()); + +/** + * Returns an instance of `Installations` for an application. + * @param application A configured `FirebaseApp` instance. + * @returns An instance of `Installations` corresponding to the passed application. + * @throw Throws an exception if required `FirebaseApp` options are missing. + */ ++ (FIRInstallations *)installationsWithApp:(FIRApp *)application NS_SWIFT_NAME(installations(app:)); + +/** + * The method creates or retrieves an installation ID. The installation ID is a stable identifier + * that uniquely identifies the app instance. NOTE: If the application already has an existing + * FirebaseInstanceID then the InstanceID identifier will be used. + * @param completion A completion handler which is invoked when the operation completes. See + * `InstallationsIDHandler` for additional details. + */ +- (void)installationIDWithCompletion:(FIRInstallationsIDHandler)completion; + +/** + * Retrieves (locally if it exists or from the server) a valid installation auth token. An existing + * token may be invalidated or expired, so it is recommended to fetch the installation auth token + * before each server request. The method does the same as `Installations.authTokenForcingRefresh(:, + * completion:)` with forcing refresh `NO`. + * @param completion A completion handler which is invoked when the operation completes. See + * `InstallationsTokenHandler` for additional details. + */ +- (void)authTokenWithCompletion:(FIRInstallationsTokenHandler)completion; + +/** + * Retrieves (locally or from the server depending on `forceRefresh` value) a valid installation + * auth token. An existing token may be invalidated or expire, so it is recommended to fetch the + * installation auth token before each server request. This method should be used with `forceRefresh + * == YES` when e.g. a request with the previously fetched installation auth token failed with "Not + * Authorized" error. + * @param forceRefresh If `YES` then the locally cached installation auth token will be ignored and + * a new one will be requested from the server. If `NO`, then the locally cached installation auth + * token will be returned if exists and has not expired yet. + * @param completion A completion handler which is invoked when the operation completes. See + * `InstallationsTokenHandler` for additional details. + */ +- (void)authTokenForcingRefresh:(BOOL)forceRefresh + completion:(FIRInstallationsTokenHandler)completion; + +/** + * Deletes all the installation data including the unique identifier, auth tokens and + * all related data on the server side. A network connection is required for the method to + * succeed. If fails, the existing installation data remains untouched. + * @param completion A completion handler which is invoked when the operation completes. `error == + * nil` indicates success. + */ +- (void)deleteWithCompletion:(void (^)(NSError *__nullable error))completion; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FIRInstallationsAuthTokenResult.h b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FIRInstallationsAuthTokenResult.h new file mode 100644 index 0000000..501ac4e --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FIRInstallationsAuthTokenResult.h @@ -0,0 +1,33 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** The class represents a result of the installation auth token request. */ +NS_SWIFT_NAME(InstallationsAuthTokenResult) +@interface FIRInstallationsAuthTokenResult : NSObject + +/** The installation auth token string. */ +@property(nonatomic, readonly) NSString *authToken; + +/** The installation auth token expiration date. */ +@property(nonatomic, readonly) NSDate *expirationDate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FIRInstallationsErrors.h b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FIRInstallationsErrors.h new file mode 100644 index 0000000..d0c3b99 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FIRInstallationsErrors.h @@ -0,0 +1,34 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +extern NSString *const kFirebaseInstallationsErrorDomain; + +typedef NS_ENUM(NSUInteger, FIRInstallationsErrorCode) { + /** Unknown error. See `userInfo` for details. */ + FIRInstallationsErrorCodeUnknown = 0, + + /** Keychain error. See `userInfo` for details. */ + FIRInstallationsErrorCodeKeychain = 1, + + /** Server unreachable. A network error or server is unavailable. See `userInfo` for details. */ + FIRInstallationsErrorCodeServerUnreachable = 2, + + /** FirebaseApp configuration issues e.g. invalid GMP-App-ID, etc. See `userInfo` for details. */ + FIRInstallationsErrorCodeInvalidConfiguration = 3, + +} NS_SWIFT_NAME(InstallationsErrorCode); diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FirebaseInstallations-umbrella.h b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FirebaseInstallations-umbrella.h new file mode 100644 index 0000000..431ef45 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FirebaseInstallations-umbrella.h @@ -0,0 +1,20 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "FirebaseInstallations.h" +#import "FIRInstallations.h" +#import "FIRInstallationsAuthTokenResult.h" +#import "FIRInstallationsErrors.h" + +FOUNDATION_EXPORT double FirebaseInstallationsVersionNumber; +FOUNDATION_EXPORT const unsigned char FirebaseInstallationsVersionString[]; + diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FirebaseInstallations.h b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FirebaseInstallations.h new file mode 100644 index 0000000..8a9b3c1 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Headers/FirebaseInstallations.h @@ -0,0 +1,19 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "FIRInstallations.h" +#import "FIRInstallationsAuthTokenResult.h" +#import "FIRInstallationsErrors.h" diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Info.plist b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Info.plist new file mode 100644 index 0000000..ce1cfff Binary files /dev/null and b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Modules/module.modulemap new file mode 100644 index 0000000..f6e2a29 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseInstallations.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FirebaseInstallations { + umbrella header "FirebaseInstallations-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/FirebaseInstanceID b/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/FirebaseInstanceID new file mode 100755 index 0000000..1ef9610 Binary files /dev/null and b/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/FirebaseInstanceID differ diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h b/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h new file mode 100644 index 0000000..4f5a662 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h @@ -0,0 +1,327 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class FIRInstanceIDResult; +/** + * @memberof FIRInstanceID + * + * The scope to be used when fetching/deleting a token for Firebase Messaging. + */ +FOUNDATION_EXPORT NSString *const kFIRInstanceIDScopeFirebaseMessaging + NS_SWIFT_NAME(InstanceIDScopeFirebaseMessaging) DEPRECATED_ATTRIBUTE; + +#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 +/** + * Called when the system determines that tokens need to be refreshed. + * This method is also called if Instance ID has been reset in which + * case, tokens and FCM topic subscriptions also need to be refreshed. + * + * Instance ID service will throttle the refresh event across all devices + * to control the rate of token updates on application servers. + */ +FOUNDATION_EXPORT const NSNotificationName kFIRInstanceIDTokenRefreshNotification + NS_SWIFT_NAME(InstanceIDTokenRefresh) DEPRECATED_ATTRIBUTE; +#else +/** + * Called when the system determines that tokens need to be refreshed. + * This method is also called if Instance ID has been reset in which + * case, tokens and FCM topic subscriptions also need to be refreshed. + * + * Instance ID service will throttle the refresh event across all devices + * to control the rate of token updates on application servers. + */ +FOUNDATION_EXPORT NSString *const kFIRInstanceIDTokenRefreshNotification + NS_SWIFT_NAME(InstanceIDTokenRefreshNotification) DEPRECATED_ATTRIBUTE; +#endif // defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the InstanceID token returns. If + * the call fails we return the appropriate `error code` as described below. + * + * @param token The valid token as returned by InstanceID backend. + * + * @param error The error describing why generating a new token + * failed. See the error codes below for a more detailed + * description. + */ +typedef void (^FIRInstanceIDTokenHandler)(NSString *__nullable token, NSError *__nullable error) + NS_SWIFT_NAME(InstanceIDTokenHandler); + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the InstanceID `deleteToken` returns. If + * the call fails we return the appropriate `error code` as described below + * + * @param error The error describing why deleting the token failed. + * See the error codes below for a more detailed description. + */ +typedef void (^FIRInstanceIDDeleteTokenHandler)(NSError *error) + NS_SWIFT_NAME(InstanceIDDeleteTokenHandler); + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the app identity is created. If the + * identity wasn't created for some reason we return the appropriate error code. + * + * @param identity A valid identity for the app instance, nil if there was an error + * while creating an identity. + * @param error The error if fetching the identity fails else nil. + */ +typedef void (^FIRInstanceIDHandler)(NSString *__nullable identity, NSError *__nullable error) + NS_SWIFT_NAME(InstanceIDHandler); + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the app identity and all the tokens associated + * with it are deleted. Returns a valid error object in case of failure else nil. + * + * @param error The error if deleting the identity and all the tokens associated with + * it fails else nil. + */ +typedef void (^FIRInstanceIDDeleteHandler)(NSError *__nullable error) + NS_SWIFT_NAME(InstanceIDDeleteHandler); + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the app identity and token are fetched. If the + * identity wasn't created for some reason we return the appropriate error code. + * + * @param result The result containing an identity for the app instance and a valid token, + * nil if there was an error while creating the result. + * @param error The error if fetching the identity or token fails else nil. + */ +typedef void (^FIRInstanceIDResultHandler)(FIRInstanceIDResult *__nullable result, + NSError *__nullable error) + NS_SWIFT_NAME(InstanceIDResultHandler); + +/** + * Public errors produced by InstanceID. + */ +typedef NS_ENUM(NSUInteger, FIRInstanceIDError) { + // Http related errors. + + /// Unknown error. + FIRInstanceIDErrorUnknown = 0, + + /// Auth Error -- GCM couldn't validate request from this client. + FIRInstanceIDErrorAuthentication = 1, + + /// NoAccess -- InstanceID service cannot be accessed. + FIRInstanceIDErrorNoAccess = 2, + + /// Timeout -- Request to InstanceID backend timed out. + FIRInstanceIDErrorTimeout = 3, + + /// Network -- No network available to reach the servers. + FIRInstanceIDErrorNetwork = 4, + + /// OperationInProgress -- Another similar operation in progress, + /// bailing this one. + FIRInstanceIDErrorOperationInProgress = 5, + + /// InvalidRequest -- Some parameters of the request were invalid. + FIRInstanceIDErrorInvalidRequest = 7, +} NS_SWIFT_NAME(InstanceIDError); + +/** + * A class contains the results of InstanceID and token query. + */ +NS_SWIFT_NAME(InstanceIDResult) +__deprecated_msg("FIRInstanceIDResult is deprecated, please use FIRInstallations " + "for app instance identifier handling and use FIRMessaging for " + "FCM registration token handling.") @interface FIRInstanceIDResult + : NSObject + +/** + * An instanceID uniquely identifies the app instance. + */ +@property(nonatomic, readonly, copy) NSString *instanceID; + +/* + * Returns a Firebase Messaging scoped token for the firebase app. + */ +@property(nonatomic, readonly, copy) NSString *token; + +@end + +/** + * Instance ID provides a unique identifier for each app instance and a mechanism + * to authenticate and authorize actions (for example, sending an FCM message). + * + * Once an InstanceID is generated, the library periodically sends information about the + * application and the device where it's running to the Firebase backend. To stop this. see + * `[FIRInstanceID deleteIDWithHandler:]`. + * + * Instance ID is long lived but, may be reset if the device is not used for + * a long time or the Instance ID service detects a problem. + * If Instance ID is reset, the app will be notified via + * `kFIRInstanceIDTokenRefreshNotification`. + * + * If the Instance ID has become invalid, the app can request a new one and + * send it to the app server. + * To prove ownership of Instance ID and to allow servers to access data or + * services associated with the app, call + * `[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler]`. + */ +NS_SWIFT_NAME(InstanceID) +__deprecated_msg("FIRInstanceID is deprecated, please use FIRInstallations for installation " + "identifier handling and use FIRMessaging for FCM registration token handling.") + @interface FIRInstanceID : NSObject + +/** + * FIRInstanceID. + * + * @return A shared instance of FIRInstanceID. + */ ++ (instancetype)instanceID NS_SWIFT_NAME(instanceID()); + +/** + * Unavailable. Use +instanceID instead. + */ +- (instancetype)init __attribute__((unavailable("Use +instanceID instead."))); + +#pragma mark - Tokens + +/** + * Returns a result of app instance identifier InstanceID and a Firebase Messaging scoped token. + * param handler The callback handler invoked when an app instanceID and a default token + * are generated and returned. If instanceID and token fetching fail for some + * reason the callback is invoked with nil `result` and the appropriate error. + */ +- (void)instanceIDWithHandler:(FIRInstanceIDResultHandler)handler + __deprecated_msg("Use `Installations.installationID(completion:)` to get the app instance " + "identifier instead. " + "Use `Messaging.token(completion:)` to get FCM registration token instead."); + +/** + * Returns a token that authorizes an Entity (example: cloud service) to perform + * an action on behalf of the application identified by Instance ID. + * + * This is similar to an OAuth2 token except, it applies to the + * application instance instead of a user. + * + * This is an asynchronous call. If the token fetching fails for some reason + * we invoke the completion callback with nil `token` and the appropriate + * error. + * + * This generates an Instance ID if it does not exist yet, which starts periodically sending + * information to the Firebase backend (see `[FIRInstanceID getIDWithHandler:]`). + * + * Note, you can only have one `token` or `deleteToken` call for a given + * authorizedEntity and scope at any point of time. Making another such call with the + * same authorizedEntity and scope before the last one finishes will result in an + * error with code `OperationInProgress`. + * + * @see FIRInstanceID deleteTokenWithAuthorizedEntity:scope:handler: + * + * @param authorizedEntity Entity authorized by the token. + * @param scope Action authorized for authorizedEntity. + * @param options The extra options to be sent with your token request. The + * value for the `apns_token` should be the NSData object + * passed to the UIApplicationDelegate's + * `didRegisterForRemoteNotificationsWithDeviceToken` method. + * The value for `apns_sandbox` should be a boolean (or an + * NSNumber representing a BOOL in Objective-C) set to true if + * your app is a debug build, which means that the APNs + * device token is for the sandbox environment. It should be + * set to false otherwise. If the `apns_sandbox` key is not + * provided, an automatically-detected value shall be used. + * @param handler The callback handler which is invoked when the token is + * successfully fetched. In case of success a valid `token` and + * `nil` error are returned. In case of any error the `token` + * is nil and a valid `error` is returned. The valid error + * codes have been documented above. + */ +- (void)tokenWithAuthorizedEntity:(NSString *)authorizedEntity + scope:(NSString *)scope + options:(nullable NSDictionary *)options + handler:(FIRInstanceIDTokenHandler)handler + __deprecated_msg("Use Messaging.token(completion:) instead."); + +/** + * Revokes access to a scope (action) for an entity previously + * authorized by `[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler]`. + * + * This is an asynchronous call. Call this on the main thread since InstanceID lib + * is not thread safe. In case token deletion fails for some reason we invoke the + * `handler` callback passed in with the appropriate error code. + * + * Note, you can only have one `token` or `deleteToken` call for a given + * authorizedEntity and scope at a point of time. Making another such call with the + * same authorizedEntity and scope before the last one finishes will result in an error + * with code `OperationInProgress`. + * + * @param authorizedEntity Entity that must no longer have access. + * @param scope Action that entity is no longer authorized to perform. + * @param handler The handler that is invoked once the unsubscribe call ends. + * In case of error an appropriate error object is returned + * else error is nil. + */ +- (void)deleteTokenWithAuthorizedEntity:(NSString *)authorizedEntity + scope:(NSString *)scope + handler:(FIRInstanceIDDeleteTokenHandler)handler + __deprecated_msg("Use `Messaging.deleteToken(completion:)` instead."); + +#pragma mark - Identity + +/** + * Asynchronously fetch a stable identifier that uniquely identifies the app + * instance. If the identifier has been revoked or has expired, this method will + * return a new identifier. + * + * Once an InstanceID is generated, the library periodically sends information about the + * application and the device where it's running to the Firebase backend. To stop this. see + * `[FIRInstanceID deleteIDWithHandler:]`. + * + * @param handler The handler to invoke once the identifier has been fetched. + * In case of error an appropriate error object is returned else + * a valid identifier is returned and a valid identifier for the + * application instance. + */ +- (void)getIDWithHandler:(FIRInstanceIDHandler)handler + NS_SWIFT_NAME(getID(handler:)) + __deprecated_msg("Use `Installations.installationID(completion:)` instead."); + +/** + * Resets Instance ID and revokes all tokens. + * + * This method also triggers a request to fetch a new Instance ID and Firebase Messaging scope + * token. Please listen to kFIRInstanceIDTokenRefreshNotification when the new ID and token are + * ready. + * + * This stops the periodic sending of data to the Firebase backend that began when the Instance ID + * was generated. No more data is sent until another library calls Instance ID internally again + * (like FCM, RemoteConfig or Analytics) or user explicitly calls Instance ID APIs to get an + * Instance ID and token again. + */ +- (void)deleteIDWithHandler:(FIRInstanceIDDeleteHandler)handler NS_SWIFT_NAME(deleteID(handler:)) + __deprecated_msg("Use `Installations.delete(completion:)` instead. " + "Also check `Messaging.deleteData(completion:)`" + "if you want to delete FCM registration token."); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID-umbrella.h b/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID-umbrella.h new file mode 100644 index 0000000..90ba5de --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID-umbrella.h @@ -0,0 +1,18 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "FirebaseInstanceID.h" +#import "FIRInstanceID.h" + +FOUNDATION_EXPORT double FirebaseInstanceIDVersionNumber; +FOUNDATION_EXPORT const unsigned char FirebaseInstanceIDVersionString[]; + diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h b/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h new file mode 100644 index 0000000..78c9ef1 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h @@ -0,0 +1,17 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "FIRInstanceID.h" diff --git a/plugins/2020.3569/iphone/FirebaseMessaging.framework/Info.plist b/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Info.plist similarity index 53% rename from plugins/2020.3569/iphone/FirebaseMessaging.framework/Info.plist rename to src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Info.plist index e87dcb2..f4654ae 100644 Binary files a/plugins/2020.3569/iphone/FirebaseMessaging.framework/Info.plist and b/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Modules/module.modulemap new file mode 100644 index 0000000..ff5248f --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseInstanceID.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FirebaseInstanceID { + umbrella header "FirebaseInstanceID-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/FirebaseMessaging b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/FirebaseMessaging new file mode 100755 index 0000000..50705ab Binary files /dev/null and b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/FirebaseMessaging differ diff --git a/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Headers/FIRMessaging.h b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Headers/FIRMessaging.h new file mode 100644 index 0000000..0a22dae --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Headers/FIRMessaging.h @@ -0,0 +1,398 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * @related FIRMessaging + * + * The completion handler invoked when the registration token returns. + * If the call fails we return the appropriate `error code`, described by + * `FIRMessagingError`. + * + * @param FCMToken The valid registration token returned by FCM. + * @param error The error describing why a token request failed. The error code + * will match a value from the FIRMessagingError enumeration. + */ +typedef void (^FIRMessagingFCMTokenFetchCompletion)(NSString *_Nullable FCMToken, + NSError *_Nullable error) + NS_SWIFT_NAME(MessagingFCMTokenFetchCompletion); + +/** + * @related FIRMessaging + * + * The completion handler invoked when the registration token deletion request is + * completed. If the call fails we return the appropriate `error code`, described + * by `FIRMessagingError`. + * + * @param error The error describing why a token deletion failed. The error code + * will match a value from the FIRMessagingError enumeration. + */ +typedef void (^FIRMessagingDeleteFCMTokenCompletion)(NSError *_Nullable error) + NS_SWIFT_NAME(MessagingDeleteFCMTokenCompletion); + +/** + * Callback to invoke once the HTTP call to FIRMessaging backend for updating + * subscription finishes. + * + * @param error The error which occurred while updating the subscription topic + * on the FIRMessaging server. This will be nil in case the operation + * was successful, or if the operation was cancelled. + */ +typedef void (^FIRMessagingTopicOperationCompletion)(NSError *_Nullable error); + +/** + * Notification sent when the FCM registration token has been refreshed. Please use the + * FIRMessaging delegate method `messaging:didReceiveRegistrationToken:` to receive current and + * updated tokens. + */ +FOUNDATION_EXPORT const NSNotificationName FIRMessagingRegistrationTokenRefreshedNotification + NS_SWIFT_NAME(MessagingRegistrationTokenRefreshed); + +/** + * @enum FIRMessagingError + */ +typedef NS_ENUM(NSUInteger, FIRMessagingError) { + /// Unknown error. + FIRMessagingErrorUnknown = 0, + + /// FIRMessaging couldn't validate request from this client. + FIRMessagingErrorAuthentication = 1, + + /// InstanceID service cannot be accessed. + FIRMessagingErrorNoAccess = 2, + + /// Request to InstanceID backend timed out. + FIRMessagingErrorTimeout = 3, + + /// No network available to reach the servers. + FIRMessagingErrorNetwork = 4, + + /// Another similar operation in progress, bailing this one. + FIRMessagingErrorOperationInProgress = 5, + + /// Some parameters of the request were invalid. + FIRMessagingErrorInvalidRequest = 7, + + /// Topic name is invalid for subscription/unsubscription. + FIRMessagingErrorInvalidTopicName = 8, + +} NS_SWIFT_NAME(MessagingError); + +/// Status for the downstream message received by the app. +typedef NS_ENUM(NSInteger, FIRMessagingMessageStatus) { + /// Unknown status. + FIRMessagingMessageStatusUnknown, + /// New downstream message received by the app. + FIRMessagingMessageStatusNew, +} NS_SWIFT_NAME(MessagingMessageStatus); + +/** + * The APNs token type for the app. If the token type is set to `UNKNOWN` + * Firebase Messaging will implicitly try to figure out what the actual token type + * is from the provisioning profile. + * Unless you really need to specify the type, you should use the `APNSToken` + * property instead. + */ +typedef NS_ENUM(NSInteger, FIRMessagingAPNSTokenType) { + /// Unknown token type. + FIRMessagingAPNSTokenTypeUnknown, + /// Sandbox token type. + FIRMessagingAPNSTokenTypeSandbox, + /// Production token type. + FIRMessagingAPNSTokenTypeProd, +} NS_SWIFT_NAME(MessagingAPNSTokenType); + +/// Information about a downstream message received by the app. +NS_SWIFT_NAME(MessagingMessageInfo) +@interface FIRMessagingMessageInfo : NSObject + +/// The status of the downstream message +@property(nonatomic, readonly, assign) FIRMessagingMessageStatus status; + +@end + +@class FIRMessaging; +@class FIRMessagingExtensionHelper; + +/** + * A protocol to handle token update or data message delivery from FCM. + * + */ +NS_SWIFT_NAME(MessagingDelegate) +@protocol FIRMessagingDelegate + +@optional +/// This method will be called once a token is available, or has been refreshed. Typically it +/// will be called once per app start, but may be called more often, if token is invalidated or +/// updated. In this method, you should perform operations such as: +/// +/// * Uploading the FCM token to your application server, so targeted notifications can be sent. +/// +/// * Subscribing to any topics. +- (void)messaging:(FIRMessaging *)messaging + didReceiveRegistrationToken:(nullable NSString *)fcmToken + NS_SWIFT_NAME(messaging(_:didReceiveRegistrationToken:)); +@end + +/** + * Firebase Messaging lets you reliably deliver messages at no cost. + * + * To send or receive messages, the app must get a + * registration token from FIRInstanceID. This token authorizes an + * app server to send messages to an app instance. + * + * In order to receive FIRMessaging messages, declare + * `application:didReceiveRemoteNotification::fetchCompletionHandler:`. + */ +NS_SWIFT_NAME(Messaging) +@interface FIRMessaging : NSObject + +/** + * Delegate to handle FCM token refreshes, and remote data messages received via FCM direct channel. + */ +@property(nonatomic, weak, nullable) id delegate; + +/** + * FIRMessaging + * + * @return An instance of FIRMessaging. + */ ++ (instancetype)messaging NS_SWIFT_NAME(messaging()); + +/** + * FIRMessagingExtensionHelper + * + * Use FIRMessagingExtensionHelper to populate rich UI contents for your notifications. + * e.g. If an image URL is set in your notification payload or on the console, call + * FIRMessagingExtensionHelper API to render it on your notification. + * + * @return An instance of FIRMessagingExtensionHelper that handles the extensions API. + */ ++ (FIRMessagingExtensionHelper *)extensionHelper NS_SWIFT_NAME(serviceExtension()) + NS_AVAILABLE(10.14, 10.0); + +/** + * Unavailable. Use +messaging instead. + */ +- (instancetype)init __attribute__((unavailable("Use +messaging instead."))); + +#pragma mark - APNs + +/** + * This property is used to set the APNs Token received by the application delegate. + * + * FIRMessaging uses method swizzling to ensure that the APNs token is set + * automatically. However, if you have disabled swizzling by setting + * `FirebaseAppDelegateProxyEnabled` to `NO` in your app's + * Info.plist, you should manually set the APNs token in your application + * delegate's `-application:didRegisterForRemoteNotificationsWithDeviceToken:` + * method. + * + * If you would like to set the type of the APNs token, rather than relying on + * automatic detection, see: `-setAPNSToken:type:`. + */ +@property(nonatomic, copy, nullable) NSData *APNSToken NS_SWIFT_NAME(apnsToken); + +/** + * Set APNs token for the application. This APNs token will be used to register + * with Firebase Messaging using `FCMToken` or + * `tokenWithAuthorizedEntity:scope:options:handler`. + * + * @param apnsToken The APNs token for the application. + * @param type The type of APNs token. Debug builds should use + * FIRMessagingAPNSTokenTypeSandbox. Alternatively, you can supply + * FIRMessagingAPNSTokenTypeUnknown to have the type automatically + * detected based on your provisioning profile. + */ +- (void)setAPNSToken:(NSData *)apnsToken type:(FIRMessagingAPNSTokenType)type; + +#pragma mark - FCM Tokens + +/** + * Is Firebase Messaging token auto generation enabled? If this flag is disabled, Firebase + * Messaging will not generate token automatically for message delivery. + * + * If this flag is disabled, Firebase Messaging does not generate new tokens automatically for + * message delivery. If this flag is enabled, FCM generates a registration token on application + * start when there is no existing valid token and periodically refreshes the token and sends + * data to Firebase backend. + * + * This setting is persisted, and is applied on future invocations of your application. Once + * explicitly set, it overrides any settings in your Info.plist. + * + * By default, FCM automatic initialization is enabled. If you need to change the + * default (for example, because you want to prompt the user before getting token) + * set FirebaseMessagingAutoInitEnabled to false in your application's Info.plist. + */ +@property(nonatomic, assign, getter=isAutoInitEnabled) BOOL autoInitEnabled; + +/** + * The FCM registration token is used to identify this device so that FCM can send notifications to + * it. It is associated with your APNs token when the APNs token is supplied, so messages sent to + * the FCM token will be delivered over APNs. + * + * The FCM registration token is sometimes refreshed automatically. In your FIRMessaging delegate, + * the delegate method `messaging:didReceiveRegistrationToken:` will be called once a token is + * available, or has been refreshed. Typically it should be called once per app start, but + * may be called more often if the token is invalidated or updated. + * + * Once you have an FCM registration token, you should send it to your application server, so it can + * use the FCM token to send notifications to your device. + */ +@property(nonatomic, readonly, nullable) NSString *FCMToken NS_SWIFT_NAME(fcmToken); + +/** + * Asynchronously gets the default FCM registration token. + * + * This creates a Firebase Installations ID, if one does not exist, and sends information about the + * application and the device to the Firebase backend. A network connection is required for the + * method to succeed. To stop this, see `Messaging.isAutoInitEnabled`, + * `Messaging.delete(completion:)` and `Installations.delete(completion:)`. + * + * @param completion The completion handler to handle the token request. + */ + +- (void)tokenWithCompletion:(void (^)(NSString *__nullable token, + NSError *__nullable error))completion; + +/** + * Asynchronously deletes the default FCM registration token. + * + * This does not delete all tokens for non-default sender IDs, See `Messaging.delete(completion:)` + * for deleting all of them. To prevent token auto generation, see `Messaging.isAutoInitEnabled`. + * + * @param completion The completion handler to handle the token deletion. + */ + +- (void)deleteTokenWithCompletion:(void (^)(NSError *__nullable error))completion; + +/** + * Retrieves an FCM registration token for a particular Sender ID. This can be used to allow + * multiple senders to send notifications to the same device. By providing a different Sender + * ID than your default when fetching a token, you can create a new FCM token which you can + * give to a different sender. Both tokens will deliver notifications to your device, and you + * can revoke a token when you need to. + * + * This registration token is not cached by FIRMessaging. FIRMessaging should have an APNs + * token set before calling this to ensure that notifications can be delivered via APNs using + * this FCM token. You may re-retrieve the FCM token once you have the APNs token set, to + * associate it with the FCM token. The default FCM token is automatically associated with + * the APNs token, if the APNs token data is available. + * + * This creates a Firebase Installations ID, if one does not exist, and sends information + * about the application and the device to the Firebase backend. + * + * @param senderID The Sender ID for a particular Firebase project. + * @param completion The completion handler to handle the token request. + */ +- (void)retrieveFCMTokenForSenderID:(NSString *)senderID + completion:(void (^)(NSString *_Nullable FCMToken, + NSError *_Nullable error))completion + NS_SWIFT_NAME(retrieveFCMToken(forSenderID:completion:)); + +/** + * Invalidates an FCM token for a particular Sender ID. That Sender ID cannot no longer send + * notifications to that FCM token. This does not delete the Firebase Installations ID that may have + * been created when generating the token. See `Installations.delete(completion:)`. + * + * @param senderID The senderID for a particular Firebase project. + * @param completion The completion handler to handle the token deletion. + */ +- (void)deleteFCMTokenForSenderID:(NSString *)senderID + completion:(void (^)(NSError *_Nullable error))completion + NS_SWIFT_NAME(deleteFCMToken(forSenderID:completion:)); + +#pragma mark - Topics + +/** + * Asynchronously subscribes to a topic. This uses the default FCM registration token to identify + * the app instance and periodically sends data to the Firebase backend. To stop this, see + * `Messaging.delete(completion:)` and `Installations.delete(completion:)`. + * + * @param topic The name of the topic, for example, @"sports". + */ +- (void)subscribeToTopic:(NSString *)topic NS_SWIFT_NAME(subscribe(toTopic:)); + +/** + * Asynchronously subscribe to the provided topic, retrying on failure. This uses the default FCM + * registration token to identify the app instance and periodically sends data to the Firebase + * backend. To stop this, see `Messaging.delete(completion:)` and + * `Installations.delete(completion:)`. + * + * @param topic The topic name to subscribe to, for example, @"sports". + * @param completion The completion that is invoked once the subscribe call ends. + * In case of success, nil error is returned. Otherwise, an + * appropriate error object is returned. + */ +- (void)subscribeToTopic:(nonnull NSString *)topic + completion:(void (^_Nullable)(NSError *_Nullable error))completion; + +/** + * Asynchronously unsubscribe from a topic. This uses a FCM Token + * to identify the app instance and periodically sends data to the Firebase backend. To stop this, + * see `Messaging.delete(completion:)` and `Installations.delete(completion:)`. + * + * @param topic The name of the topic, for example @"sports". + */ +- (void)unsubscribeFromTopic:(NSString *)topic NS_SWIFT_NAME(unsubscribe(fromTopic:)); + +/** + * Asynchronously unsubscribe from the provided topic, retrying on failure. This uses a FCM Token + * to identify the app instance and periodically sends data to the Firebase backend. To stop this, + * see `Messaging.delete(completion:)` and `Installations.delete(completion:)`. + * + * @param topic The topic name to unsubscribe from, for example @"sports". + * @param completion The completion that is invoked once the unsubscribe call ends. + * In case of success, nil error is returned. Otherwise, an + * appropriate error object is returned. + */ +- (void)unsubscribeFromTopic:(nonnull NSString *)topic + completion:(void (^_Nullable)(NSError *_Nullable error))completion; + +#pragma mark - Analytics + +/** + * Use this to track message delivery and analytics for messages, typically + * when you receive a notification in `application:didReceiveRemoteNotification:`. + * However, you only need to call this if you set the `FirebaseAppDelegateProxyEnabled` + * flag to `NO` in your Info.plist. If `FirebaseAppDelegateProxyEnabled` is either missing + * or set to `YES` in your Info.plist, the library will call this automatically. + * + * @param message The downstream message received by the application. + * + * @return Information about the downstream message. + */ +- (FIRMessagingMessageInfo *)appDidReceiveMessage:(NSDictionary *)message; + +#pragma mark - GDPR +/** + * Deletes all the tokens and checkin data of the Firebase project and related data on the server + * side. A network connection is required for the method to succeed. + * + * This does not delete the Firebase Installations ID. See `Installations.delete(completion:)`. + * To prevent token auto generation, see `Messaging.isAutoInitEnabled`. + * + * @param completion A completion handler which is invoked when the operation completes. `error == + * nil` indicates success. + */ +- (void)deleteDataWithCompletion:(void (^)(NSError *__nullable error))completion; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Headers/FIRMessagingExtensionHelper.h b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Headers/FIRMessagingExtensionHelper.h new file mode 100644 index 0000000..f4bd7ca --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Headers/FIRMessagingExtensionHelper.h @@ -0,0 +1,39 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 || \ + __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_14 +#import +#endif + +NS_ASSUME_NONNULL_BEGIN + +/// This class is used to automatically populate a notification with an image if it is +/// specified in the notification body via the `image` parameter. Images and other +/// rich content can be populated manually without the use of this class. See the +/// `UNNotificationServiceExtension` type for more details. +__OSX_AVAILABLE(10.14) @interface FIRMessagingExtensionHelper : NSObject + +/// Call this API to complete your notification content modification. If you like to +/// overwrite some properties of the content instead of using the default payload, +/// make sure to make your customized motification to the content before passing it to +/// this call. +- (void)populateNotificationContent:(UNMutableNotificationContent *)content + withContentHandler:(void (^)(UNNotificationContent *_Nonnull))contentHandler; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Headers/FirebaseMessaging-umbrella.h b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Headers/FirebaseMessaging-umbrella.h new file mode 100644 index 0000000..84a9257 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Headers/FirebaseMessaging-umbrella.h @@ -0,0 +1,19 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "FirebaseMessaging.h" +#import "FIRMessaging.h" +#import "FIRMessagingExtensionHelper.h" + +FOUNDATION_EXPORT double FirebaseMessagingVersionNumber; +FOUNDATION_EXPORT const unsigned char FirebaseMessagingVersionString[]; + diff --git a/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Headers/FirebaseMessaging.h b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Headers/FirebaseMessaging.h new file mode 100755 index 0000000..c5d0bd0 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Headers/FirebaseMessaging.h @@ -0,0 +1,18 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "FIRMessaging.h" +#import "FIRMessagingExtensionHelper.h" diff --git a/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Info.plist b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Info.plist new file mode 100644 index 0000000..d10fd6b Binary files /dev/null and b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Modules/module.modulemap new file mode 100644 index 0000000..4ab5827 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/FirebaseMessaging.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FirebaseMessaging { + umbrella header "FirebaseMessaging-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/GoogleDataTransport b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/GoogleDataTransport new file mode 100755 index 0000000..f484a36 Binary files /dev/null and b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/GoogleDataTransport differ diff --git a/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCORClock.h b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCORClock.h new file mode 100644 index 0000000..8c75b50 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCORClock.h @@ -0,0 +1,66 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** This class manages the device clock and produces snapshots of the current time. */ +@interface GDTCORClock : NSObject + +/** The wallclock time, UTC, in milliseconds. */ +@property(nonatomic, readonly) int64_t timeMillis; + +/** The offset from UTC in seconds. */ +@property(nonatomic, readonly) int64_t timezoneOffsetSeconds; + +/** The kernel boot time when this clock was created in nanoseconds. */ +@property(nonatomic, readonly) int64_t kernelBootTimeNanoseconds; + +/** The device uptime when this clock was created in nanoseconds. */ +@property(nonatomic, readonly) int64_t uptimeNanoseconds; + +@property(nonatomic, readonly) int64_t kernelBootTime DEPRECATED_MSG_ATTRIBUTE( + "Please use `kernelBootTimeNanoseconds` instead"); + +@property(nonatomic, readonly) + int64_t uptime DEPRECATED_MSG_ATTRIBUTE("Please use `uptimeNanoseconds` instead"); + +/** Creates a GDTCORClock object using the current time and offsets. + * + * @return A new GDTCORClock object representing the current time state. + */ ++ (instancetype)snapshot; + +/** Creates a GDTCORClock object representing a time in the future, relative to now. + * + * @param millisInTheFuture The millis in the future from now this clock should represent. + * @return An instance representing a future time. + */ ++ (instancetype)clockSnapshotInTheFuture:(uint64_t)millisInTheFuture; + +/** Compares one clock with another, returns YES if the caller is after the parameter. + * + * @return YES if the calling clock's time is after the given clock's time. + */ +- (BOOL)isAfter:(GDTCORClock *)otherClock; + +/** Returns value of `uptime` property in milliseconds. */ +- (int64_t)uptimeMilliseconds; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCORConsoleLogger.h b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCORConsoleLogger.h new file mode 100644 index 0000000..d306f18 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCORConsoleLogger.h @@ -0,0 +1,143 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/** The current logging level. This value and higher will be printed. Declared as volatile to make + * getting and setting atomic. + */ +FOUNDATION_EXPORT volatile NSInteger GDTCORConsoleLoggerLoggingLevel; + +/** A list of logging levels that GDT supports. */ +typedef NS_ENUM(NSInteger, GDTCORLoggingLevel) { + + /** Causes all logs to be printed. */ + GDTCORLoggingLevelDebug = 1, + + /** Causes all non-debug logs to be printed. */ + GDTCORLoggingLevelVerbose = 2, + + /** Causes warnings and errors to be printed. */ + GDTCORLoggingLevelWarnings = 3, + + /** Causes errors to be printed. This is the default value. */ + GDTCORLoggingLevelErrors = 4 +}; + +/** A list of message codes to print in the logger that help to correspond printed messages with + * code locations. + * + * Prefixes: + * - MCD => MessageCodeDebug + * - MCW => MessageCodeWarning + * - MCE => MessageCodeError + */ +typedef NS_ENUM(NSInteger, GDTCORMessageCode) { + + /** For debug logs. */ + GDTCORMCDDebugLog = 0, + + /** For warning messages concerning transportBytes: not being implemented by a data object. */ + GDTCORMCWDataObjectMissingBytesImpl = 1, + + /** For warning messages concerning a failed event upload. */ + GDTCORMCWUploadFailed = 2, + + /** For warning messages concerning a forced event upload. */ + GDTCORMCWForcedUpload = 3, + + /** For warning messages concerning a failed reachability call. */ + GDTCORMCWReachabilityFailed = 4, + + /** For warning messages concerning a database warning. */ + GDTCORMCWDatabaseWarning = 5, + + /** For warning messages concerning the reading of a event file. */ + GDTCORMCWFileReadError = 6, + + /** For error messages concerning transform: not being implemented by an event transformer. */ + GDTCORMCETransformerDoesntImplementTransform = 1000, + + /** For error messages concerning the creation of a directory failing. */ + GDTCORMCEDirectoryCreationError = 1001, + + /** For error messages concerning the writing of a event file. */ + GDTCORMCEFileWriteError = 1002, + + /** For error messages concerning the lack of a prioritizer for a given backend. */ + GDTCORMCEPrioritizerError = 1003, + + /** For error messages concerning a package delivery API violation. */ + GDTCORMCEDeliverTwice = 1004, + + /** For error messages concerning an error in an implementation of -transportBytes. */ + GDTCORMCETransportBytesError = 1005, + + /** For general purpose error messages in a dependency. */ + GDTCORMCEGeneralError = 1006, + + /** For fatal errors. Please go to https://github.com/firebase/firebase-ios-sdk/issues and open + * an issue if you encounter an error with this code. + */ + GDTCORMCEFatalAssertion = 1007, + + /** For error messages concerning the reading of a event file. */ + GDTCORMCEFileReadError = 1008, + + /** For errors related to running sqlite. */ + GDTCORMCEDatabaseError = 1009, +}; + +/** Prints the given code and format string to the console. + * + * @param code The message code describing the nature of the log. + * @param logLevel The log level of this log. + * @param format The format string. + */ +FOUNDATION_EXPORT +void GDTCORLog(GDTCORMessageCode code, GDTCORLoggingLevel logLevel, NSString *_Nonnull format, ...) + NS_FORMAT_FUNCTION(3, 4); + +/** Prints an assert log to the console. + * + * @param wasFatal Send YES if the assertion should be fatal, NO otherwise. + * @param file The file in which the failure occurred. + * @param line The line number of the failure. + * @param format The format string. + */ +FOUNDATION_EXPORT void GDTCORLogAssert(BOOL wasFatal, + NSString *_Nonnull file, + NSInteger line, + NSString *_Nullable format, + ...) NS_FORMAT_FUNCTION(4, 5); + +/** Returns the string that represents some message code. + * + * @param code The code to convert to a string. + * @return The string representing the message code. + */ +FOUNDATION_EXPORT NSString *_Nonnull GDTCORMessageCodeEnumToString(GDTCORMessageCode code); + +#define GDTCORLogDebug(MESSAGE_FORMAT, ...) \ + GDTCORLog(GDTCORMCDDebugLog, GDTCORLoggingLevelDebug, MESSAGE_FORMAT, __VA_ARGS__); + +// A define to wrap GULLogWarning with slightly more convenient usage. +#define GDTCORLogWarning(MESSAGE_CODE, MESSAGE_FORMAT, ...) \ + GDTCORLog(MESSAGE_CODE, GDTCORLoggingLevelWarnings, MESSAGE_FORMAT, __VA_ARGS__); + +// A define to wrap GULLogError with slightly more convenient usage and a failing assert. +#define GDTCORLogError(MESSAGE_CODE, MESSAGE_FORMAT, ...) \ + GDTCORLog(MESSAGE_CODE, GDTCORLoggingLevelErrors, MESSAGE_FORMAT, __VA_ARGS__); diff --git a/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCOREvent.h b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCOREvent.h new file mode 100644 index 0000000..52c2384 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCOREvent.h @@ -0,0 +1,87 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GDTCOREventDataObject.h" +#import "GDTCORTargets.h" + +@class GDTCORClock; + +NS_ASSUME_NONNULL_BEGIN + +/** The different possible quality of service specifiers. High values indicate high priority. */ +typedef NS_ENUM(NSInteger, GDTCOREventQoS) { + /** The QoS tier wasn't set, and won't ever be sent. */ + GDTCOREventQoSUnknown = 0, + + /** This event is internal telemetry data that should not be sent on its own if possible. */ + GDTCOREventQoSTelemetry = 1, + + /** This event should be sent, but in a batch only roughly once per day. */ + GDTCOREventQoSDaily = 2, + + /** This event should be sent when requested by the uploader. */ + GDTCOREventQosDefault = 3, + + /** This event should be sent immediately along with any other data that can be batched. */ + GDTCOREventQoSFast = 4, + + /** This event should only be uploaded on wifi. */ + GDTCOREventQoSWifiOnly = 5, +}; + +@interface GDTCOREvent : NSObject + +/** The unique ID of the event. */ +@property(readonly, nonatomic) NSString *eventID; + +/** The mapping identifier, to allow backends to map the transport bytes to a proto. */ +@property(nullable, readonly, nonatomic) NSString *mappingID; + +/** The identifier for the backend this event will eventually be sent to. */ +@property(readonly, nonatomic) GDTCORTarget target; + +/** The data object encapsulated in the transport of your choice, as long as it implements + * the GDTCOREventDataObject protocol. */ +@property(nullable, nonatomic) id dataObject; + +/** The serialized bytes from calling [dataObject transportBytes]. */ +@property(nullable, readonly, nonatomic) NSData *serializedDataObjectBytes; + +/** The quality of service tier this event belongs to. */ +@property(nonatomic) GDTCOREventQoS qosTier; + +/** The clock snapshot at the time of the event. */ +@property(nonatomic) GDTCORClock *clockSnapshot; + +/** The expiration date of the event. Default is 604800 seconds (7 days) from creation. */ +@property(nonatomic) NSDate *expirationDate; + +/** Bytes that can be used by an uploader later on. */ +@property(nullable, nonatomic) NSData *customBytes; + +/** Initializes an instance using the given mappingID. + * + * @param mappingID The mapping identifier. + * @param target The event's target identifier. + * @return An instance of this class. + */ +- (nullable instancetype)initWithMappingID:(NSString *)mappingID target:(GDTCORTarget)target; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCOREventDataObject.h b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCOREventDataObject.h new file mode 100644 index 0000000..34ef624 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCOREventDataObject.h @@ -0,0 +1,36 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** This protocol defines the common interface that event protos should implement regardless of the + * underlying transport technology (protobuf, nanopb, etc). + */ +@protocol GDTCOREventDataObject + +@required + +/** Returns the serialized proto bytes of the implementing event proto. + * + * @return the serialized proto bytes of the implementing event proto. + */ +- (NSData *)transportBytes; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCOREventTransformer.h b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCOREventTransformer.h new file mode 100644 index 0000000..29f9592 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCOREventTransformer.h @@ -0,0 +1,38 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class GDTCOREvent; + +NS_ASSUME_NONNULL_BEGIN + +/** Defines the API that event transformers must adopt. */ +@protocol GDTCOREventTransformer + +@required + +/** Transforms an event by applying some logic to it. Events returned can be nil, for example, in + * instances where the event should be sampled. + * + * @param event The event to transform. + * @return A transformed event, or nil if the transformation dropped the event. + */ +- (nullable GDTCOREvent *)transform:(GDTCOREvent *)event; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCORTargets.h b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCORTargets.h new file mode 100644 index 0000000..0b83ab9 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCORTargets.h @@ -0,0 +1,40 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/** The list of targets supported by the shared transport infrastructure. If adding a new target, + * please use the previous value +1. + */ +typedef NS_ENUM(NSInteger, GDTCORTarget) { + + /** A target only used in testing. */ + kGDTCORTargetTest = 999, + + /** The CCT target. */ + kGDTCORTargetCCT = 1000, + + /** The FLL target. */ + kGDTCORTargetFLL = 1001, + + /** The CSH target. The CSH target is a special-purpose backend. Please do not use it without + * permission. + */ + kGDTCORTargetCSH = 1002, + + /** The INT target. */ + kGDTCORTargetINT = 1003, +}; diff --git a/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCORTransport.h b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCORTransport.h new file mode 100644 index 0000000..e58248d --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GDTCORTransport.h @@ -0,0 +1,92 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GDTCOREventTransformer.h" +#import "GDTCORTargets.h" + +@class GDTCOREvent; + +NS_ASSUME_NONNULL_BEGIN + +@interface GDTCORTransport : NSObject + +// Please use the designated initializer. +- (instancetype)init NS_UNAVAILABLE; + +/** Initializes a new transport that will send events to the given target backend. + * + * @param mappingID The mapping identifier used by the backend to map the data object transport + * bytes to a proto. + * @param transformers A list of transformers to be applied to events that are sent. + * @param target The target backend of this transport. + * @return A transport that will send events. + */ +- (nullable instancetype)initWithMappingID:(NSString *)mappingID + transformers: + (nullable NSArray> *)transformers + target:(GDTCORTarget)target NS_DESIGNATED_INITIALIZER; + +/** Copies and sends an internal telemetry event. Events sent using this API are lower in priority, + * and sometimes won't be sent on their own. + * + * @note This will convert the event's data object to data and release the original event. + * + * @param event The event to send. + * @param completion A block that will be called when the event has been written or dropped. + */ +- (void)sendTelemetryEvent:(GDTCOREvent *)event + onComplete:(void (^_Nullable)(BOOL wasWritten, NSError *_Nullable error))completion; + +/** Copies and sends an internal telemetry event. Events sent using this API are lower in priority, + * and sometimes won't be sent on their own. + * + * @note This will convert the event's data object to data and release the original event. + * + * @param event The event to send. + */ +- (void)sendTelemetryEvent:(GDTCOREvent *)event; + +/** Copies and sends an SDK service data event. Events send using this API are higher in priority, + * and will cause a network request at some point in the relative near future. + * + * @note This will convert the event's data object to data and release the original event. + * + * @param event The event to send. + * @param completion A block that will be called when the event has been written or dropped. + */ +- (void)sendDataEvent:(GDTCOREvent *)event + onComplete:(void (^_Nullable)(BOOL wasWritten, NSError *_Nullable error))completion; + +/** Copies and sends an SDK service data event. Events send using this API are higher in priority, + * and will cause a network request at some point in the relative near future. + * + * @note This will convert the event's data object to data and release the original event. + * + * @param event The event to send. + */ +- (void)sendDataEvent:(GDTCOREvent *)event; + +/** Creates an event for use by this transport. + * + * @return An event that is suited for use by this transport. + */ +- (GDTCOREvent *)eventForTransport; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GoogleDataTransport-umbrella.h b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GoogleDataTransport-umbrella.h new file mode 100644 index 0000000..be6567f --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GoogleDataTransport-umbrella.h @@ -0,0 +1,24 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "GDTCORClock.h" +#import "GDTCORConsoleLogger.h" +#import "GDTCOREvent.h" +#import "GDTCOREventDataObject.h" +#import "GDTCOREventTransformer.h" +#import "GDTCORTargets.h" +#import "GDTCORTransport.h" +#import "GoogleDataTransport.h" + +FOUNDATION_EXPORT double GoogleDataTransportVersionNumber; +FOUNDATION_EXPORT const unsigned char GoogleDataTransportVersionString[]; + diff --git a/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GoogleDataTransport.h b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GoogleDataTransport.h new file mode 100644 index 0000000..6fe6d34 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Headers/GoogleDataTransport.h @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "GDTCORClock.h" +#import "GDTCORConsoleLogger.h" +#import "GDTCOREvent.h" +#import "GDTCOREventDataObject.h" +#import "GDTCOREventTransformer.h" +#import "GDTCORTargets.h" +#import "GDTCORTransport.h" diff --git a/plugins/2020.3569/iphone/FirebaseInstanceID.framework/Info.plist b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Info.plist similarity index 53% rename from plugins/2020.3569/iphone/FirebaseInstanceID.framework/Info.plist rename to src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Info.plist index a901ef2..e6107c0 100644 Binary files a/plugins/2020.3569/iphone/FirebaseInstanceID.framework/Info.plist and b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Modules/module.modulemap new file mode 100644 index 0000000..8a67414 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleDataTransport.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module GoogleDataTransport { + umbrella header "GoogleDataTransport-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/GoogleUtilities b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/GoogleUtilities new file mode 100755 index 0000000..8815049 Binary files /dev/null and b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/GoogleUtilities differ diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULAppDelegateSwizzler.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULAppDelegateSwizzler.h new file mode 100644 index 0000000..58dec49 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULAppDelegateSwizzler.h @@ -0,0 +1,107 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GULApplication.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef NSString *const GULAppDelegateInterceptorID; + +/** This class contains methods that isa swizzle the app delegate. */ +@interface GULAppDelegateSwizzler : NSProxy + +/** Registers an app delegate interceptor whose methods will be invoked as they're invoked on the + * original app delegate. + * + * @param interceptor An instance of a class that conforms to the application delegate protocol. + * The interceptor is NOT retained. + * @return A unique GULAppDelegateInterceptorID if interceptor was successfully registered; nil + * if it fails. + */ ++ (nullable GULAppDelegateInterceptorID)registerAppDelegateInterceptor: + (id)interceptor; + +/** Unregisters an interceptor with the given ID if it exists. + * + * @param interceptorID The object that was generated when the interceptor was registered. + */ ++ (void)unregisterAppDelegateInterceptorWithID:(GULAppDelegateInterceptorID)interceptorID; + +/** This method ensures that the original app delegate has been proxied. Call this before + * registering your interceptor. This method is safe to call multiple times (but it only proxies + * the app delegate once). + * + * This method doesn't proxy APNS related methods: + * @code + * - application:didRegisterForRemoteNotificationsWithDeviceToken: + * - application:didFailToRegisterForRemoteNotificationsWithError: + * - application:didReceiveRemoteNotification:fetchCompletionHandler: + * - application:didReceiveRemoteNotification: + * @endcode + * + * To proxy these methods use +[GULAppDelegateSwizzler + * proxyOriginalDelegateIncludingAPNSMethods]. The methods have to be proxied separately to + * avoid potential warnings from Apple review about missing Push Notification Entitlement (e.g. + * https://github.com/firebase/firebase-ios-sdk/issues/2807) + * + * The method has no effect for extensions. + * + * @see proxyOriginalDelegateIncludingAPNSMethods + */ ++ (void)proxyOriginalDelegate; + +/** This method ensures that the original app delegate has been proxied including APNS related + * methods. Call this before registering your interceptor. This method is safe to call multiple + * times (but it only proxies the app delegate once) or + * after +[GULAppDelegateSwizzler proxyOriginalDelegate] + * + * This method calls +[GULAppDelegateSwizzler proxyOriginalDelegate] under the hood. + * After calling this method the following App Delegate methods will be proxied in addition to + * the methods proxied by proxyOriginalDelegate: + * @code + * - application:didRegisterForRemoteNotificationsWithDeviceToken: + * - application:didFailToRegisterForRemoteNotificationsWithError: + * - application:didReceiveRemoteNotification:fetchCompletionHandler: + * - application:didReceiveRemoteNotification: + * @endcode + * + * The method has no effect for extensions. + * + * @see proxyOriginalDelegate + */ ++ (void)proxyOriginalDelegateIncludingAPNSMethods; + +/** Indicates whether app delegate proxy is explicitly disabled or enabled. Enabled by default. + * + * @return YES if AppDelegateProxy is Enabled, NO otherwise. + */ ++ (BOOL)isAppDelegateProxyEnabled; + +/** Returns the current sharedApplication. + * + * @return the current application instance if in an app, or nil if in extension or if it doesn't + * exist. + */ ++ (nullable GULApplication *)sharedApplication; + +/** Do not initialize this class. */ +- (instancetype)init NS_UNAVAILABLE; + +NS_ASSUME_NONNULL_END + +@end diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULAppEnvironmentUtil.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULAppEnvironmentUtil.h new file mode 100644 index 0000000..d2bb935 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULAppEnvironmentUtil.h @@ -0,0 +1,60 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface GULAppEnvironmentUtil : NSObject + +/// Indicates whether the app is from Apple Store or not. Returns NO if the app is on simulator, +/// development environment or sideloaded. ++ (BOOL)isFromAppStore; + +/// Indicates whether the app is a Testflight app. Returns YES if the app has sandbox receipt. +/// Returns NO otherwise. ++ (BOOL)isAppStoreReceiptSandbox; + +/// Indicates whether the app is on simulator or not at runtime depending on the device +/// architecture. ++ (BOOL)isSimulator; + +/// The current device model. Returns an empty string if device model cannot be retrieved. ++ (nullable NSString *)deviceModel; + +/// The current operating system version. Returns an empty string if the system version cannot be +/// retrieved. ++ (NSString *)systemVersion; + +/// Indicates whether it is running inside an extension or an app. ++ (BOOL)isAppExtension; + +/// @return Returns @YES when is run on iOS version greater or equal to 7.0 ++ (BOOL)isIOS7OrHigher DEPRECATED_MSG_ATTRIBUTE( + "Always `YES` because only iOS 8 and higher supported. The method will be removed."); + +/// @return YES if Swift runtime detected in the app. ++ (BOOL)hasSwiftRuntime; + +/// @return An Apple platform. Possible values "ios", "tvos", "macos", "watchos", "maccatalyst". ++ (NSString *)applePlatform; + +/// @return The way the library was added to the app, e.g. "swiftpm", "cocoapods", etc. ++ (NSString *)deploymentType; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULApplication.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULApplication.h new file mode 100644 index 0000000..8067212 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULApplication.h @@ -0,0 +1,50 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import + +#define GULApplication UIApplication +#define GULApplicationDelegate UIApplicationDelegate +#define GULUserActivityRestoring UIUserActivityRestoring + +static NSString *const kGULApplicationClassName = @"UIApplication"; + +#elif TARGET_OS_OSX + +#import + +#define GULApplication NSApplication +#define GULApplicationDelegate NSApplicationDelegate +#define GULUserActivityRestoring NSUserActivityRestoring + +static NSString *const kGULApplicationClassName = @"NSApplication"; + +#elif TARGET_OS_WATCH + +#import + +// We match the according watchOS API but swizzling should not work in watch +#define GULApplication WKExtension +#define GULApplicationDelegate WKExtensionDelegate +#define GULUserActivityRestoring NSUserActivityRestoring + +static NSString *const kGULApplicationClassName = @"WKExtension"; + +#endif diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULHeartbeatDateStorage.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULHeartbeatDateStorage.h new file mode 100644 index 0000000..9432dfc --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULHeartbeatDateStorage.h @@ -0,0 +1,49 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/// Stores either a date or a dictionary to a specified file. +@interface GULHeartbeatDateStorage : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +@property(nonatomic, readonly) NSURL *fileURL; + +/** + * Default initializer. + * @param fileName The name of the file to store the date information. + * exist, it will be created if needed. + */ +- (instancetype)initWithFileName:(NSString *)fileName; + +/** + * Reads the date from the specified file for the given tag. + * @return Returns date if exists, otherwise `nil`. + */ +- (nullable NSDate *)heartbeatDateForTag:(NSString *)tag; + +/** + * Saves the date for the specified tag in the specified file. + * @return YES on success, NO otherwise. + */ +- (BOOL)setHearbeatDate:(NSDate *)date forTag:(NSString *)tag; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULKeychainStorage.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULKeychainStorage.h new file mode 100644 index 0000000..dc01a83 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULKeychainStorage.h @@ -0,0 +1,79 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FBLPromise; + +NS_ASSUME_NONNULL_BEGIN + +/// The class provides a convenient abstraction on top of the iOS Keychain API to save data. +@interface GULKeychainStorage : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +/** Initializes the keychain storage with Keychain Service name. + * @param service A Keychain Service name that will be used to store and retrieve objects. See also + * `kSecAttrService`. + */ +- (instancetype)initWithService:(NSString *)service; + +/** + * Get an object by key. + * @param key The key. + * @param objectClass The expected object class required by `NSSecureCoding`. + * @param accessGroup The Keychain Access Group. + * + * @return Returns a promise. It is resolved with an object stored by key if exists. It is resolved + * with `nil` when the object not found. It fails on a Keychain error. + */ +- (FBLPromise> *)getObjectForKey:(NSString *)key + objectClass:(Class)objectClass + accessGroup:(nullable NSString *)accessGroup; + +/** + * Saves the given object by the given key. + * @param object The object to store. + * @param key The key to store the object. If there is an existing object by the key, it will be + * overridden. + * @param accessGroup The Keychain Access Group. + * + * @return Returns which is resolved with `[NSNull null]` on success. + */ +- (FBLPromise *)setObject:(id)object + forKey:(NSString *)key + accessGroup:(nullable NSString *)accessGroup; + +/** + * Removes the object by the given key. + * @param key The key to store the object. If there is an existing object by the key, it will be + * overridden. + * @param accessGroup The Keychain Access Group. + * + * @return Returns which is resolved with `[NSNull null]` on success. + */ +- (FBLPromise *)removeObjectForKey:(NSString *)key + accessGroup:(nullable NSString *)accessGroup; + +#if TARGET_OS_OSX +/// If not `nil`, then only this keychain will be used to save and read data (see +/// `kSecMatchSearchList` and `kSecUseKeychain`. It is mostly intended to be used by unit tests. +@property(nonatomic, nullable) SecKeychainRef keychainRef; +#endif // TARGET_OSX + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULKeychainUtils.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULKeychainUtils.h new file mode 100644 index 0000000..de4bef2 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULKeychainUtils.h @@ -0,0 +1,61 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +FOUNDATION_EXPORT NSString *const kGULKeychainUtilsErrorDomain; + +/// Helper functions to access Keychain. +@interface GULKeychainUtils : NSObject + +/** Fetches a keychain item data matching to the provided query. + * @param query A dictionary with Keychain query parameters. See docs for `SecItemCopyMatching` for + * details. + * @param outError A pointer to `NSError` instance or `NULL`. The instance at `outError` will be + * assigned with an error if there is. + * @returns Data for the first Keychain Item matching the provided query or `nil` if there is not + * such an item (`outError` will be `nil` in this case) or an error occurred. + */ ++ (nullable NSData *)getItemWithQuery:(NSDictionary *)query + error:(NSError *_Nullable *_Nullable)outError; + +/** Stores data to a Keychain Item matching to the provided query. An existing Keychain Item + * matching the query parameters will be updated or a new will be created. + * @param item A Keychain Item data to store. + * @param query A dictionary with Keychain query parameters. See docs for `SecItemAdd` and + * `SecItemUpdate` for details. + * @param outError A pointer to `NSError` instance or `NULL`. The instance at `outError` will be + * assigned with an error if there is. + * @returns `YES` when data was successfully stored, `NO` otherwise. + */ ++ (BOOL)setItem:(NSData *)item + withQuery:(NSDictionary *)query + error:(NSError *_Nullable *_Nullable)outError; + +/** Removes a Keychain Item matching to the provided query. + * @param query A dictionary with Keychain query parameters. See docs for `SecItemDelete` for + * details. + * @param outError A pointer to `NSError` instance or `NULL`. The instance at `outError` will be + * assigned with an error if there is. + * @returns `YES` if the item was removed successfully or doesn't exist, `NO` otherwise. + */ ++ (BOOL)removeItemWithQuery:(NSDictionary *)query error:(NSError *_Nullable *_Nullable)outError; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULLogger.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULLogger.h new file mode 100644 index 0000000..6797399 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULLogger.h @@ -0,0 +1,159 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GULLoggerLevel.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * The services used in the logger. + */ +typedef NSString *const GULLoggerService; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/** + * Initialize GULLogger. + */ +extern void GULLoggerInitializeASL(void); + +/** + * Override log level to Debug. + */ +void GULLoggerForceDebug(void); + +/** + * Turn on logging to STDERR. + */ +extern void GULLoggerEnableSTDERR(void); + +/** + * Changes the default logging level of GULLoggerLevelNotice to a user-specified level. + * The default level cannot be set above GULLoggerLevelNotice if the app is running from App Store. + * (required) log level (one of the GULLoggerLevel enum values). + */ +extern void GULSetLoggerLevel(GULLoggerLevel loggerLevel); + +/** + * Checks if the specified logger level is loggable given the current settings. + * (required) log level (one of the GULLoggerLevel enum values). + */ +extern BOOL GULIsLoggableLevel(GULLoggerLevel loggerLevel); + +/** + * Register version to include in logs. + * (required) version + */ +extern void GULLoggerRegisterVersion(NSString *version); + +/** + * Logs a message to the Xcode console and the device log. If running from AppStore, will + * not log any messages with a level higher than GULLoggerLevelNotice to avoid log spamming. + * (required) log level (one of the GULLoggerLevel enum values). + * (required) service name of type GULLoggerService. + * (required) message code starting with "I-" which means iOS, followed by a capitalized + * three-character service identifier and a six digit integer message ID that is unique + * within the service. + * An example of the message code is @"I-COR000001". + * (required) message string which can be a format string. + * (optional) variable arguments list obtained from calling va_start, used when message is a format + * string. + */ +extern void GULLogBasic(GULLoggerLevel level, + GULLoggerService service, + BOOL forceLog, + NSString *messageCode, + NSString *message, +// On 64-bit simulators, va_list is not a pointer, so cannot be marked nullable +// See: http://stackoverflow.com/q/29095469 +#if __LP64__ && TARGET_OS_SIMULATOR || TARGET_OS_OSX + va_list args_ptr +#else + va_list _Nullable args_ptr +#endif +); + +/** + * The following functions accept the following parameters in order: + * (required) service name of type GULLoggerService. + * (required) message code starting from "I-" which means iOS, followed by a capitalized + * three-character service identifier and a six digit integer message ID that is unique + * within the service. + * An example of the message code is @"I-COR000001". + * See go/firebase-log-proposal for details. + * (required) message string which can be a format string. + * (optional) the list of arguments to substitute into the format string. + * Example usage: + * GULLogError(kGULLoggerCore, @"I-COR000001", @"Configuration of %@ failed.", app.name); + */ +extern void GULLogError(GULLoggerService service, + BOOL force, + NSString *messageCode, + NSString *message, + ...) NS_FORMAT_FUNCTION(4, 5); +extern void GULLogWarning(GULLoggerService service, + BOOL force, + NSString *messageCode, + NSString *message, + ...) NS_FORMAT_FUNCTION(4, 5); +extern void GULLogNotice(GULLoggerService service, + BOOL force, + NSString *messageCode, + NSString *message, + ...) NS_FORMAT_FUNCTION(4, 5); +extern void GULLogInfo(GULLoggerService service, + BOOL force, + NSString *messageCode, + NSString *message, + ...) NS_FORMAT_FUNCTION(4, 5); +extern void GULLogDebug(GULLoggerService service, + BOOL force, + NSString *messageCode, + NSString *message, + ...) NS_FORMAT_FUNCTION(4, 5); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +@interface GULLoggerWrapper : NSObject + +/** + * Objective-C wrapper for GULLogBasic to allow weak linking to GULLogger + * (required) log level (one of the GULLoggerLevel enum values). + * (required) service name of type GULLoggerService. + * (required) message code starting with "I-" which means iOS, followed by a capitalized + * three-character service identifier and a six digit integer message ID that is unique + * within the service. + * An example of the message code is @"I-COR000001". + * (required) message string which can be a format string. + * (optional) variable arguments list obtained from calling va_start, used when message is a format + * string. + */ + ++ (void)logWithLevel:(GULLoggerLevel)level + withService:(GULLoggerService)service + withCode:(NSString *)messageCode + withMessage:(NSString *)message + withArgs:(va_list)args; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULLoggerLevel.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULLoggerLevel.h new file mode 100644 index 0000000..f0ee435 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULLoggerLevel.h @@ -0,0 +1,37 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/** + * The log levels used by internal logging. + */ +typedef NS_ENUM(NSInteger, GULLoggerLevel) { + /** Error level, matches ASL_LEVEL_ERR. */ + GULLoggerLevelError = 3, + /** Warning level, matches ASL_LEVEL_WARNING. */ + GULLoggerLevelWarning = 4, + /** Notice level, matches ASL_LEVEL_NOTICE. */ + GULLoggerLevelNotice = 5, + /** Info level, matches ASL_LEVEL_INFO. */ + GULLoggerLevelInfo = 6, + /** Debug level, matches ASL_LEVEL_DEBUG. */ + GULLoggerLevelDebug = 7, + /** Minimum log level. */ + GULLoggerLevelMin = GULLoggerLevelError, + /** Maximum log level. */ + GULLoggerLevelMax = GULLoggerLevelDebug +} NS_SWIFT_NAME(GoogleLoggerLevel); diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULMutableDictionary.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULMutableDictionary.h new file mode 100644 index 0000000..a8cc45b --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULMutableDictionary.h @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/// A mutable dictionary that provides atomic accessor and mutators. +@interface GULMutableDictionary : NSObject + +/// Returns an object given a key in the dictionary or nil if not found. +- (id)objectForKey:(id)key; + +/// Updates the object given its key or adds it to the dictionary if it is not in the dictionary. +- (void)setObject:(id)object forKey:(id)key; + +/// Removes the object given its session ID from the dictionary. +- (void)removeObjectForKey:(id)key; + +/// Removes all objects. +- (void)removeAllObjects; + +/// Returns the number of current objects in the dictionary. +- (NSUInteger)count; + +/// Returns an object given a key in the dictionary or nil if not found. +- (id)objectForKeyedSubscript:(id)key; + +/// Updates the object given its key or adds it to the dictionary if it is not in the dictionary. +- (void)setObject:(id)obj forKeyedSubscript:(id)key; + +/// Returns the immutable dictionary. +- (NSDictionary *)dictionary; + +@end diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNSData+zlib.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNSData+zlib.h new file mode 100644 index 0000000..36f94a7 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNSData+zlib.h @@ -0,0 +1,49 @@ +// Copyright 2018 Google +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#import + +/// This is a copy of Google Toolbox for Mac library to avoid creating an extra framework. + +// NOTE: For 64bit, none of these apis handle input sizes >32bits, they will return nil when given +// such data. To handle data of that size you really should be streaming it rather then doing it all +// in memory. + +@interface NSData (GULGzip) + +/// Returns an data as the result of decompressing the payload of |data|.The data to decompress must +/// be a gzipped payloads. ++ (NSData *)gul_dataByInflatingGzippedData:(NSData *)data error:(NSError **)error; + +/// Returns an compressed data with the result of gzipping the payload of |data|. Uses the default +/// compression level. ++ (NSData *)gul_dataByGzippingData:(NSData *)data error:(NSError **)error; + +FOUNDATION_EXPORT NSString *const GULNSDataZlibErrorDomain; +FOUNDATION_EXPORT NSString *const GULNSDataZlibErrorKey; // NSNumber +FOUNDATION_EXPORT NSString *const GULNSDataZlibRemainingBytesKey; // NSNumber + +typedef NS_ENUM(NSInteger, GULNSDataZlibError) { + GULNSDataZlibErrorGreaterThan32BitsToCompress = 1024, + // An internal zlib error. + // GULNSDataZlibErrorKey will contain the error value. + // NSLocalizedDescriptionKey may contain an error string from zlib. + // Look in zlib.h for list of errors. + GULNSDataZlibErrorInternal, + // There was left over data in the buffer that was not used. + // GULNSDataZlibRemainingBytesKey will contain number of remaining bytes. + GULNSDataZlibErrorDataRemaining +}; + +@end diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetwork.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetwork.h new file mode 100644 index 0000000..0e75ae5 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetwork.h @@ -0,0 +1,87 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GULNetworkConstants.h" +#import "GULNetworkLoggerProtocol.h" +#import "GULNetworkURLSession.h" + +/// Delegate protocol for GULNetwork events. +@protocol GULNetworkReachabilityDelegate + +/// Tells the delegate to handle events when the network reachability changes to connected or not +/// connected. +- (void)reachabilityDidChange; + +@end + +/// The Network component that provides network status and handles network requests and responses. +/// This is not thread safe. +/// +/// NOTE: +/// User must add FIRAnalytics handleEventsForBackgroundURLSessionID:completionHandler to the +/// AppDelegate application:handleEventsForBackgroundURLSession:completionHandler: +@interface GULNetwork : NSObject + +/// Indicates if network connectivity is available. +@property(nonatomic, readonly, getter=isNetworkConnected) BOOL networkConnected; + +/// Indicates if there are any uploads in progress. +@property(nonatomic, readonly, getter=hasUploadInProgress) BOOL uploadInProgress; + +/// An optional delegate that can be used in the event when network reachability changes. +@property(nonatomic, weak) id reachabilityDelegate; + +/// An optional delegate that can be used to log messages, warnings or errors that occur in the +/// network operations. +@property(nonatomic, weak) id loggerDelegate; + +/// Indicates whether the logger should display debug messages. +@property(nonatomic, assign) BOOL isDebugModeEnabled; + +/// The time interval in seconds for the network request to timeout. +@property(nonatomic, assign) NSTimeInterval timeoutInterval; + +/// Initializes with the default reachability host. +- (instancetype)init; + +/// Initializes with a custom reachability host. +- (instancetype)initWithReachabilityHost:(NSString *)reachabilityHost; + +/// Handles events when background session with the given ID has finished. ++ (void)handleEventsForBackgroundURLSessionID:(NSString *)sessionID + completionHandler:(GULNetworkSystemCompletionHandler)completionHandler; + +/// Compresses and sends a POST request with the provided data to the URL. The session will be +/// background session if usingBackgroundSession is YES. Otherwise, the POST session is default +/// session. Returns a session ID or nil if an error occurs. +- (NSString *)postURL:(NSURL *)url + payload:(NSData *)payload + queue:(dispatch_queue_t)queue + usingBackgroundSession:(BOOL)usingBackgroundSession + completionHandler:(GULNetworkCompletionHandler)handler; + +/// Sends a GET request with the provided data to the URL. The session will be background session +/// if usingBackgroundSession is YES. Otherwise, the GET session is default session. Returns a +/// session ID or nil if an error occurs. +- (NSString *)getURL:(NSURL *)url + headers:(NSDictionary *)headers + queue:(dispatch_queue_t)queue + usingBackgroundSession:(BOOL)usingBackgroundSession + completionHandler:(GULNetworkCompletionHandler)handler; + +@end diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetworkConstants.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetworkConstants.h new file mode 100644 index 0000000..1cbedd1 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetworkConstants.h @@ -0,0 +1,71 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/// Error codes in Firebase Network error domain. +/// Note: these error codes should never change. It would make it harder to decode the errors if +/// we inadvertently altered any of these codes in a future SDK version. +typedef NS_ENUM(NSInteger, GULNetworkErrorCode) { + /// Unknown error. + GULNetworkErrorCodeUnknown = 0, + /// Error occurs when the request URL is invalid. + GULErrorCodeNetworkInvalidURL = 1, + /// Error occurs when request cannot be constructed. + GULErrorCodeNetworkRequestCreation = 2, + /// Error occurs when payload cannot be compressed. + GULErrorCodeNetworkPayloadCompression = 3, + /// Error occurs when session task cannot be created. + GULErrorCodeNetworkSessionTaskCreation = 4, + /// Error occurs when there is no response. + GULErrorCodeNetworkInvalidResponse = 5 +}; + +#pragma mark - Network constants + +/// The prefix of the ID of the background session. +extern NSString *const kGULNetworkBackgroundSessionConfigIDPrefix; + +/// The sub directory to store the files of data that is being uploaded in the background. +extern NSString *const kGULNetworkApplicationSupportSubdirectory; + +/// Name of the temporary directory that stores files for background uploading. +extern NSString *const kGULNetworkTempDirectoryName; + +/// The period when the temporary uploading file can stay. +extern const NSTimeInterval kGULNetworkTempFolderExpireTime; + +/// The default network request timeout interval. +extern const NSTimeInterval kGULNetworkTimeOutInterval; + +/// The host to check the reachability of the network. +extern NSString *const kGULNetworkReachabilityHost; + +/// The key to get the error context of the UserInfo. +extern NSString *const kGULNetworkErrorContext; + +#pragma mark - Network Status Code + +extern const int kGULNetworkHTTPStatusOK; +extern const int kGULNetworkHTTPStatusNoContent; +extern const int kGULNetworkHTTPStatusCodeMultipleChoices; +extern const int kGULNetworkHTTPStatusCodeMovedPermanently; +extern const int kGULNetworkHTTPStatusCodeFound; +extern const int kGULNetworkHTTPStatusCodeNotModified; +extern const int kGULNetworkHTTPStatusCodeMovedTemporarily; +extern const int kGULNetworkHTTPStatusCodeNotFound; +extern const int kGULNetworkHTTPStatusCodeCannotAcceptTraffic; +extern const int kGULNetworkHTTPStatusCodeUnavailable; diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetworkLoggerProtocol.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetworkLoggerProtocol.h new file mode 100644 index 0000000..425c073 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetworkLoggerProtocol.h @@ -0,0 +1,49 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GULNetworkMessageCode.h" + +/// The log levels used by GULNetworkLogger. +typedef NS_ENUM(NSInteger, GULNetworkLogLevel) { + kGULNetworkLogLevelError = 3, + kGULNetworkLogLevelWarning = 4, + kGULNetworkLogLevelInfo = 6, + kGULNetworkLogLevelDebug = 7, +}; + +@protocol GULNetworkLoggerDelegate + +@required +/// Tells the delegate to log a message with an array of contexts and the log level. +- (void)GULNetwork_logWithLevel:(GULNetworkLogLevel)logLevel + messageCode:(GULNetworkMessageCode)messageCode + message:(NSString *)message + contexts:(NSArray *)contexts; + +/// Tells the delegate to log a message with a context and the log level. +- (void)GULNetwork_logWithLevel:(GULNetworkLogLevel)logLevel + messageCode:(GULNetworkMessageCode)messageCode + message:(NSString *)message + context:(id)context; + +/// Tells the delegate to log a message with the log level. +- (void)GULNetwork_logWithLevel:(GULNetworkLogLevel)logLevel + messageCode:(GULNetworkMessageCode)messageCode + message:(NSString *)message; + +@end diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetworkMessageCode.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetworkMessageCode.h new file mode 100644 index 0000000..507bc5a --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetworkMessageCode.h @@ -0,0 +1,47 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +// Make sure these codes do not overlap with any contained in the FIRAMessageCode enum. +typedef NS_ENUM(NSInteger, GULNetworkMessageCode) { + // GULNetwork.m + kGULNetworkMessageCodeNetwork000 = 900000, // I-NET900000 + kGULNetworkMessageCodeNetwork001 = 900001, // I-NET900001 + kGULNetworkMessageCodeNetwork002 = 900002, // I-NET900002 + kGULNetworkMessageCodeNetwork003 = 900003, // I-NET900003 + // GULNetworkURLSession.m + kGULNetworkMessageCodeURLSession000 = 901000, // I-NET901000 + kGULNetworkMessageCodeURLSession001 = 901001, // I-NET901001 + kGULNetworkMessageCodeURLSession002 = 901002, // I-NET901002 + kGULNetworkMessageCodeURLSession003 = 901003, // I-NET901003 + kGULNetworkMessageCodeURLSession004 = 901004, // I-NET901004 + kGULNetworkMessageCodeURLSession005 = 901005, // I-NET901005 + kGULNetworkMessageCodeURLSession006 = 901006, // I-NET901006 + kGULNetworkMessageCodeURLSession007 = 901007, // I-NET901007 + kGULNetworkMessageCodeURLSession008 = 901008, // I-NET901008 + kGULNetworkMessageCodeURLSession009 = 901009, // I-NET901009 + kGULNetworkMessageCodeURLSession010 = 901010, // I-NET901010 + kGULNetworkMessageCodeURLSession011 = 901011, // I-NET901011 + kGULNetworkMessageCodeURLSession012 = 901012, // I-NET901012 + kGULNetworkMessageCodeURLSession013 = 901013, // I-NET901013 + kGULNetworkMessageCodeURLSession014 = 901014, // I-NET901014 + kGULNetworkMessageCodeURLSession015 = 901015, // I-NET901015 + kGULNetworkMessageCodeURLSession016 = 901016, // I-NET901016 + kGULNetworkMessageCodeURLSession017 = 901017, // I-NET901017 + kGULNetworkMessageCodeURLSession018 = 901018, // I-NET901018 + kGULNetworkMessageCodeURLSession019 = 901019, // I-NET901019 +}; diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetworkURLSession.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetworkURLSession.h new file mode 100644 index 0000000..3f9f7f9 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULNetworkURLSession.h @@ -0,0 +1,62 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GULNetworkLoggerProtocol.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void (^GULNetworkCompletionHandler)(NSHTTPURLResponse *_Nullable response, + NSData *_Nullable data, + NSError *_Nullable error); +typedef void (^GULNetworkURLSessionCompletionHandler)(NSHTTPURLResponse *_Nullable response, + NSData *_Nullable data, + NSString *sessionID, + NSError *_Nullable error); +typedef void (^GULNetworkSystemCompletionHandler)(void); + +/// The protocol that uses NSURLSession for iOS >= 7.0 to handle requests and responses. +@interface GULNetworkURLSession : NSObject + +/// Indicates whether the background network is enabled. Default value is NO. +@property(nonatomic, getter=isBackgroundNetworkEnabled) BOOL backgroundNetworkEnabled; + +/// The logger delegate to log message, errors or warnings that occur during the network operations. +@property(nonatomic, weak, nullable) id loggerDelegate; + +/// Calls the system provided completion handler after the background session is finished. ++ (void)handleEventsForBackgroundURLSessionID:(NSString *)sessionID + completionHandler:(GULNetworkSystemCompletionHandler)completionHandler; + +/// Initializes with logger delegate. +- (instancetype)initWithNetworkLoggerDelegate: + (nullable id)networkLoggerDelegate NS_DESIGNATED_INITIALIZER; + +- (instancetype)init NS_UNAVAILABLE; + +/// Sends an asynchronous POST request and calls the provided completion handler when the request +/// completes or when errors occur, and returns an ID of the session/connection. +- (nullable NSString *)sessionIDFromAsyncPOSTRequest:(NSURLRequest *)request + completionHandler:(GULNetworkURLSessionCompletionHandler)handler; + +/// Sends an asynchronous GET request and calls the provided completion handler when the request +/// completes or when errors occur, and returns an ID of the session. +- (nullable NSString *)sessionIDFromAsyncGETRequest:(NSURLRequest *)request + completionHandler:(GULNetworkURLSessionCompletionHandler)handler; + +NS_ASSUME_NONNULL_END +@end diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULOriginalIMPConvenienceMacros.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULOriginalIMPConvenienceMacros.h new file mode 100644 index 0000000..a33262a --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULOriginalIMPConvenienceMacros.h @@ -0,0 +1,207 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * GULOriginalIMPConvenienceMacros.h + * + * This header contains convenience macros for invoking the original IMP of a swizzled method. + */ + +/** + * Invokes original IMP when the original selector takes no arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + */ +#define GUL_INVOKE_ORIGINAL_IMP0(__receivingObject, __swizzledSEL, __returnType, __originalIMP) \ + ((__returnType(*)(id, SEL))__originalIMP)(__receivingObject, __swizzledSEL) + +/** + * Invokes original IMP when the original selector takes 1 argument. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP1(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1)))__originalIMP)(__receivingObject, __swizzledSEL, \ + __arg1) + +/** + * Invokes original IMP when the original selector takes 2 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP2(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2)))__originalIMP)( \ + __receivingObject, __swizzledSEL, __arg1, __arg2) + +/** + * Invokes original IMP when the original selector takes 3 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP3(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), \ + __typeof__(__arg3)))__originalIMP)(__receivingObject, __swizzledSEL, __arg1, \ + __arg2, __arg3) + +/** + * Invokes original IMP when the original selector takes 4 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + * @param __arg4 The fourth argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP4(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3, __arg4) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), __typeof__(__arg3), \ + __typeof__(__arg4)))__originalIMP)(__receivingObject, __swizzledSEL, __arg1, \ + __arg2, __arg3, __arg4) + +/** + * Invokes original IMP when the original selector takes 5 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + * @param __arg4 The fourth argument. + * @param __arg5 The fifth argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP5(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3, __arg4, __arg5) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), __typeof__(__arg3), \ + __typeof__(__arg4), __typeof__(__arg5)))__originalIMP)( \ + __receivingObject, __swizzledSEL, __arg1, __arg2, __arg3, __arg4, __arg5) + +/** + * Invokes original IMP when the original selector takes 6 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + * @param __arg4 The fourth argument. + * @param __arg5 The fifth argument. + * @param __arg6 The sixth argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP6(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), __typeof__(__arg3), \ + __typeof__(__arg4), __typeof__(__arg5), __typeof__(__arg6)))__originalIMP)( \ + __receivingObject, __swizzledSEL, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) + +/** + * Invokes original IMP when the original selector takes 7 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + * @param __arg4 The fourth argument. + * @param __arg5 The fifth argument. + * @param __arg6 The sixth argument. + * @param __arg7 The seventh argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP7(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3, __arg4, __arg5, __arg6, __arg7) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), __typeof__(__arg3), \ + __typeof__(__arg4), __typeof__(__arg5), __typeof__(__arg6), \ + __typeof__(__arg7)))__originalIMP)( \ + __receivingObject, __swizzledSEL, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6, __arg7) + +/** + * Invokes original IMP when the original selector takes 8 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + * @param __arg4 The fourth argument. + * @param __arg5 The fifth argument. + * @param __arg6 The sixth argument. + * @param __arg7 The seventh argument. + * @param __arg8 The eighth argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP8(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3, __arg4, __arg5, __arg6, __arg7, __arg8) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), __typeof__(__arg3), \ + __typeof__(__arg4), __typeof__(__arg5), __typeof__(__arg6), \ + __typeof__(__arg7), __typeof__(__arg8)))__originalIMP)( \ + __receivingObject, __swizzledSEL, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6, __arg7, \ + __arg8) + +/** + * Invokes original IMP when the original selector takes 9 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + * @param __arg4 The fourth argument. + * @param __arg5 The fifth argument. + * @param __arg6 The sixth argument. + * @param __arg7 The seventh argument. + * @param __arg8 The eighth argument. + * @param __arg9 The ninth argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP9(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3, __arg4, __arg5, __arg6, __arg7, __arg8, \ + __arg9) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), __typeof__(__arg3), \ + __typeof__(__arg4), __typeof__(__arg5), __typeof__(__arg6), \ + __typeof__(__arg7), __typeof__(__arg8), __typeof__(__arg9)))__originalIMP)( \ + __receivingObject, __swizzledSEL, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6, __arg7, \ + __arg8, __arg9) diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULReachabilityChecker.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULReachabilityChecker.h new file mode 100644 index 0000000..0c70c05 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULReachabilityChecker.h @@ -0,0 +1,79 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import +#if !TARGET_OS_WATCH +#import +#endif + +/// Reachability Status +typedef enum { + kGULReachabilityUnknown, ///< Have not yet checked or been notified whether host is reachable. + kGULReachabilityNotReachable, ///< Host is not reachable. + kGULReachabilityViaWifi, ///< Host is reachable via Wifi. + kGULReachabilityViaCellular, ///< Host is reachable via cellular. +} GULReachabilityStatus; + +const NSString *GULReachabilityStatusString(GULReachabilityStatus status); + +@class GULReachabilityChecker; + +/// Google Analytics iOS Reachability Checker. +@protocol GULReachabilityDelegate +@required +/// Called when network status has changed. +- (void)reachability:(GULReachabilityChecker *)reachability + statusChanged:(GULReachabilityStatus)status; +@end + +/// Google Analytics iOS Network Status Checker. +@interface GULReachabilityChecker : NSObject + +/// The last known reachability status, or GULReachabilityStatusUnknown if the +/// checker is not active. +@property(nonatomic, readonly) GULReachabilityStatus reachabilityStatus; +/// The host to which reachability status is to be checked. +@property(nonatomic, copy, readonly) NSString *host; +/// The delegate to be notified of reachability status changes. +@property(nonatomic, weak) id reachabilityDelegate; +/// `YES` if the reachability checker is active, `NO` otherwise. +@property(nonatomic, readonly) BOOL isActive; + +/// Initialize the reachability checker. Note that you must call start to begin checking for and +/// receiving notifications about network status changes. +/// +/// @param reachabilityDelegate The delegate to be notified when reachability status to host +/// changes. +/// +/// @param host The name of the host. +/// +- (instancetype)initWithReachabilityDelegate:(id)reachabilityDelegate + withHost:(NSString *)host; + +- (instancetype)init NS_UNAVAILABLE; + +/// Start checking for reachability to the specified host. This has no effect if the status +/// checker is already checking for connectivity. +/// +/// @return `YES` if initiating status checking was successful or the status checking has already +/// been initiated, `NO` otherwise. +- (BOOL)start; + +/// Stop checking for reachability to the specified host. This has no effect if the status +/// checker is not checking for connectivity. +- (void)stop; + +@end diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULSceneDelegateSwizzler.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULSceneDelegateSwizzler.h new file mode 100644 index 0000000..ed080a3 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULSceneDelegateSwizzler.h @@ -0,0 +1,76 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import +#import + +#if !TARGET_OS_OSX +#import +#endif // !TARGET_OS_OSX + +#if ((TARGET_OS_IOS || TARGET_OS_TV) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000)) +#define UISCENE_SUPPORTED 1 +#endif + +NS_ASSUME_NONNULL_BEGIN + +typedef NSString *const GULSceneDelegateInterceptorID; + +/** This class contains methods that isa swizzle the scene delegate. */ +@interface GULSceneDelegateSwizzler : NSProxy + +#if UISCENE_SUPPORTED + +/** Registers a scene delegate interceptor whose methods will be invoked as they're invoked on the + * original scene delegate. + * + * @param interceptor An instance of a class that conforms to the application delegate protocol. + * The interceptor is NOT retained. + * @return A unique GULSceneDelegateInterceptorID if interceptor was successfully registered; nil + * if it fails. + */ ++ (nullable GULSceneDelegateInterceptorID)registerSceneDelegateInterceptor: + (id)interceptor API_AVAILABLE(ios(13.0), tvos(13.0)); + +/** Unregisters an interceptor with the given ID if it exists. + * + * @param interceptorID The object that was generated when the interceptor was registered. + */ ++ (void)unregisterSceneDelegateInterceptorWithID:(GULSceneDelegateInterceptorID)interceptorID + API_AVAILABLE(ios(13.0), tvos(13.0)); + +/** Do not initialize this class. */ +- (instancetype)init NS_UNAVAILABLE; + +#endif // UISCENE_SUPPORTED + +/** This method ensures that the original scene delegate has been proxied. Call this before + * registering your interceptor. This method is safe to call multiple times (but it only proxies + * the scene delegate once). + * + * The method has no effect for extensions. + */ ++ (void)proxyOriginalSceneDelegate; + +/** Indicates whether scene delegate proxy is explicitly disabled or enabled. Enabled by default. + * + * @return YES if SceneDelegateProxy is Enabled, NO otherwise. + */ ++ (BOOL)isSceneDelegateProxyEnabled; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULSecureCoding.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULSecureCoding.h new file mode 100644 index 0000000..8484b39 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULSecureCoding.h @@ -0,0 +1,36 @@ +// Copyright 2019 Google +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** The class wraps `NSKeyedArchiver` and `NSKeyedUnarchiver` API to provide a unified secure coding + * methods for iOS versions before and after 11. + */ +@interface GULSecureCoding : NSObject + ++ (nullable id)unarchivedObjectOfClasses:(NSSet *)classes + fromData:(NSData *)data + error:(NSError **)outError; + ++ (nullable id)unarchivedObjectOfClass:(Class)class + fromData:(NSData *)data + error:(NSError **)outError; + ++ (nullable NSData *)archivedDataWithRootObject:(id)object error:(NSError **)outError; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULSwizzler.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULSwizzler.h new file mode 100644 index 0000000..26949c8 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULSwizzler.h @@ -0,0 +1,71 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** This class handles the runtime manipulation necessary to instrument selectors. It stores the + * classes and selectors that have been swizzled, and runs all operations on its own queue. + */ +@interface GULSwizzler : NSObject + +/** Manipulates the Objective-C runtime to replace the original IMP with the supplied block. + * + * @param aClass The class to swizzle. + * @param selector The selector of the class to swizzle. + * @param isClassSelector A BOOL specifying whether the selector is a class or instance selector. + * @param block The block that replaces the original IMP. + */ ++ (void)swizzleClass:(Class)aClass + selector:(SEL)selector + isClassSelector:(BOOL)isClassSelector + withBlock:(nullable id)block; + +/** Returns the current IMP for the given class and selector. + * + * @param aClass The class to use. + * @param selector The selector to find the implementation of. + * @param isClassSelector A BOOL specifying whether the selector is a class or instance selector. + * @return The implementation of the selector in the runtime. + */ ++ (nullable IMP)currentImplementationForClass:(Class)aClass + selector:(SEL)selector + isClassSelector:(BOOL)isClassSelector; + +/** Checks the runtime to see if a selector exists on a class. If a property is declared as + * @dynamic, we have a reverse swizzling situation, where the implementation of a method exists + * only in concrete subclasses, and NOT in the superclass. We can detect that situation using + * this helper method. Similarly, we can detect situations where a class doesn't implement a + * protocol method. + * + * @param selector The selector to check for. + * @param aClass The class to check. + * @param isClassSelector A BOOL specifying whether the selector is a class or instance selector. + * @return YES if the method was found in this selector/class combination, NO otherwise. + */ ++ (BOOL)selector:(SEL)selector existsInClass:(Class)aClass isClassSelector:(BOOL)isClassSelector; + +/** Returns a list of all Objective-C (and not primitive) ivars contained by the given object. + * + * @param object The object whose ivars will be iterated. + * @return The list of ivar objects. + */ ++ (NSArray *)ivarObjectsForObject:(id)object; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULUserDefaults.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULUserDefaults.h new file mode 100644 index 0000000..0d04781 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GULUserDefaults.h @@ -0,0 +1,110 @@ +// Copyright 2018 Google +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#import + +NS_ASSUME_NONNULL_BEGIN + +/// A thread-safe user defaults that uses C functions from CFPreferences.h instead of +/// `NSUserDefaults`. This is to avoid sending an `NSNotification` when it's changed from a +/// background thread to avoid crashing. // TODO: Insert radar number here. +@interface GULUserDefaults : NSObject + +/// A shared user defaults similar to +[NSUserDefaults standardUserDefaults] and accesses the same +/// data of the standardUserDefaults. ++ (GULUserDefaults *)standardUserDefaults; + +/// Initializes preferences with a suite name that is the same with the NSUserDefaults' suite name. +/// Both of CFPreferences and NSUserDefaults share the same plist file so their data will exactly +/// the same. +/// +/// @param suiteName The name of the suite of the user defaults. +- (instancetype)initWithSuiteName:(nullable NSString *)suiteName; + +#pragma mark - Getters + +/// Searches the receiver's search list for a default with the key 'defaultName' and return it. If +/// another process has changed defaults in the search list, NSUserDefaults will automatically +/// update to the latest values. If the key in question has been marked as ubiquitous via a Defaults +/// Configuration File, the latest value may not be immediately available, and the registered value +/// will be returned instead. +- (nullable id)objectForKey:(NSString *)defaultName; + +/// Equivalent to -objectForKey:, except that it will return nil if the value is not an NSArray. +- (nullable NSArray *)arrayForKey:(NSString *)defaultName; + +/// Equivalent to -objectForKey:, except that it will return nil if the value +/// is not an NSDictionary. +- (nullable NSDictionary *)dictionaryForKey:(NSString *)defaultName; + +/// Equivalent to -objectForKey:, except that it will convert NSNumber values to their NSString +/// representation. If a non-string non-number value is found, nil will be returned. +- (nullable NSString *)stringForKey:(NSString *)defaultName; + +/// Equivalent to -objectForKey:, except that it converts the returned value to an NSInteger. If the +/// value is an NSNumber, the result of -integerValue will be returned. If the value is an NSString, +/// it will be converted to NSInteger if possible. If the value is a boolean, it will be converted +/// to either 1 for YES or 0 for NO. If the value is absent or can't be converted to an integer, 0 +/// will be returned. +- (NSInteger)integerForKey:(NSString *)defaultName; + +/// Similar to -integerForKey:, except that it returns a float, and boolean values will not be +/// converted. +- (float)floatForKey:(NSString *)defaultName; + +/// Similar to -integerForKey:, except that it returns a double, and boolean values will not be +/// converted. +- (double)doubleForKey:(NSString *)defaultName; + +/// Equivalent to -objectForKey:, except that it converts the returned value to a BOOL. If the value +/// is an NSNumber, NO will be returned if the value is 0, YES otherwise. If the value is an +/// NSString, values of "YES" or "1" will return YES, and values of "NO", "0", or any other string +/// will return NO. If the value is absent or can't be converted to a BOOL, NO will be returned. +- (BOOL)boolForKey:(NSString *)defaultName; + +#pragma mark - Setters + +/// Immediately stores a value (or removes the value if `nil` is passed as the value) for the +/// provided key in the search list entry for the receiver's suite name in the current user and any +/// host, then asynchronously stores the value persistently, where it is made available to other +/// processes. +- (void)setObject:(nullable id)value forKey:(NSString *)defaultName; + +/// Equivalent to -setObject:forKey: except that the value is converted from a float to an NSNumber. +- (void)setFloat:(float)value forKey:(NSString *)defaultName; + +/// Equivalent to -setObject:forKey: except that the value is converted from a double to an +/// NSNumber. +- (void)setDouble:(double)value forKey:(NSString *)defaultName; + +/// Equivalent to -setObject:forKey: except that the value is converted from an NSInteger to an +/// NSNumber. +- (void)setInteger:(NSInteger)value forKey:(NSString *)defaultName; + +/// Equivalent to -setObject:forKey: except that the value is converted from a BOOL to an NSNumber. +- (void)setBool:(BOOL)value forKey:(NSString *)defaultName; + +#pragma mark - Removing Defaults + +/// Equivalent to -[... setObject:nil forKey:defaultName] +- (void)removeObjectForKey:(NSString *)defaultName; + +#pragma mark - Save data + +/// Blocks the calling thread until all in-progress set operations have completed. +- (void)synchronize; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GoogleUtilities-umbrella.h b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GoogleUtilities-umbrella.h new file mode 100644 index 0000000..80815a5 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Headers/GoogleUtilities-umbrella.h @@ -0,0 +1,37 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "GULAppDelegateSwizzler.h" +#import "GULApplication.h" +#import "GULSceneDelegateSwizzler.h" +#import "GULAppEnvironmentUtil.h" +#import "GULHeartbeatDateStorage.h" +#import "GULKeychainStorage.h" +#import "GULKeychainUtils.h" +#import "GULSecureCoding.h" +#import "GULLogger.h" +#import "GULLoggerLevel.h" +#import "GULOriginalIMPConvenienceMacros.h" +#import "GULSwizzler.h" +#import "GULNSData+zlib.h" +#import "GULMutableDictionary.h" +#import "GULNetwork.h" +#import "GULNetworkConstants.h" +#import "GULNetworkLoggerProtocol.h" +#import "GULNetworkMessageCode.h" +#import "GULNetworkURLSession.h" +#import "GULReachabilityChecker.h" +#import "GULUserDefaults.h" + +FOUNDATION_EXPORT double GoogleUtilitiesVersionNumber; +FOUNDATION_EXPORT const unsigned char GoogleUtilitiesVersionString[]; + diff --git a/plugins/2020.3569/iphone/resources/Frameworks/GoogleUtilities.framework/Info.plist b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Info.plist similarity index 53% rename from plugins/2020.3569/iphone/resources/Frameworks/GoogleUtilities.framework/Info.plist rename to src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Info.plist index ac0c962..5a14eb4 100644 Binary files a/plugins/2020.3569/iphone/resources/Frameworks/GoogleUtilities.framework/Info.plist and b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Modules/module.modulemap new file mode 100644 index 0000000..491dd0a --- /dev/null +++ b/src/ios/EmbeddedFrameworks/GoogleUtilities.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module GoogleUtilities { + umbrella header "GoogleUtilities-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworks/Readme.markdown b/src/ios/EmbeddedFrameworks/Readme.markdown new file mode 100644 index 0000000..e12598f --- /dev/null +++ b/src/ios/EmbeddedFrameworks/Readme.markdown @@ -0,0 +1,2 @@ + +put embedded frameworks for a plugin here diff --git a/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/nanopb-umbrella.h b/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/nanopb-umbrella.h new file mode 100644 index 0000000..07e77b3 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/nanopb-umbrella.h @@ -0,0 +1,26 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "pb.h" +#import "pb_common.h" +#import "pb_decode.h" +#import "pb_encode.h" +#import "pb.h" +#import "pb_decode.h" +#import "pb_common.h" +#import "pb.h" +#import "pb_encode.h" +#import "pb_common.h" + +FOUNDATION_EXPORT double nanopbVersionNumber; +FOUNDATION_EXPORT const unsigned char nanopbVersionString[]; + diff --git a/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/pb.h b/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/pb.h new file mode 100644 index 0000000..2ba6c63 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/pb.h @@ -0,0 +1,599 @@ +/* Common parts of the nanopb library. Most of these are quite low-level + * stuff. For the high-level interface, see pb_encode.h and pb_decode.h. + */ + +#ifndef PB_H_INCLUDED +#define PB_H_INCLUDED + +/***************************************************************** + * Nanopb compilation time options. You can change these here by * + * uncommenting the lines, or on the compiler command line. * + *****************************************************************/ + +/* Enable support for dynamically allocated fields */ +/* #define PB_ENABLE_MALLOC 1 */ + +/* Define this if your CPU / compiler combination does not support + * unaligned memory access to packed structures. */ +/* #define PB_NO_PACKED_STRUCTS 1 */ + +/* Increase the number of required fields that are tracked. + * A compiler warning will tell if you need this. */ +/* #define PB_MAX_REQUIRED_FIELDS 256 */ + +/* Add support for tag numbers > 255 and fields larger than 255 bytes. */ +/* #define PB_FIELD_16BIT 1 */ + +/* Add support for tag numbers > 65536 and fields larger than 65536 bytes. */ +/* #define PB_FIELD_32BIT 1 */ + +/* Disable support for error messages in order to save some code space. */ +/* #define PB_NO_ERRMSG 1 */ + +/* Disable support for custom streams (support only memory buffers). */ +/* #define PB_BUFFER_ONLY 1 */ + +/* Switch back to the old-style callback function signature. + * This was the default until nanopb-0.2.1. */ +/* #define PB_OLD_CALLBACK_STYLE */ + + +/* Don't encode scalar arrays as packed. This is only to be used when + * the decoder on the receiving side cannot process packed scalar arrays. + * Such example is older protobuf.js. */ +/* #define PB_ENCODE_ARRAYS_UNPACKED 1 */ + +/****************************************************************** + * You usually don't need to change anything below this line. * + * Feel free to look around and use the defined macros, though. * + ******************************************************************/ + + +/* Version of the nanopb library. Just in case you want to check it in + * your own program. */ +#define NANOPB_VERSION nanopb-0.3.9.6 + +/* Include all the system headers needed by nanopb. You will need the + * definitions of the following: + * - strlen, memcpy, memset functions + * - [u]int_least8_t, uint_fast8_t, [u]int_least16_t, [u]int32_t, [u]int64_t + * - size_t + * - bool + * + * If you don't have the standard header files, you can instead provide + * a custom header that defines or includes all this. In that case, + * define PB_SYSTEM_HEADER to the path of this file. + */ +#ifdef PB_SYSTEM_HEADER +#include PB_SYSTEM_HEADER +#else +#include +#include +#include +#include + +#ifdef PB_ENABLE_MALLOC +#include +#endif +#endif + +/* Macro for defining packed structures (compiler dependent). + * This just reduces memory requirements, but is not required. + */ +#if defined(PB_NO_PACKED_STRUCTS) + /* Disable struct packing */ +# define PB_PACKED_STRUCT_START +# define PB_PACKED_STRUCT_END +# define pb_packed +#elif defined(__GNUC__) || defined(__clang__) + /* For GCC and clang */ +# define PB_PACKED_STRUCT_START +# define PB_PACKED_STRUCT_END +# define pb_packed __attribute__((packed)) +#elif defined(__ICCARM__) || defined(__CC_ARM) + /* For IAR ARM and Keil MDK-ARM compilers */ +# define PB_PACKED_STRUCT_START _Pragma("pack(push, 1)") +# define PB_PACKED_STRUCT_END _Pragma("pack(pop)") +# define pb_packed +#elif defined(_MSC_VER) && (_MSC_VER >= 1500) + /* For Microsoft Visual C++ */ +# define PB_PACKED_STRUCT_START __pragma(pack(push, 1)) +# define PB_PACKED_STRUCT_END __pragma(pack(pop)) +# define pb_packed +#else + /* Unknown compiler */ +# define PB_PACKED_STRUCT_START +# define PB_PACKED_STRUCT_END +# define pb_packed +#endif + +/* Handly macro for suppressing unreferenced-parameter compiler warnings. */ +#ifndef PB_UNUSED +#define PB_UNUSED(x) (void)(x) +#endif + +/* Compile-time assertion, used for checking compatible compilation options. + * If this does not work properly on your compiler, use + * #define PB_NO_STATIC_ASSERT to disable it. + * + * But before doing that, check carefully the error message / place where it + * comes from to see if the error has a real cause. Unfortunately the error + * message is not always very clear to read, but you can see the reason better + * in the place where the PB_STATIC_ASSERT macro was called. + */ +#ifndef PB_NO_STATIC_ASSERT +#ifndef PB_STATIC_ASSERT +#define PB_STATIC_ASSERT(COND,MSG) typedef char PB_STATIC_ASSERT_MSG(MSG, __LINE__, __COUNTER__)[(COND)?1:-1]; +#define PB_STATIC_ASSERT_MSG(MSG, LINE, COUNTER) PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) +#define PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) pb_static_assertion_##MSG##LINE##COUNTER +#endif +#else +#define PB_STATIC_ASSERT(COND,MSG) +#endif + +/* Number of required fields to keep track of. */ +#ifndef PB_MAX_REQUIRED_FIELDS +#define PB_MAX_REQUIRED_FIELDS 64 +#endif + +#if PB_MAX_REQUIRED_FIELDS < 64 +#error You should not lower PB_MAX_REQUIRED_FIELDS from the default value (64). +#endif + +/* List of possible field types. These are used in the autogenerated code. + * Least-significant 4 bits tell the scalar type + * Most-significant 4 bits specify repeated/required/packed etc. + */ + +typedef uint_least8_t pb_type_t; + +/**** Field data types ****/ + +/* Numeric types */ +#define PB_LTYPE_BOOL 0x00 /* bool */ +#define PB_LTYPE_VARINT 0x01 /* int32, int64, enum, bool */ +#define PB_LTYPE_UVARINT 0x02 /* uint32, uint64 */ +#define PB_LTYPE_SVARINT 0x03 /* sint32, sint64 */ +#define PB_LTYPE_FIXED32 0x04 /* fixed32, sfixed32, float */ +#define PB_LTYPE_FIXED64 0x05 /* fixed64, sfixed64, double */ + +/* Marker for last packable field type. */ +#define PB_LTYPE_LAST_PACKABLE 0x05 + +/* Byte array with pre-allocated buffer. + * data_size is the length of the allocated PB_BYTES_ARRAY structure. */ +#define PB_LTYPE_BYTES 0x06 + +/* String with pre-allocated buffer. + * data_size is the maximum length. */ +#define PB_LTYPE_STRING 0x07 + +/* Submessage + * submsg_fields is pointer to field descriptions */ +#define PB_LTYPE_SUBMESSAGE 0x08 + +/* Extension pseudo-field + * The field contains a pointer to pb_extension_t */ +#define PB_LTYPE_EXTENSION 0x09 + +/* Byte array with inline, pre-allocated byffer. + * data_size is the length of the inline, allocated buffer. + * This differs from PB_LTYPE_BYTES by defining the element as + * pb_byte_t[data_size] rather than pb_bytes_array_t. */ +#define PB_LTYPE_FIXED_LENGTH_BYTES 0x0A + +/* Number of declared LTYPES */ +#define PB_LTYPES_COUNT 0x0B +#define PB_LTYPE_MASK 0x0F + +/**** Field repetition rules ****/ + +#define PB_HTYPE_REQUIRED 0x00 +#define PB_HTYPE_OPTIONAL 0x10 +#define PB_HTYPE_REPEATED 0x20 +#define PB_HTYPE_ONEOF 0x30 +#define PB_HTYPE_MASK 0x30 + +/**** Field allocation types ****/ + +#define PB_ATYPE_STATIC 0x00 +#define PB_ATYPE_POINTER 0x80 +#define PB_ATYPE_CALLBACK 0x40 +#define PB_ATYPE_MASK 0xC0 + +#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK) +#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK) +#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK) + +/* Data type used for storing sizes of struct fields + * and array counts. + */ +#if defined(PB_FIELD_32BIT) + typedef uint32_t pb_size_t; + typedef int32_t pb_ssize_t; +#elif defined(PB_FIELD_16BIT) + typedef uint_least16_t pb_size_t; + typedef int_least16_t pb_ssize_t; +#else + typedef uint_least8_t pb_size_t; + typedef int_least8_t pb_ssize_t; +#endif +#define PB_SIZE_MAX ((pb_size_t)-1) + +/* Data type for storing encoded data and other byte streams. + * This typedef exists to support platforms where uint8_t does not exist. + * You can regard it as equivalent on uint8_t on other platforms. + */ +typedef uint_least8_t pb_byte_t; + +/* This structure is used in auto-generated constants + * to specify struct fields. + * You can change field sizes if you need structures + * larger than 256 bytes or field tags larger than 256. + * The compiler should complain if your .proto has such + * structures. Fix that by defining PB_FIELD_16BIT or + * PB_FIELD_32BIT. + */ +PB_PACKED_STRUCT_START +typedef struct pb_field_s pb_field_t; +struct pb_field_s { + pb_size_t tag; + pb_type_t type; + pb_size_t data_offset; /* Offset of field data, relative to previous field. */ + pb_ssize_t size_offset; /* Offset of array size or has-boolean, relative to data */ + pb_size_t data_size; /* Data size in bytes for a single item */ + pb_size_t array_size; /* Maximum number of entries in array */ + + /* Field definitions for submessage + * OR default value for all other non-array, non-callback types + * If null, then field will zeroed. */ + const void *ptr; +} pb_packed; +PB_PACKED_STRUCT_END + +/* Make sure that the standard integer types are of the expected sizes. + * Otherwise fixed32/fixed64 fields can break. + * + * If you get errors here, it probably means that your stdint.h is not + * correct for your platform. + */ +#ifndef PB_WITHOUT_64BIT +PB_STATIC_ASSERT(sizeof(int64_t) == 2 * sizeof(int32_t), INT64_T_WRONG_SIZE) +PB_STATIC_ASSERT(sizeof(uint64_t) == 2 * sizeof(uint32_t), UINT64_T_WRONG_SIZE) +#endif + +/* This structure is used for 'bytes' arrays. + * It has the number of bytes in the beginning, and after that an array. + * Note that actual structs used will have a different length of bytes array. + */ +#define PB_BYTES_ARRAY_T(n) struct { pb_size_t size; pb_byte_t bytes[n]; } +#define PB_BYTES_ARRAY_T_ALLOCSIZE(n) ((size_t)n + offsetof(pb_bytes_array_t, bytes)) + +struct pb_bytes_array_s { + pb_size_t size; + pb_byte_t bytes[1]; +}; +typedef struct pb_bytes_array_s pb_bytes_array_t; + +/* This structure is used for giving the callback function. + * It is stored in the message structure and filled in by the method that + * calls pb_decode. + * + * The decoding callback will be given a limited-length stream + * If the wire type was string, the length is the length of the string. + * If the wire type was a varint/fixed32/fixed64, the length is the length + * of the actual value. + * The function may be called multiple times (especially for repeated types, + * but also otherwise if the message happens to contain the field multiple + * times.) + * + * The encoding callback will receive the actual output stream. + * It should write all the data in one call, including the field tag and + * wire type. It can write multiple fields. + * + * The callback can be null if you want to skip a field. + */ +typedef struct pb_istream_s pb_istream_t; +typedef struct pb_ostream_s pb_ostream_t; +typedef struct pb_callback_s pb_callback_t; +struct pb_callback_s { +#ifdef PB_OLD_CALLBACK_STYLE + /* Deprecated since nanopb-0.2.1 */ + union { + bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void *arg); + bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, const void *arg); + } funcs; +#else + /* New function signature, which allows modifying arg contents in callback. */ + union { + bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void **arg); + bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, void * const *arg); + } funcs; +#endif + + /* Free arg for use by callback */ + void *arg; +}; + +/* Wire types. Library user needs these only in encoder callbacks. */ +typedef enum { + PB_WT_VARINT = 0, + PB_WT_64BIT = 1, + PB_WT_STRING = 2, + PB_WT_32BIT = 5 +} pb_wire_type_t; + +/* Structure for defining the handling of unknown/extension fields. + * Usually the pb_extension_type_t structure is automatically generated, + * while the pb_extension_t structure is created by the user. However, + * if you want to catch all unknown fields, you can also create a custom + * pb_extension_type_t with your own callback. + */ +typedef struct pb_extension_type_s pb_extension_type_t; +typedef struct pb_extension_s pb_extension_t; +struct pb_extension_type_s { + /* Called for each unknown field in the message. + * If you handle the field, read off all of its data and return true. + * If you do not handle the field, do not read anything and return true. + * If you run into an error, return false. + * Set to NULL for default handler. + */ + bool (*decode)(pb_istream_t *stream, pb_extension_t *extension, + uint32_t tag, pb_wire_type_t wire_type); + + /* Called once after all regular fields have been encoded. + * If you have something to write, do so and return true. + * If you do not have anything to write, just return true. + * If you run into an error, return false. + * Set to NULL for default handler. + */ + bool (*encode)(pb_ostream_t *stream, const pb_extension_t *extension); + + /* Free field for use by the callback. */ + const void *arg; +}; + +struct pb_extension_s { + /* Type describing the extension field. Usually you'll initialize + * this to a pointer to the automatically generated structure. */ + const pb_extension_type_t *type; + + /* Destination for the decoded data. This must match the datatype + * of the extension field. */ + void *dest; + + /* Pointer to the next extension handler, or NULL. + * If this extension does not match a field, the next handler is + * automatically called. */ + pb_extension_t *next; + + /* The decoder sets this to true if the extension was found. + * Ignored for encoding. */ + bool found; +}; + +/* Memory allocation functions to use. You can define pb_realloc and + * pb_free to custom functions if you want. */ +#ifdef PB_ENABLE_MALLOC +# ifndef pb_realloc +# define pb_realloc(ptr, size) realloc(ptr, size) +# endif +# ifndef pb_free +# define pb_free(ptr) free(ptr) +# endif +#endif + +/* This is used to inform about need to regenerate .pb.h/.pb.c files. */ +#define PB_PROTO_HEADER_VERSION 30 + +/* These macros are used to declare pb_field_t's in the constant array. */ +/* Size of a structure member, in bytes. */ +#define pb_membersize(st, m) (sizeof ((st*)0)->m) +/* Number of entries in an array. */ +#define pb_arraysize(st, m) (pb_membersize(st, m) / pb_membersize(st, m[0])) +/* Delta from start of one member to the start of another member. */ +#define pb_delta(st, m1, m2) ((int)offsetof(st, m1) - (int)offsetof(st, m2)) +/* Marks the end of the field list */ +#define PB_LAST_FIELD {0,(pb_type_t) 0,0,0,0,0,0} + +/* Macros for filling in the data_offset field */ +/* data_offset for first field in a message */ +#define PB_DATAOFFSET_FIRST(st, m1, m2) (offsetof(st, m1)) +/* data_offset for subsequent fields */ +#define PB_DATAOFFSET_OTHER(st, m1, m2) (offsetof(st, m1) - offsetof(st, m2) - pb_membersize(st, m2)) +/* data offset for subsequent fields inside an union (oneof) */ +#define PB_DATAOFFSET_UNION(st, m1, m2) (PB_SIZE_MAX) +/* Choose first/other based on m1 == m2 (deprecated, remains for backwards compatibility) */ +#define PB_DATAOFFSET_CHOOSE(st, m1, m2) (int)(offsetof(st, m1) == offsetof(st, m2) \ + ? PB_DATAOFFSET_FIRST(st, m1, m2) \ + : PB_DATAOFFSET_OTHER(st, m1, m2)) + +/* Required fields are the simplest. They just have delta (padding) from + * previous field end, and the size of the field. Pointer is used for + * submessages and default values. + */ +#define PB_REQUIRED_STATIC(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_REQUIRED | ltype, \ + fd, 0, pb_membersize(st, m), 0, ptr} + +/* Optional fields add the delta to the has_ variable. */ +#define PB_OPTIONAL_STATIC(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | ltype, \ + fd, \ + pb_delta(st, has_ ## m, m), \ + pb_membersize(st, m), 0, ptr} + +#define PB_SINGULAR_STATIC(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | ltype, \ + fd, 0, pb_membersize(st, m), 0, ptr} + +/* Repeated fields have a _count field and also the maximum number of entries. */ +#define PB_REPEATED_STATIC(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_REPEATED | ltype, \ + fd, \ + pb_delta(st, m ## _count, m), \ + pb_membersize(st, m[0]), \ + pb_arraysize(st, m), ptr} + +/* Allocated fields carry the size of the actual data, not the pointer */ +#define PB_REQUIRED_POINTER(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_POINTER | PB_HTYPE_REQUIRED | ltype, \ + fd, 0, pb_membersize(st, m[0]), 0, ptr} + +/* Optional fields don't need a has_ variable, as information would be redundant */ +#define PB_OPTIONAL_POINTER(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_POINTER | PB_HTYPE_OPTIONAL | ltype, \ + fd, 0, pb_membersize(st, m[0]), 0, ptr} + +/* Same as optional fields*/ +#define PB_SINGULAR_POINTER(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_POINTER | PB_HTYPE_OPTIONAL | ltype, \ + fd, 0, pb_membersize(st, m[0]), 0, ptr} + +/* Repeated fields have a _count field and a pointer to array of pointers */ +#define PB_REPEATED_POINTER(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_POINTER | PB_HTYPE_REPEATED | ltype, \ + fd, pb_delta(st, m ## _count, m), \ + pb_membersize(st, m[0]), 0, ptr} + +/* Callbacks are much like required fields except with special datatype. */ +#define PB_REQUIRED_CALLBACK(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_CALLBACK | PB_HTYPE_REQUIRED | ltype, \ + fd, 0, pb_membersize(st, m), 0, ptr} + +#define PB_OPTIONAL_CALLBACK(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_CALLBACK | PB_HTYPE_OPTIONAL | ltype, \ + fd, 0, pb_membersize(st, m), 0, ptr} + +#define PB_SINGULAR_CALLBACK(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_CALLBACK | PB_HTYPE_OPTIONAL | ltype, \ + fd, 0, pb_membersize(st, m), 0, ptr} + +#define PB_REPEATED_CALLBACK(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_CALLBACK | PB_HTYPE_REPEATED | ltype, \ + fd, 0, pb_membersize(st, m), 0, ptr} + +/* Optional extensions don't have the has_ field, as that would be redundant. + * Furthermore, the combination of OPTIONAL without has_ field is used + * for indicating proto3 style fields. Extensions exist in proto2 mode only, + * so they should be encoded according to proto2 rules. To avoid the conflict, + * extensions are marked as REQUIRED instead. + */ +#define PB_OPTEXT_STATIC(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_REQUIRED | ltype, \ + 0, \ + 0, \ + pb_membersize(st, m), 0, ptr} + +#define PB_OPTEXT_POINTER(tag, st, m, fd, ltype, ptr) \ + PB_OPTIONAL_POINTER(tag, st, m, fd, ltype, ptr) + +#define PB_OPTEXT_CALLBACK(tag, st, m, fd, ltype, ptr) \ + PB_OPTIONAL_CALLBACK(tag, st, m, fd, ltype, ptr) + +/* The mapping from protobuf types to LTYPEs is done using these macros. */ +#define PB_LTYPE_MAP_BOOL PB_LTYPE_BOOL +#define PB_LTYPE_MAP_BYTES PB_LTYPE_BYTES +#define PB_LTYPE_MAP_DOUBLE PB_LTYPE_FIXED64 +#define PB_LTYPE_MAP_ENUM PB_LTYPE_VARINT +#define PB_LTYPE_MAP_UENUM PB_LTYPE_UVARINT +#define PB_LTYPE_MAP_FIXED32 PB_LTYPE_FIXED32 +#define PB_LTYPE_MAP_FIXED64 PB_LTYPE_FIXED64 +#define PB_LTYPE_MAP_FLOAT PB_LTYPE_FIXED32 +#define PB_LTYPE_MAP_INT32 PB_LTYPE_VARINT +#define PB_LTYPE_MAP_INT64 PB_LTYPE_VARINT +#define PB_LTYPE_MAP_MESSAGE PB_LTYPE_SUBMESSAGE +#define PB_LTYPE_MAP_SFIXED32 PB_LTYPE_FIXED32 +#define PB_LTYPE_MAP_SFIXED64 PB_LTYPE_FIXED64 +#define PB_LTYPE_MAP_SINT32 PB_LTYPE_SVARINT +#define PB_LTYPE_MAP_SINT64 PB_LTYPE_SVARINT +#define PB_LTYPE_MAP_STRING PB_LTYPE_STRING +#define PB_LTYPE_MAP_UINT32 PB_LTYPE_UVARINT +#define PB_LTYPE_MAP_UINT64 PB_LTYPE_UVARINT +#define PB_LTYPE_MAP_EXTENSION PB_LTYPE_EXTENSION +#define PB_LTYPE_MAP_FIXED_LENGTH_BYTES PB_LTYPE_FIXED_LENGTH_BYTES + +/* This is the actual macro used in field descriptions. + * It takes these arguments: + * - Field tag number + * - Field type: BOOL, BYTES, DOUBLE, ENUM, UENUM, FIXED32, FIXED64, + * FLOAT, INT32, INT64, MESSAGE, SFIXED32, SFIXED64 + * SINT32, SINT64, STRING, UINT32, UINT64 or EXTENSION + * - Field rules: REQUIRED, OPTIONAL or REPEATED + * - Allocation: STATIC, CALLBACK or POINTER + * - Placement: FIRST or OTHER, depending on if this is the first field in structure. + * - Message name + * - Field name + * - Previous field name (or field name again for first field) + * - Pointer to default value or submsg fields. + */ + +#define PB_FIELD(tag, type, rules, allocation, placement, message, field, prevfield, ptr) \ + PB_ ## rules ## _ ## allocation(tag, message, field, \ + PB_DATAOFFSET_ ## placement(message, field, prevfield), \ + PB_LTYPE_MAP_ ## type, ptr) + +/* Field description for repeated static fixed count fields.*/ +#define PB_REPEATED_FIXED_COUNT(tag, type, placement, message, field, prevfield, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_REPEATED | PB_LTYPE_MAP_ ## type, \ + PB_DATAOFFSET_ ## placement(message, field, prevfield), \ + 0, \ + pb_membersize(message, field[0]), \ + pb_arraysize(message, field), ptr} + +/* Field description for oneof fields. This requires taking into account the + * union name also, that's why a separate set of macros is needed. + */ +#define PB_ONEOF_STATIC(u, tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_ONEOF | ltype, \ + fd, pb_delta(st, which_ ## u, u.m), \ + pb_membersize(st, u.m), 0, ptr} + +#define PB_ONEOF_POINTER(u, tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_POINTER | PB_HTYPE_ONEOF | ltype, \ + fd, pb_delta(st, which_ ## u, u.m), \ + pb_membersize(st, u.m[0]), 0, ptr} + +#define PB_ONEOF_FIELD(union_name, tag, type, rules, allocation, placement, message, field, prevfield, ptr) \ + PB_ONEOF_ ## allocation(union_name, tag, message, field, \ + PB_DATAOFFSET_ ## placement(message, union_name.field, prevfield), \ + PB_LTYPE_MAP_ ## type, ptr) + +#define PB_ANONYMOUS_ONEOF_STATIC(u, tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_ONEOF | ltype, \ + fd, pb_delta(st, which_ ## u, m), \ + pb_membersize(st, m), 0, ptr} + +#define PB_ANONYMOUS_ONEOF_POINTER(u, tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_POINTER | PB_HTYPE_ONEOF | ltype, \ + fd, pb_delta(st, which_ ## u, m), \ + pb_membersize(st, m[0]), 0, ptr} + +#define PB_ANONYMOUS_ONEOF_FIELD(union_name, tag, type, rules, allocation, placement, message, field, prevfield, ptr) \ + PB_ANONYMOUS_ONEOF_ ## allocation(union_name, tag, message, field, \ + PB_DATAOFFSET_ ## placement(message, field, prevfield), \ + PB_LTYPE_MAP_ ## type, ptr) + +/* These macros are used for giving out error messages. + * They are mostly a debugging aid; the main error information + * is the true/false return value from functions. + * Some code space can be saved by disabling the error + * messages if not used. + * + * PB_SET_ERROR() sets the error message if none has been set yet. + * msg must be a constant string literal. + * PB_GET_ERROR() always returns a pointer to a string. + * PB_RETURN_ERROR() sets the error and returns false from current + * function. + */ +#ifdef PB_NO_ERRMSG +#define PB_SET_ERROR(stream, msg) PB_UNUSED(stream) +#define PB_GET_ERROR(stream) "(errmsg disabled)" +#else +#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg)) +#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)") +#endif + +#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false + +#endif diff --git a/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/pb_common.h b/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/pb_common.h new file mode 100644 index 0000000..60b3d37 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/pb_common.h @@ -0,0 +1,42 @@ +/* pb_common.h: Common support functions for pb_encode.c and pb_decode.c. + * These functions are rarely needed by applications directly. + */ + +#ifndef PB_COMMON_H_INCLUDED +#define PB_COMMON_H_INCLUDED + +#include "pb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Iterator for pb_field_t list */ +struct pb_field_iter_s { + const pb_field_t *start; /* Start of the pb_field_t array */ + const pb_field_t *pos; /* Current position of the iterator */ + unsigned required_field_index; /* Zero-based index that counts only the required fields */ + void *dest_struct; /* Pointer to start of the structure */ + void *pData; /* Pointer to current field value */ + void *pSize; /* Pointer to count/has field */ +}; +typedef struct pb_field_iter_s pb_field_iter_t; + +/* Initialize the field iterator structure to beginning. + * Returns false if the message type is empty. */ +bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct); + +/* Advance the iterator to the next field. + * Returns false when the iterator wraps back to the first field. */ +bool pb_field_iter_next(pb_field_iter_t *iter); + +/* Advance the iterator until it points at a field with the given tag. + * Returns false if no such field exists. */ +bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif + diff --git a/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/pb_decode.h b/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/pb_decode.h new file mode 100644 index 0000000..3577c20 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/pb_decode.h @@ -0,0 +1,178 @@ +/* pb_decode.h: Functions to decode protocol buffers. Depends on pb_decode.c. + * The main function is pb_decode. You also need an input stream, and the + * field descriptions created by nanopb_generator.py. + */ + +#ifndef PB_DECODE_H_INCLUDED +#define PB_DECODE_H_INCLUDED + +#include "pb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Structure for defining custom input streams. You will need to provide + * a callback function to read the bytes from your storage, which can be + * for example a file or a network socket. + * + * The callback must conform to these rules: + * + * 1) Return false on IO errors. This will cause decoding to abort. + * 2) You can use state to store your own data (e.g. buffer pointer), + * and rely on pb_read to verify that no-body reads past bytes_left. + * 3) Your callback may be used with substreams, in which case bytes_left + * is different than from the main stream. Don't use bytes_left to compute + * any pointers. + */ +struct pb_istream_s +{ +#ifdef PB_BUFFER_ONLY + /* Callback pointer is not used in buffer-only configuration. + * Having an int pointer here allows binary compatibility but + * gives an error if someone tries to assign callback function. + */ + int *callback; +#else + bool (*callback)(pb_istream_t *stream, pb_byte_t *buf, size_t count); +#endif + + void *state; /* Free field for use by callback implementation */ + size_t bytes_left; + +#ifndef PB_NO_ERRMSG + const char *errmsg; +#endif +}; + +/*************************** + * Main decoding functions * + ***************************/ + +/* Decode a single protocol buffers message from input stream into a C structure. + * Returns true on success, false on any failure. + * The actual struct pointed to by dest must match the description in fields. + * Callback fields of the destination structure must be initialized by caller. + * All other fields will be initialized by this function. + * + * Example usage: + * MyMessage msg = {}; + * uint8_t buffer[64]; + * pb_istream_t stream; + * + * // ... read some data into buffer ... + * + * stream = pb_istream_from_buffer(buffer, count); + * pb_decode(&stream, MyMessage_fields, &msg); + */ +bool pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); + +/* Same as pb_decode, except does not initialize the destination structure + * to default values. This is slightly faster if you need no default values + * and just do memset(struct, 0, sizeof(struct)) yourself. + * + * This can also be used for 'merging' two messages, i.e. update only the + * fields that exist in the new message. + * + * Note: If this function returns with an error, it will not release any + * dynamically allocated fields. You will need to call pb_release() yourself. + */ +bool pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); + +/* Same as pb_decode, except expects the stream to start with the message size + * encoded as varint. Corresponds to parseDelimitedFrom() in Google's + * protobuf API. + */ +bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); + +/* Same as pb_decode_delimited, except that it does not initialize the destination structure. + * See pb_decode_noinit + */ +bool pb_decode_delimited_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); + +/* Same as pb_decode, except allows the message to be terminated with a null byte. + * NOTE: Until nanopb-0.4.0, pb_decode() also allows null-termination. This behaviour + * is not supported in most other protobuf implementations, so pb_decode_delimited() + * is a better option for compatibility. + */ +bool pb_decode_nullterminated(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); + +#ifdef PB_ENABLE_MALLOC +/* Release any allocated pointer fields. If you use dynamic allocation, you should + * call this for any successfully decoded message when you are done with it. If + * pb_decode() returns with an error, the message is already released. + */ +void pb_release(const pb_field_t fields[], void *dest_struct); +#endif + + +/************************************** + * Functions for manipulating streams * + **************************************/ + +/* Create an input stream for reading from a memory buffer. + * + * Alternatively, you can use a custom stream that reads directly from e.g. + * a file or a network socket. + */ +pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize); + +/* Function to read from a pb_istream_t. You can use this if you need to + * read some custom header data, or to read data in field callbacks. + */ +bool pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count); + + +/************************************************ + * Helper functions for writing field callbacks * + ************************************************/ + +/* Decode the tag for the next field in the stream. Gives the wire type and + * field tag. At end of the message, returns false and sets eof to true. */ +bool pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof); + +/* Skip the field payload data, given the wire type. */ +bool pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type); + +/* Decode an integer in the varint format. This works for enum, int32, + * int64, uint32 and uint64 field types. */ +#ifndef PB_WITHOUT_64BIT +bool pb_decode_varint(pb_istream_t *stream, uint64_t *dest); +#else +#define pb_decode_varint pb_decode_varint32 +#endif + +/* Decode an integer in the varint format. This works for enum, int32, + * and uint32 field types. */ +bool pb_decode_varint32(pb_istream_t *stream, uint32_t *dest); + +/* Decode a bool value in varint format. */ +bool pb_decode_bool(pb_istream_t *stream, bool *dest); + +/* Decode an integer in the zig-zagged svarint format. This works for sint32 + * and sint64. */ +#ifndef PB_WITHOUT_64BIT +bool pb_decode_svarint(pb_istream_t *stream, int64_t *dest); +#else +bool pb_decode_svarint(pb_istream_t *stream, int32_t *dest); +#endif + +/* Decode a fixed32, sfixed32 or float value. You need to pass a pointer to + * a 4-byte wide C variable. */ +bool pb_decode_fixed32(pb_istream_t *stream, void *dest); + +#ifndef PB_WITHOUT_64BIT +/* Decode a fixed64, sfixed64 or double value. You need to pass a pointer to + * a 8-byte wide C variable. */ +bool pb_decode_fixed64(pb_istream_t *stream, void *dest); +#endif + +/* Make a limited-length substream for reading a PB_WT_STRING field. */ +bool pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream); +bool pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/pb_encode.h b/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/pb_encode.h new file mode 100644 index 0000000..8bf78dd --- /dev/null +++ b/src/ios/EmbeddedFrameworks/nanopb.framework/Headers/pb_encode.h @@ -0,0 +1,170 @@ +/* pb_encode.h: Functions to encode protocol buffers. Depends on pb_encode.c. + * The main function is pb_encode. You also need an output stream, and the + * field descriptions created by nanopb_generator.py. + */ + +#ifndef PB_ENCODE_H_INCLUDED +#define PB_ENCODE_H_INCLUDED + +#include "pb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Structure for defining custom output streams. You will need to provide + * a callback function to write the bytes to your storage, which can be + * for example a file or a network socket. + * + * The callback must conform to these rules: + * + * 1) Return false on IO errors. This will cause encoding to abort. + * 2) You can use state to store your own data (e.g. buffer pointer). + * 3) pb_write will update bytes_written after your callback runs. + * 4) Substreams will modify max_size and bytes_written. Don't use them + * to calculate any pointers. + */ +struct pb_ostream_s +{ +#ifdef PB_BUFFER_ONLY + /* Callback pointer is not used in buffer-only configuration. + * Having an int pointer here allows binary compatibility but + * gives an error if someone tries to assign callback function. + * Also, NULL pointer marks a 'sizing stream' that does not + * write anything. + */ + int *callback; +#else + bool (*callback)(pb_ostream_t *stream, const pb_byte_t *buf, size_t count); +#endif + void *state; /* Free field for use by callback implementation. */ + size_t max_size; /* Limit number of output bytes written (or use SIZE_MAX). */ + size_t bytes_written; /* Number of bytes written so far. */ + +#ifndef PB_NO_ERRMSG + const char *errmsg; +#endif +}; + +/*************************** + * Main encoding functions * + ***************************/ + +/* Encode a single protocol buffers message from C structure into a stream. + * Returns true on success, false on any failure. + * The actual struct pointed to by src_struct must match the description in fields. + * All required fields in the struct are assumed to have been filled in. + * + * Example usage: + * MyMessage msg = {}; + * uint8_t buffer[64]; + * pb_ostream_t stream; + * + * msg.field1 = 42; + * stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); + * pb_encode(&stream, MyMessage_fields, &msg); + */ +bool pb_encode(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); + +/* Same as pb_encode, but prepends the length of the message as a varint. + * Corresponds to writeDelimitedTo() in Google's protobuf API. + */ +bool pb_encode_delimited(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); + +/* Same as pb_encode, but appends a null byte to the message for termination. + * NOTE: This behaviour is not supported in most other protobuf implementations, so pb_encode_delimited() + * is a better option for compatibility. + */ +bool pb_encode_nullterminated(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); + +/* Encode the message to get the size of the encoded data, but do not store + * the data. */ +bool pb_get_encoded_size(size_t *size, const pb_field_t fields[], const void *src_struct); + +/************************************** + * Functions for manipulating streams * + **************************************/ + +/* Create an output stream for writing into a memory buffer. + * The number of bytes written can be found in stream.bytes_written after + * encoding the message. + * + * Alternatively, you can use a custom stream that writes directly to e.g. + * a file or a network socket. + */ +pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize); + +/* Pseudo-stream for measuring the size of a message without actually storing + * the encoded data. + * + * Example usage: + * MyMessage msg = {}; + * pb_ostream_t stream = PB_OSTREAM_SIZING; + * pb_encode(&stream, MyMessage_fields, &msg); + * printf("Message size is %d\n", stream.bytes_written); + */ +#ifndef PB_NO_ERRMSG +#define PB_OSTREAM_SIZING {0,0,0,0,0} +#else +#define PB_OSTREAM_SIZING {0,0,0,0} +#endif + +/* Function to write into a pb_ostream_t stream. You can use this if you need + * to append or prepend some custom headers to the message. + */ +bool pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count); + + +/************************************************ + * Helper functions for writing field callbacks * + ************************************************/ + +/* Encode field header based on type and field number defined in the field + * structure. Call this from the callback before writing out field contents. */ +bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_t *field); + +/* Encode field header by manually specifing wire type. You need to use this + * if you want to write out packed arrays from a callback field. */ +bool pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number); + +/* Encode an integer in the varint format. + * This works for bool, enum, int32, int64, uint32 and uint64 field types. */ +#ifndef PB_WITHOUT_64BIT +bool pb_encode_varint(pb_ostream_t *stream, uint64_t value); +#else +bool pb_encode_varint(pb_ostream_t *stream, uint32_t value); +#endif + +/* Encode an integer in the zig-zagged svarint format. + * This works for sint32 and sint64. */ +#ifndef PB_WITHOUT_64BIT +bool pb_encode_svarint(pb_ostream_t *stream, int64_t value); +#else +bool pb_encode_svarint(pb_ostream_t *stream, int32_t value); +#endif + +/* Encode a string or bytes type field. For strings, pass strlen(s) as size. */ +bool pb_encode_string(pb_ostream_t *stream, const pb_byte_t *buffer, size_t size); + +/* Encode a fixed32, sfixed32 or float value. + * You need to pass a pointer to a 4-byte wide C variable. */ +bool pb_encode_fixed32(pb_ostream_t *stream, const void *value); + +#ifndef PB_WITHOUT_64BIT +/* Encode a fixed64, sfixed64 or double value. + * You need to pass a pointer to a 8-byte wide C variable. */ +bool pb_encode_fixed64(pb_ostream_t *stream, const void *value); +#endif + +/* Encode a submessage field. + * You need to pass the pb_field_t array and pointer to struct, just like + * with pb_encode(). This internally encodes the submessage twice, first to + * calculate message size and then to actually write it out. + */ +bool pb_encode_submessage(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/plugins/2020.3569/iphone/resources/Frameworks/protobuf.framework/Info.plist b/src/ios/EmbeddedFrameworks/nanopb.framework/Info.plist similarity index 54% rename from plugins/2020.3569/iphone/resources/Frameworks/protobuf.framework/Info.plist rename to src/ios/EmbeddedFrameworks/nanopb.framework/Info.plist index cd186df..15d91cf 100644 Binary files a/plugins/2020.3569/iphone/resources/Frameworks/protobuf.framework/Info.plist and b/src/ios/EmbeddedFrameworks/nanopb.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworks/nanopb.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworks/nanopb.framework/Modules/module.modulemap new file mode 100644 index 0000000..e8d4b53 --- /dev/null +++ b/src/ios/EmbeddedFrameworks/nanopb.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module nanopb { + umbrella header "nanopb-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworks/nanopb.framework/nanopb b/src/ios/EmbeddedFrameworks/nanopb.framework/nanopb new file mode 100755 index 0000000..f220c46 Binary files /dev/null and b/src/ios/EmbeddedFrameworks/nanopb.framework/nanopb differ diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/FBLPromises b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/FBLPromises new file mode 100755 index 0000000..fb79470 Binary files /dev/null and b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/FBLPromises differ diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+All.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+All.h new file mode 100644 index 0000000..9c0090e --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+All.h @@ -0,0 +1,63 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(AllAdditions) + +/** + Wait until all of the given promises are fulfilled. + If one of the given promises is rejected, then the returned promise is rejected with same error. + If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, + it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly. + Promises resolved with `nil` become `NSNull` instances in the resulting array. + + @param promises Promises to wait for. + @return Promise of an array containing the values of input promises in the same order. + */ ++ (FBLPromise *)all:(NSArray *)promises NS_SWIFT_UNAVAILABLE(""); + +/** + Wait until all of the given promises are fulfilled. + If one of the given promises is rejected, then the returned promise is rejected with same error. + If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, + it's implicitly considered a pre-fulfilled or pre-rejected FBLPromise correspondingly. + Promises resolved with `nil` become `NSNull` instances in the resulting array. + + @param queue A queue to dispatch on. + @param promises Promises to wait for. + @return Promise of an array containing the values of input promises in the same order. + */ ++ (FBLPromise *)onQueue:(dispatch_queue_t)queue + all:(NSArray *)promises NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `all` operators. + Usage: FBLPromise.all(@[ ... ]) + */ +@interface FBLPromise(DotSyntax_AllAdditions) + ++ (FBLPromise * (^)(NSArray *))all FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise * (^)(dispatch_queue_t, NSArray *))allOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Always.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Always.h new file mode 100644 index 0000000..13000f5 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Always.h @@ -0,0 +1,54 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(AlwaysAdditions) + +typedef void (^FBLPromiseAlwaysWorkBlock)(void) NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block that always executes, no matter if the receiver is rejected or fulfilled. + @return A new pending promise to be resolved with same resolution as the receiver. + */ +- (FBLPromise *)always:(FBLPromiseAlwaysWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to dispatch on. + @param work A block that always executes, no matter if the receiver is rejected or fulfilled. + @return A new pending promise to be resolved with same resolution as the receiver. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + always:(FBLPromiseAlwaysWorkBlock)work NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `always` operators. + Usage: promise.always(^{...}) + */ +@interface FBLPromise(DotSyntax_AlwaysAdditions) + +- (FBLPromise* (^)(FBLPromiseAlwaysWorkBlock))always FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise* (^)(dispatch_queue_t, FBLPromiseAlwaysWorkBlock))alwaysOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Any.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Any.h new file mode 100644 index 0000000..82875bf --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Any.h @@ -0,0 +1,69 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(AnyAdditions) + +/** + Waits until all of the given promises are either fulfilled or rejected. + If all promises are rejected, then the returned promise is rejected with same error + as the last one rejected. + If at least one of the promises is fulfilled, the resulting promise is fulfilled with an array of + values or `NSErrors`, matching the original order of fulfilled or rejected promises respectively. + If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, + it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly. + Promises resolved with `nil` become `NSNull` instances in the resulting array. + + @param promises Promises to wait for. + @return Promise of array containing the values or `NSError`s of input promises in the same order. + */ ++ (FBLPromise *)any:(NSArray *)promises NS_SWIFT_UNAVAILABLE(""); + +/** + Waits until all of the given promises are either fulfilled or rejected. + If all promises are rejected, then the returned promise is rejected with same error + as the last one rejected. + If at least one of the promises is fulfilled, the resulting promise is fulfilled with an array of + values or `NSError`s, matching the original order of fulfilled or rejected promises respectively. + If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, + it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly. + Promises resolved with `nil` become `NSNull` instances in the resulting array. + + @param queue A queue to dispatch on. + @param promises Promises to wait for. + @return Promise of array containing the values or `NSError`s of input promises in the same order. + */ ++ (FBLPromise *)onQueue:(dispatch_queue_t)queue + any:(NSArray *)promises NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `any` operators. + Usage: FBLPromise.any(@[ ... ]) + */ +@interface FBLPromise(DotSyntax_AnyAdditions) + ++ (FBLPromise * (^)(NSArray *))any FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise * (^)(dispatch_queue_t, NSArray *))anyOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Async.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Async.h new file mode 100644 index 0000000..0588a9e --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Async.h @@ -0,0 +1,60 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(AsyncAdditions) + +typedef void (^FBLPromiseFulfillBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseRejectBlock)(NSError *error) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseAsyncWorkBlock)(FBLPromiseFulfillBlock fulfill, + FBLPromiseRejectBlock reject) NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise and executes `work` block asynchronously. + + @param work A block to perform any operations needed to resolve the promise. + @return A new pending promise. + */ ++ (instancetype)async:(FBLPromiseAsyncWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise and executes `work` block asynchronously on the given queue. + + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @return A new pending promise. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue + async:(FBLPromiseAsyncWorkBlock)work NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `async` operators. + Usage: FBLPromise.async(^(FBLPromiseFulfillBlock fulfill, FBLPromiseRejectBlock reject) { ... }) + */ +@interface FBLPromise(DotSyntax_AsyncAdditions) + ++ (FBLPromise* (^)(FBLPromiseAsyncWorkBlock))async FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, FBLPromiseAsyncWorkBlock))asyncOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Await.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Await.h new file mode 100644 index 0000000..c97a1ba --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Await.h @@ -0,0 +1,32 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + Waits for promise resolution. The current thread blocks until the promise is resolved. + + @param promise Promise to wait for. + @param error Error the promise was rejected with, or `nil` if the promise was fulfilled. + @return Value the promise was fulfilled with. If the promise was rejected, the return value + is always `nil`, but the error out arg is not. + */ +FOUNDATION_EXTERN id __nullable FBLPromiseAwait(FBLPromise *promise, + NSError **error) NS_REFINED_FOR_SWIFT; + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Catch.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Catch.h new file mode 100644 index 0000000..a9ff170 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Catch.h @@ -0,0 +1,59 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(CatchAdditions) + +typedef void (^FBLPromiseCatchWorkBlock)(NSError *error) NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise which eventually gets resolved with same resolution as the receiver. + If receiver is rejected, then `reject` block is executed asynchronously. + + @param reject A block to handle the error that receiver was rejected with. + @return A new pending promise. + */ +- (FBLPromise *)catch:(FBLPromiseCatchWorkBlock)reject NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise which eventually gets resolved with same resolution as the receiver. + If receiver is rejected, then `reject` block is executed asynchronously on the given queue. + + @param queue A queue to invoke the `reject` block on. + @param reject A block to handle the error that receiver was rejected with. + @return A new pending promise. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + catch:(FBLPromiseCatchWorkBlock)reject NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `catch` operators. + Usage: promise.catch(^(NSError *error) { ... }) + */ +@interface FBLPromise(DotSyntax_CatchAdditions) + +- (FBLPromise* (^)(FBLPromiseCatchWorkBlock))catch FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise* (^)(dispatch_queue_t, FBLPromiseCatchWorkBlock))catchOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Delay.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Delay.h new file mode 100644 index 0000000..557df48 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Delay.h @@ -0,0 +1,59 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(DelayAdditions) + +/** + Creates a new pending promise that fulfills with the same value as `self` after the `delay`, or + rejects with the same error immediately. + + @param interval Time to wait in seconds. + @return A new pending promise that fulfills at least `delay` seconds later than `self`, or rejects + with the same error immediately. + */ +- (FBLPromise *)delay:(NSTimeInterval)interval NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a new pending promise that fulfills with the same value as `self` after the `delay`, or + rejects with the same error immediately. + + @param queue A queue to dispatch on. + @param interval Time to wait in seconds. + @return A new pending promise that fulfills at least `delay` seconds later than `self`, or rejects + with the same error immediately. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + delay:(NSTimeInterval)interval NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `delay` operators. + Usage: promise.delay(...) + */ +@interface FBLPromise(DotSyntax_DelayAdditions) + +- (FBLPromise * (^)(NSTimeInterval))delay FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise * (^)(dispatch_queue_t, NSTimeInterval))delayOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Do.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Do.h new file mode 100644 index 0000000..6838e0a --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Do.h @@ -0,0 +1,55 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(DoAdditions) + +typedef id __nullable (^FBLPromiseDoWorkBlock)(void) NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise and executes `work` block asynchronously. + + @param work A block that returns a value or an error used to resolve the promise. + @return A new pending promise. + */ ++ (instancetype)do:(FBLPromiseDoWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise and executes `work` block asynchronously on the given queue. + + @param queue A queue to invoke the `work` block on. + @param work A block that returns a value or an error used to resolve the promise. + @return A new pending promise. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue do:(FBLPromiseDoWorkBlock)work NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `do` operators. + Usage: FBLPromise.doOn(queue, ^(NSError *error) { ... }) + */ +@interface FBLPromise(DotSyntax_DoAdditions) + ++ (FBLPromise * (^)(dispatch_queue_t, FBLPromiseDoWorkBlock))doOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Race.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Race.h new file mode 100644 index 0000000..2f67258 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Race.h @@ -0,0 +1,62 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(RaceAdditions) + +/** + Wait until any of the given promises are fulfilled. + If one of the promises is rejected, then the returned promise is rejected with same error. + If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, + it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly. + + @param promises Promises to wait for. + @return A new pending promise to be resolved with the same resolution as the first promise, among + the given ones, which was resolved. + */ ++ (instancetype)race:(NSArray *)promises NS_SWIFT_UNAVAILABLE(""); + +/** + Wait until any of the given promises are fulfilled. + If one of the promises is rejected, then the returned promise is rejected with same error. + If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`, + it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly. + + @param queue A queue to dispatch on. + @param promises Promises to wait for. + @return A new pending promise to be resolved with the same resolution as the first promise, among + the given ones, which was resolved. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue race:(NSArray *)promises NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `race` operators. + Usage: FBLPromise.race(@[ ... ]) + */ +@interface FBLPromise(DotSyntax_RaceAdditions) + ++ (FBLPromise * (^)(NSArray *))race FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise * (^)(dispatch_queue_t, NSArray *))raceOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Recover.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Recover.h new file mode 100644 index 0000000..bb7df7e --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Recover.h @@ -0,0 +1,60 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(RecoverAdditions) + +typedef id __nullable (^FBLPromiseRecoverWorkBlock)(NSError *error) NS_SWIFT_UNAVAILABLE(""); + +/** + Provides a new promise to recover in case the receiver gets rejected. + + @param recovery A block to handle the error that the receiver was rejected with. + @return A new pending promise to use instead of the rejected one that gets resolved with resolution + returned from `recovery` block. + */ +- (FBLPromise *)recover:(FBLPromiseRecoverWorkBlock)recovery NS_SWIFT_UNAVAILABLE(""); + +/** + Provides a new promise to recover in case the receiver gets rejected. + + @param queue A queue to dispatch on. + @param recovery A block to handle the error that the receiver was rejected with. + @return A new pending promise to use instead of the rejected one that gets resolved with resolution + returned from `recovery` block. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + recover:(FBLPromiseRecoverWorkBlock)recovery NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `recover` operators. + Usage: promise.recover(^id(NSError *error) {...}) + */ +@interface FBLPromise(DotSyntax_RecoverAdditions) + +- (FBLPromise * (^)(FBLPromiseRecoverWorkBlock))recover FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise * (^)(dispatch_queue_t, FBLPromiseRecoverWorkBlock))recoverOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Reduce.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Reduce.h new file mode 100644 index 0000000..5bb1eee --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Reduce.h @@ -0,0 +1,71 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(ReduceAdditions) + +typedef id __nullable (^FBLPromiseReducerBlock)(Value __nullable partial, id next) + NS_SWIFT_UNAVAILABLE(""); + +/** + Sequentially reduces a collection of values to a single promise using a given combining block + and the value `self` resolves with as initial value. + + @param items An array of values to process in order. + @param reducer A block to combine an accumulating value and an element of the sequence into + the new accumulating value or a promise resolved with it, to be used in the next + call of the `reducer` or returned to the caller. + @return A new pending promise returned from the last `reducer` invocation. + Or `self` if `items` is empty. + */ +- (FBLPromise *)reduce:(NSArray *)items + combine:(FBLPromiseReducerBlock)reducer NS_SWIFT_UNAVAILABLE(""); + +/** + Sequentially reduces a collection of values to a single promise using a given combining block + and the value `self` resolves with as initial value. + + @param queue A queue to dispatch on. + @param items An array of values to process in order. + @param reducer A block to combine an accumulating value and an element of the sequence into + the new accumulating value or a promise resolved with it, to be used in the next + call of the `reducer` or returned to the caller. + @return A new pending promise returned from the last `reducer` invocation. + Or `self` if `items` is empty. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + reduce:(NSArray *)items + combine:(FBLPromiseReducerBlock)reducer NS_SWIFT_UNAVAILABLE(""); + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `reduce` operators. + Usage: promise.reduce(values, ^id(id partial, id next) { ... }) + */ +@interface FBLPromise(DotSyntax_ReduceAdditions) + +- (FBLPromise * (^)(NSArray *, FBLPromiseReducerBlock))reduce FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise * (^)(dispatch_queue_t, NSArray *, FBLPromiseReducerBlock))reduceOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Retry.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Retry.h new file mode 100644 index 0000000..98ef558 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Retry.h @@ -0,0 +1,165 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +/** The default number of retry attempts is 1. */ +FOUNDATION_EXTERN NSInteger const FBLPromiseRetryDefaultAttemptsCount NS_REFINED_FOR_SWIFT; + +/** The default delay interval before making a retry attempt is 1.0 second. */ +FOUNDATION_EXTERN NSTimeInterval const FBLPromiseRetryDefaultDelayInterval NS_REFINED_FOR_SWIFT; + +@interface FBLPromise(RetryAdditions) + +typedef id __nullable (^FBLPromiseRetryWorkBlock)(void) NS_SWIFT_UNAVAILABLE(""); +typedef BOOL (^FBLPromiseRetryPredicateBlock)(NSInteger, NSError *) NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise that fulfills with the same value as the promise returned from `work` + block, which executes asynchronously, or rejects with the same error after all retry attempts have + been exhausted. Defaults to `FBLPromiseRetryDefaultAttemptsCount` attempt(s) on rejection where the + `work` block is retried after a delay of `FBLPromiseRetryDefaultDelayInterval` second(s). + + @param work A block that executes asynchronously on the default queue and returns a value or an + error used to resolve the promise. + @return A new pending promise that fulfills with the same value as the promise returned from `work` + block, or rejects with the same error after all retry attempts have been exhausted. + */ ++ (FBLPromise *)retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise that fulfills with the same value as the promise returned from `work` + block, which executes asynchronously on the given `queue`, or rejects with the same error after all + retry attempts have been exhausted. Defaults to `FBLPromiseRetryDefaultAttemptsCount` attempt(s) on + rejection where the `work` block is retried on the given `queue` after a delay of + `FBLPromiseRetryDefaultDelayInterval` second(s). + + @param queue A queue to invoke the `work` block on. + @param work A block that executes asynchronously on the given `queue` and returns a value or an + error used to resolve the promise. + @return A new pending promise that fulfills with the same value as the promise returned from `work` + block, or rejects with the same error after all retry attempts have been exhausted. + */ ++ (FBLPromise *)onQueue:(dispatch_queue_t)queue + retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise that fulfills with the same value as the promise returned from `work` + block, which executes asynchronously, or rejects with the same error after all retry attempts have + been exhausted. + + @param count Max number of retry attempts. The `work` block will be executed once if the specified + count is less than or equal to zero. + @param work A block that executes asynchronously on the default queue and returns a value or an + error used to resolve the promise. + @return A new pending promise that fulfills with the same value as the promise returned from `work` + block, or rejects with the same error after all retry attempts have been exhausted. + */ ++ (FBLPromise *)attempts:(NSInteger)count + retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise that fulfills with the same value as the promise returned from `work` + block, which executes asynchronously on the given `queue`, or rejects with the same error after all + retry attempts have been exhausted. + + @param queue A queue to invoke the `work` block on. + @param count Max number of retry attempts. The `work` block will be executed once if the specified + count is less than or equal to zero. + @param work A block that executes asynchronously on the given `queue` and returns a value or an + error used to resolve the promise. + @return A new pending promise that fulfills with the same value as the promise returned from `work` + block, or rejects with the same error after all retry attempts have been exhausted. + */ ++ (FBLPromise *)onQueue:(dispatch_queue_t)queue + attempts:(NSInteger)count + retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise that fulfills with the same value as the promise returned from `work` + block, which executes asynchronously, or rejects with the same error after all retry attempts have + been exhausted. On rejection, the `work` block is retried after the given delay `interval` and will + continue to retry until the number of specified attempts have been exhausted or will bail early if + the given condition is not met. + + @param count Max number of retry attempts. The `work` block will be executed once if the specified + count is less than or equal to zero. + @param interval Time to wait before the next retry attempt. + @param predicate Condition to check before the next retry attempt. The predicate block provides the + the number of remaining retry attempts and the error that the promise was rejected + with. + @param work A block that executes asynchronously on the default queue and returns a value or an + error used to resolve the promise. + @return A new pending promise that fulfills with the same value as the promise returned from `work` + block, or rejects with the same error after all retry attempts have been exhausted or if + the given condition is not met. + */ ++ (FBLPromise *)attempts:(NSInteger)count + delay:(NSTimeInterval)interval + condition:(nullable FBLPromiseRetryPredicateBlock)predicate + retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise that fulfills with the same value as the promise returned from `work` + block, which executes asynchronously on the given `queue`, or rejects with the same error after all + retry attempts have been exhausted. On rejection, the `work` block is retried after the given + delay `interval` and will continue to retry until the number of specified attempts have been + exhausted or will bail early if the given condition is not met. + + @param queue A queue to invoke the `work` block on. + @param count Max number of retry attempts. The `work` block will be executed once if the specified + count is less than or equal to zero. + @param interval Time to wait before the next retry attempt. + @param predicate Condition to check before the next retry attempt. The predicate block provides the + the number of remaining retry attempts and the error that the promise was rejected + with. + @param work A block that executes asynchronously on the given `queue` and returns a value or an + error used to resolve the promise. + @return A new pending promise that fulfills with the same value as the promise returned from `work` + block, or rejects with the same error after all retry attempts have been exhausted or if + the given condition is not met. + */ ++ (FBLPromise *)onQueue:(dispatch_queue_t)queue + attempts:(NSInteger)count + delay:(NSTimeInterval)interval + condition:(nullable FBLPromiseRetryPredicateBlock)predicate + retry:(FBLPromiseRetryWorkBlock)work NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise+Retry` operators. + Usage: FBLPromise.retry(^id { ... }) + */ +@interface FBLPromise(DotSyntax_RetryAdditions) + ++ (FBLPromise * (^)(FBLPromiseRetryWorkBlock))retry FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise * (^)(dispatch_queue_t, FBLPromiseRetryWorkBlock))retryOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise * (^)(NSInteger, NSTimeInterval, FBLPromiseRetryPredicateBlock __nullable, + FBLPromiseRetryWorkBlock))retryAgain FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise * (^)(dispatch_queue_t, NSInteger, NSTimeInterval, + FBLPromiseRetryPredicateBlock __nullable, + FBLPromiseRetryWorkBlock))retryAgainOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Testing.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Testing.h new file mode 100644 index 0000000..8478ae2 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Testing.h @@ -0,0 +1,57 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + Waits for all scheduled promises blocks. + + @param timeout Maximum time to wait. + @return YES if all promises blocks have completed before the timeout and NO otherwise. + */ +FOUNDATION_EXTERN BOOL FBLWaitForPromisesWithTimeout(NSTimeInterval timeout) NS_REFINED_FOR_SWIFT; + +@interface FBLPromise(TestingAdditions) + +/** + Dispatch group for promises that is typically used to wait for all scheduled blocks. + */ +@property(class, nonatomic, readonly) dispatch_group_t dispatchGroup NS_REFINED_FOR_SWIFT; + +/** + Properties to get the current state of the promise. + */ +@property(nonatomic, readonly) BOOL isPending NS_REFINED_FOR_SWIFT; +@property(nonatomic, readonly) BOOL isFulfilled NS_REFINED_FOR_SWIFT; +@property(nonatomic, readonly) BOOL isRejected NS_REFINED_FOR_SWIFT; + +/** + Value the promise was fulfilled with. + Can be nil if the promise is still pending, was resolved with nil or after it has been rejected. + */ +@property(nonatomic, readonly, nullable) Value value NS_REFINED_FOR_SWIFT; + +/** + Error the promise was rejected with. + Can be nil if the promise is still pending or after it has been fulfilled. + */ +@property(nonatomic, readonly, nullable) NSError *error NS_REFINED_FOR_SWIFT; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Then.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Then.h new file mode 100644 index 0000000..32027e6 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Then.h @@ -0,0 +1,63 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(ThenAdditions) + +typedef id __nullable (^FBLPromiseThenWorkBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise which eventually gets resolved with resolution returned from `work` + block: either value, error or another promise. The `work` block is executed asynchronously only + when the receiver is fulfilled. If receiver is rejected, the returned promise is also rejected with + the same error. + + @param work A block to handle the value that receiver was fulfilled with. + @return A new pending promise to be resolved with resolution returned from the `work` block. + */ +- (FBLPromise *)then:(FBLPromiseThenWorkBlock)work NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise which eventually gets resolved with resolution returned from `work` + block: either value, error or another promise. The `work` block is executed asynchronously when the + receiver is fulfilled. If receiver is rejected, the returned promise is also rejected with the same + error. + + @param queue A queue to invoke the `work` block on. + @param work A block to handle the value that receiver was fulfilled with. + @return A new pending promise to be resolved with resolution returned from the `work` block. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + then:(FBLPromiseThenWorkBlock)work NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `then` operators. + Usage: promise.then(^id(id value) { ... }) + */ +@interface FBLPromise(DotSyntax_ThenAdditions) + +- (FBLPromise* (^)(FBLPromiseThenWorkBlock))then FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise* (^)(dispatch_queue_t, FBLPromiseThenWorkBlock))thenOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Timeout.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Timeout.h new file mode 100644 index 0000000..184ba16 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Timeout.h @@ -0,0 +1,57 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(TimeoutAdditions) + +/** + Waits for a promise with the specified `timeout`. + + @param interval Time to wait in seconds. + @return A new pending promise that gets either resolved with same resolution as the receiver or + rejected with `FBLPromiseErrorCodeTimedOut` error code in `FBLPromiseErrorDomain`. + */ +- (FBLPromise *)timeout:(NSTimeInterval)interval NS_SWIFT_UNAVAILABLE(""); + +/** + Waits for a promise with the specified `timeout`. + + @param queue A queue to dispatch on. + @param interval Time to wait in seconds. + @return A new pending promise that gets either resolved with same resolution as the receiver or + rejected with `FBLPromiseErrorCodeTimedOut` error code in `FBLPromiseErrorDomain`. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + timeout:(NSTimeInterval)interval NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `timeout` operators. + Usage: promise.timeout(...) + */ +@interface FBLPromise(DotSyntax_TimeoutAdditions) + +- (FBLPromise* (^)(NSTimeInterval))timeout FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise* (^)(dispatch_queue_t, NSTimeInterval))timeoutOn FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Validate.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Validate.h new file mode 100644 index 0000000..9dfa2f1 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Validate.h @@ -0,0 +1,60 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface FBLPromise(ValidateAdditions) + +typedef BOOL (^FBLPromiseValidateWorkBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE(""); + +/** + Validates a fulfilled value or rejects the value if it can not be validated. + + @param predicate An expression to validate. + @return A new pending promise that gets either resolved with same resolution as the receiver or + rejected with `FBLPromiseErrorCodeValidationFailure` error code in `FBLPromiseErrorDomain`. + */ +- (FBLPromise *)validate:(FBLPromiseValidateWorkBlock)predicate NS_SWIFT_UNAVAILABLE(""); + +/** + Validates a fulfilled value or rejects the value if it can not be validated. + + @param queue A queue to dispatch on. + @param predicate An expression to validate. + @return A new pending promise that gets either resolved with same resolution as the receiver or + rejected with `FBLPromiseErrorCodeValidationFailure` error code in `FBLPromiseErrorDomain`. + */ +- (FBLPromise *)onQueue:(dispatch_queue_t)queue + validate:(FBLPromiseValidateWorkBlock)predicate NS_REFINED_FOR_SWIFT; + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `validate` operators. + Usage: promise.validate(^BOOL(id value) { ... }) + */ +@interface FBLPromise(DotSyntax_ValidateAdditions) + +- (FBLPromise * (^)(FBLPromiseValidateWorkBlock))validate FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); +- (FBLPromise * (^)(dispatch_queue_t, FBLPromiseValidateWorkBlock))validateOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Wrap.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Wrap.h new file mode 100644 index 0000000..664e1bb --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise+Wrap.h @@ -0,0 +1,316 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + Different types of completion handlers available to be wrapped with promise. + */ +typedef void (^FBLPromiseCompletion)(void) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseObjectCompletion)(id __nullable) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseErrorCompletion)(NSError* __nullable) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseObjectOrErrorCompletion)(id __nullable, NSError* __nullable) + NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseErrorOrObjectCompletion)(NSError* __nullable, id __nullable) + NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromise2ObjectsOrErrorCompletion)(id __nullable, id __nullable, + NSError* __nullable) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseBoolCompletion)(BOOL) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseBoolOrErrorCompletion)(BOOL, NSError* __nullable) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseIntegerCompletion)(NSInteger) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseIntegerOrErrorCompletion)(NSInteger, NSError* __nullable) + NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseDoubleCompletion)(double) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseDoubleOrErrorCompletion)(double, NSError* __nullable) + NS_SWIFT_UNAVAILABLE(""); + +/** + Provides an easy way to convert methods that use common callback patterns into promises. + */ +@interface FBLPromise(WrapAdditions) + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with `nil` when completion handler is invoked. + */ ++ (instancetype)wrapCompletion:(void (^)(FBLPromiseCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with `nil` when completion handler is invoked. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue + wrapCompletion:(void (^)(FBLPromiseCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an object provided by completion handler. + */ ++ (instancetype)wrapObjectCompletion:(void (^)(FBLPromiseObjectCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an object provided by completion handler. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue + wrapObjectCompletion:(void (^)(FBLPromiseObjectCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an error provided by completion handler. + If error is `nil`, fulfills with `nil`, otherwise rejects with the error. + */ ++ (instancetype)wrapErrorCompletion:(void (^)(FBLPromiseErrorCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an error provided by completion handler. + If error is `nil`, fulfills with `nil`, otherwise rejects with the error. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue + wrapErrorCompletion:(void (^)(FBLPromiseErrorCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an object provided by completion handler if error is `nil`. + Otherwise, rejects with the error. + */ ++ (instancetype)wrapObjectOrErrorCompletion: + (void (^)(FBLPromiseObjectOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an object provided by completion handler if error is `nil`. + Otherwise, rejects with the error. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue + wrapObjectOrErrorCompletion:(void (^)(FBLPromiseObjectOrErrorCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an error or object provided by completion handler. If error + is not `nil`, rejects with the error. + */ ++ (instancetype)wrapErrorOrObjectCompletion: + (void (^)(FBLPromiseErrorOrObjectCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an error or object provided by completion handler. If error + is not `nil`, rejects with the error. + */ ++ (instancetype)onQueue:(dispatch_queue_t)queue + wrapErrorOrObjectCompletion:(void (^)(FBLPromiseErrorOrObjectCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an array of objects provided by completion handler in order + if error is `nil`. Otherwise, rejects with the error. + */ ++ (FBLPromise*)wrap2ObjectsOrErrorCompletion: + (void (^)(FBLPromise2ObjectsOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an array of objects provided by completion handler in order + if error is `nil`. Otherwise, rejects with the error. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrap2ObjectsOrErrorCompletion:(void (^)(FBLPromise2ObjectsOrErrorCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping YES/NO. + */ ++ (FBLPromise*)wrapBoolCompletion:(void (^)(FBLPromiseBoolCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping YES/NO. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrapBoolCompletion:(void (^)(FBLPromiseBoolCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping YES/NO when error is `nil`. + Otherwise rejects with the error. + */ ++ (FBLPromise*)wrapBoolOrErrorCompletion: + (void (^)(FBLPromiseBoolOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping YES/NO when error is `nil`. + Otherwise rejects with the error. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrapBoolOrErrorCompletion:(void (^)(FBLPromiseBoolOrErrorCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping an integer. + */ ++ (FBLPromise*)wrapIntegerCompletion:(void (^)(FBLPromiseIntegerCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping an integer. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrapIntegerCompletion:(void (^)(FBLPromiseIntegerCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping an integer when error is `nil`. + Otherwise rejects with the error. + */ ++ (FBLPromise*)wrapIntegerOrErrorCompletion: + (void (^)(FBLPromiseIntegerOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping an integer when error is `nil`. + Otherwise rejects with the error. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrapIntegerOrErrorCompletion:(void (^)(FBLPromiseIntegerOrErrorCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping a double. + */ ++ (FBLPromise*)wrapDoubleCompletion:(void (^)(FBLPromiseDoubleCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping a double. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrapDoubleCompletion:(void (^)(FBLPromiseDoubleCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +/** + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping a double when error is `nil`. + Otherwise rejects with the error. + */ ++ (FBLPromise*)wrapDoubleOrErrorCompletion: + (void (^)(FBLPromiseDoubleOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE(""); + +/** + @param queue A queue to invoke the `work` block on. + @param work A block to perform any operations needed to resolve the promise. + @returns A promise that resolves with an `NSNumber` wrapping a double when error is `nil`. + Otherwise rejects with the error. + */ ++ (FBLPromise*)onQueue:(dispatch_queue_t)queue + wrapDoubleOrErrorCompletion:(void (^)(FBLPromiseDoubleOrErrorCompletion handler))work + NS_SWIFT_UNAVAILABLE(""); + +@end + +/** + Convenience dot-syntax wrappers for `FBLPromise` `wrap` operators. + Usage: FBLPromise.wrapCompletion(^(FBLPromiseCompletion handler) {...}) + */ +@interface FBLPromise(DotSyntax_WrapAdditions) + ++ (FBLPromise* (^)(void (^)(FBLPromiseCompletion)))wrapCompletion FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseCompletion)))wrapCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseObjectCompletion)))wrapObjectCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseObjectCompletion)))wrapObjectCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseErrorCompletion)))wrapErrorCompletion FBL_PROMISES_DOT_SYNTAX + NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseErrorCompletion)))wrapErrorCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseObjectOrErrorCompletion)))wrapObjectOrErrorCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, + void (^)(FBLPromiseObjectOrErrorCompletion)))wrapObjectOrErrorCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseErrorOrObjectCompletion)))wrapErrorOrObjectCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, + void (^)(FBLPromiseErrorOrObjectCompletion)))wrapErrorOrObjectCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromise2ObjectsOrErrorCompletion))) + wrap2ObjectsOrErrorCompletion FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromise2ObjectsOrErrorCompletion))) + wrap2ObjectsOrErrorCompletionOn FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseBoolCompletion)))wrapBoolCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, + void (^)(FBLPromiseBoolCompletion)))wrapBoolCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseBoolOrErrorCompletion)))wrapBoolOrErrorCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, + void (^)(FBLPromiseBoolOrErrorCompletion)))wrapBoolOrErrorCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseIntegerCompletion)))wrapIntegerCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, + void (^)(FBLPromiseIntegerCompletion)))wrapIntegerCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseIntegerOrErrorCompletion))) + wrapIntegerOrErrorCompletion FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseIntegerOrErrorCompletion))) + wrapIntegerOrErrorCompletionOn FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseDoubleCompletion)))wrapDoubleCompletion + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, + void (^)(FBLPromiseDoubleCompletion)))wrapDoubleCompletionOn + FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(void (^)(FBLPromiseDoubleOrErrorCompletion))) + wrapDoubleOrErrorCompletion FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseDoubleOrErrorCompletion))) + wrapDoubleOrErrorCompletionOn FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise.h new file mode 100644 index 0000000..b1380dc --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromise.h @@ -0,0 +1,93 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromiseError.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + Promises synchronization construct in Objective-C. + */ +@interface FBLPromise<__covariant Value> : NSObject + +/** + Default dispatch queue used for `FBLPromise`, which is `main` if a queue is not specified. + */ +@property(class) dispatch_queue_t defaultDispatchQueue NS_REFINED_FOR_SWIFT; + +/** + Creates a pending promise. + */ ++ (instancetype)pendingPromise NS_REFINED_FOR_SWIFT; + +/** + Creates a resolved promise. + + @param resolution An object to resolve the promise with: either a value or an error. + @return A new resolved promise. + */ ++ (instancetype)resolvedWith:(nullable id)resolution NS_REFINED_FOR_SWIFT; + +/** + Synchronously fulfills the promise with a value. + + @param value An arbitrary value to fulfill the promise with, including `nil`. + */ +- (void)fulfill:(nullable Value)value NS_REFINED_FOR_SWIFT; + +/** + Synchronously rejects the promise with an error. + + @param error An error to reject the promise with. + */ +- (void)reject:(NSError *)error NS_REFINED_FOR_SWIFT; + ++ (instancetype)new NS_UNAVAILABLE; +- (instancetype)init NS_UNAVAILABLE; +@end + +@interface FBLPromise() + +/** + Adds an object to the set of pending objects to keep strongly while the promise is pending. + Used by the Swift wrappers to keep them alive until the underlying ObjC promise is resolved. + + @param object An object to add. + */ +- (void)addPendingObject:(id)object NS_REFINED_FOR_SWIFT; + +@end + +#ifdef FBL_PROMISES_DOT_SYNTAX_IS_DEPRECATED +#define FBL_PROMISES_DOT_SYNTAX __attribute__((deprecated)) +#else +#define FBL_PROMISES_DOT_SYNTAX +#endif + +@interface FBLPromise(DotSyntaxAdditions) + +/** + Convenience dot-syntax wrappers for FBLPromise. + Usage: FBLPromise.pending() + FBLPromise.resolved(value) + + */ ++ (instancetype (^)(void))pending FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); ++ (instancetype (^)(id __nullable))resolved FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromiseError.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromiseError.h new file mode 100644 index 0000000..d37af53 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromiseError.h @@ -0,0 +1,43 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +FOUNDATION_EXTERN NSErrorDomain const FBLPromiseErrorDomain NS_REFINED_FOR_SWIFT; + +/** + Possible error codes in `FBLPromiseErrorDomain`. + */ +typedef NS_ENUM(NSInteger, FBLPromiseErrorCode) { + /** Promise failed to resolve in time. */ + FBLPromiseErrorCodeTimedOut = 1, + /** Validation predicate returned false. */ + FBLPromiseErrorCodeValidationFailure = 2, +} NS_REFINED_FOR_SWIFT; + +NS_INLINE BOOL FBLPromiseErrorIsTimedOut(NSError *error) NS_SWIFT_UNAVAILABLE("") { + return error.domain == FBLPromiseErrorDomain && + error.code == FBLPromiseErrorCodeTimedOut; +} + +NS_INLINE BOOL FBLPromiseErrorIsValidationFailure(NSError *error) NS_SWIFT_UNAVAILABLE("") { + return error.domain == FBLPromiseErrorDomain && + error.code == FBLPromiseErrorCodeValidationFailure; +} + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromises.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromises.h new file mode 100644 index 0000000..2d90bad --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/FBLPromises.h @@ -0,0 +1,32 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise+All.h" +#import "FBLPromise+Always.h" +#import "FBLPromise+Any.h" +#import "FBLPromise+Async.h" +#import "FBLPromise+Await.h" +#import "FBLPromise+Catch.h" +#import "FBLPromise+Delay.h" +#import "FBLPromise+Do.h" +#import "FBLPromise+Race.h" +#import "FBLPromise+Recover.h" +#import "FBLPromise+Reduce.h" +#import "FBLPromise+Retry.h" +#import "FBLPromise+Then.h" +#import "FBLPromise+Timeout.h" +#import "FBLPromise+Validate.h" +#import "FBLPromise+Wrap.h" diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/PromisesObjC-umbrella.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/PromisesObjC-umbrella.h new file mode 100644 index 0000000..5b014a8 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Headers/PromisesObjC-umbrella.h @@ -0,0 +1,36 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "FBLPromise+All.h" +#import "FBLPromise+Always.h" +#import "FBLPromise+Any.h" +#import "FBLPromise+Async.h" +#import "FBLPromise+Await.h" +#import "FBLPromise+Catch.h" +#import "FBLPromise+Delay.h" +#import "FBLPromise+Do.h" +#import "FBLPromise+Race.h" +#import "FBLPromise+Recover.h" +#import "FBLPromise+Reduce.h" +#import "FBLPromise+Retry.h" +#import "FBLPromise+Testing.h" +#import "FBLPromise+Then.h" +#import "FBLPromise+Timeout.h" +#import "FBLPromise+Validate.h" +#import "FBLPromise+Wrap.h" +#import "FBLPromise.h" +#import "FBLPromiseError.h" +#import "FBLPromises.h" + +FOUNDATION_EXPORT double FBLPromisesVersionNumber; +FOUNDATION_EXPORT const unsigned char FBLPromisesVersionString[]; + diff --git a/plugins/2020.3569/iphone-sim/resources/Frameworks/protobuf.framework/Info.plist b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Info.plist similarity index 52% rename from plugins/2020.3569/iphone-sim/resources/Frameworks/protobuf.framework/Info.plist rename to src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Info.plist index e4c17d5..33b1afe 100644 Binary files a/plugins/2020.3569/iphone-sim/resources/Frameworks/protobuf.framework/Info.plist and b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Modules/module.modulemap new file mode 100644 index 0000000..7d485cd --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FBLPromises { + umbrella header "PromisesObjC-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/PrivateHeaders/FBLPromisePrivate.h b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/PrivateHeaders/FBLPromisePrivate.h new file mode 100644 index 0000000..7a132f2 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/PrivateHeaders/FBLPromisePrivate.h @@ -0,0 +1,66 @@ +/** + Copyright 2018 Google Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "FBLPromise+Testing.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + Miscellaneous low-level private interfaces available to extend standard FBLPromise functionality. + */ +@interface FBLPromise() + +typedef void (^FBLPromiseOnFulfillBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE(""); +typedef void (^FBLPromiseOnRejectBlock)(NSError *error) NS_SWIFT_UNAVAILABLE(""); +typedef id __nullable (^__nullable FBLPromiseChainedFulfillBlock)(Value __nullable value) + NS_SWIFT_UNAVAILABLE(""); +typedef id __nullable (^__nullable FBLPromiseChainedRejectBlock)(NSError *error) + NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a pending promise. + */ +- (instancetype)initPending NS_SWIFT_UNAVAILABLE(""); + +/** + Creates a resolved promise. + + @param resolution An object to resolve the promise with: either a value or an error. + @return A new resolved promise. + */ +- (instancetype)initWithResolution:(nullable id)resolution NS_SWIFT_UNAVAILABLE(""); + +/** + Invokes `fulfill` and `reject` blocks on `queue` when the receiver gets either fulfilled or + rejected respectively. + */ +- (void)observeOnQueue:(dispatch_queue_t)queue + fulfill:(FBLPromiseOnFulfillBlock)onFulfill + reject:(FBLPromiseOnRejectBlock)onReject NS_SWIFT_UNAVAILABLE(""); + +/** + Returns a new promise which gets resolved with the return value of `chainedFulfill` or + `chainedReject` blocks respectively. The blocks are invoked when the receiver gets either + fulfilled or rejected. If `nil` is passed to either block arg, the returned promise is resolved + with the same resolution as the receiver. + */ +- (FBLPromise *)chainOnQueue:(dispatch_queue_t)queue + chainedFulfill:(FBLPromiseChainedFulfillBlock)chainedFulfill + chainedReject:(FBLPromiseChainedRejectBlock)chainedReject NS_SWIFT_UNAVAILABLE(""); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/_CodeSignature/CodeResources b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..bea9472 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FBLPromises.framework/_CodeSignature/CodeResources @@ -0,0 +1,447 @@ + + + + + files + + Headers/FBLPromise+All.h + + 1/HWSa9B9CfE+6oTjy3jrp1Dbng= + + Headers/FBLPromise+Always.h + + sVZckdpNp0YMZno6+IaJ16Zal00= + + Headers/FBLPromise+Any.h + + jYWCdqjloLKNtDe+sIQ4PyQsf0I= + + Headers/FBLPromise+Async.h + + gIl6GZ+2tBZw7sNlHmw6tQggHn4= + + Headers/FBLPromise+Await.h + + WKlBKfPKetJ8or+tZtW13HAGcaM= + + Headers/FBLPromise+Catch.h + + WaTiqwvv8w13vIKlm2K4DAgZulo= + + Headers/FBLPromise+Delay.h + + qoQSMY2FcD2SV3kKq34NITtbdmk= + + Headers/FBLPromise+Do.h + + ggkiDySeq8jvunvZvPkZ/Kkn8xU= + + Headers/FBLPromise+Race.h + + KhU7Y/hu/++OhV8HrTR0blCqsa8= + + Headers/FBLPromise+Recover.h + + bQIMfszj33smHtitYuadQj5unrM= + + Headers/FBLPromise+Reduce.h + + fHvVgIVNfukW8aWkuQb9Upl1Hv8= + + Headers/FBLPromise+Retry.h + + yWcTgblFfFp1WTKDOiSPZ5jDxNQ= + + Headers/FBLPromise+Testing.h + + Ks+FXD691hFVSvDw/g/0x4ic7+0= + + Headers/FBLPromise+Then.h + + xXwhWUcFcLdpUBrK28dob5PeMRI= + + Headers/FBLPromise+Timeout.h + + yngMore1DA762uLfNvM0zRhL/u0= + + Headers/FBLPromise+Validate.h + + QXCa+SPD+GyNt+fKriUFP4JLYi0= + + Headers/FBLPromise+Wrap.h + + pnbKEVv3KohF9zBVmwpY92K1/H8= + + Headers/FBLPromise.h + + 66aJuIe5lIRcT8lc2CR4XlzUCqA= + + Headers/FBLPromiseError.h + + NiD1rwNDO7Tz69bYyOj9qmlCGRQ= + + Headers/FBLPromises.h + + xmHnPqDlpJpUbAqgOJw5Da3418U= + + Headers/PromisesObjC-umbrella.h + + LRjj72lPCA3L9iDRZehhvoVhUGU= + + Info.plist + + TzzoxDrQ7gSD0KnY6uCKyAjq1+w= + + Modules/module.modulemap + + LZnGdhdf01gvhIz70qtzgzIYPX4= + + PrivateHeaders/FBLPromisePrivate.h + + J7AOJnwCKzdcaI5lsMAhXoByoT0= + + + files2 + + Headers/FBLPromise+All.h + + hash + + 1/HWSa9B9CfE+6oTjy3jrp1Dbng= + + hash2 + + g6BUKLMTJAGRI/4XjGU/dZaG7rA27W16VZK8WvM1eYs= + + + Headers/FBLPromise+Always.h + + hash + + sVZckdpNp0YMZno6+IaJ16Zal00= + + hash2 + + mSLLqLIfLaAdISUzmCnHE5dI5q5afctdua9s4Ddwrw4= + + + Headers/FBLPromise+Any.h + + hash + + jYWCdqjloLKNtDe+sIQ4PyQsf0I= + + hash2 + + ETMK2COV+ajlfA4XxDUUJzV3p8LUaA+GN9sRLwNE0Ck= + + + Headers/FBLPromise+Async.h + + hash + + gIl6GZ+2tBZw7sNlHmw6tQggHn4= + + hash2 + + dHc8ASbXmQxrkpQCBEbAZL4HTgO6J7gNiv9erzu92QU= + + + Headers/FBLPromise+Await.h + + hash + + WKlBKfPKetJ8or+tZtW13HAGcaM= + + hash2 + + W7kqZbC71TD1Xv9wdtMIjoDbYSZ5ktUSkok5tPZS5A8= + + + Headers/FBLPromise+Catch.h + + hash + + WaTiqwvv8w13vIKlm2K4DAgZulo= + + hash2 + + kwyC7vU/6AZticiALUlN0j/nrmzG7QFExjjBV25pQTY= + + + Headers/FBLPromise+Delay.h + + hash + + qoQSMY2FcD2SV3kKq34NITtbdmk= + + hash2 + + nSl7wEJQ+tww5d/BWlnoA4Mv9wde0pDI2SJaPISo3vI= + + + Headers/FBLPromise+Do.h + + hash + + ggkiDySeq8jvunvZvPkZ/Kkn8xU= + + hash2 + + AbrMui/y3jBRVXloC2ek4ZcwpBQPlqu29/aPRTvOE68= + + + Headers/FBLPromise+Race.h + + hash + + KhU7Y/hu/++OhV8HrTR0blCqsa8= + + hash2 + + CNuTRimQ0rZFNUumwP/hYOqi204+JbffrEkONBFuIVg= + + + Headers/FBLPromise+Recover.h + + hash + + bQIMfszj33smHtitYuadQj5unrM= + + hash2 + + WP2VmkMLEJh9pP+sW2pW5945/IEIEhib/7rGfCaIWQQ= + + + Headers/FBLPromise+Reduce.h + + hash + + fHvVgIVNfukW8aWkuQb9Upl1Hv8= + + hash2 + + OVoK729ybsf8EX8DRwCRRidRbTPXhRiHZjV4Kn40EtE= + + + Headers/FBLPromise+Retry.h + + hash + + yWcTgblFfFp1WTKDOiSPZ5jDxNQ= + + hash2 + + Va6IWZOaB2Gi/utF/TdEGwXYqFYHunwUXo4DNOCGyuc= + + + Headers/FBLPromise+Testing.h + + hash + + Ks+FXD691hFVSvDw/g/0x4ic7+0= + + hash2 + + fEVZv1dfYDKHOKyiZqgdyhYdURZ0tKWsHGVPIQL70f0= + + + Headers/FBLPromise+Then.h + + hash + + xXwhWUcFcLdpUBrK28dob5PeMRI= + + hash2 + + QMH7kzRIHfHY/An28iUioHxCvP1dvpEJ4Giffps6eBI= + + + Headers/FBLPromise+Timeout.h + + hash + + yngMore1DA762uLfNvM0zRhL/u0= + + hash2 + + NoaGHny9bLEcgwjjW5UQxZBayRPcQORpW7WJdxa8iDg= + + + Headers/FBLPromise+Validate.h + + hash + + QXCa+SPD+GyNt+fKriUFP4JLYi0= + + hash2 + + c+8J+TGkNw0JZn+It/LBQP3DACatwAluOhLLNDPozMw= + + + Headers/FBLPromise+Wrap.h + + hash + + pnbKEVv3KohF9zBVmwpY92K1/H8= + + hash2 + + m576DCvDiDcYotjxumxrhOVOJ8XyUnJcIM7qlVvq2nQ= + + + Headers/FBLPromise.h + + hash + + 66aJuIe5lIRcT8lc2CR4XlzUCqA= + + hash2 + + MD1VrgE/xaO9Oy+HbINsjj3NdgjHGD0vqLUkZ9TEkgQ= + + + Headers/FBLPromiseError.h + + hash + + NiD1rwNDO7Tz69bYyOj9qmlCGRQ= + + hash2 + + 3LBDNhkSuyDE1LE8Kk9c19ytLxAw5ABQnJu7J4/1yk8= + + + Headers/FBLPromises.h + + hash + + xmHnPqDlpJpUbAqgOJw5Da3418U= + + hash2 + + wH9eWTsWL9EixsUdC7G1gbD8vY97El45adWrrpwvqM0= + + + Headers/PromisesObjC-umbrella.h + + hash + + LRjj72lPCA3L9iDRZehhvoVhUGU= + + hash2 + + AToK0tCJy6hieeo6JMbMhLunYgbQLarPqQyHJ6dfRuA= + + + Modules/module.modulemap + + hash + + LZnGdhdf01gvhIz70qtzgzIYPX4= + + hash2 + + AMm7+HhwNWfKD7lB61N5cRjihG7RKsrGL/xaEOYGS/Y= + + + PrivateHeaders/FBLPromisePrivate.h + + hash + + J7AOJnwCKzdcaI5lsMAhXoByoT0= + + hash2 + + yTbxGjb54FkX0p6ayty7U27WUyoFPXE9uJnivUTlPv4= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/FirebaseCore b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/FirebaseCore new file mode 100755 index 0000000..eadf2de Binary files /dev/null and b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/FirebaseCore differ diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIRApp.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIRApp.h new file mode 100644 index 0000000..f5578c6 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIRApp.h @@ -0,0 +1,127 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FIROptions; + +NS_ASSUME_NONNULL_BEGIN + +/** A block that takes a BOOL and has no return value. */ +typedef void (^FIRAppVoidBoolCallback)(BOOL success) NS_SWIFT_NAME(FirebaseAppVoidBoolCallback); + +/** + * The entry point of Firebase SDKs. + * + * Initialize and configure FIRApp using +[FIRApp configure] + * or other customized ways as shown below. + * + * The logging system has two modes: default mode and debug mode. In default mode, only logs with + * log level Notice, Warning and Error will be sent to device. In debug mode, all logs will be sent + * to device. The log levels that Firebase uses are consistent with the ASL log levels. + * + * Enable debug mode by passing the -FIRDebugEnabled argument to the application. You can add this + * argument in the application's Xcode scheme. When debug mode is enabled via -FIRDebugEnabled, + * further executions of the application will also be in debug mode. In order to return to default + * mode, you must explicitly disable the debug mode with the application argument -FIRDebugDisabled. + * + * It is also possible to change the default logging level in code by calling setLoggerLevel: on + * the FIRConfiguration interface. + */ +NS_SWIFT_NAME(FirebaseApp) +@interface FIRApp : NSObject + +/** + * Configures a default Firebase app. Raises an exception if any configuration step fails. The + * default app is named "__FIRAPP_DEFAULT". This method should be called after the app is launched + * and before using Firebase services. This method should be called from the main thread and + * contains synchronous file I/O (reading GoogleService-Info.plist from disk). + */ ++ (void)configure; + +/** + * Configures the default Firebase app with the provided options. The default app is named + * "__FIRAPP_DEFAULT". Raises an exception if any configuration step fails. This method should be + * called from the main thread. + * + * @param options The Firebase application options used to configure the service. + */ ++ (void)configureWithOptions:(FIROptions *)options NS_SWIFT_NAME(configure(options:)); + +/** + * Configures a Firebase app with the given name and options. Raises an exception if any + * configuration step fails. This method should be called from the main thread. + * + * @param name The application's name given by the developer. The name should should only contain + Letters, Numbers and Underscore. + * @param options The Firebase application options used to configure the services. + */ +// clang-format off ++ (void)configureWithName:(NSString *)name + options:(FIROptions *)options NS_SWIFT_NAME(configure(name:options:)); +// clang-format on + +/** + * Returns the default app, or nil if the default app does not exist. + */ ++ (nullable FIRApp *)defaultApp NS_SWIFT_NAME(app()); + +/** + * Returns a previously created FIRApp instance with the given name, or nil if no such app exists. + * This method is thread safe. + */ ++ (nullable FIRApp *)appNamed:(NSString *)name NS_SWIFT_NAME(app(name:)); + +/** + * Returns the set of all extant FIRApp instances, or nil if there are no FIRApp instances. This + * method is thread safe. + */ +@property(class, readonly, nullable) NSDictionary *allApps; + +/** + * Cleans up the current FIRApp, freeing associated data and returning its name to the pool for + * future use. This method is thread safe. + */ +- (void)deleteApp:(FIRAppVoidBoolCallback)completion; + +/** + * FIRApp instances should not be initialized directly. Call +[FIRApp configure], + * +[FIRApp configureWithOptions:], or +[FIRApp configureWithNames:options:] directly. + */ +- (instancetype)init NS_UNAVAILABLE; + +/** + * Gets the name of this app. + */ +@property(nonatomic, copy, readonly) NSString *name; + +/** + * Gets a copy of the options for this app. These are non-modifiable. + */ +@property(nonatomic, copy, readonly) FIROptions *options; + +/** + * Gets or sets whether automatic data collection is enabled for all products. Defaults to `YES` + * unless `FirebaseDataCollectionDefaultEnabled` is set to `NO` in your app's Info.plist. This value + * is persisted across runs of the app so that it can be set once when users have consented to + * collection. + */ +@property(nonatomic, readwrite, getter=isDataCollectionDefaultEnabled) + BOOL dataCollectionDefaultEnabled; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIRConfiguration.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIRConfiguration.h new file mode 100644 index 0000000..2b8e678 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIRConfiguration.h @@ -0,0 +1,45 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "FIRLoggerLevel.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * This interface provides global level properties that the developer can tweak. + */ +NS_SWIFT_NAME(FirebaseConfiguration) +@interface FIRConfiguration : NSObject + +/** Returns the shared configuration object. */ +@property(class, nonatomic, readonly) FIRConfiguration *sharedInstance NS_SWIFT_NAME(shared); + +/** + * Sets the logging level for internal Firebase logging. Firebase will only log messages + * that are logged at or below loggerLevel. The messages are logged both to the Xcode + * console and to the device's log. Note that if an app is running from AppStore, it will + * never log above FIRLoggerLevelNotice even if loggerLevel is set to a higher (more verbose) + * setting. + * + * @param loggerLevel The maximum logging level. The default level is set to FIRLoggerLevelNotice. + */ +- (void)setLoggerLevel:(FIRLoggerLevel)loggerLevel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIRLoggerLevel.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIRLoggerLevel.h new file mode 100644 index 0000000..dca3aa0 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIRLoggerLevel.h @@ -0,0 +1,38 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Note that importing GULLoggerLevel.h will lead to a non-modular header +// import error. + +/** + * The log levels used by internal logging. + */ +typedef NS_ENUM(NSInteger, FIRLoggerLevel) { + /** Error level, matches ASL_LEVEL_ERR. */ + FIRLoggerLevelError = 3, + /** Warning level, matches ASL_LEVEL_WARNING. */ + FIRLoggerLevelWarning = 4, + /** Notice level, matches ASL_LEVEL_NOTICE. */ + FIRLoggerLevelNotice = 5, + /** Info level, matches ASL_LEVEL_INFO. */ + FIRLoggerLevelInfo = 6, + /** Debug level, matches ASL_LEVEL_DEBUG. */ + FIRLoggerLevelDebug = 7, + /** Minimum log level. */ + FIRLoggerLevelMin = FIRLoggerLevelError, + /** Maximum log level. */ + FIRLoggerLevelMax = FIRLoggerLevelDebug +} NS_SWIFT_NAME(FirebaseLoggerLevel); diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIROptions.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIROptions.h new file mode 100644 index 0000000..afabbf1 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIROptions.h @@ -0,0 +1,126 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * This class provides constant fields of Google APIs. + */ +NS_SWIFT_NAME(FirebaseOptions) +@interface FIROptions : NSObject + +/** + * Returns the default options. The first time this is called it synchronously reads + * GoogleService-Info.plist from disk. + */ ++ (nullable FIROptions *)defaultOptions NS_SWIFT_NAME(defaultOptions()); + +/** + * An iOS API key used for authenticating requests from your app, e.g. + * @"AIzaSyDdVgKwhZl0sTTTLZ7iTmt1r3N2cJLnaDk", used to identify your app to Google servers. + */ +@property(nonatomic, copy, nullable) NSString *APIKey NS_SWIFT_NAME(apiKey); + +/** + * The bundle ID for the application. Defaults to `[[NSBundle mainBundle] bundleID]` when not set + * manually or in a plist. + */ +@property(nonatomic, copy) NSString *bundleID; + +/** + * The OAuth2 client ID for iOS application used to authenticate Google users, for example + * @"12345.apps.googleusercontent.com", used for signing in with Google. + */ +@property(nonatomic, copy, nullable) NSString *clientID; + +/** + * The tracking ID for Google Analytics, e.g. @"UA-12345678-1", used to configure Google Analytics. + */ +@property(nonatomic, copy, nullable) NSString *trackingID; + +/** + * The Project Number from the Google Developer's console, for example @"012345678901", used to + * configure Google Cloud Messaging. + */ +@property(nonatomic, copy) NSString *GCMSenderID NS_SWIFT_NAME(gcmSenderID); + +/** + * The Project ID from the Firebase console, for example @"abc-xyz-123". + */ +@property(nonatomic, copy, nullable) NSString *projectID; + +/** + * The Android client ID used in Google AppInvite when an iOS app has its Android version, for + * example @"12345.apps.googleusercontent.com". + */ +@property(nonatomic, copy, nullable) NSString *androidClientID; + +/** + * The Google App ID that is used to uniquely identify an instance of an app. + */ +@property(nonatomic, copy) NSString *googleAppID; + +/** + * The database root URL, e.g. @"http://abc-xyz-123.firebaseio.com". + */ +@property(nonatomic, copy, nullable) NSString *databaseURL; + +/** + * The URL scheme used to set up Durable Deep Link service. + */ +@property(nonatomic, copy, nullable) NSString *deepLinkURLScheme; + +/** + * The Google Cloud Storage bucket name, e.g. @"abc-xyz-123.storage.firebase.com". + */ +@property(nonatomic, copy, nullable) NSString *storageBucket; + +/** + * The App Group identifier to share data between the application and the application extensions. + * The App Group must be configured in the application and on the Apple Developer Portal. Default + * value `nil`. + */ +@property(nonatomic, copy, nullable) NSString *appGroupID; + +/** + * Initializes a customized instance of FIROptions from the file at the given plist file path. This + * will read the file synchronously from disk. + * For example, + * NSString *filePath = + * [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]; + * FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath]; + * Returns nil if the plist file does not exist or is invalid. + */ +- (nullable instancetype)initWithContentsOfFile:(NSString *)plistPath NS_DESIGNATED_INITIALIZER; + +/** + * Initializes a customized instance of FIROptions with required fields. Use the mutable properties + * to modify fields for configuring specific services. + */ +// clang-format off +- (instancetype)initWithGoogleAppID:(NSString *)googleAppID + GCMSenderID:(NSString *)GCMSenderID + NS_SWIFT_NAME(init(googleAppID:gcmSenderID:)) NS_DESIGNATED_INITIALIZER; +// clang-format on + +/** Unavailable. Please use `init(contentsOfFile:)` or `init(googleAppID:gcmSenderID:)` instead. */ +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIRVersion.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIRVersion.h new file mode 100644 index 0000000..7fcca4b --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FIRVersion.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +NS_SWIFT_NAME(FirebaseVersion()) +NSString* FIRFirebaseVersion(void); + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FirebaseCore-umbrella.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FirebaseCore-umbrella.h new file mode 100644 index 0000000..0f96d94 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FirebaseCore-umbrella.h @@ -0,0 +1,22 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "FIRApp.h" +#import "FIRConfiguration.h" +#import "FirebaseCore.h" +#import "FIRLoggerLevel.h" +#import "FIROptions.h" +#import "FIRVersion.h" + +FOUNDATION_EXPORT double FirebaseCoreVersionNumber; +FOUNDATION_EXPORT const unsigned char FirebaseCoreVersionString[]; + diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FirebaseCore.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FirebaseCore.h new file mode 100644 index 0000000..680d604 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Headers/FirebaseCore.h @@ -0,0 +1,21 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "FIRApp.h" +#import "FIRConfiguration.h" +#import "FIRLoggerLevel.h" +#import "FIROptions.h" +#import "FIRVersion.h" diff --git a/plugins/2020.3569/iphone-sim/resources/Frameworks/FBLPromises.framework/Info.plist b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Info.plist similarity index 52% rename from plugins/2020.3569/iphone-sim/resources/Frameworks/FBLPromises.framework/Info.plist rename to src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Info.plist index b61d112..cb43e9f 100644 Binary files a/plugins/2020.3569/iphone-sim/resources/Frameworks/FBLPromises.framework/Info.plist and b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Modules/module.modulemap new file mode 100644 index 0000000..4c38b87 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FirebaseCore { + umbrella header "FirebaseCore-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRAppInternal.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRAppInternal.h new file mode 100644 index 0000000..0f3decf --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRAppInternal.h @@ -0,0 +1,155 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FIRComponentContainer; +@protocol FIRLibrary; + +/** + * The internal interface to FIRApp. This is meant for first-party integrators, who need to receive + * FIRApp notifications, log info about the success or failure of their configuration, and access + * other internal functionality of FIRApp. + * + * TODO(b/28296561): Restructure this header. + */ +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSInteger, FIRConfigType) { + FIRConfigTypeCore = 1, + FIRConfigTypeSDK = 2, +}; + +extern NSString *const kFIRDefaultAppName; +extern NSString *const kFIRAppReadyToConfigureSDKNotification; +extern NSString *const kFIRAppDeleteNotification; +extern NSString *const kFIRAppIsDefaultAppKey; +extern NSString *const kFIRAppNameKey; +extern NSString *const kFIRGoogleAppIDKey; +extern NSString *const kFirebaseCoreErrorDomain; + +/** + * The format string for the User Defaults key used for storing the data collection enabled flag. + * This includes formatting to append the Firebase App's name. + */ +extern NSString *const kFIRGlobalAppDataCollectionEnabledDefaultsKeyFormat; + +/** + * The plist key used for storing the data collection enabled flag. + */ +extern NSString *const kFIRGlobalAppDataCollectionEnabledPlistKey; + +/** + * A notification fired containing diagnostic information when SDK errors occur. + */ +extern NSString *const kFIRAppDiagnosticsNotification; + +/** @var FIRAuthStateDidChangeInternalNotification + @brief The name of the @c NSNotificationCenter notification which is posted when the auth state + changes (e.g. a new token has been produced, a user logs in or out). The object parameter of + the notification is a dictionary possibly containing the key: + @c FIRAuthStateDidChangeInternalNotificationTokenKey (the new access token.) If it does not + contain this key it indicates a sign-out event took place. + */ +extern NSString *const FIRAuthStateDidChangeInternalNotification; + +/** @var FIRAuthStateDidChangeInternalNotificationTokenKey + @brief A key present in the dictionary object parameter of the + @c FIRAuthStateDidChangeInternalNotification notification. The value associated with this + key will contain the new access token. + */ +extern NSString *const FIRAuthStateDidChangeInternalNotificationTokenKey; + +/** @var FIRAuthStateDidChangeInternalNotificationAppKey + @brief A key present in the dictionary object parameter of the + @c FIRAuthStateDidChangeInternalNotification notification. The value associated with this + key will contain the FIRApp associated with the auth instance. + */ +extern NSString *const FIRAuthStateDidChangeInternalNotificationAppKey; + +/** @var FIRAuthStateDidChangeInternalNotificationUIDKey + @brief A key present in the dictionary object parameter of the + @c FIRAuthStateDidChangeInternalNotification notification. The value associated with this + key will contain the new user's UID (or nil if there is no longer a user signed in). + */ +extern NSString *const FIRAuthStateDidChangeInternalNotificationUIDKey; + +@interface FIRApp () + +/** + * A flag indicating if this is the default app (has the default app name). + */ +@property(nonatomic, readonly) BOOL isDefaultApp; + +/* + * The container of interop SDKs for this app. + */ +@property(nonatomic) FIRComponentContainer *container; + +/** + * Checks if the default app is configured without trying to configure it. + */ ++ (BOOL)isDefaultAppConfigured; + +/** + * Registers a given third-party library with the given version number to be reported for + * analytics. + * + * @param name Name of the library. + * @param version Version of the library. + */ ++ (void)registerLibrary:(nonnull NSString *)name withVersion:(nonnull NSString *)version; + +/** + * Registers a given internal library to be reported for analytics. + * + * @param library Optional parameter for component registration. + * @param name Name of the library. + */ ++ (void)registerInternalLibrary:(nonnull Class)library + withName:(nonnull NSString *)name; + +/** + * Registers a given internal library with the given version number to be reported for + * analytics. This should only be used for non-Firebase libraries that have their own versioning + * scheme. + * + * @param library Optional parameter for component registration. + * @param name Name of the library. + * @param version Version of the library. + */ ++ (void)registerInternalLibrary:(nonnull Class)library + withName:(nonnull NSString *)name + withVersion:(nonnull NSString *)version; + +/** + * A concatenated string representing all the third-party libraries and version numbers. + */ ++ (NSString *)firebaseUserAgent; + +/** + * Can be used by the unit tests in eack SDK to reset FIRApp. This method is thread unsafe. + */ ++ (void)resetApps; + +/** + * Can be used by the unit tests in each SDK to set customized options. + */ +- (instancetype)initInstanceWithName:(NSString *)name options:(FIROptions *)options; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRComponent.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRComponent.h new file mode 100644 index 0000000..cb51ee7 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRComponent.h @@ -0,0 +1,91 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FIRApp; +@class FIRComponentContainer; + +NS_ASSUME_NONNULL_BEGIN + +/// Provides a system to clean up cached instances returned from the component system. +NS_SWIFT_NAME(ComponentLifecycleMaintainer) +@protocol FIRComponentLifecycleMaintainer +/// The associated app will be deleted, clean up any resources as they are about to be deallocated. +- (void)appWillBeDeleted:(FIRApp *)app; +@end + +typedef _Nullable id (^FIRComponentCreationBlock)(FIRComponentContainer *container, + BOOL *isCacheable) + NS_SWIFT_NAME(ComponentCreationBlock); + +@class FIRDependency; + +/// Describes the timing of instantiation. Note: new components should default to lazy unless there +/// is a strong reason to be eager. +typedef NS_ENUM(NSInteger, FIRInstantiationTiming) { + FIRInstantiationTimingLazy, + FIRInstantiationTimingAlwaysEager, + FIRInstantiationTimingEagerInDefaultApp +} NS_SWIFT_NAME(InstantiationTiming); + +/// A component that can be used from other Firebase SDKs. +NS_SWIFT_NAME(Component) +@interface FIRComponent : NSObject + +/// The protocol describing functionality provided from the Component. +@property(nonatomic, strong, readonly) Protocol *protocol; + +/// The timing of instantiation. +@property(nonatomic, readonly) FIRInstantiationTiming instantiationTiming; + +/// An array of dependencies for the component. +@property(nonatomic, copy, readonly) NSArray *dependencies; + +/// A block to instantiate an instance of the component with the appropriate dependencies. +@property(nonatomic, copy, readonly) FIRComponentCreationBlock creationBlock; + +// There's an issue with long NS_SWIFT_NAMES that causes compilation to fail, disable clang-format +// for the next two methods. +// clang-format off + +/// Creates a component with no dependencies that will be lazily initialized. ++ (instancetype)componentWithProtocol:(Protocol *)protocol + creationBlock:(FIRComponentCreationBlock)creationBlock +NS_SWIFT_NAME(init(_:creationBlock:)); + +/// Creates a component to be registered with the component container. +/// +/// @param protocol - The protocol describing functionality provided by the component. +/// @param instantiationTiming - When the component should be initialized. Use .lazy unless there's +/// a good reason to be instantiated earlier. +/// @param dependencies - Any dependencies the `implementingClass` has, optional or required. +/// @param creationBlock - A block to instantiate the component with a container, and if +/// @return A component that can be registered with the component container. ++ (instancetype)componentWithProtocol:(Protocol *)protocol + instantiationTiming:(FIRInstantiationTiming)instantiationTiming + dependencies:(NSArray *)dependencies + creationBlock:(FIRComponentCreationBlock)creationBlock +NS_SWIFT_NAME(init(_:instantiationTiming:dependencies:creationBlock:)); + +// clang-format on + +/// Unavailable. +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRComponentContainer.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRComponentContainer.h new file mode 100644 index 0000000..af18a93 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRComponentContainer.h @@ -0,0 +1,41 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#import + +NS_ASSUME_NONNULL_BEGIN + +/// A type-safe macro to retrieve a component from a container. This should be used to retrieve +/// components instead of using the container directly. +#define FIR_COMPONENT(type, container) \ + [FIRComponentType> instanceForProtocol:@protocol(type) inContainer:container] + +@class FIRApp; + +/// A container that holds different components that are registered via the +/// `registerAsComponentRegistrant:` call. These classes should conform to `FIRComponentRegistrant` +/// in order to properly register components for Core. +NS_SWIFT_NAME(FirebaseComponentContainer) +@interface FIRComponentContainer : NSObject + +/// A weak reference to the app that an instance of the container belongs to. +@property(nonatomic, weak, readonly) FIRApp *app; + +/// Unavailable. Use the `container` property on `FIRApp`. +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRComponentType.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRComponentType.h new file mode 100644 index 0000000..6f2aca7 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRComponentType.h @@ -0,0 +1,34 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FIRComponentContainer; + +NS_ASSUME_NONNULL_BEGIN + +/// Do not use directly. A placeholder type in order to provide a macro that will warn users of +/// mis-matched protocols. +NS_SWIFT_NAME(ComponentType) +@interface FIRComponentType<__covariant T> : NSObject + +/// Do not use directly. A factory method to retrieve an instance that provides a specific +/// functionality. ++ (T)instanceForProtocol:(Protocol *)protocol inContainer:(FIRComponentContainer *)container; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRCoreDiagnosticsConnector.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRCoreDiagnosticsConnector.h new file mode 100644 index 0000000..76c0c05 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRCoreDiagnosticsConnector.h @@ -0,0 +1,35 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FIRDiagnosticsData; +@class FIROptions; + +NS_ASSUME_NONNULL_BEGIN + +/** Connects FIRCore with the CoreDiagnostics library. */ +@interface FIRCoreDiagnosticsConnector : NSObject + +/** Logs FirebaseCore related data. + * + * @param options The options object containing data to log. + */ ++ (void)logCoreTelemetryWithOptions:(FIROptions *)options; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRDependency.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRDependency.h new file mode 100644 index 0000000..46e9b7e --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRDependency.h @@ -0,0 +1,45 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/// A dependency on a specific protocol's functionality. +NS_SWIFT_NAME(Dependency) +@interface FIRDependency : NSObject + +/// The protocol describing functionality being depended on. +@property(nonatomic, strong, readonly) Protocol *protocol; + +/// A flag to specify if the dependency is required or not. +@property(nonatomic, readonly) BOOL isRequired; + +/// Initializes a dependency that is required. Calls `initWithProtocol:isRequired` with `YES` for +/// the required parameter. +/// Creates a required dependency on the specified protocol's functionality. ++ (instancetype)dependencyWithProtocol:(Protocol *)protocol; + +/// Creates a dependency on the specified protocol's functionality and specify if it's required for +/// the class's functionality. ++ (instancetype)dependencyWithProtocol:(Protocol *)protocol isRequired:(BOOL)required; + +/// Use `dependencyWithProtocol:isRequired:` instead. +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRHeartbeatInfo.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRHeartbeatInfo.h new file mode 100644 index 0000000..bfff73e --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRHeartbeatInfo.h @@ -0,0 +1,39 @@ +// Copyright 2019 Google +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface FIRHeartbeatInfo : NSObject + +// Enum representing the different heartbeat codes. +typedef NS_ENUM(NSInteger, FIRHeartbeatInfoCode) { + FIRHeartbeatInfoCodeNone = 0, + FIRHeartbeatInfoCodeSDK = 1, + FIRHeartbeatInfoCodeGlobal = 2, + FIRHeartbeatInfoCodeCombined = 3, +}; + +/** + * Get heartbeat code requred for the sdk. + * @param heartbeatTag String representing the sdk heartbeat tag. + * @return Heartbeat code indicating whether or not an sdk/global heartbeat + * needs to be sent + */ ++ (FIRHeartbeatInfoCode)heartbeatCodeForTag:(NSString *)heartbeatTag; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRLibrary.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRLibrary.h new file mode 100644 index 0000000..9575e94 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRLibrary.h @@ -0,0 +1,44 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FIRLibrary_h +#define FIRLibrary_h + +#import + +@class FIRApp; +@class FIRComponent; + +NS_ASSUME_NONNULL_BEGIN + +/// Provide an interface to register a library for userAgent logging and availability to others. +NS_SWIFT_NAME(Library) +@protocol FIRLibrary + +/// Returns one or more FIRComponents that will be registered in +/// FIRApp and participate in dependency resolution and injection. ++ (NSArray *)componentsToRegister; + +@optional +/// Implement this method if the library needs notifications for lifecycle events. This method is +/// called when the developer calls `FirebaseApp.configure()`. ++ (void)configureWithApp:(FIRApp *)app; + +@end + +NS_ASSUME_NONNULL_END + +#endif /* FIRLibrary_h */ diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRLogger.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRLogger.h new file mode 100644 index 0000000..f71c20d --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIRLogger.h @@ -0,0 +1,148 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * The Firebase services used in Firebase logger. + */ +typedef NSString *const FIRLoggerService; + +extern FIRLoggerService kFIRLoggerAnalytics; +extern FIRLoggerService kFIRLoggerCrash; +extern FIRLoggerService kFIRLoggerCore; +extern FIRLoggerService kFIRLoggerMLKit; +extern FIRLoggerService kFIRLoggerPerf; +extern FIRLoggerService kFIRLoggerRemoteConfig; + +/** + * The key used to store the logger's error count. + */ +extern NSString *const kFIRLoggerErrorCountKey; + +/** + * The key used to store the logger's warning count. + */ +extern NSString *const kFIRLoggerWarningCountKey; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/** + * Enables or disables Analytics debug mode. + * If set to YES, the logging level for Analytics will be set to FIRLoggerLevelDebug. + * Enabling the debug mode has no effect if the app is running from App Store. + * (required) analytics debug mode flag. + */ +void FIRSetAnalyticsDebugMode(BOOL analyticsDebugMode); + +/** + * Changes the default logging level of FIRLoggerLevelNotice to a user-specified level. + * The default level cannot be set above FIRLoggerLevelNotice if the app is running from App Store. + * (required) log level (one of the FIRLoggerLevel enum values). + */ +void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel); + +/** + * Checks if the specified logger level is loggable given the current settings. + * (required) log level (one of the FIRLoggerLevel enum values). + * (required) whether or not this function is called from the Analytics component. + */ +BOOL FIRIsLoggableLevel(FIRLoggerLevel loggerLevel, BOOL analyticsComponent); + +/** + * Logs a message to the Xcode console and the device log. If running from AppStore, will + * not log any messages with a level higher than FIRLoggerLevelNotice to avoid log spamming. + * (required) log level (one of the FIRLoggerLevel enum values). + * (required) service name of type FIRLoggerService. + * (required) message code starting with "I-" which means iOS, followed by a capitalized + * three-character service identifier and a six digit integer message ID that is unique + * within the service. + * An example of the message code is @"I-COR000001". + * (required) message string which can be a format string. + * (optional) variable arguments list obtained from calling va_start, used when message is a format + * string. + */ +extern void FIRLogBasic(FIRLoggerLevel level, + FIRLoggerService service, + NSString *messageCode, + NSString *message, +// On 64-bit simulators, va_list is not a pointer, so cannot be marked nullable +// See: http://stackoverflow.com/q/29095469 +#if __LP64__ && TARGET_OS_SIMULATOR || TARGET_OS_OSX + va_list args_ptr +#else + va_list _Nullable args_ptr +#endif +); + +/** + * The following functions accept the following parameters in order: + * (required) service name of type FIRLoggerService. + * (required) message code starting from "I-" which means iOS, followed by a capitalized + * three-character service identifier and a six digit integer message ID that is unique + * within the service. + * An example of the message code is @"I-COR000001". + * See go/firebase-log-proposal for details. + * (required) message string which can be a format string. + * (optional) the list of arguments to substitute into the format string. + * Example usage: + * FIRLogError(kFIRLoggerCore, @"I-COR000001", @"Configuration of %@ failed.", app.name); + */ +extern void FIRLogError(FIRLoggerService service, NSString *messageCode, NSString *message, ...) + NS_FORMAT_FUNCTION(3, 4); +extern void FIRLogWarning(FIRLoggerService service, NSString *messageCode, NSString *message, ...) + NS_FORMAT_FUNCTION(3, 4); +extern void FIRLogNotice(FIRLoggerService service, NSString *messageCode, NSString *message, ...) + NS_FORMAT_FUNCTION(3, 4); +extern void FIRLogInfo(FIRLoggerService service, NSString *messageCode, NSString *message, ...) + NS_FORMAT_FUNCTION(3, 4); +extern void FIRLogDebug(FIRLoggerService service, NSString *messageCode, NSString *message, ...) + NS_FORMAT_FUNCTION(3, 4); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +@interface FIRLoggerWrapper : NSObject + +/** + * Objective-C wrapper for FIRLogBasic to allow weak linking to FIRLogger + * (required) log level (one of the FIRLoggerLevel enum values). + * (required) service name of type FIRLoggerService. + * (required) message code starting with "I-" which means iOS, followed by a capitalized + * three-character service identifier and a six digit integer message ID that is unique + * within the service. + * An example of the message code is @"I-COR000001". + * (required) message string which can be a format string. + * (optional) variable arguments list obtained from calling va_start, used when message is a format + * string. + */ + ++ (void)logWithLevel:(FIRLoggerLevel)level + withService:(FIRLoggerService)service + withCode:(NSString *)messageCode + withMessage:(NSString *)message + withArgs:(va_list)args; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIROptionsInternal.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIROptionsInternal.h new file mode 100644 index 0000000..8efc5fc --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FIROptionsInternal.h @@ -0,0 +1,115 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/** + * Keys for the strings in the plist file. + */ +extern NSString *const kFIRAPIKey; +extern NSString *const kFIRTrackingID; +extern NSString *const kFIRGoogleAppID; +extern NSString *const kFIRClientID; +extern NSString *const kFIRGCMSenderID; +extern NSString *const kFIRAndroidClientID; +extern NSString *const kFIRDatabaseURL; +extern NSString *const kFIRStorageBucket; +extern NSString *const kFIRBundleID; +extern NSString *const kFIRProjectID; + +/** + * Keys for the plist file name + */ +extern NSString *const kServiceInfoFileName; + +extern NSString *const kServiceInfoFileType; + +/** + * This header file exposes the initialization of FIROptions to internal use. + */ +@interface FIROptions () + +/** + * resetDefaultOptions and initInternalWithOptionsDictionary: are exposed only for unit tests. + */ ++ (void)resetDefaultOptions; + +/** + * Initializes the options with dictionary. The above strings are the keys of the dictionary. + * This is the designated initializer. + */ +- (instancetype)initInternalWithOptionsDictionary:(NSDictionary *)serviceInfoDictionary + NS_DESIGNATED_INITIALIZER; + +/** + * defaultOptions and defaultOptionsDictionary are exposed in order to be used in FIRApp and + * other first party services. + */ ++ (FIROptions *)defaultOptions; + ++ (NSDictionary *)defaultOptionsDictionary; + +/** + * Indicates whether or not Analytics collection was explicitly enabled via a plist flag or at + * runtime. + */ +@property(nonatomic, readonly) BOOL isAnalyticsCollectionExplicitlySet; + +/** + * Whether or not Analytics Collection was enabled. Analytics Collection is enabled unless + * explicitly disabled in GoogleService-Info.plist. + */ +@property(nonatomic, readonly) BOOL isAnalyticsCollectionEnabled; + +/** + * Whether or not Analytics Collection was completely disabled. If YES, then + * isAnalyticsCollectionEnabled will be NO. + */ +@property(nonatomic, readonly) BOOL isAnalyticsCollectionDeactivated; + +/** + * The version ID of the client library, e.g. @"1100000". + */ +@property(nonatomic, readonly, copy) NSString *libraryVersionID; + +/** + * The flag indicating whether this object was constructed with the values in the default plist + * file. + */ +@property(nonatomic) BOOL usingOptionsFromDefaultPlist; + +/** + * Whether or not Measurement was enabled. Measurement is enabled unless explicitly disabled in + * GoogleService-Info.plist. + */ +@property(nonatomic, readonly) BOOL isMeasurementEnabled; + +/** + * Whether or not Analytics was enabled in the developer console. + */ +@property(nonatomic, readonly) BOOL isAnalyticsEnabled; + +/** + * Whether or not SignIn was enabled in the developer console. + */ +@property(nonatomic, readonly) BOOL isSignInEnabled; + +/** + * Whether or not editing is locked. This should occur after FIROptions has been set on a FIRApp. + */ +@property(nonatomic, getter=isEditingLocked) BOOL editingLocked; + +@end diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FirebaseCoreInternal.h b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FirebaseCoreInternal.h new file mode 100644 index 0000000..88d012b --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/PrivateHeaders/FirebaseCoreInternal.h @@ -0,0 +1,28 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// An umbrella header, for any other libraries in this repo to access Firebase Public and Private +// headers. Any package manager complexity should be handled here. + +#import + +#import "FirebaseCore/Sources/Private/FIRAppInternal.h" +#import "FirebaseCore/Sources/Private/FIRComponent.h" +#import "FirebaseCore/Sources/Private/FIRComponentContainer.h" +#import "FirebaseCore/Sources/Private/FIRComponentType.h" +#import "FirebaseCore/Sources/Private/FIRDependency.h" +#import "FirebaseCore/Sources/Private/FIRHeartbeatInfo.h" +#import "FirebaseCore/Sources/Private/FIRLibrary.h" +#import "FirebaseCore/Sources/Private/FIRLogger.h" +#import "FirebaseCore/Sources/Private/FIROptionsInternal.h" diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/_CodeSignature/CodeResources b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..7069abc --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCore.framework/_CodeSignature/CodeResources @@ -0,0 +1,387 @@ + + + + + files + + Headers/FIRApp.h + + bs+mZbpB/+IipeJfATxIAH8zr9o= + + Headers/FIRConfiguration.h + + YsiMiUSSzVKkpDvcavbZDBVX7qI= + + Headers/FIRLoggerLevel.h + + VlN6UfvmnqD8Dn1khwZXHiro2u8= + + Headers/FIROptions.h + + p3ooFCdPxgzkaa5vwhizxl3tYMM= + + Headers/FIRVersion.h + + drgrG8VEj9xVnuDIZ/MNCsWpaPM= + + Headers/FirebaseCore-umbrella.h + + 9mUW0slJTxtirtcy67uYxFP7BnA= + + Headers/FirebaseCore.h + + 1cV5ZW/3+cyH6+oNi4QffBtH4j4= + + Info.plist + + xQkREsZZWN2ceYvuCwJ78SHEQMY= + + Modules/module.modulemap + + 5t1Th/TpACsGlSSRS5aPmiC+gmk= + + PrivateHeaders/FIRAppInternal.h + + oqgiPNgIZaufjV1fZ2CFeQlqvB8= + + PrivateHeaders/FIRComponent.h + + stqBu/dMKzLvycPSa/955TkcSQY= + + PrivateHeaders/FIRComponentContainer.h + + UoomgyhqNRkBFOCdQ9V5m6VC+Yk= + + PrivateHeaders/FIRComponentType.h + + 9nv5PF7PDECI+Yv/H9j0mOA0pVE= + + PrivateHeaders/FIRCoreDiagnosticsConnector.h + + Vvl+2bDxUv2RaMjETxlOZwEEQHg= + + PrivateHeaders/FIRDependency.h + + uYNS0fL/S1gyBI3/J3erEWzHuiU= + + PrivateHeaders/FIRHeartbeatInfo.h + + tNg/kXA5V7BFDg598I9P2pc8Dmc= + + PrivateHeaders/FIRLibrary.h + + PC8GsdFfU9sd6O2fGvipe5yb2M0= + + PrivateHeaders/FIRLogger.h + + HMvgtarBAy6+k1TL16Yk2Le9vAc= + + PrivateHeaders/FIROptionsInternal.h + + od+zSJ+USLZPOvhfiMy8ImbFXyc= + + PrivateHeaders/FirebaseCoreInternal.h + + aKSvrrgxyK6SJBKwb2buWzpSiOs= + + + files2 + + Headers/FIRApp.h + + hash + + bs+mZbpB/+IipeJfATxIAH8zr9o= + + hash2 + + OUyUXB5zH7zPSAXVp4kt2q93P+B+DCjsqB2zPq97Hw8= + + + Headers/FIRConfiguration.h + + hash + + YsiMiUSSzVKkpDvcavbZDBVX7qI= + + hash2 + + hgFMWIci1/HF1YT6aBUQZB44wlN/Jwi8YjWfDXOLktI= + + + Headers/FIRLoggerLevel.h + + hash + + VlN6UfvmnqD8Dn1khwZXHiro2u8= + + hash2 + + pS/fGCYP2V0x+wDCLTZ+8DQLrO8Jy7OyU4GgV0LlmQU= + + + Headers/FIROptions.h + + hash + + p3ooFCdPxgzkaa5vwhizxl3tYMM= + + hash2 + + W967zVKrA+ikdKfXADDt5PptpEkKOjK6M8Z3CFTF0lA= + + + Headers/FIRVersion.h + + hash + + drgrG8VEj9xVnuDIZ/MNCsWpaPM= + + hash2 + + ohVjJYwcHUVXUtiCfeWOOfZZKvxENOOdXo74dngv108= + + + Headers/FirebaseCore-umbrella.h + + hash + + 9mUW0slJTxtirtcy67uYxFP7BnA= + + hash2 + + iwHinUnNhI7vMXN2pesmKujJ+nDOc+v+J537rjLL2o4= + + + Headers/FirebaseCore.h + + hash + + 1cV5ZW/3+cyH6+oNi4QffBtH4j4= + + hash2 + + LGQ1nF3qjoVSkAkKAwJcNkfrSCqnDmEQ/6NBPHCg1Ug= + + + Modules/module.modulemap + + hash + + 5t1Th/TpACsGlSSRS5aPmiC+gmk= + + hash2 + + mwdNKv/bQHLE4+4DLZyrM0eG0bAvIJ2ryk6LX1F5olA= + + + PrivateHeaders/FIRAppInternal.h + + hash + + oqgiPNgIZaufjV1fZ2CFeQlqvB8= + + hash2 + + RVtsiGk3C67PcZSkZM/OYU2JcxtfpN0jwLGhX1cOTqQ= + + + PrivateHeaders/FIRComponent.h + + hash + + stqBu/dMKzLvycPSa/955TkcSQY= + + hash2 + + 8L4Z3tyK3mTIYyuFmK0ODMX9ATI2qeqYhdjlPA1MJBE= + + + PrivateHeaders/FIRComponentContainer.h + + hash + + UoomgyhqNRkBFOCdQ9V5m6VC+Yk= + + hash2 + + tjUOJtUndmuGYiXQFnuSjGACPByO/bDR+IflYPvYX8c= + + + PrivateHeaders/FIRComponentType.h + + hash + + 9nv5PF7PDECI+Yv/H9j0mOA0pVE= + + hash2 + + M+PvfFqg886ZzZXaO3W9AP+nfHlgK6eNckNDQosdffA= + + + PrivateHeaders/FIRCoreDiagnosticsConnector.h + + hash + + Vvl+2bDxUv2RaMjETxlOZwEEQHg= + + hash2 + + MbqX0nT4LH/ifZ7j6k/J7/WEgvk3JsTCT2HA4NfNdlA= + + + PrivateHeaders/FIRDependency.h + + hash + + uYNS0fL/S1gyBI3/J3erEWzHuiU= + + hash2 + + 0+AUURSQjKipNiWLkzUCn83IOO3+Slk3Wna7bKy8Jrk= + + + PrivateHeaders/FIRHeartbeatInfo.h + + hash + + tNg/kXA5V7BFDg598I9P2pc8Dmc= + + hash2 + + TXhQilnZIwaeYXFCH8iITucKtZqnZowvfNdRLaVja2E= + + + PrivateHeaders/FIRLibrary.h + + hash + + PC8GsdFfU9sd6O2fGvipe5yb2M0= + + hash2 + + ISv+5xzdZbW6kLSM1SI+Ot8DEJSH4WWrf5Eeh+Nw/kc= + + + PrivateHeaders/FIRLogger.h + + hash + + HMvgtarBAy6+k1TL16Yk2Le9vAc= + + hash2 + + uhnNvQlelwZTOQW2KnGbUucl91Sw51AehchKW2L3Oi0= + + + PrivateHeaders/FIROptionsInternal.h + + hash + + od+zSJ+USLZPOvhfiMy8ImbFXyc= + + hash2 + + WaSeq5A1iQWcZOCE1OzjfGmcorAKmpyRrzQNKSj9B1k= + + + PrivateHeaders/FirebaseCoreInternal.h + + hash + + aKSvrrgxyK6SJBKwb2buWzpSiOs= + + hash2 + + 51f/DJDaXZJkn1Swn2okfk0mAln3sCG2kEYWWJwM1M4= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics b/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics new file mode 100755 index 0000000..d204ed0 Binary files /dev/null and b/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics differ diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/Headers/FIRCoreDiagnostics.h b/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/Headers/FIRCoreDiagnostics.h new file mode 100644 index 0000000..5076d6b --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/Headers/FIRCoreDiagnostics.h @@ -0,0 +1,18 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// There are no actual public headers in the lib. This is a dummy public header to prevent Cocoapods +// from adding all internal headers as public. diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/Headers/FirebaseCoreDiagnostics-umbrella.h b/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/Headers/FirebaseCoreDiagnostics-umbrella.h new file mode 100644 index 0000000..a27569f --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/Headers/FirebaseCoreDiagnostics-umbrella.h @@ -0,0 +1,17 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "FIRCoreDiagnostics.h" + +FOUNDATION_EXPORT double FirebaseCoreDiagnosticsVersionNumber; +FOUNDATION_EXPORT const unsigned char FirebaseCoreDiagnosticsVersionString[]; + diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/Info.plist b/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/Info.plist new file mode 100644 index 0000000..deda1b7 Binary files /dev/null and b/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/Modules/module.modulemap new file mode 100644 index 0000000..d9cad8b --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FirebaseCoreDiagnostics { + umbrella header "FirebaseCoreDiagnostics-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/_CodeSignature/CodeResources b/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..831ece8 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseCoreDiagnostics.framework/_CodeSignature/CodeResources @@ -0,0 +1,147 @@ + + + + + files + + Headers/FIRCoreDiagnostics.h + + GITcu3gAbquOEA3mKpqnb+mlCBw= + + Headers/FirebaseCoreDiagnostics-umbrella.h + + 4JmL8IjLOD4CVKh0agRXI2t0pTI= + + Info.plist + + nYtFK1DQ0jOL9FJyIAsXdIkYPpE= + + Modules/module.modulemap + + 3BUx2MCiW8bHIaui/77Jaiu90mQ= + + + files2 + + Headers/FIRCoreDiagnostics.h + + hash + + GITcu3gAbquOEA3mKpqnb+mlCBw= + + hash2 + + EeoWUh+TrKqC7f6fLMk+ZaVJzypkLoEmi8iDP4H71GA= + + + Headers/FirebaseCoreDiagnostics-umbrella.h + + hash + + 4JmL8IjLOD4CVKh0agRXI2t0pTI= + + hash2 + + KIngDWqtudDuzaN2BPqOfuA1UMncorS9jBLJlpJsUUI= + + + Modules/module.modulemap + + hash + + 3BUx2MCiW8bHIaui/77Jaiu90mQ= + + hash2 + + of7Lcet633iNVOeWqJtLqLdUXqQAmwpIqc2xgpzaONU= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/FirebaseInstallations b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/FirebaseInstallations new file mode 100755 index 0000000..8bd55db Binary files /dev/null and b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/FirebaseInstallations differ diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FIRInstallations.h b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FIRInstallations.h new file mode 100644 index 0000000..fdb56c4 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FIRInstallations.h @@ -0,0 +1,123 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FIRApp; +@class FIRInstallationsAuthTokenResult; + +NS_ASSUME_NONNULL_BEGIN + +/** A notification with this name is sent each time an installation is created or deleted. */ +FOUNDATION_EXPORT const NSNotificationName FIRInstallationIDDidChangeNotification + NS_SWIFT_NAME(InstallationIDDidChange); +/** `userInfo` key for the `FirebaseApp.name` in `FIRInstallationIDDidChangeNotification`. */ +FOUNDATION_EXPORT NSString *const kFIRInstallationIDDidChangeNotificationAppNameKey + NS_SWIFT_NAME(InstallationIDDidChangeAppNameKey); + +/** + * An installation ID handler block. + * @param identifier The installation ID string if exists or `nil` otherwise. + * @param error The error when `identifier == nil` or `nil` otherwise. + */ +typedef void (^FIRInstallationsIDHandler)(NSString *__nullable identifier, + NSError *__nullable error) + NS_SWIFT_NAME(InstallationsIDHandler); + +/** + * An authorization token handler block. + * @param tokenResult An instance of `InstallationsAuthTokenResult` in case of success or `nil` + * otherwise. + * @param error The error when `tokenResult == nil` or `nil` otherwise. + */ +typedef void (^FIRInstallationsTokenHandler)( + FIRInstallationsAuthTokenResult *__nullable tokenResult, NSError *__nullable error) + NS_SWIFT_NAME(InstallationsTokenHandler); + +/** + * The class provides API for Firebase Installations. + * Each configured `FirebaseApp` has a corresponding single instance of `Installations`. + * An instance of the class provides access to the installation info for the `FirebaseApp` as well + * as the ability to delete it. A Firebase Installation is unique by `FirebaseApp.name` and + * `FirebaseApp.options.googleAppID` . + */ +NS_SWIFT_NAME(Installations) +@interface FIRInstallations : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +/** + * Returns a default instance of `Installations`. + * @returns An instance of `Installations` for `FirebaseApp.defaultApp(). + * @throw Throws an exception if the default app is not configured yet or required `FirebaseApp` + * options are missing. + */ ++ (FIRInstallations *)installations NS_SWIFT_NAME(installations()); + +/** + * Returns an instance of `Installations` for an application. + * @param application A configured `FirebaseApp` instance. + * @returns An instance of `Installations` corresponding to the passed application. + * @throw Throws an exception if required `FirebaseApp` options are missing. + */ ++ (FIRInstallations *)installationsWithApp:(FIRApp *)application NS_SWIFT_NAME(installations(app:)); + +/** + * The method creates or retrieves an installation ID. The installation ID is a stable identifier + * that uniquely identifies the app instance. NOTE: If the application already has an existing + * FirebaseInstanceID then the InstanceID identifier will be used. + * @param completion A completion handler which is invoked when the operation completes. See + * `InstallationsIDHandler` for additional details. + */ +- (void)installationIDWithCompletion:(FIRInstallationsIDHandler)completion; + +/** + * Retrieves (locally if it exists or from the server) a valid installation auth token. An existing + * token may be invalidated or expired, so it is recommended to fetch the installation auth token + * before each server request. The method does the same as `Installations.authTokenForcingRefresh(:, + * completion:)` with forcing refresh `NO`. + * @param completion A completion handler which is invoked when the operation completes. See + * `InstallationsTokenHandler` for additional details. + */ +- (void)authTokenWithCompletion:(FIRInstallationsTokenHandler)completion; + +/** + * Retrieves (locally or from the server depending on `forceRefresh` value) a valid installation + * auth token. An existing token may be invalidated or expire, so it is recommended to fetch the + * installation auth token before each server request. This method should be used with `forceRefresh + * == YES` when e.g. a request with the previously fetched installation auth token failed with "Not + * Authorized" error. + * @param forceRefresh If `YES` then the locally cached installation auth token will be ignored and + * a new one will be requested from the server. If `NO`, then the locally cached installation auth + * token will be returned if exists and has not expired yet. + * @param completion A completion handler which is invoked when the operation completes. See + * `InstallationsTokenHandler` for additional details. + */ +- (void)authTokenForcingRefresh:(BOOL)forceRefresh + completion:(FIRInstallationsTokenHandler)completion; + +/** + * Deletes all the installation data including the unique identifier, auth tokens and + * all related data on the server side. A network connection is required for the method to + * succeed. If fails, the existing installation data remains untouched. + * @param completion A completion handler which is invoked when the operation completes. `error == + * nil` indicates success. + */ +- (void)deleteWithCompletion:(void (^)(NSError *__nullable error))completion; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FIRInstallationsAuthTokenResult.h b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FIRInstallationsAuthTokenResult.h new file mode 100644 index 0000000..501ac4e --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FIRInstallationsAuthTokenResult.h @@ -0,0 +1,33 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** The class represents a result of the installation auth token request. */ +NS_SWIFT_NAME(InstallationsAuthTokenResult) +@interface FIRInstallationsAuthTokenResult : NSObject + +/** The installation auth token string. */ +@property(nonatomic, readonly) NSString *authToken; + +/** The installation auth token expiration date. */ +@property(nonatomic, readonly) NSDate *expirationDate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FIRInstallationsErrors.h b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FIRInstallationsErrors.h new file mode 100644 index 0000000..d0c3b99 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FIRInstallationsErrors.h @@ -0,0 +1,34 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +extern NSString *const kFirebaseInstallationsErrorDomain; + +typedef NS_ENUM(NSUInteger, FIRInstallationsErrorCode) { + /** Unknown error. See `userInfo` for details. */ + FIRInstallationsErrorCodeUnknown = 0, + + /** Keychain error. See `userInfo` for details. */ + FIRInstallationsErrorCodeKeychain = 1, + + /** Server unreachable. A network error or server is unavailable. See `userInfo` for details. */ + FIRInstallationsErrorCodeServerUnreachable = 2, + + /** FirebaseApp configuration issues e.g. invalid GMP-App-ID, etc. See `userInfo` for details. */ + FIRInstallationsErrorCodeInvalidConfiguration = 3, + +} NS_SWIFT_NAME(InstallationsErrorCode); diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FirebaseInstallations-umbrella.h b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FirebaseInstallations-umbrella.h new file mode 100644 index 0000000..431ef45 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FirebaseInstallations-umbrella.h @@ -0,0 +1,20 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "FirebaseInstallations.h" +#import "FIRInstallations.h" +#import "FIRInstallationsAuthTokenResult.h" +#import "FIRInstallationsErrors.h" + +FOUNDATION_EXPORT double FirebaseInstallationsVersionNumber; +FOUNDATION_EXPORT const unsigned char FirebaseInstallationsVersionString[]; + diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FirebaseInstallations.h b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FirebaseInstallations.h new file mode 100644 index 0000000..8a9b3c1 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Headers/FirebaseInstallations.h @@ -0,0 +1,19 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "FIRInstallations.h" +#import "FIRInstallationsAuthTokenResult.h" +#import "FIRInstallationsErrors.h" diff --git a/plugins/2020.3569/iphone-sim/FirebaseInstallations.framework/Info.plist b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Info.plist similarity index 59% rename from plugins/2020.3569/iphone-sim/FirebaseInstallations.framework/Info.plist rename to src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Info.plist index 0f13572..2160ad9 100644 Binary files a/plugins/2020.3569/iphone-sim/FirebaseInstallations.framework/Info.plist and b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Modules/module.modulemap new file mode 100644 index 0000000..f6e2a29 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FirebaseInstallations { + umbrella header "FirebaseInstallations-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/_CodeSignature/CodeResources b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..03879f9 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseInstallations.framework/_CodeSignature/CodeResources @@ -0,0 +1,192 @@ + + + + + files + + Headers/FIRInstallations.h + + Gg6NPBtwVPZagpoU5UaSTNMwgOE= + + Headers/FIRInstallationsAuthTokenResult.h + + z60m46zEzh9yn4Bt7VIlBSceIV0= + + Headers/FIRInstallationsErrors.h + + y9S5XukkUeKs7MfM4pAz7U6bEXE= + + Headers/FirebaseInstallations-umbrella.h + + 77D4JhMPM5LuwfY2Fy9TverO2kc= + + Headers/FirebaseInstallations.h + + ZfdzPat4xYq3QhUuKo1MaY6koQM= + + Info.plist + + YJb3927ApAxiq6MYw/OFY2OCEOI= + + Modules/module.modulemap + + dmkv8wZIrCTkLk4k1v8n+xLh5Dw= + + + files2 + + Headers/FIRInstallations.h + + hash + + Gg6NPBtwVPZagpoU5UaSTNMwgOE= + + hash2 + + YzryAJefaq3g3PcAzXk7w/JnthsUp7dFa36P/ZYg9RA= + + + Headers/FIRInstallationsAuthTokenResult.h + + hash + + z60m46zEzh9yn4Bt7VIlBSceIV0= + + hash2 + + Ck0312ZhoNq87GtsV7zjdxyY+w0S2FSfn/p4lfKtT+s= + + + Headers/FIRInstallationsErrors.h + + hash + + y9S5XukkUeKs7MfM4pAz7U6bEXE= + + hash2 + + TlT5+XpVl4OzF3ZSY8h8EUc61EskCVzasm48B1D4WNs= + + + Headers/FirebaseInstallations-umbrella.h + + hash + + 77D4JhMPM5LuwfY2Fy9TverO2kc= + + hash2 + + ydRKuFg2IROTtRE3o1fwZCI0H5QHzvkEQwIhTFJWfd0= + + + Headers/FirebaseInstallations.h + + hash + + ZfdzPat4xYq3QhUuKo1MaY6koQM= + + hash2 + + VFpFA8n5RF/GLv0N9QEr0IoYtDzt72v7vlrDv/hjA0k= + + + Modules/module.modulemap + + hash + + dmkv8wZIrCTkLk4k1v8n+xLh5Dw= + + hash2 + + 33Bhw6DIixw6oOJuRbbAXLu3Vdd9LW6MNE3zxH1N7NE= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/FirebaseInstanceID b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/FirebaseInstanceID new file mode 100755 index 0000000..351fbe5 Binary files /dev/null and b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/FirebaseInstanceID differ diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Headers/FIRInstanceID.h b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Headers/FIRInstanceID.h new file mode 100644 index 0000000..4f5a662 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Headers/FIRInstanceID.h @@ -0,0 +1,327 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class FIRInstanceIDResult; +/** + * @memberof FIRInstanceID + * + * The scope to be used when fetching/deleting a token for Firebase Messaging. + */ +FOUNDATION_EXPORT NSString *const kFIRInstanceIDScopeFirebaseMessaging + NS_SWIFT_NAME(InstanceIDScopeFirebaseMessaging) DEPRECATED_ATTRIBUTE; + +#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 +/** + * Called when the system determines that tokens need to be refreshed. + * This method is also called if Instance ID has been reset in which + * case, tokens and FCM topic subscriptions also need to be refreshed. + * + * Instance ID service will throttle the refresh event across all devices + * to control the rate of token updates on application servers. + */ +FOUNDATION_EXPORT const NSNotificationName kFIRInstanceIDTokenRefreshNotification + NS_SWIFT_NAME(InstanceIDTokenRefresh) DEPRECATED_ATTRIBUTE; +#else +/** + * Called when the system determines that tokens need to be refreshed. + * This method is also called if Instance ID has been reset in which + * case, tokens and FCM topic subscriptions also need to be refreshed. + * + * Instance ID service will throttle the refresh event across all devices + * to control the rate of token updates on application servers. + */ +FOUNDATION_EXPORT NSString *const kFIRInstanceIDTokenRefreshNotification + NS_SWIFT_NAME(InstanceIDTokenRefreshNotification) DEPRECATED_ATTRIBUTE; +#endif // defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the InstanceID token returns. If + * the call fails we return the appropriate `error code` as described below. + * + * @param token The valid token as returned by InstanceID backend. + * + * @param error The error describing why generating a new token + * failed. See the error codes below for a more detailed + * description. + */ +typedef void (^FIRInstanceIDTokenHandler)(NSString *__nullable token, NSError *__nullable error) + NS_SWIFT_NAME(InstanceIDTokenHandler); + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the InstanceID `deleteToken` returns. If + * the call fails we return the appropriate `error code` as described below + * + * @param error The error describing why deleting the token failed. + * See the error codes below for a more detailed description. + */ +typedef void (^FIRInstanceIDDeleteTokenHandler)(NSError *error) + NS_SWIFT_NAME(InstanceIDDeleteTokenHandler); + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the app identity is created. If the + * identity wasn't created for some reason we return the appropriate error code. + * + * @param identity A valid identity for the app instance, nil if there was an error + * while creating an identity. + * @param error The error if fetching the identity fails else nil. + */ +typedef void (^FIRInstanceIDHandler)(NSString *__nullable identity, NSError *__nullable error) + NS_SWIFT_NAME(InstanceIDHandler); + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the app identity and all the tokens associated + * with it are deleted. Returns a valid error object in case of failure else nil. + * + * @param error The error if deleting the identity and all the tokens associated with + * it fails else nil. + */ +typedef void (^FIRInstanceIDDeleteHandler)(NSError *__nullable error) + NS_SWIFT_NAME(InstanceIDDeleteHandler); + +/** + * @related FIRInstanceID + * + * The completion handler invoked when the app identity and token are fetched. If the + * identity wasn't created for some reason we return the appropriate error code. + * + * @param result The result containing an identity for the app instance and a valid token, + * nil if there was an error while creating the result. + * @param error The error if fetching the identity or token fails else nil. + */ +typedef void (^FIRInstanceIDResultHandler)(FIRInstanceIDResult *__nullable result, + NSError *__nullable error) + NS_SWIFT_NAME(InstanceIDResultHandler); + +/** + * Public errors produced by InstanceID. + */ +typedef NS_ENUM(NSUInteger, FIRInstanceIDError) { + // Http related errors. + + /// Unknown error. + FIRInstanceIDErrorUnknown = 0, + + /// Auth Error -- GCM couldn't validate request from this client. + FIRInstanceIDErrorAuthentication = 1, + + /// NoAccess -- InstanceID service cannot be accessed. + FIRInstanceIDErrorNoAccess = 2, + + /// Timeout -- Request to InstanceID backend timed out. + FIRInstanceIDErrorTimeout = 3, + + /// Network -- No network available to reach the servers. + FIRInstanceIDErrorNetwork = 4, + + /// OperationInProgress -- Another similar operation in progress, + /// bailing this one. + FIRInstanceIDErrorOperationInProgress = 5, + + /// InvalidRequest -- Some parameters of the request were invalid. + FIRInstanceIDErrorInvalidRequest = 7, +} NS_SWIFT_NAME(InstanceIDError); + +/** + * A class contains the results of InstanceID and token query. + */ +NS_SWIFT_NAME(InstanceIDResult) +__deprecated_msg("FIRInstanceIDResult is deprecated, please use FIRInstallations " + "for app instance identifier handling and use FIRMessaging for " + "FCM registration token handling.") @interface FIRInstanceIDResult + : NSObject + +/** + * An instanceID uniquely identifies the app instance. + */ +@property(nonatomic, readonly, copy) NSString *instanceID; + +/* + * Returns a Firebase Messaging scoped token for the firebase app. + */ +@property(nonatomic, readonly, copy) NSString *token; + +@end + +/** + * Instance ID provides a unique identifier for each app instance and a mechanism + * to authenticate and authorize actions (for example, sending an FCM message). + * + * Once an InstanceID is generated, the library periodically sends information about the + * application and the device where it's running to the Firebase backend. To stop this. see + * `[FIRInstanceID deleteIDWithHandler:]`. + * + * Instance ID is long lived but, may be reset if the device is not used for + * a long time or the Instance ID service detects a problem. + * If Instance ID is reset, the app will be notified via + * `kFIRInstanceIDTokenRefreshNotification`. + * + * If the Instance ID has become invalid, the app can request a new one and + * send it to the app server. + * To prove ownership of Instance ID and to allow servers to access data or + * services associated with the app, call + * `[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler]`. + */ +NS_SWIFT_NAME(InstanceID) +__deprecated_msg("FIRInstanceID is deprecated, please use FIRInstallations for installation " + "identifier handling and use FIRMessaging for FCM registration token handling.") + @interface FIRInstanceID : NSObject + +/** + * FIRInstanceID. + * + * @return A shared instance of FIRInstanceID. + */ ++ (instancetype)instanceID NS_SWIFT_NAME(instanceID()); + +/** + * Unavailable. Use +instanceID instead. + */ +- (instancetype)init __attribute__((unavailable("Use +instanceID instead."))); + +#pragma mark - Tokens + +/** + * Returns a result of app instance identifier InstanceID and a Firebase Messaging scoped token. + * param handler The callback handler invoked when an app instanceID and a default token + * are generated and returned. If instanceID and token fetching fail for some + * reason the callback is invoked with nil `result` and the appropriate error. + */ +- (void)instanceIDWithHandler:(FIRInstanceIDResultHandler)handler + __deprecated_msg("Use `Installations.installationID(completion:)` to get the app instance " + "identifier instead. " + "Use `Messaging.token(completion:)` to get FCM registration token instead."); + +/** + * Returns a token that authorizes an Entity (example: cloud service) to perform + * an action on behalf of the application identified by Instance ID. + * + * This is similar to an OAuth2 token except, it applies to the + * application instance instead of a user. + * + * This is an asynchronous call. If the token fetching fails for some reason + * we invoke the completion callback with nil `token` and the appropriate + * error. + * + * This generates an Instance ID if it does not exist yet, which starts periodically sending + * information to the Firebase backend (see `[FIRInstanceID getIDWithHandler:]`). + * + * Note, you can only have one `token` or `deleteToken` call for a given + * authorizedEntity and scope at any point of time. Making another such call with the + * same authorizedEntity and scope before the last one finishes will result in an + * error with code `OperationInProgress`. + * + * @see FIRInstanceID deleteTokenWithAuthorizedEntity:scope:handler: + * + * @param authorizedEntity Entity authorized by the token. + * @param scope Action authorized for authorizedEntity. + * @param options The extra options to be sent with your token request. The + * value for the `apns_token` should be the NSData object + * passed to the UIApplicationDelegate's + * `didRegisterForRemoteNotificationsWithDeviceToken` method. + * The value for `apns_sandbox` should be a boolean (or an + * NSNumber representing a BOOL in Objective-C) set to true if + * your app is a debug build, which means that the APNs + * device token is for the sandbox environment. It should be + * set to false otherwise. If the `apns_sandbox` key is not + * provided, an automatically-detected value shall be used. + * @param handler The callback handler which is invoked when the token is + * successfully fetched. In case of success a valid `token` and + * `nil` error are returned. In case of any error the `token` + * is nil and a valid `error` is returned. The valid error + * codes have been documented above. + */ +- (void)tokenWithAuthorizedEntity:(NSString *)authorizedEntity + scope:(NSString *)scope + options:(nullable NSDictionary *)options + handler:(FIRInstanceIDTokenHandler)handler + __deprecated_msg("Use Messaging.token(completion:) instead."); + +/** + * Revokes access to a scope (action) for an entity previously + * authorized by `[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler]`. + * + * This is an asynchronous call. Call this on the main thread since InstanceID lib + * is not thread safe. In case token deletion fails for some reason we invoke the + * `handler` callback passed in with the appropriate error code. + * + * Note, you can only have one `token` or `deleteToken` call for a given + * authorizedEntity and scope at a point of time. Making another such call with the + * same authorizedEntity and scope before the last one finishes will result in an error + * with code `OperationInProgress`. + * + * @param authorizedEntity Entity that must no longer have access. + * @param scope Action that entity is no longer authorized to perform. + * @param handler The handler that is invoked once the unsubscribe call ends. + * In case of error an appropriate error object is returned + * else error is nil. + */ +- (void)deleteTokenWithAuthorizedEntity:(NSString *)authorizedEntity + scope:(NSString *)scope + handler:(FIRInstanceIDDeleteTokenHandler)handler + __deprecated_msg("Use `Messaging.deleteToken(completion:)` instead."); + +#pragma mark - Identity + +/** + * Asynchronously fetch a stable identifier that uniquely identifies the app + * instance. If the identifier has been revoked or has expired, this method will + * return a new identifier. + * + * Once an InstanceID is generated, the library periodically sends information about the + * application and the device where it's running to the Firebase backend. To stop this. see + * `[FIRInstanceID deleteIDWithHandler:]`. + * + * @param handler The handler to invoke once the identifier has been fetched. + * In case of error an appropriate error object is returned else + * a valid identifier is returned and a valid identifier for the + * application instance. + */ +- (void)getIDWithHandler:(FIRInstanceIDHandler)handler + NS_SWIFT_NAME(getID(handler:)) + __deprecated_msg("Use `Installations.installationID(completion:)` instead."); + +/** + * Resets Instance ID and revokes all tokens. + * + * This method also triggers a request to fetch a new Instance ID and Firebase Messaging scope + * token. Please listen to kFIRInstanceIDTokenRefreshNotification when the new ID and token are + * ready. + * + * This stops the periodic sending of data to the Firebase backend that began when the Instance ID + * was generated. No more data is sent until another library calls Instance ID internally again + * (like FCM, RemoteConfig or Analytics) or user explicitly calls Instance ID APIs to get an + * Instance ID and token again. + */ +- (void)deleteIDWithHandler:(FIRInstanceIDDeleteHandler)handler NS_SWIFT_NAME(deleteID(handler:)) + __deprecated_msg("Use `Installations.delete(completion:)` instead. " + "Also check `Messaging.deleteData(completion:)`" + "if you want to delete FCM registration token."); + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Headers/FirebaseInstanceID-umbrella.h b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Headers/FirebaseInstanceID-umbrella.h new file mode 100644 index 0000000..90ba5de --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Headers/FirebaseInstanceID-umbrella.h @@ -0,0 +1,18 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "FirebaseInstanceID.h" +#import "FIRInstanceID.h" + +FOUNDATION_EXPORT double FirebaseInstanceIDVersionNumber; +FOUNDATION_EXPORT const unsigned char FirebaseInstanceIDVersionString[]; + diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h new file mode 100644 index 0000000..78c9ef1 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h @@ -0,0 +1,17 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "FIRInstanceID.h" diff --git a/plugins/2020.3569/iphone-sim/FirebaseMessaging.framework/Info.plist b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Info.plist similarity index 51% rename from plugins/2020.3569/iphone-sim/FirebaseMessaging.framework/Info.plist rename to src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Info.plist index 76b963b..351f60d 100644 Binary files a/plugins/2020.3569/iphone-sim/FirebaseMessaging.framework/Info.plist and b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Modules/module.modulemap new file mode 100644 index 0000000..ff5248f --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FirebaseInstanceID { + umbrella header "FirebaseInstanceID-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/_CodeSignature/CodeResources b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..e249e2d --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseInstanceID.framework/_CodeSignature/CodeResources @@ -0,0 +1,162 @@ + + + + + files + + Headers/FIRInstanceID.h + + Az1Lyd42t2uEfFZ3TUL2CjjsxJw= + + Headers/FirebaseInstanceID-umbrella.h + + +4lrUsDRnCsXKotao4hEkD/LnAs= + + Headers/FirebaseInstanceID.h + + WaCVBPDEw34uHDz0W83bHXe5Rxg= + + Info.plist + + PfD64um+kxWc5OsqMVEnL4LaoK8= + + Modules/module.modulemap + + aHtjWJ0UCO6y4SVAxmigh79V4ZY= + + + files2 + + Headers/FIRInstanceID.h + + hash + + Az1Lyd42t2uEfFZ3TUL2CjjsxJw= + + hash2 + + xvwR9x5qxKZMdYlcAVgP1Xaegt1ZbNn/FCU5b+YMO08= + + + Headers/FirebaseInstanceID-umbrella.h + + hash + + +4lrUsDRnCsXKotao4hEkD/LnAs= + + hash2 + + r7ycdAkrQmK1O1QFDU9wWFafkkgt11hMJlVcapWTDm0= + + + Headers/FirebaseInstanceID.h + + hash + + WaCVBPDEw34uHDz0W83bHXe5Rxg= + + hash2 + + j+af1yKoHkGr50vHOGG/ilifHxubmLKtAVrcHZRIFkw= + + + Modules/module.modulemap + + hash + + aHtjWJ0UCO6y4SVAxmigh79V4ZY= + + hash2 + + NQ5y81thh9X30Xafg4AcTtMIZJbayTbbtYceCUr2hpQ= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/FirebaseMessaging b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/FirebaseMessaging new file mode 100755 index 0000000..067d485 Binary files /dev/null and b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/FirebaseMessaging differ diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Headers/FIRMessaging.h b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Headers/FIRMessaging.h new file mode 100644 index 0000000..0a22dae --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Headers/FIRMessaging.h @@ -0,0 +1,398 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + * @related FIRMessaging + * + * The completion handler invoked when the registration token returns. + * If the call fails we return the appropriate `error code`, described by + * `FIRMessagingError`. + * + * @param FCMToken The valid registration token returned by FCM. + * @param error The error describing why a token request failed. The error code + * will match a value from the FIRMessagingError enumeration. + */ +typedef void (^FIRMessagingFCMTokenFetchCompletion)(NSString *_Nullable FCMToken, + NSError *_Nullable error) + NS_SWIFT_NAME(MessagingFCMTokenFetchCompletion); + +/** + * @related FIRMessaging + * + * The completion handler invoked when the registration token deletion request is + * completed. If the call fails we return the appropriate `error code`, described + * by `FIRMessagingError`. + * + * @param error The error describing why a token deletion failed. The error code + * will match a value from the FIRMessagingError enumeration. + */ +typedef void (^FIRMessagingDeleteFCMTokenCompletion)(NSError *_Nullable error) + NS_SWIFT_NAME(MessagingDeleteFCMTokenCompletion); + +/** + * Callback to invoke once the HTTP call to FIRMessaging backend for updating + * subscription finishes. + * + * @param error The error which occurred while updating the subscription topic + * on the FIRMessaging server. This will be nil in case the operation + * was successful, or if the operation was cancelled. + */ +typedef void (^FIRMessagingTopicOperationCompletion)(NSError *_Nullable error); + +/** + * Notification sent when the FCM registration token has been refreshed. Please use the + * FIRMessaging delegate method `messaging:didReceiveRegistrationToken:` to receive current and + * updated tokens. + */ +FOUNDATION_EXPORT const NSNotificationName FIRMessagingRegistrationTokenRefreshedNotification + NS_SWIFT_NAME(MessagingRegistrationTokenRefreshed); + +/** + * @enum FIRMessagingError + */ +typedef NS_ENUM(NSUInteger, FIRMessagingError) { + /// Unknown error. + FIRMessagingErrorUnknown = 0, + + /// FIRMessaging couldn't validate request from this client. + FIRMessagingErrorAuthentication = 1, + + /// InstanceID service cannot be accessed. + FIRMessagingErrorNoAccess = 2, + + /// Request to InstanceID backend timed out. + FIRMessagingErrorTimeout = 3, + + /// No network available to reach the servers. + FIRMessagingErrorNetwork = 4, + + /// Another similar operation in progress, bailing this one. + FIRMessagingErrorOperationInProgress = 5, + + /// Some parameters of the request were invalid. + FIRMessagingErrorInvalidRequest = 7, + + /// Topic name is invalid for subscription/unsubscription. + FIRMessagingErrorInvalidTopicName = 8, + +} NS_SWIFT_NAME(MessagingError); + +/// Status for the downstream message received by the app. +typedef NS_ENUM(NSInteger, FIRMessagingMessageStatus) { + /// Unknown status. + FIRMessagingMessageStatusUnknown, + /// New downstream message received by the app. + FIRMessagingMessageStatusNew, +} NS_SWIFT_NAME(MessagingMessageStatus); + +/** + * The APNs token type for the app. If the token type is set to `UNKNOWN` + * Firebase Messaging will implicitly try to figure out what the actual token type + * is from the provisioning profile. + * Unless you really need to specify the type, you should use the `APNSToken` + * property instead. + */ +typedef NS_ENUM(NSInteger, FIRMessagingAPNSTokenType) { + /// Unknown token type. + FIRMessagingAPNSTokenTypeUnknown, + /// Sandbox token type. + FIRMessagingAPNSTokenTypeSandbox, + /// Production token type. + FIRMessagingAPNSTokenTypeProd, +} NS_SWIFT_NAME(MessagingAPNSTokenType); + +/// Information about a downstream message received by the app. +NS_SWIFT_NAME(MessagingMessageInfo) +@interface FIRMessagingMessageInfo : NSObject + +/// The status of the downstream message +@property(nonatomic, readonly, assign) FIRMessagingMessageStatus status; + +@end + +@class FIRMessaging; +@class FIRMessagingExtensionHelper; + +/** + * A protocol to handle token update or data message delivery from FCM. + * + */ +NS_SWIFT_NAME(MessagingDelegate) +@protocol FIRMessagingDelegate + +@optional +/// This method will be called once a token is available, or has been refreshed. Typically it +/// will be called once per app start, but may be called more often, if token is invalidated or +/// updated. In this method, you should perform operations such as: +/// +/// * Uploading the FCM token to your application server, so targeted notifications can be sent. +/// +/// * Subscribing to any topics. +- (void)messaging:(FIRMessaging *)messaging + didReceiveRegistrationToken:(nullable NSString *)fcmToken + NS_SWIFT_NAME(messaging(_:didReceiveRegistrationToken:)); +@end + +/** + * Firebase Messaging lets you reliably deliver messages at no cost. + * + * To send or receive messages, the app must get a + * registration token from FIRInstanceID. This token authorizes an + * app server to send messages to an app instance. + * + * In order to receive FIRMessaging messages, declare + * `application:didReceiveRemoteNotification::fetchCompletionHandler:`. + */ +NS_SWIFT_NAME(Messaging) +@interface FIRMessaging : NSObject + +/** + * Delegate to handle FCM token refreshes, and remote data messages received via FCM direct channel. + */ +@property(nonatomic, weak, nullable) id delegate; + +/** + * FIRMessaging + * + * @return An instance of FIRMessaging. + */ ++ (instancetype)messaging NS_SWIFT_NAME(messaging()); + +/** + * FIRMessagingExtensionHelper + * + * Use FIRMessagingExtensionHelper to populate rich UI contents for your notifications. + * e.g. If an image URL is set in your notification payload or on the console, call + * FIRMessagingExtensionHelper API to render it on your notification. + * + * @return An instance of FIRMessagingExtensionHelper that handles the extensions API. + */ ++ (FIRMessagingExtensionHelper *)extensionHelper NS_SWIFT_NAME(serviceExtension()) + NS_AVAILABLE(10.14, 10.0); + +/** + * Unavailable. Use +messaging instead. + */ +- (instancetype)init __attribute__((unavailable("Use +messaging instead."))); + +#pragma mark - APNs + +/** + * This property is used to set the APNs Token received by the application delegate. + * + * FIRMessaging uses method swizzling to ensure that the APNs token is set + * automatically. However, if you have disabled swizzling by setting + * `FirebaseAppDelegateProxyEnabled` to `NO` in your app's + * Info.plist, you should manually set the APNs token in your application + * delegate's `-application:didRegisterForRemoteNotificationsWithDeviceToken:` + * method. + * + * If you would like to set the type of the APNs token, rather than relying on + * automatic detection, see: `-setAPNSToken:type:`. + */ +@property(nonatomic, copy, nullable) NSData *APNSToken NS_SWIFT_NAME(apnsToken); + +/** + * Set APNs token for the application. This APNs token will be used to register + * with Firebase Messaging using `FCMToken` or + * `tokenWithAuthorizedEntity:scope:options:handler`. + * + * @param apnsToken The APNs token for the application. + * @param type The type of APNs token. Debug builds should use + * FIRMessagingAPNSTokenTypeSandbox. Alternatively, you can supply + * FIRMessagingAPNSTokenTypeUnknown to have the type automatically + * detected based on your provisioning profile. + */ +- (void)setAPNSToken:(NSData *)apnsToken type:(FIRMessagingAPNSTokenType)type; + +#pragma mark - FCM Tokens + +/** + * Is Firebase Messaging token auto generation enabled? If this flag is disabled, Firebase + * Messaging will not generate token automatically for message delivery. + * + * If this flag is disabled, Firebase Messaging does not generate new tokens automatically for + * message delivery. If this flag is enabled, FCM generates a registration token on application + * start when there is no existing valid token and periodically refreshes the token and sends + * data to Firebase backend. + * + * This setting is persisted, and is applied on future invocations of your application. Once + * explicitly set, it overrides any settings in your Info.plist. + * + * By default, FCM automatic initialization is enabled. If you need to change the + * default (for example, because you want to prompt the user before getting token) + * set FirebaseMessagingAutoInitEnabled to false in your application's Info.plist. + */ +@property(nonatomic, assign, getter=isAutoInitEnabled) BOOL autoInitEnabled; + +/** + * The FCM registration token is used to identify this device so that FCM can send notifications to + * it. It is associated with your APNs token when the APNs token is supplied, so messages sent to + * the FCM token will be delivered over APNs. + * + * The FCM registration token is sometimes refreshed automatically. In your FIRMessaging delegate, + * the delegate method `messaging:didReceiveRegistrationToken:` will be called once a token is + * available, or has been refreshed. Typically it should be called once per app start, but + * may be called more often if the token is invalidated or updated. + * + * Once you have an FCM registration token, you should send it to your application server, so it can + * use the FCM token to send notifications to your device. + */ +@property(nonatomic, readonly, nullable) NSString *FCMToken NS_SWIFT_NAME(fcmToken); + +/** + * Asynchronously gets the default FCM registration token. + * + * This creates a Firebase Installations ID, if one does not exist, and sends information about the + * application and the device to the Firebase backend. A network connection is required for the + * method to succeed. To stop this, see `Messaging.isAutoInitEnabled`, + * `Messaging.delete(completion:)` and `Installations.delete(completion:)`. + * + * @param completion The completion handler to handle the token request. + */ + +- (void)tokenWithCompletion:(void (^)(NSString *__nullable token, + NSError *__nullable error))completion; + +/** + * Asynchronously deletes the default FCM registration token. + * + * This does not delete all tokens for non-default sender IDs, See `Messaging.delete(completion:)` + * for deleting all of them. To prevent token auto generation, see `Messaging.isAutoInitEnabled`. + * + * @param completion The completion handler to handle the token deletion. + */ + +- (void)deleteTokenWithCompletion:(void (^)(NSError *__nullable error))completion; + +/** + * Retrieves an FCM registration token for a particular Sender ID. This can be used to allow + * multiple senders to send notifications to the same device. By providing a different Sender + * ID than your default when fetching a token, you can create a new FCM token which you can + * give to a different sender. Both tokens will deliver notifications to your device, and you + * can revoke a token when you need to. + * + * This registration token is not cached by FIRMessaging. FIRMessaging should have an APNs + * token set before calling this to ensure that notifications can be delivered via APNs using + * this FCM token. You may re-retrieve the FCM token once you have the APNs token set, to + * associate it with the FCM token. The default FCM token is automatically associated with + * the APNs token, if the APNs token data is available. + * + * This creates a Firebase Installations ID, if one does not exist, and sends information + * about the application and the device to the Firebase backend. + * + * @param senderID The Sender ID for a particular Firebase project. + * @param completion The completion handler to handle the token request. + */ +- (void)retrieveFCMTokenForSenderID:(NSString *)senderID + completion:(void (^)(NSString *_Nullable FCMToken, + NSError *_Nullable error))completion + NS_SWIFT_NAME(retrieveFCMToken(forSenderID:completion:)); + +/** + * Invalidates an FCM token for a particular Sender ID. That Sender ID cannot no longer send + * notifications to that FCM token. This does not delete the Firebase Installations ID that may have + * been created when generating the token. See `Installations.delete(completion:)`. + * + * @param senderID The senderID for a particular Firebase project. + * @param completion The completion handler to handle the token deletion. + */ +- (void)deleteFCMTokenForSenderID:(NSString *)senderID + completion:(void (^)(NSError *_Nullable error))completion + NS_SWIFT_NAME(deleteFCMToken(forSenderID:completion:)); + +#pragma mark - Topics + +/** + * Asynchronously subscribes to a topic. This uses the default FCM registration token to identify + * the app instance and periodically sends data to the Firebase backend. To stop this, see + * `Messaging.delete(completion:)` and `Installations.delete(completion:)`. + * + * @param topic The name of the topic, for example, @"sports". + */ +- (void)subscribeToTopic:(NSString *)topic NS_SWIFT_NAME(subscribe(toTopic:)); + +/** + * Asynchronously subscribe to the provided topic, retrying on failure. This uses the default FCM + * registration token to identify the app instance and periodically sends data to the Firebase + * backend. To stop this, see `Messaging.delete(completion:)` and + * `Installations.delete(completion:)`. + * + * @param topic The topic name to subscribe to, for example, @"sports". + * @param completion The completion that is invoked once the subscribe call ends. + * In case of success, nil error is returned. Otherwise, an + * appropriate error object is returned. + */ +- (void)subscribeToTopic:(nonnull NSString *)topic + completion:(void (^_Nullable)(NSError *_Nullable error))completion; + +/** + * Asynchronously unsubscribe from a topic. This uses a FCM Token + * to identify the app instance and periodically sends data to the Firebase backend. To stop this, + * see `Messaging.delete(completion:)` and `Installations.delete(completion:)`. + * + * @param topic The name of the topic, for example @"sports". + */ +- (void)unsubscribeFromTopic:(NSString *)topic NS_SWIFT_NAME(unsubscribe(fromTopic:)); + +/** + * Asynchronously unsubscribe from the provided topic, retrying on failure. This uses a FCM Token + * to identify the app instance and periodically sends data to the Firebase backend. To stop this, + * see `Messaging.delete(completion:)` and `Installations.delete(completion:)`. + * + * @param topic The topic name to unsubscribe from, for example @"sports". + * @param completion The completion that is invoked once the unsubscribe call ends. + * In case of success, nil error is returned. Otherwise, an + * appropriate error object is returned. + */ +- (void)unsubscribeFromTopic:(nonnull NSString *)topic + completion:(void (^_Nullable)(NSError *_Nullable error))completion; + +#pragma mark - Analytics + +/** + * Use this to track message delivery and analytics for messages, typically + * when you receive a notification in `application:didReceiveRemoteNotification:`. + * However, you only need to call this if you set the `FirebaseAppDelegateProxyEnabled` + * flag to `NO` in your Info.plist. If `FirebaseAppDelegateProxyEnabled` is either missing + * or set to `YES` in your Info.plist, the library will call this automatically. + * + * @param message The downstream message received by the application. + * + * @return Information about the downstream message. + */ +- (FIRMessagingMessageInfo *)appDidReceiveMessage:(NSDictionary *)message; + +#pragma mark - GDPR +/** + * Deletes all the tokens and checkin data of the Firebase project and related data on the server + * side. A network connection is required for the method to succeed. + * + * This does not delete the Firebase Installations ID. See `Installations.delete(completion:)`. + * To prevent token auto generation, see `Messaging.isAutoInitEnabled`. + * + * @param completion A completion handler which is invoked when the operation completes. `error == + * nil` indicates success. + */ +- (void)deleteDataWithCompletion:(void (^)(NSError *__nullable error))completion; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Headers/FIRMessagingExtensionHelper.h b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Headers/FIRMessagingExtensionHelper.h new file mode 100644 index 0000000..f4bd7ca --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Headers/FIRMessagingExtensionHelper.h @@ -0,0 +1,39 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 || \ + __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_14 +#import +#endif + +NS_ASSUME_NONNULL_BEGIN + +/// This class is used to automatically populate a notification with an image if it is +/// specified in the notification body via the `image` parameter. Images and other +/// rich content can be populated manually without the use of this class. See the +/// `UNNotificationServiceExtension` type for more details. +__OSX_AVAILABLE(10.14) @interface FIRMessagingExtensionHelper : NSObject + +/// Call this API to complete your notification content modification. If you like to +/// overwrite some properties of the content instead of using the default payload, +/// make sure to make your customized motification to the content before passing it to +/// this call. +- (void)populateNotificationContent:(UNMutableNotificationContent *)content + withContentHandler:(void (^)(UNNotificationContent *_Nonnull))contentHandler; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Headers/FirebaseMessaging-umbrella.h b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Headers/FirebaseMessaging-umbrella.h new file mode 100644 index 0000000..84a9257 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Headers/FirebaseMessaging-umbrella.h @@ -0,0 +1,19 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "FirebaseMessaging.h" +#import "FIRMessaging.h" +#import "FIRMessagingExtensionHelper.h" + +FOUNDATION_EXPORT double FirebaseMessagingVersionNumber; +FOUNDATION_EXPORT const unsigned char FirebaseMessagingVersionString[]; + diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Headers/FirebaseMessaging.h b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Headers/FirebaseMessaging.h new file mode 100755 index 0000000..c5d0bd0 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Headers/FirebaseMessaging.h @@ -0,0 +1,18 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "FIRMessaging.h" +#import "FIRMessagingExtensionHelper.h" diff --git a/plugins/2020.3569/iphone-sim/resources/Frameworks/GoogleUtilities.framework/Info.plist b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Info.plist similarity index 51% rename from plugins/2020.3569/iphone-sim/resources/Frameworks/GoogleUtilities.framework/Info.plist rename to src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Info.plist index e905f26..7904843 100644 Binary files a/plugins/2020.3569/iphone-sim/resources/Frameworks/GoogleUtilities.framework/Info.plist and b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Modules/module.modulemap new file mode 100644 index 0000000..4ab5827 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FirebaseMessaging { + umbrella header "FirebaseMessaging-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/_CodeSignature/CodeResources b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..afdcf00 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/FirebaseMessaging.framework/_CodeSignature/CodeResources @@ -0,0 +1,177 @@ + + + + + files + + Headers/FIRMessaging.h + + rOAUWbctgaVPy0IiWHTawuGMZGY= + + Headers/FIRMessagingExtensionHelper.h + + cYSluS+JMCzqcUONoD5zvfBlyoU= + + Headers/FirebaseMessaging-umbrella.h + + Yvvw/cUSXyWzU1RFBEWw9naum7U= + + Headers/FirebaseMessaging.h + + nlzjtwMlY6Z1ig0tSzU7KrXTLug= + + Info.plist + + u3sK9DQ8dBPrA+WfmW5beOfcB3Q= + + Modules/module.modulemap + + 6CLldHhM370XzmBqHDjrR+p7dms= + + + files2 + + Headers/FIRMessaging.h + + hash + + rOAUWbctgaVPy0IiWHTawuGMZGY= + + hash2 + + /RvSXSB4DcMd0cCRKd0B/IBhAgunuULwdf8+2Vx+9yw= + + + Headers/FIRMessagingExtensionHelper.h + + hash + + cYSluS+JMCzqcUONoD5zvfBlyoU= + + hash2 + + xEuT23RK1xl19nTf34hv3ZSFtPtP8fZv4dexSGcq6tY= + + + Headers/FirebaseMessaging-umbrella.h + + hash + + Yvvw/cUSXyWzU1RFBEWw9naum7U= + + hash2 + + Fyal1ZmcrIfMiCQQDPShII9i9prTnITW0t5RIy+b4EM= + + + Headers/FirebaseMessaging.h + + hash + + nlzjtwMlY6Z1ig0tSzU7KrXTLug= + + hash2 + + Yx5eG5zbsxtKV0DY9S/JCqEs1FxSP2o4gRjZSVUjiu0= + + + Modules/module.modulemap + + hash + + 6CLldHhM370XzmBqHDjrR+p7dms= + + hash2 + + bhqjCP2jxfwc099QmTX/8363JGDt5e0nXeiLhp8hrig= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/GoogleDataTransport b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/GoogleDataTransport new file mode 100755 index 0000000..c0bf25c Binary files /dev/null and b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/GoogleDataTransport differ diff --git a/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCORClock.h b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCORClock.h new file mode 100644 index 0000000..8c75b50 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCORClock.h @@ -0,0 +1,66 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** This class manages the device clock and produces snapshots of the current time. */ +@interface GDTCORClock : NSObject + +/** The wallclock time, UTC, in milliseconds. */ +@property(nonatomic, readonly) int64_t timeMillis; + +/** The offset from UTC in seconds. */ +@property(nonatomic, readonly) int64_t timezoneOffsetSeconds; + +/** The kernel boot time when this clock was created in nanoseconds. */ +@property(nonatomic, readonly) int64_t kernelBootTimeNanoseconds; + +/** The device uptime when this clock was created in nanoseconds. */ +@property(nonatomic, readonly) int64_t uptimeNanoseconds; + +@property(nonatomic, readonly) int64_t kernelBootTime DEPRECATED_MSG_ATTRIBUTE( + "Please use `kernelBootTimeNanoseconds` instead"); + +@property(nonatomic, readonly) + int64_t uptime DEPRECATED_MSG_ATTRIBUTE("Please use `uptimeNanoseconds` instead"); + +/** Creates a GDTCORClock object using the current time and offsets. + * + * @return A new GDTCORClock object representing the current time state. + */ ++ (instancetype)snapshot; + +/** Creates a GDTCORClock object representing a time in the future, relative to now. + * + * @param millisInTheFuture The millis in the future from now this clock should represent. + * @return An instance representing a future time. + */ ++ (instancetype)clockSnapshotInTheFuture:(uint64_t)millisInTheFuture; + +/** Compares one clock with another, returns YES if the caller is after the parameter. + * + * @return YES if the calling clock's time is after the given clock's time. + */ +- (BOOL)isAfter:(GDTCORClock *)otherClock; + +/** Returns value of `uptime` property in milliseconds. */ +- (int64_t)uptimeMilliseconds; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCORConsoleLogger.h b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCORConsoleLogger.h new file mode 100644 index 0000000..d306f18 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCORConsoleLogger.h @@ -0,0 +1,143 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/** The current logging level. This value and higher will be printed. Declared as volatile to make + * getting and setting atomic. + */ +FOUNDATION_EXPORT volatile NSInteger GDTCORConsoleLoggerLoggingLevel; + +/** A list of logging levels that GDT supports. */ +typedef NS_ENUM(NSInteger, GDTCORLoggingLevel) { + + /** Causes all logs to be printed. */ + GDTCORLoggingLevelDebug = 1, + + /** Causes all non-debug logs to be printed. */ + GDTCORLoggingLevelVerbose = 2, + + /** Causes warnings and errors to be printed. */ + GDTCORLoggingLevelWarnings = 3, + + /** Causes errors to be printed. This is the default value. */ + GDTCORLoggingLevelErrors = 4 +}; + +/** A list of message codes to print in the logger that help to correspond printed messages with + * code locations. + * + * Prefixes: + * - MCD => MessageCodeDebug + * - MCW => MessageCodeWarning + * - MCE => MessageCodeError + */ +typedef NS_ENUM(NSInteger, GDTCORMessageCode) { + + /** For debug logs. */ + GDTCORMCDDebugLog = 0, + + /** For warning messages concerning transportBytes: not being implemented by a data object. */ + GDTCORMCWDataObjectMissingBytesImpl = 1, + + /** For warning messages concerning a failed event upload. */ + GDTCORMCWUploadFailed = 2, + + /** For warning messages concerning a forced event upload. */ + GDTCORMCWForcedUpload = 3, + + /** For warning messages concerning a failed reachability call. */ + GDTCORMCWReachabilityFailed = 4, + + /** For warning messages concerning a database warning. */ + GDTCORMCWDatabaseWarning = 5, + + /** For warning messages concerning the reading of a event file. */ + GDTCORMCWFileReadError = 6, + + /** For error messages concerning transform: not being implemented by an event transformer. */ + GDTCORMCETransformerDoesntImplementTransform = 1000, + + /** For error messages concerning the creation of a directory failing. */ + GDTCORMCEDirectoryCreationError = 1001, + + /** For error messages concerning the writing of a event file. */ + GDTCORMCEFileWriteError = 1002, + + /** For error messages concerning the lack of a prioritizer for a given backend. */ + GDTCORMCEPrioritizerError = 1003, + + /** For error messages concerning a package delivery API violation. */ + GDTCORMCEDeliverTwice = 1004, + + /** For error messages concerning an error in an implementation of -transportBytes. */ + GDTCORMCETransportBytesError = 1005, + + /** For general purpose error messages in a dependency. */ + GDTCORMCEGeneralError = 1006, + + /** For fatal errors. Please go to https://github.com/firebase/firebase-ios-sdk/issues and open + * an issue if you encounter an error with this code. + */ + GDTCORMCEFatalAssertion = 1007, + + /** For error messages concerning the reading of a event file. */ + GDTCORMCEFileReadError = 1008, + + /** For errors related to running sqlite. */ + GDTCORMCEDatabaseError = 1009, +}; + +/** Prints the given code and format string to the console. + * + * @param code The message code describing the nature of the log. + * @param logLevel The log level of this log. + * @param format The format string. + */ +FOUNDATION_EXPORT +void GDTCORLog(GDTCORMessageCode code, GDTCORLoggingLevel logLevel, NSString *_Nonnull format, ...) + NS_FORMAT_FUNCTION(3, 4); + +/** Prints an assert log to the console. + * + * @param wasFatal Send YES if the assertion should be fatal, NO otherwise. + * @param file The file in which the failure occurred. + * @param line The line number of the failure. + * @param format The format string. + */ +FOUNDATION_EXPORT void GDTCORLogAssert(BOOL wasFatal, + NSString *_Nonnull file, + NSInteger line, + NSString *_Nullable format, + ...) NS_FORMAT_FUNCTION(4, 5); + +/** Returns the string that represents some message code. + * + * @param code The code to convert to a string. + * @return The string representing the message code. + */ +FOUNDATION_EXPORT NSString *_Nonnull GDTCORMessageCodeEnumToString(GDTCORMessageCode code); + +#define GDTCORLogDebug(MESSAGE_FORMAT, ...) \ + GDTCORLog(GDTCORMCDDebugLog, GDTCORLoggingLevelDebug, MESSAGE_FORMAT, __VA_ARGS__); + +// A define to wrap GULLogWarning with slightly more convenient usage. +#define GDTCORLogWarning(MESSAGE_CODE, MESSAGE_FORMAT, ...) \ + GDTCORLog(MESSAGE_CODE, GDTCORLoggingLevelWarnings, MESSAGE_FORMAT, __VA_ARGS__); + +// A define to wrap GULLogError with slightly more convenient usage and a failing assert. +#define GDTCORLogError(MESSAGE_CODE, MESSAGE_FORMAT, ...) \ + GDTCORLog(MESSAGE_CODE, GDTCORLoggingLevelErrors, MESSAGE_FORMAT, __VA_ARGS__); diff --git a/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCOREvent.h b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCOREvent.h new file mode 100644 index 0000000..52c2384 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCOREvent.h @@ -0,0 +1,87 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GDTCOREventDataObject.h" +#import "GDTCORTargets.h" + +@class GDTCORClock; + +NS_ASSUME_NONNULL_BEGIN + +/** The different possible quality of service specifiers. High values indicate high priority. */ +typedef NS_ENUM(NSInteger, GDTCOREventQoS) { + /** The QoS tier wasn't set, and won't ever be sent. */ + GDTCOREventQoSUnknown = 0, + + /** This event is internal telemetry data that should not be sent on its own if possible. */ + GDTCOREventQoSTelemetry = 1, + + /** This event should be sent, but in a batch only roughly once per day. */ + GDTCOREventQoSDaily = 2, + + /** This event should be sent when requested by the uploader. */ + GDTCOREventQosDefault = 3, + + /** This event should be sent immediately along with any other data that can be batched. */ + GDTCOREventQoSFast = 4, + + /** This event should only be uploaded on wifi. */ + GDTCOREventQoSWifiOnly = 5, +}; + +@interface GDTCOREvent : NSObject + +/** The unique ID of the event. */ +@property(readonly, nonatomic) NSString *eventID; + +/** The mapping identifier, to allow backends to map the transport bytes to a proto. */ +@property(nullable, readonly, nonatomic) NSString *mappingID; + +/** The identifier for the backend this event will eventually be sent to. */ +@property(readonly, nonatomic) GDTCORTarget target; + +/** The data object encapsulated in the transport of your choice, as long as it implements + * the GDTCOREventDataObject protocol. */ +@property(nullable, nonatomic) id dataObject; + +/** The serialized bytes from calling [dataObject transportBytes]. */ +@property(nullable, readonly, nonatomic) NSData *serializedDataObjectBytes; + +/** The quality of service tier this event belongs to. */ +@property(nonatomic) GDTCOREventQoS qosTier; + +/** The clock snapshot at the time of the event. */ +@property(nonatomic) GDTCORClock *clockSnapshot; + +/** The expiration date of the event. Default is 604800 seconds (7 days) from creation. */ +@property(nonatomic) NSDate *expirationDate; + +/** Bytes that can be used by an uploader later on. */ +@property(nullable, nonatomic) NSData *customBytes; + +/** Initializes an instance using the given mappingID. + * + * @param mappingID The mapping identifier. + * @param target The event's target identifier. + * @return An instance of this class. + */ +- (nullable instancetype)initWithMappingID:(NSString *)mappingID target:(GDTCORTarget)target; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCOREventDataObject.h b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCOREventDataObject.h new file mode 100644 index 0000000..34ef624 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCOREventDataObject.h @@ -0,0 +1,36 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** This protocol defines the common interface that event protos should implement regardless of the + * underlying transport technology (protobuf, nanopb, etc). + */ +@protocol GDTCOREventDataObject + +@required + +/** Returns the serialized proto bytes of the implementing event proto. + * + * @return the serialized proto bytes of the implementing event proto. + */ +- (NSData *)transportBytes; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCOREventTransformer.h b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCOREventTransformer.h new file mode 100644 index 0000000..29f9592 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCOREventTransformer.h @@ -0,0 +1,38 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class GDTCOREvent; + +NS_ASSUME_NONNULL_BEGIN + +/** Defines the API that event transformers must adopt. */ +@protocol GDTCOREventTransformer + +@required + +/** Transforms an event by applying some logic to it. Events returned can be nil, for example, in + * instances where the event should be sampled. + * + * @param event The event to transform. + * @return A transformed event, or nil if the transformation dropped the event. + */ +- (nullable GDTCOREvent *)transform:(GDTCOREvent *)event; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCORTargets.h b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCORTargets.h new file mode 100644 index 0000000..0b83ab9 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCORTargets.h @@ -0,0 +1,40 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/** The list of targets supported by the shared transport infrastructure. If adding a new target, + * please use the previous value +1. + */ +typedef NS_ENUM(NSInteger, GDTCORTarget) { + + /** A target only used in testing. */ + kGDTCORTargetTest = 999, + + /** The CCT target. */ + kGDTCORTargetCCT = 1000, + + /** The FLL target. */ + kGDTCORTargetFLL = 1001, + + /** The CSH target. The CSH target is a special-purpose backend. Please do not use it without + * permission. + */ + kGDTCORTargetCSH = 1002, + + /** The INT target. */ + kGDTCORTargetINT = 1003, +}; diff --git a/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCORTransport.h b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCORTransport.h new file mode 100644 index 0000000..e58248d --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GDTCORTransport.h @@ -0,0 +1,92 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GDTCOREventTransformer.h" +#import "GDTCORTargets.h" + +@class GDTCOREvent; + +NS_ASSUME_NONNULL_BEGIN + +@interface GDTCORTransport : NSObject + +// Please use the designated initializer. +- (instancetype)init NS_UNAVAILABLE; + +/** Initializes a new transport that will send events to the given target backend. + * + * @param mappingID The mapping identifier used by the backend to map the data object transport + * bytes to a proto. + * @param transformers A list of transformers to be applied to events that are sent. + * @param target The target backend of this transport. + * @return A transport that will send events. + */ +- (nullable instancetype)initWithMappingID:(NSString *)mappingID + transformers: + (nullable NSArray> *)transformers + target:(GDTCORTarget)target NS_DESIGNATED_INITIALIZER; + +/** Copies and sends an internal telemetry event. Events sent using this API are lower in priority, + * and sometimes won't be sent on their own. + * + * @note This will convert the event's data object to data and release the original event. + * + * @param event The event to send. + * @param completion A block that will be called when the event has been written or dropped. + */ +- (void)sendTelemetryEvent:(GDTCOREvent *)event + onComplete:(void (^_Nullable)(BOOL wasWritten, NSError *_Nullable error))completion; + +/** Copies and sends an internal telemetry event. Events sent using this API are lower in priority, + * and sometimes won't be sent on their own. + * + * @note This will convert the event's data object to data and release the original event. + * + * @param event The event to send. + */ +- (void)sendTelemetryEvent:(GDTCOREvent *)event; + +/** Copies and sends an SDK service data event. Events send using this API are higher in priority, + * and will cause a network request at some point in the relative near future. + * + * @note This will convert the event's data object to data and release the original event. + * + * @param event The event to send. + * @param completion A block that will be called when the event has been written or dropped. + */ +- (void)sendDataEvent:(GDTCOREvent *)event + onComplete:(void (^_Nullable)(BOOL wasWritten, NSError *_Nullable error))completion; + +/** Copies and sends an SDK service data event. Events send using this API are higher in priority, + * and will cause a network request at some point in the relative near future. + * + * @note This will convert the event's data object to data and release the original event. + * + * @param event The event to send. + */ +- (void)sendDataEvent:(GDTCOREvent *)event; + +/** Creates an event for use by this transport. + * + * @return An event that is suited for use by this transport. + */ +- (GDTCOREvent *)eventForTransport; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GoogleDataTransport-umbrella.h b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GoogleDataTransport-umbrella.h new file mode 100644 index 0000000..be6567f --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GoogleDataTransport-umbrella.h @@ -0,0 +1,24 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "GDTCORClock.h" +#import "GDTCORConsoleLogger.h" +#import "GDTCOREvent.h" +#import "GDTCOREventDataObject.h" +#import "GDTCOREventTransformer.h" +#import "GDTCORTargets.h" +#import "GDTCORTransport.h" +#import "GoogleDataTransport.h" + +FOUNDATION_EXPORT double GoogleDataTransportVersionNumber; +FOUNDATION_EXPORT const unsigned char GoogleDataTransportVersionString[]; + diff --git a/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GoogleDataTransport.h b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GoogleDataTransport.h new file mode 100644 index 0000000..6fe6d34 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Headers/GoogleDataTransport.h @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "GDTCORClock.h" +#import "GDTCORConsoleLogger.h" +#import "GDTCOREvent.h" +#import "GDTCOREventDataObject.h" +#import "GDTCOREventTransformer.h" +#import "GDTCORTargets.h" +#import "GDTCORTransport.h" diff --git a/plugins/2020.3569/iphone-sim/FirebaseInstanceID.framework/Info.plist b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Info.plist similarity index 51% rename from plugins/2020.3569/iphone-sim/FirebaseInstanceID.framework/Info.plist rename to src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Info.plist index 820c93e..8747b45 100644 Binary files a/plugins/2020.3569/iphone-sim/FirebaseInstanceID.framework/Info.plist and b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Modules/module.modulemap new file mode 100644 index 0000000..8a67414 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module GoogleDataTransport { + umbrella header "GoogleDataTransport-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/_CodeSignature/CodeResources b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..3467a1f --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleDataTransport.framework/_CodeSignature/CodeResources @@ -0,0 +1,252 @@ + + + + + files + + Headers/GDTCORClock.h + + sG7akfwMxggtOPYkuBxhbh+65R8= + + Headers/GDTCORConsoleLogger.h + + uiGrugM18w6jcKhynrsxsOgGOyA= + + Headers/GDTCOREvent.h + + 74bI+hfvOqrVXOnOsXT2ZgNgoU8= + + Headers/GDTCOREventDataObject.h + + sQLFncr+5wJyRtrxRWbLjqPCFLw= + + Headers/GDTCOREventTransformer.h + + 1rrLonJHF3GgbUFpegWWCokndso= + + Headers/GDTCORTargets.h + + Y/B7J3zmBLT57u7M/Q1wur2FHPQ= + + Headers/GDTCORTransport.h + + cEY4cbmarwn5AOSM2b67qlrb41M= + + Headers/GoogleDataTransport-umbrella.h + + EJ3Jqtj/cIWTGkF6q3Hwz4og5qY= + + Headers/GoogleDataTransport.h + + eyFUfLxFS5s1ge4AoHkHyWzTi98= + + Info.plist + + R9zvG/jIAcG4pqfmfOJkaA9LCE4= + + Modules/module.modulemap + + j0NufvJe8xgrgCjT9J02PJmqYcU= + + + files2 + + Headers/GDTCORClock.h + + hash + + sG7akfwMxggtOPYkuBxhbh+65R8= + + hash2 + + lx/hxUkZt3ZDN/2YP9J5pUop4/mY6bf/tVj9xne+dJ0= + + + Headers/GDTCORConsoleLogger.h + + hash + + uiGrugM18w6jcKhynrsxsOgGOyA= + + hash2 + + Z2n6AV8EVfZIdPeF8vcZjV8/Mxhy6YeEslxXBcmmyf4= + + + Headers/GDTCOREvent.h + + hash + + 74bI+hfvOqrVXOnOsXT2ZgNgoU8= + + hash2 + + NiwpMxc5Vg7sggK6yDTzC5VafAKKQKOSlG6VJPCdfgA= + + + Headers/GDTCOREventDataObject.h + + hash + + sQLFncr+5wJyRtrxRWbLjqPCFLw= + + hash2 + + 0KitKPy/jmxA/wwV/oInKPbDOss1xYrSuUNMV7bCRNA= + + + Headers/GDTCOREventTransformer.h + + hash + + 1rrLonJHF3GgbUFpegWWCokndso= + + hash2 + + VdbKh12dQWncGhKcIkxzIHl921RpsPGtJG7RYjQ+riI= + + + Headers/GDTCORTargets.h + + hash + + Y/B7J3zmBLT57u7M/Q1wur2FHPQ= + + hash2 + + PaTryOPdmnTfKxuYnAxGd/ukYnw+1MlVgyhEnDCBOq4= + + + Headers/GDTCORTransport.h + + hash + + cEY4cbmarwn5AOSM2b67qlrb41M= + + hash2 + + ouF//Qfe6Tr6y3eUp6hk+xlLk7fnepu7EvgaKBYe/sY= + + + Headers/GoogleDataTransport-umbrella.h + + hash + + EJ3Jqtj/cIWTGkF6q3Hwz4og5qY= + + hash2 + + jIDFnTsg8kxKN1CuHCTVpke/QsRBQXrxyDshRKyrjK8= + + + Headers/GoogleDataTransport.h + + hash + + eyFUfLxFS5s1ge4AoHkHyWzTi98= + + hash2 + + epPD/RJD/HmQTnhUBF4PbaOdvheTqY2yyvJOHPnCx4k= + + + Modules/module.modulemap + + hash + + j0NufvJe8xgrgCjT9J02PJmqYcU= + + hash2 + + 8vLrUl+sfNbDFOOT4aLdjyton88PHl3Bgh3AMv4wfs8= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/GoogleUtilities b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/GoogleUtilities new file mode 100755 index 0000000..2786ad9 Binary files /dev/null and b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/GoogleUtilities differ diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULAppDelegateSwizzler.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULAppDelegateSwizzler.h new file mode 100644 index 0000000..58dec49 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULAppDelegateSwizzler.h @@ -0,0 +1,107 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GULApplication.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef NSString *const GULAppDelegateInterceptorID; + +/** This class contains methods that isa swizzle the app delegate. */ +@interface GULAppDelegateSwizzler : NSProxy + +/** Registers an app delegate interceptor whose methods will be invoked as they're invoked on the + * original app delegate. + * + * @param interceptor An instance of a class that conforms to the application delegate protocol. + * The interceptor is NOT retained. + * @return A unique GULAppDelegateInterceptorID if interceptor was successfully registered; nil + * if it fails. + */ ++ (nullable GULAppDelegateInterceptorID)registerAppDelegateInterceptor: + (id)interceptor; + +/** Unregisters an interceptor with the given ID if it exists. + * + * @param interceptorID The object that was generated when the interceptor was registered. + */ ++ (void)unregisterAppDelegateInterceptorWithID:(GULAppDelegateInterceptorID)interceptorID; + +/** This method ensures that the original app delegate has been proxied. Call this before + * registering your interceptor. This method is safe to call multiple times (but it only proxies + * the app delegate once). + * + * This method doesn't proxy APNS related methods: + * @code + * - application:didRegisterForRemoteNotificationsWithDeviceToken: + * - application:didFailToRegisterForRemoteNotificationsWithError: + * - application:didReceiveRemoteNotification:fetchCompletionHandler: + * - application:didReceiveRemoteNotification: + * @endcode + * + * To proxy these methods use +[GULAppDelegateSwizzler + * proxyOriginalDelegateIncludingAPNSMethods]. The methods have to be proxied separately to + * avoid potential warnings from Apple review about missing Push Notification Entitlement (e.g. + * https://github.com/firebase/firebase-ios-sdk/issues/2807) + * + * The method has no effect for extensions. + * + * @see proxyOriginalDelegateIncludingAPNSMethods + */ ++ (void)proxyOriginalDelegate; + +/** This method ensures that the original app delegate has been proxied including APNS related + * methods. Call this before registering your interceptor. This method is safe to call multiple + * times (but it only proxies the app delegate once) or + * after +[GULAppDelegateSwizzler proxyOriginalDelegate] + * + * This method calls +[GULAppDelegateSwizzler proxyOriginalDelegate] under the hood. + * After calling this method the following App Delegate methods will be proxied in addition to + * the methods proxied by proxyOriginalDelegate: + * @code + * - application:didRegisterForRemoteNotificationsWithDeviceToken: + * - application:didFailToRegisterForRemoteNotificationsWithError: + * - application:didReceiveRemoteNotification:fetchCompletionHandler: + * - application:didReceiveRemoteNotification: + * @endcode + * + * The method has no effect for extensions. + * + * @see proxyOriginalDelegate + */ ++ (void)proxyOriginalDelegateIncludingAPNSMethods; + +/** Indicates whether app delegate proxy is explicitly disabled or enabled. Enabled by default. + * + * @return YES if AppDelegateProxy is Enabled, NO otherwise. + */ ++ (BOOL)isAppDelegateProxyEnabled; + +/** Returns the current sharedApplication. + * + * @return the current application instance if in an app, or nil if in extension or if it doesn't + * exist. + */ ++ (nullable GULApplication *)sharedApplication; + +/** Do not initialize this class. */ +- (instancetype)init NS_UNAVAILABLE; + +NS_ASSUME_NONNULL_END + +@end diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULAppEnvironmentUtil.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULAppEnvironmentUtil.h new file mode 100644 index 0000000..d2bb935 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULAppEnvironmentUtil.h @@ -0,0 +1,60 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface GULAppEnvironmentUtil : NSObject + +/// Indicates whether the app is from Apple Store or not. Returns NO if the app is on simulator, +/// development environment or sideloaded. ++ (BOOL)isFromAppStore; + +/// Indicates whether the app is a Testflight app. Returns YES if the app has sandbox receipt. +/// Returns NO otherwise. ++ (BOOL)isAppStoreReceiptSandbox; + +/// Indicates whether the app is on simulator or not at runtime depending on the device +/// architecture. ++ (BOOL)isSimulator; + +/// The current device model. Returns an empty string if device model cannot be retrieved. ++ (nullable NSString *)deviceModel; + +/// The current operating system version. Returns an empty string if the system version cannot be +/// retrieved. ++ (NSString *)systemVersion; + +/// Indicates whether it is running inside an extension or an app. ++ (BOOL)isAppExtension; + +/// @return Returns @YES when is run on iOS version greater or equal to 7.0 ++ (BOOL)isIOS7OrHigher DEPRECATED_MSG_ATTRIBUTE( + "Always `YES` because only iOS 8 and higher supported. The method will be removed."); + +/// @return YES if Swift runtime detected in the app. ++ (BOOL)hasSwiftRuntime; + +/// @return An Apple platform. Possible values "ios", "tvos", "macos", "watchos", "maccatalyst". ++ (NSString *)applePlatform; + +/// @return The way the library was added to the app, e.g. "swiftpm", "cocoapods", etc. ++ (NSString *)deploymentType; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULApplication.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULApplication.h new file mode 100644 index 0000000..8067212 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULApplication.h @@ -0,0 +1,50 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import + +#define GULApplication UIApplication +#define GULApplicationDelegate UIApplicationDelegate +#define GULUserActivityRestoring UIUserActivityRestoring + +static NSString *const kGULApplicationClassName = @"UIApplication"; + +#elif TARGET_OS_OSX + +#import + +#define GULApplication NSApplication +#define GULApplicationDelegate NSApplicationDelegate +#define GULUserActivityRestoring NSUserActivityRestoring + +static NSString *const kGULApplicationClassName = @"NSApplication"; + +#elif TARGET_OS_WATCH + +#import + +// We match the according watchOS API but swizzling should not work in watch +#define GULApplication WKExtension +#define GULApplicationDelegate WKExtensionDelegate +#define GULUserActivityRestoring NSUserActivityRestoring + +static NSString *const kGULApplicationClassName = @"WKExtension"; + +#endif diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULHeartbeatDateStorage.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULHeartbeatDateStorage.h new file mode 100644 index 0000000..9432dfc --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULHeartbeatDateStorage.h @@ -0,0 +1,49 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/// Stores either a date or a dictionary to a specified file. +@interface GULHeartbeatDateStorage : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +@property(nonatomic, readonly) NSURL *fileURL; + +/** + * Default initializer. + * @param fileName The name of the file to store the date information. + * exist, it will be created if needed. + */ +- (instancetype)initWithFileName:(NSString *)fileName; + +/** + * Reads the date from the specified file for the given tag. + * @return Returns date if exists, otherwise `nil`. + */ +- (nullable NSDate *)heartbeatDateForTag:(NSString *)tag; + +/** + * Saves the date for the specified tag in the specified file. + * @return YES on success, NO otherwise. + */ +- (BOOL)setHearbeatDate:(NSDate *)date forTag:(NSString *)tag; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULKeychainStorage.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULKeychainStorage.h new file mode 100644 index 0000000..dc01a83 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULKeychainStorage.h @@ -0,0 +1,79 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +@class FBLPromise; + +NS_ASSUME_NONNULL_BEGIN + +/// The class provides a convenient abstraction on top of the iOS Keychain API to save data. +@interface GULKeychainStorage : NSObject + +- (instancetype)init NS_UNAVAILABLE; + +/** Initializes the keychain storage with Keychain Service name. + * @param service A Keychain Service name that will be used to store and retrieve objects. See also + * `kSecAttrService`. + */ +- (instancetype)initWithService:(NSString *)service; + +/** + * Get an object by key. + * @param key The key. + * @param objectClass The expected object class required by `NSSecureCoding`. + * @param accessGroup The Keychain Access Group. + * + * @return Returns a promise. It is resolved with an object stored by key if exists. It is resolved + * with `nil` when the object not found. It fails on a Keychain error. + */ +- (FBLPromise> *)getObjectForKey:(NSString *)key + objectClass:(Class)objectClass + accessGroup:(nullable NSString *)accessGroup; + +/** + * Saves the given object by the given key. + * @param object The object to store. + * @param key The key to store the object. If there is an existing object by the key, it will be + * overridden. + * @param accessGroup The Keychain Access Group. + * + * @return Returns which is resolved with `[NSNull null]` on success. + */ +- (FBLPromise *)setObject:(id)object + forKey:(NSString *)key + accessGroup:(nullable NSString *)accessGroup; + +/** + * Removes the object by the given key. + * @param key The key to store the object. If there is an existing object by the key, it will be + * overridden. + * @param accessGroup The Keychain Access Group. + * + * @return Returns which is resolved with `[NSNull null]` on success. + */ +- (FBLPromise *)removeObjectForKey:(NSString *)key + accessGroup:(nullable NSString *)accessGroup; + +#if TARGET_OS_OSX +/// If not `nil`, then only this keychain will be used to save and read data (see +/// `kSecMatchSearchList` and `kSecUseKeychain`. It is mostly intended to be used by unit tests. +@property(nonatomic, nullable) SecKeychainRef keychainRef; +#endif // TARGET_OSX + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULKeychainUtils.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULKeychainUtils.h new file mode 100644 index 0000000..de4bef2 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULKeychainUtils.h @@ -0,0 +1,61 @@ +/* + * Copyright 2019 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +FOUNDATION_EXPORT NSString *const kGULKeychainUtilsErrorDomain; + +/// Helper functions to access Keychain. +@interface GULKeychainUtils : NSObject + +/** Fetches a keychain item data matching to the provided query. + * @param query A dictionary with Keychain query parameters. See docs for `SecItemCopyMatching` for + * details. + * @param outError A pointer to `NSError` instance or `NULL`. The instance at `outError` will be + * assigned with an error if there is. + * @returns Data for the first Keychain Item matching the provided query or `nil` if there is not + * such an item (`outError` will be `nil` in this case) or an error occurred. + */ ++ (nullable NSData *)getItemWithQuery:(NSDictionary *)query + error:(NSError *_Nullable *_Nullable)outError; + +/** Stores data to a Keychain Item matching to the provided query. An existing Keychain Item + * matching the query parameters will be updated or a new will be created. + * @param item A Keychain Item data to store. + * @param query A dictionary with Keychain query parameters. See docs for `SecItemAdd` and + * `SecItemUpdate` for details. + * @param outError A pointer to `NSError` instance or `NULL`. The instance at `outError` will be + * assigned with an error if there is. + * @returns `YES` when data was successfully stored, `NO` otherwise. + */ ++ (BOOL)setItem:(NSData *)item + withQuery:(NSDictionary *)query + error:(NSError *_Nullable *_Nullable)outError; + +/** Removes a Keychain Item matching to the provided query. + * @param query A dictionary with Keychain query parameters. See docs for `SecItemDelete` for + * details. + * @param outError A pointer to `NSError` instance or `NULL`. The instance at `outError` will be + * assigned with an error if there is. + * @returns `YES` if the item was removed successfully or doesn't exist, `NO` otherwise. + */ ++ (BOOL)removeItemWithQuery:(NSDictionary *)query error:(NSError *_Nullable *_Nullable)outError; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULLogger.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULLogger.h new file mode 100644 index 0000000..6797399 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULLogger.h @@ -0,0 +1,159 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GULLoggerLevel.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + * The services used in the logger. + */ +typedef NSString *const GULLoggerService; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/** + * Initialize GULLogger. + */ +extern void GULLoggerInitializeASL(void); + +/** + * Override log level to Debug. + */ +void GULLoggerForceDebug(void); + +/** + * Turn on logging to STDERR. + */ +extern void GULLoggerEnableSTDERR(void); + +/** + * Changes the default logging level of GULLoggerLevelNotice to a user-specified level. + * The default level cannot be set above GULLoggerLevelNotice if the app is running from App Store. + * (required) log level (one of the GULLoggerLevel enum values). + */ +extern void GULSetLoggerLevel(GULLoggerLevel loggerLevel); + +/** + * Checks if the specified logger level is loggable given the current settings. + * (required) log level (one of the GULLoggerLevel enum values). + */ +extern BOOL GULIsLoggableLevel(GULLoggerLevel loggerLevel); + +/** + * Register version to include in logs. + * (required) version + */ +extern void GULLoggerRegisterVersion(NSString *version); + +/** + * Logs a message to the Xcode console and the device log. If running from AppStore, will + * not log any messages with a level higher than GULLoggerLevelNotice to avoid log spamming. + * (required) log level (one of the GULLoggerLevel enum values). + * (required) service name of type GULLoggerService. + * (required) message code starting with "I-" which means iOS, followed by a capitalized + * three-character service identifier and a six digit integer message ID that is unique + * within the service. + * An example of the message code is @"I-COR000001". + * (required) message string which can be a format string. + * (optional) variable arguments list obtained from calling va_start, used when message is a format + * string. + */ +extern void GULLogBasic(GULLoggerLevel level, + GULLoggerService service, + BOOL forceLog, + NSString *messageCode, + NSString *message, +// On 64-bit simulators, va_list is not a pointer, so cannot be marked nullable +// See: http://stackoverflow.com/q/29095469 +#if __LP64__ && TARGET_OS_SIMULATOR || TARGET_OS_OSX + va_list args_ptr +#else + va_list _Nullable args_ptr +#endif +); + +/** + * The following functions accept the following parameters in order: + * (required) service name of type GULLoggerService. + * (required) message code starting from "I-" which means iOS, followed by a capitalized + * three-character service identifier and a six digit integer message ID that is unique + * within the service. + * An example of the message code is @"I-COR000001". + * See go/firebase-log-proposal for details. + * (required) message string which can be a format string. + * (optional) the list of arguments to substitute into the format string. + * Example usage: + * GULLogError(kGULLoggerCore, @"I-COR000001", @"Configuration of %@ failed.", app.name); + */ +extern void GULLogError(GULLoggerService service, + BOOL force, + NSString *messageCode, + NSString *message, + ...) NS_FORMAT_FUNCTION(4, 5); +extern void GULLogWarning(GULLoggerService service, + BOOL force, + NSString *messageCode, + NSString *message, + ...) NS_FORMAT_FUNCTION(4, 5); +extern void GULLogNotice(GULLoggerService service, + BOOL force, + NSString *messageCode, + NSString *message, + ...) NS_FORMAT_FUNCTION(4, 5); +extern void GULLogInfo(GULLoggerService service, + BOOL force, + NSString *messageCode, + NSString *message, + ...) NS_FORMAT_FUNCTION(4, 5); +extern void GULLogDebug(GULLoggerService service, + BOOL force, + NSString *messageCode, + NSString *message, + ...) NS_FORMAT_FUNCTION(4, 5); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +@interface GULLoggerWrapper : NSObject + +/** + * Objective-C wrapper for GULLogBasic to allow weak linking to GULLogger + * (required) log level (one of the GULLoggerLevel enum values). + * (required) service name of type GULLoggerService. + * (required) message code starting with "I-" which means iOS, followed by a capitalized + * three-character service identifier and a six digit integer message ID that is unique + * within the service. + * An example of the message code is @"I-COR000001". + * (required) message string which can be a format string. + * (optional) variable arguments list obtained from calling va_start, used when message is a format + * string. + */ + ++ (void)logWithLevel:(GULLoggerLevel)level + withService:(GULLoggerService)service + withCode:(NSString *)messageCode + withMessage:(NSString *)message + withArgs:(va_list)args; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULLoggerLevel.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULLoggerLevel.h new file mode 100644 index 0000000..f0ee435 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULLoggerLevel.h @@ -0,0 +1,37 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/** + * The log levels used by internal logging. + */ +typedef NS_ENUM(NSInteger, GULLoggerLevel) { + /** Error level, matches ASL_LEVEL_ERR. */ + GULLoggerLevelError = 3, + /** Warning level, matches ASL_LEVEL_WARNING. */ + GULLoggerLevelWarning = 4, + /** Notice level, matches ASL_LEVEL_NOTICE. */ + GULLoggerLevelNotice = 5, + /** Info level, matches ASL_LEVEL_INFO. */ + GULLoggerLevelInfo = 6, + /** Debug level, matches ASL_LEVEL_DEBUG. */ + GULLoggerLevelDebug = 7, + /** Minimum log level. */ + GULLoggerLevelMin = GULLoggerLevelError, + /** Maximum log level. */ + GULLoggerLevelMax = GULLoggerLevelDebug +} NS_SWIFT_NAME(GoogleLoggerLevel); diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULMutableDictionary.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULMutableDictionary.h new file mode 100644 index 0000000..a8cc45b --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULMutableDictionary.h @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/// A mutable dictionary that provides atomic accessor and mutators. +@interface GULMutableDictionary : NSObject + +/// Returns an object given a key in the dictionary or nil if not found. +- (id)objectForKey:(id)key; + +/// Updates the object given its key or adds it to the dictionary if it is not in the dictionary. +- (void)setObject:(id)object forKey:(id)key; + +/// Removes the object given its session ID from the dictionary. +- (void)removeObjectForKey:(id)key; + +/// Removes all objects. +- (void)removeAllObjects; + +/// Returns the number of current objects in the dictionary. +- (NSUInteger)count; + +/// Returns an object given a key in the dictionary or nil if not found. +- (id)objectForKeyedSubscript:(id)key; + +/// Updates the object given its key or adds it to the dictionary if it is not in the dictionary. +- (void)setObject:(id)obj forKeyedSubscript:(id)key; + +/// Returns the immutable dictionary. +- (NSDictionary *)dictionary; + +@end diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNSData+zlib.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNSData+zlib.h new file mode 100644 index 0000000..36f94a7 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNSData+zlib.h @@ -0,0 +1,49 @@ +// Copyright 2018 Google +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#import + +/// This is a copy of Google Toolbox for Mac library to avoid creating an extra framework. + +// NOTE: For 64bit, none of these apis handle input sizes >32bits, they will return nil when given +// such data. To handle data of that size you really should be streaming it rather then doing it all +// in memory. + +@interface NSData (GULGzip) + +/// Returns an data as the result of decompressing the payload of |data|.The data to decompress must +/// be a gzipped payloads. ++ (NSData *)gul_dataByInflatingGzippedData:(NSData *)data error:(NSError **)error; + +/// Returns an compressed data with the result of gzipping the payload of |data|. Uses the default +/// compression level. ++ (NSData *)gul_dataByGzippingData:(NSData *)data error:(NSError **)error; + +FOUNDATION_EXPORT NSString *const GULNSDataZlibErrorDomain; +FOUNDATION_EXPORT NSString *const GULNSDataZlibErrorKey; // NSNumber +FOUNDATION_EXPORT NSString *const GULNSDataZlibRemainingBytesKey; // NSNumber + +typedef NS_ENUM(NSInteger, GULNSDataZlibError) { + GULNSDataZlibErrorGreaterThan32BitsToCompress = 1024, + // An internal zlib error. + // GULNSDataZlibErrorKey will contain the error value. + // NSLocalizedDescriptionKey may contain an error string from zlib. + // Look in zlib.h for list of errors. + GULNSDataZlibErrorInternal, + // There was left over data in the buffer that was not used. + // GULNSDataZlibRemainingBytesKey will contain number of remaining bytes. + GULNSDataZlibErrorDataRemaining +}; + +@end diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetwork.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetwork.h new file mode 100644 index 0000000..0e75ae5 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetwork.h @@ -0,0 +1,87 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GULNetworkConstants.h" +#import "GULNetworkLoggerProtocol.h" +#import "GULNetworkURLSession.h" + +/// Delegate protocol for GULNetwork events. +@protocol GULNetworkReachabilityDelegate + +/// Tells the delegate to handle events when the network reachability changes to connected or not +/// connected. +- (void)reachabilityDidChange; + +@end + +/// The Network component that provides network status and handles network requests and responses. +/// This is not thread safe. +/// +/// NOTE: +/// User must add FIRAnalytics handleEventsForBackgroundURLSessionID:completionHandler to the +/// AppDelegate application:handleEventsForBackgroundURLSession:completionHandler: +@interface GULNetwork : NSObject + +/// Indicates if network connectivity is available. +@property(nonatomic, readonly, getter=isNetworkConnected) BOOL networkConnected; + +/// Indicates if there are any uploads in progress. +@property(nonatomic, readonly, getter=hasUploadInProgress) BOOL uploadInProgress; + +/// An optional delegate that can be used in the event when network reachability changes. +@property(nonatomic, weak) id reachabilityDelegate; + +/// An optional delegate that can be used to log messages, warnings or errors that occur in the +/// network operations. +@property(nonatomic, weak) id loggerDelegate; + +/// Indicates whether the logger should display debug messages. +@property(nonatomic, assign) BOOL isDebugModeEnabled; + +/// The time interval in seconds for the network request to timeout. +@property(nonatomic, assign) NSTimeInterval timeoutInterval; + +/// Initializes with the default reachability host. +- (instancetype)init; + +/// Initializes with a custom reachability host. +- (instancetype)initWithReachabilityHost:(NSString *)reachabilityHost; + +/// Handles events when background session with the given ID has finished. ++ (void)handleEventsForBackgroundURLSessionID:(NSString *)sessionID + completionHandler:(GULNetworkSystemCompletionHandler)completionHandler; + +/// Compresses and sends a POST request with the provided data to the URL. The session will be +/// background session if usingBackgroundSession is YES. Otherwise, the POST session is default +/// session. Returns a session ID or nil if an error occurs. +- (NSString *)postURL:(NSURL *)url + payload:(NSData *)payload + queue:(dispatch_queue_t)queue + usingBackgroundSession:(BOOL)usingBackgroundSession + completionHandler:(GULNetworkCompletionHandler)handler; + +/// Sends a GET request with the provided data to the URL. The session will be background session +/// if usingBackgroundSession is YES. Otherwise, the GET session is default session. Returns a +/// session ID or nil if an error occurs. +- (NSString *)getURL:(NSURL *)url + headers:(NSDictionary *)headers + queue:(dispatch_queue_t)queue + usingBackgroundSession:(BOOL)usingBackgroundSession + completionHandler:(GULNetworkCompletionHandler)handler; + +@end diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetworkConstants.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetworkConstants.h new file mode 100644 index 0000000..1cbedd1 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetworkConstants.h @@ -0,0 +1,71 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/// Error codes in Firebase Network error domain. +/// Note: these error codes should never change. It would make it harder to decode the errors if +/// we inadvertently altered any of these codes in a future SDK version. +typedef NS_ENUM(NSInteger, GULNetworkErrorCode) { + /// Unknown error. + GULNetworkErrorCodeUnknown = 0, + /// Error occurs when the request URL is invalid. + GULErrorCodeNetworkInvalidURL = 1, + /// Error occurs when request cannot be constructed. + GULErrorCodeNetworkRequestCreation = 2, + /// Error occurs when payload cannot be compressed. + GULErrorCodeNetworkPayloadCompression = 3, + /// Error occurs when session task cannot be created. + GULErrorCodeNetworkSessionTaskCreation = 4, + /// Error occurs when there is no response. + GULErrorCodeNetworkInvalidResponse = 5 +}; + +#pragma mark - Network constants + +/// The prefix of the ID of the background session. +extern NSString *const kGULNetworkBackgroundSessionConfigIDPrefix; + +/// The sub directory to store the files of data that is being uploaded in the background. +extern NSString *const kGULNetworkApplicationSupportSubdirectory; + +/// Name of the temporary directory that stores files for background uploading. +extern NSString *const kGULNetworkTempDirectoryName; + +/// The period when the temporary uploading file can stay. +extern const NSTimeInterval kGULNetworkTempFolderExpireTime; + +/// The default network request timeout interval. +extern const NSTimeInterval kGULNetworkTimeOutInterval; + +/// The host to check the reachability of the network. +extern NSString *const kGULNetworkReachabilityHost; + +/// The key to get the error context of the UserInfo. +extern NSString *const kGULNetworkErrorContext; + +#pragma mark - Network Status Code + +extern const int kGULNetworkHTTPStatusOK; +extern const int kGULNetworkHTTPStatusNoContent; +extern const int kGULNetworkHTTPStatusCodeMultipleChoices; +extern const int kGULNetworkHTTPStatusCodeMovedPermanently; +extern const int kGULNetworkHTTPStatusCodeFound; +extern const int kGULNetworkHTTPStatusCodeNotModified; +extern const int kGULNetworkHTTPStatusCodeMovedTemporarily; +extern const int kGULNetworkHTTPStatusCodeNotFound; +extern const int kGULNetworkHTTPStatusCodeCannotAcceptTraffic; +extern const int kGULNetworkHTTPStatusCodeUnavailable; diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetworkLoggerProtocol.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetworkLoggerProtocol.h new file mode 100644 index 0000000..425c073 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetworkLoggerProtocol.h @@ -0,0 +1,49 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GULNetworkMessageCode.h" + +/// The log levels used by GULNetworkLogger. +typedef NS_ENUM(NSInteger, GULNetworkLogLevel) { + kGULNetworkLogLevelError = 3, + kGULNetworkLogLevelWarning = 4, + kGULNetworkLogLevelInfo = 6, + kGULNetworkLogLevelDebug = 7, +}; + +@protocol GULNetworkLoggerDelegate + +@required +/// Tells the delegate to log a message with an array of contexts and the log level. +- (void)GULNetwork_logWithLevel:(GULNetworkLogLevel)logLevel + messageCode:(GULNetworkMessageCode)messageCode + message:(NSString *)message + contexts:(NSArray *)contexts; + +/// Tells the delegate to log a message with a context and the log level. +- (void)GULNetwork_logWithLevel:(GULNetworkLogLevel)logLevel + messageCode:(GULNetworkMessageCode)messageCode + message:(NSString *)message + context:(id)context; + +/// Tells the delegate to log a message with the log level. +- (void)GULNetwork_logWithLevel:(GULNetworkLogLevel)logLevel + messageCode:(GULNetworkMessageCode)messageCode + message:(NSString *)message; + +@end diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetworkMessageCode.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetworkMessageCode.h new file mode 100644 index 0000000..507bc5a --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetworkMessageCode.h @@ -0,0 +1,47 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +// Make sure these codes do not overlap with any contained in the FIRAMessageCode enum. +typedef NS_ENUM(NSInteger, GULNetworkMessageCode) { + // GULNetwork.m + kGULNetworkMessageCodeNetwork000 = 900000, // I-NET900000 + kGULNetworkMessageCodeNetwork001 = 900001, // I-NET900001 + kGULNetworkMessageCodeNetwork002 = 900002, // I-NET900002 + kGULNetworkMessageCodeNetwork003 = 900003, // I-NET900003 + // GULNetworkURLSession.m + kGULNetworkMessageCodeURLSession000 = 901000, // I-NET901000 + kGULNetworkMessageCodeURLSession001 = 901001, // I-NET901001 + kGULNetworkMessageCodeURLSession002 = 901002, // I-NET901002 + kGULNetworkMessageCodeURLSession003 = 901003, // I-NET901003 + kGULNetworkMessageCodeURLSession004 = 901004, // I-NET901004 + kGULNetworkMessageCodeURLSession005 = 901005, // I-NET901005 + kGULNetworkMessageCodeURLSession006 = 901006, // I-NET901006 + kGULNetworkMessageCodeURLSession007 = 901007, // I-NET901007 + kGULNetworkMessageCodeURLSession008 = 901008, // I-NET901008 + kGULNetworkMessageCodeURLSession009 = 901009, // I-NET901009 + kGULNetworkMessageCodeURLSession010 = 901010, // I-NET901010 + kGULNetworkMessageCodeURLSession011 = 901011, // I-NET901011 + kGULNetworkMessageCodeURLSession012 = 901012, // I-NET901012 + kGULNetworkMessageCodeURLSession013 = 901013, // I-NET901013 + kGULNetworkMessageCodeURLSession014 = 901014, // I-NET901014 + kGULNetworkMessageCodeURLSession015 = 901015, // I-NET901015 + kGULNetworkMessageCodeURLSession016 = 901016, // I-NET901016 + kGULNetworkMessageCodeURLSession017 = 901017, // I-NET901017 + kGULNetworkMessageCodeURLSession018 = 901018, // I-NET901018 + kGULNetworkMessageCodeURLSession019 = 901019, // I-NET901019 +}; diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetworkURLSession.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetworkURLSession.h new file mode 100644 index 0000000..3f9f7f9 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULNetworkURLSession.h @@ -0,0 +1,62 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import "GULNetworkLoggerProtocol.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void (^GULNetworkCompletionHandler)(NSHTTPURLResponse *_Nullable response, + NSData *_Nullable data, + NSError *_Nullable error); +typedef void (^GULNetworkURLSessionCompletionHandler)(NSHTTPURLResponse *_Nullable response, + NSData *_Nullable data, + NSString *sessionID, + NSError *_Nullable error); +typedef void (^GULNetworkSystemCompletionHandler)(void); + +/// The protocol that uses NSURLSession for iOS >= 7.0 to handle requests and responses. +@interface GULNetworkURLSession : NSObject + +/// Indicates whether the background network is enabled. Default value is NO. +@property(nonatomic, getter=isBackgroundNetworkEnabled) BOOL backgroundNetworkEnabled; + +/// The logger delegate to log message, errors or warnings that occur during the network operations. +@property(nonatomic, weak, nullable) id loggerDelegate; + +/// Calls the system provided completion handler after the background session is finished. ++ (void)handleEventsForBackgroundURLSessionID:(NSString *)sessionID + completionHandler:(GULNetworkSystemCompletionHandler)completionHandler; + +/// Initializes with logger delegate. +- (instancetype)initWithNetworkLoggerDelegate: + (nullable id)networkLoggerDelegate NS_DESIGNATED_INITIALIZER; + +- (instancetype)init NS_UNAVAILABLE; + +/// Sends an asynchronous POST request and calls the provided completion handler when the request +/// completes or when errors occur, and returns an ID of the session/connection. +- (nullable NSString *)sessionIDFromAsyncPOSTRequest:(NSURLRequest *)request + completionHandler:(GULNetworkURLSessionCompletionHandler)handler; + +/// Sends an asynchronous GET request and calls the provided completion handler when the request +/// completes or when errors occur, and returns an ID of the session. +- (nullable NSString *)sessionIDFromAsyncGETRequest:(NSURLRequest *)request + completionHandler:(GULNetworkURLSessionCompletionHandler)handler; + +NS_ASSUME_NONNULL_END +@end diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULOriginalIMPConvenienceMacros.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULOriginalIMPConvenienceMacros.h new file mode 100644 index 0000000..a33262a --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULOriginalIMPConvenienceMacros.h @@ -0,0 +1,207 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * GULOriginalIMPConvenienceMacros.h + * + * This header contains convenience macros for invoking the original IMP of a swizzled method. + */ + +/** + * Invokes original IMP when the original selector takes no arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + */ +#define GUL_INVOKE_ORIGINAL_IMP0(__receivingObject, __swizzledSEL, __returnType, __originalIMP) \ + ((__returnType(*)(id, SEL))__originalIMP)(__receivingObject, __swizzledSEL) + +/** + * Invokes original IMP when the original selector takes 1 argument. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP1(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1)))__originalIMP)(__receivingObject, __swizzledSEL, \ + __arg1) + +/** + * Invokes original IMP when the original selector takes 2 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP2(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2)))__originalIMP)( \ + __receivingObject, __swizzledSEL, __arg1, __arg2) + +/** + * Invokes original IMP when the original selector takes 3 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP3(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), \ + __typeof__(__arg3)))__originalIMP)(__receivingObject, __swizzledSEL, __arg1, \ + __arg2, __arg3) + +/** + * Invokes original IMP when the original selector takes 4 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + * @param __arg4 The fourth argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP4(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3, __arg4) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), __typeof__(__arg3), \ + __typeof__(__arg4)))__originalIMP)(__receivingObject, __swizzledSEL, __arg1, \ + __arg2, __arg3, __arg4) + +/** + * Invokes original IMP when the original selector takes 5 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + * @param __arg4 The fourth argument. + * @param __arg5 The fifth argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP5(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3, __arg4, __arg5) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), __typeof__(__arg3), \ + __typeof__(__arg4), __typeof__(__arg5)))__originalIMP)( \ + __receivingObject, __swizzledSEL, __arg1, __arg2, __arg3, __arg4, __arg5) + +/** + * Invokes original IMP when the original selector takes 6 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + * @param __arg4 The fourth argument. + * @param __arg5 The fifth argument. + * @param __arg6 The sixth argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP6(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), __typeof__(__arg3), \ + __typeof__(__arg4), __typeof__(__arg5), __typeof__(__arg6)))__originalIMP)( \ + __receivingObject, __swizzledSEL, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) + +/** + * Invokes original IMP when the original selector takes 7 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + * @param __arg4 The fourth argument. + * @param __arg5 The fifth argument. + * @param __arg6 The sixth argument. + * @param __arg7 The seventh argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP7(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3, __arg4, __arg5, __arg6, __arg7) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), __typeof__(__arg3), \ + __typeof__(__arg4), __typeof__(__arg5), __typeof__(__arg6), \ + __typeof__(__arg7)))__originalIMP)( \ + __receivingObject, __swizzledSEL, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6, __arg7) + +/** + * Invokes original IMP when the original selector takes 8 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + * @param __arg4 The fourth argument. + * @param __arg5 The fifth argument. + * @param __arg6 The sixth argument. + * @param __arg7 The seventh argument. + * @param __arg8 The eighth argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP8(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3, __arg4, __arg5, __arg6, __arg7, __arg8) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), __typeof__(__arg3), \ + __typeof__(__arg4), __typeof__(__arg5), __typeof__(__arg6), \ + __typeof__(__arg7), __typeof__(__arg8)))__originalIMP)( \ + __receivingObject, __swizzledSEL, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6, __arg7, \ + __arg8) + +/** + * Invokes original IMP when the original selector takes 9 arguments. + * + * @param __receivingObject The object on which the IMP is invoked. + * @param __swizzledSEL The selector used for swizzling. + * @param __returnType The return type of the original implementation. + * @param __originalIMP The original IMP. + * @param __arg1 The first argument. + * @param __arg2 The second argument. + * @param __arg3 The third argument. + * @param __arg4 The fourth argument. + * @param __arg5 The fifth argument. + * @param __arg6 The sixth argument. + * @param __arg7 The seventh argument. + * @param __arg8 The eighth argument. + * @param __arg9 The ninth argument. + */ +#define GUL_INVOKE_ORIGINAL_IMP9(__receivingObject, __swizzledSEL, __returnType, __originalIMP, \ + __arg1, __arg2, __arg3, __arg4, __arg5, __arg6, __arg7, __arg8, \ + __arg9) \ + ((__returnType(*)(id, SEL, __typeof__(__arg1), __typeof__(__arg2), __typeof__(__arg3), \ + __typeof__(__arg4), __typeof__(__arg5), __typeof__(__arg6), \ + __typeof__(__arg7), __typeof__(__arg8), __typeof__(__arg9)))__originalIMP)( \ + __receivingObject, __swizzledSEL, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6, __arg7, \ + __arg8, __arg9) diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULReachabilityChecker.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULReachabilityChecker.h new file mode 100644 index 0000000..0c70c05 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULReachabilityChecker.h @@ -0,0 +1,79 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import +#if !TARGET_OS_WATCH +#import +#endif + +/// Reachability Status +typedef enum { + kGULReachabilityUnknown, ///< Have not yet checked or been notified whether host is reachable. + kGULReachabilityNotReachable, ///< Host is not reachable. + kGULReachabilityViaWifi, ///< Host is reachable via Wifi. + kGULReachabilityViaCellular, ///< Host is reachable via cellular. +} GULReachabilityStatus; + +const NSString *GULReachabilityStatusString(GULReachabilityStatus status); + +@class GULReachabilityChecker; + +/// Google Analytics iOS Reachability Checker. +@protocol GULReachabilityDelegate +@required +/// Called when network status has changed. +- (void)reachability:(GULReachabilityChecker *)reachability + statusChanged:(GULReachabilityStatus)status; +@end + +/// Google Analytics iOS Network Status Checker. +@interface GULReachabilityChecker : NSObject + +/// The last known reachability status, or GULReachabilityStatusUnknown if the +/// checker is not active. +@property(nonatomic, readonly) GULReachabilityStatus reachabilityStatus; +/// The host to which reachability status is to be checked. +@property(nonatomic, copy, readonly) NSString *host; +/// The delegate to be notified of reachability status changes. +@property(nonatomic, weak) id reachabilityDelegate; +/// `YES` if the reachability checker is active, `NO` otherwise. +@property(nonatomic, readonly) BOOL isActive; + +/// Initialize the reachability checker. Note that you must call start to begin checking for and +/// receiving notifications about network status changes. +/// +/// @param reachabilityDelegate The delegate to be notified when reachability status to host +/// changes. +/// +/// @param host The name of the host. +/// +- (instancetype)initWithReachabilityDelegate:(id)reachabilityDelegate + withHost:(NSString *)host; + +- (instancetype)init NS_UNAVAILABLE; + +/// Start checking for reachability to the specified host. This has no effect if the status +/// checker is already checking for connectivity. +/// +/// @return `YES` if initiating status checking was successful or the status checking has already +/// been initiated, `NO` otherwise. +- (BOOL)start; + +/// Stop checking for reachability to the specified host. This has no effect if the status +/// checker is not checking for connectivity. +- (void)stop; + +@end diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULSceneDelegateSwizzler.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULSceneDelegateSwizzler.h new file mode 100644 index 0000000..ed080a3 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULSceneDelegateSwizzler.h @@ -0,0 +1,76 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import +#import + +#if !TARGET_OS_OSX +#import +#endif // !TARGET_OS_OSX + +#if ((TARGET_OS_IOS || TARGET_OS_TV) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000)) +#define UISCENE_SUPPORTED 1 +#endif + +NS_ASSUME_NONNULL_BEGIN + +typedef NSString *const GULSceneDelegateInterceptorID; + +/** This class contains methods that isa swizzle the scene delegate. */ +@interface GULSceneDelegateSwizzler : NSProxy + +#if UISCENE_SUPPORTED + +/** Registers a scene delegate interceptor whose methods will be invoked as they're invoked on the + * original scene delegate. + * + * @param interceptor An instance of a class that conforms to the application delegate protocol. + * The interceptor is NOT retained. + * @return A unique GULSceneDelegateInterceptorID if interceptor was successfully registered; nil + * if it fails. + */ ++ (nullable GULSceneDelegateInterceptorID)registerSceneDelegateInterceptor: + (id)interceptor API_AVAILABLE(ios(13.0), tvos(13.0)); + +/** Unregisters an interceptor with the given ID if it exists. + * + * @param interceptorID The object that was generated when the interceptor was registered. + */ ++ (void)unregisterSceneDelegateInterceptorWithID:(GULSceneDelegateInterceptorID)interceptorID + API_AVAILABLE(ios(13.0), tvos(13.0)); + +/** Do not initialize this class. */ +- (instancetype)init NS_UNAVAILABLE; + +#endif // UISCENE_SUPPORTED + +/** This method ensures that the original scene delegate has been proxied. Call this before + * registering your interceptor. This method is safe to call multiple times (but it only proxies + * the scene delegate once). + * + * The method has no effect for extensions. + */ ++ (void)proxyOriginalSceneDelegate; + +/** Indicates whether scene delegate proxy is explicitly disabled or enabled. Enabled by default. + * + * @return YES if SceneDelegateProxy is Enabled, NO otherwise. + */ ++ (BOOL)isSceneDelegateProxyEnabled; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULSecureCoding.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULSecureCoding.h new file mode 100644 index 0000000..8484b39 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULSecureCoding.h @@ -0,0 +1,36 @@ +// Copyright 2019 Google +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** The class wraps `NSKeyedArchiver` and `NSKeyedUnarchiver` API to provide a unified secure coding + * methods for iOS versions before and after 11. + */ +@interface GULSecureCoding : NSObject + ++ (nullable id)unarchivedObjectOfClasses:(NSSet *)classes + fromData:(NSData *)data + error:(NSError **)outError; + ++ (nullable id)unarchivedObjectOfClass:(Class)class + fromData:(NSData *)data + error:(NSError **)outError; + ++ (nullable NSData *)archivedDataWithRootObject:(id)object error:(NSError **)outError; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULSwizzler.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULSwizzler.h new file mode 100644 index 0000000..26949c8 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULSwizzler.h @@ -0,0 +1,71 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** This class handles the runtime manipulation necessary to instrument selectors. It stores the + * classes and selectors that have been swizzled, and runs all operations on its own queue. + */ +@interface GULSwizzler : NSObject + +/** Manipulates the Objective-C runtime to replace the original IMP with the supplied block. + * + * @param aClass The class to swizzle. + * @param selector The selector of the class to swizzle. + * @param isClassSelector A BOOL specifying whether the selector is a class or instance selector. + * @param block The block that replaces the original IMP. + */ ++ (void)swizzleClass:(Class)aClass + selector:(SEL)selector + isClassSelector:(BOOL)isClassSelector + withBlock:(nullable id)block; + +/** Returns the current IMP for the given class and selector. + * + * @param aClass The class to use. + * @param selector The selector to find the implementation of. + * @param isClassSelector A BOOL specifying whether the selector is a class or instance selector. + * @return The implementation of the selector in the runtime. + */ ++ (nullable IMP)currentImplementationForClass:(Class)aClass + selector:(SEL)selector + isClassSelector:(BOOL)isClassSelector; + +/** Checks the runtime to see if a selector exists on a class. If a property is declared as + * @dynamic, we have a reverse swizzling situation, where the implementation of a method exists + * only in concrete subclasses, and NOT in the superclass. We can detect that situation using + * this helper method. Similarly, we can detect situations where a class doesn't implement a + * protocol method. + * + * @param selector The selector to check for. + * @param aClass The class to check. + * @param isClassSelector A BOOL specifying whether the selector is a class or instance selector. + * @return YES if the method was found in this selector/class combination, NO otherwise. + */ ++ (BOOL)selector:(SEL)selector existsInClass:(Class)aClass isClassSelector:(BOOL)isClassSelector; + +/** Returns a list of all Objective-C (and not primitive) ivars contained by the given object. + * + * @param object The object whose ivars will be iterated. + * @return The list of ivar objects. + */ ++ (NSArray *)ivarObjectsForObject:(id)object; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULUserDefaults.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULUserDefaults.h new file mode 100644 index 0000000..0d04781 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GULUserDefaults.h @@ -0,0 +1,110 @@ +// Copyright 2018 Google +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#import + +NS_ASSUME_NONNULL_BEGIN + +/// A thread-safe user defaults that uses C functions from CFPreferences.h instead of +/// `NSUserDefaults`. This is to avoid sending an `NSNotification` when it's changed from a +/// background thread to avoid crashing. // TODO: Insert radar number here. +@interface GULUserDefaults : NSObject + +/// A shared user defaults similar to +[NSUserDefaults standardUserDefaults] and accesses the same +/// data of the standardUserDefaults. ++ (GULUserDefaults *)standardUserDefaults; + +/// Initializes preferences with a suite name that is the same with the NSUserDefaults' suite name. +/// Both of CFPreferences and NSUserDefaults share the same plist file so their data will exactly +/// the same. +/// +/// @param suiteName The name of the suite of the user defaults. +- (instancetype)initWithSuiteName:(nullable NSString *)suiteName; + +#pragma mark - Getters + +/// Searches the receiver's search list for a default with the key 'defaultName' and return it. If +/// another process has changed defaults in the search list, NSUserDefaults will automatically +/// update to the latest values. If the key in question has been marked as ubiquitous via a Defaults +/// Configuration File, the latest value may not be immediately available, and the registered value +/// will be returned instead. +- (nullable id)objectForKey:(NSString *)defaultName; + +/// Equivalent to -objectForKey:, except that it will return nil if the value is not an NSArray. +- (nullable NSArray *)arrayForKey:(NSString *)defaultName; + +/// Equivalent to -objectForKey:, except that it will return nil if the value +/// is not an NSDictionary. +- (nullable NSDictionary *)dictionaryForKey:(NSString *)defaultName; + +/// Equivalent to -objectForKey:, except that it will convert NSNumber values to their NSString +/// representation. If a non-string non-number value is found, nil will be returned. +- (nullable NSString *)stringForKey:(NSString *)defaultName; + +/// Equivalent to -objectForKey:, except that it converts the returned value to an NSInteger. If the +/// value is an NSNumber, the result of -integerValue will be returned. If the value is an NSString, +/// it will be converted to NSInteger if possible. If the value is a boolean, it will be converted +/// to either 1 for YES or 0 for NO. If the value is absent or can't be converted to an integer, 0 +/// will be returned. +- (NSInteger)integerForKey:(NSString *)defaultName; + +/// Similar to -integerForKey:, except that it returns a float, and boolean values will not be +/// converted. +- (float)floatForKey:(NSString *)defaultName; + +/// Similar to -integerForKey:, except that it returns a double, and boolean values will not be +/// converted. +- (double)doubleForKey:(NSString *)defaultName; + +/// Equivalent to -objectForKey:, except that it converts the returned value to a BOOL. If the value +/// is an NSNumber, NO will be returned if the value is 0, YES otherwise. If the value is an +/// NSString, values of "YES" or "1" will return YES, and values of "NO", "0", or any other string +/// will return NO. If the value is absent or can't be converted to a BOOL, NO will be returned. +- (BOOL)boolForKey:(NSString *)defaultName; + +#pragma mark - Setters + +/// Immediately stores a value (or removes the value if `nil` is passed as the value) for the +/// provided key in the search list entry for the receiver's suite name in the current user and any +/// host, then asynchronously stores the value persistently, where it is made available to other +/// processes. +- (void)setObject:(nullable id)value forKey:(NSString *)defaultName; + +/// Equivalent to -setObject:forKey: except that the value is converted from a float to an NSNumber. +- (void)setFloat:(float)value forKey:(NSString *)defaultName; + +/// Equivalent to -setObject:forKey: except that the value is converted from a double to an +/// NSNumber. +- (void)setDouble:(double)value forKey:(NSString *)defaultName; + +/// Equivalent to -setObject:forKey: except that the value is converted from an NSInteger to an +/// NSNumber. +- (void)setInteger:(NSInteger)value forKey:(NSString *)defaultName; + +/// Equivalent to -setObject:forKey: except that the value is converted from a BOOL to an NSNumber. +- (void)setBool:(BOOL)value forKey:(NSString *)defaultName; + +#pragma mark - Removing Defaults + +/// Equivalent to -[... setObject:nil forKey:defaultName] +- (void)removeObjectForKey:(NSString *)defaultName; + +#pragma mark - Save data + +/// Blocks the calling thread until all in-progress set operations have completed. +- (void)synchronize; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GoogleUtilities-umbrella.h b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GoogleUtilities-umbrella.h new file mode 100644 index 0000000..80815a5 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Headers/GoogleUtilities-umbrella.h @@ -0,0 +1,37 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "GULAppDelegateSwizzler.h" +#import "GULApplication.h" +#import "GULSceneDelegateSwizzler.h" +#import "GULAppEnvironmentUtil.h" +#import "GULHeartbeatDateStorage.h" +#import "GULKeychainStorage.h" +#import "GULKeychainUtils.h" +#import "GULSecureCoding.h" +#import "GULLogger.h" +#import "GULLoggerLevel.h" +#import "GULOriginalIMPConvenienceMacros.h" +#import "GULSwizzler.h" +#import "GULNSData+zlib.h" +#import "GULMutableDictionary.h" +#import "GULNetwork.h" +#import "GULNetworkConstants.h" +#import "GULNetworkLoggerProtocol.h" +#import "GULNetworkMessageCode.h" +#import "GULNetworkURLSession.h" +#import "GULReachabilityChecker.h" +#import "GULUserDefaults.h" + +FOUNDATION_EXPORT double GoogleUtilitiesVersionNumber; +FOUNDATION_EXPORT const unsigned char GoogleUtilitiesVersionString[]; + diff --git a/plugins/2020.3569/iphone-sim/FirebaseCore.framework/Info.plist b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Info.plist similarity index 51% rename from plugins/2020.3569/iphone-sim/FirebaseCore.framework/Info.plist rename to src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Info.plist index 8a81656..469182d 100644 Binary files a/plugins/2020.3569/iphone-sim/FirebaseCore.framework/Info.plist and b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Modules/module.modulemap new file mode 100644 index 0000000..491dd0a --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module GoogleUtilities { + umbrella header "GoogleUtilities-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/_CodeSignature/CodeResources b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..54d27fe --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/GoogleUtilities.framework/_CodeSignature/CodeResources @@ -0,0 +1,447 @@ + + + + + files + + Headers/GULAppDelegateSwizzler.h + + syLcTf4iZM/zGTHKReVOIYHhIJI= + + Headers/GULAppEnvironmentUtil.h + + oLIlvIclqXKwr63bfXf7r+1rsDE= + + Headers/GULApplication.h + + 7eqiPaw5GXPL0Rb2twRgpT07iNg= + + Headers/GULHeartbeatDateStorage.h + + dQjZtlXKLOHOKRu3PyACBqLdb3I= + + Headers/GULKeychainStorage.h + + o2DEAQa/+zOClWtKDeRy4iy+ONg= + + Headers/GULKeychainUtils.h + + bSt0Sx0S0D2jdw79sWwVx+MnabY= + + Headers/GULLogger.h + + BejMmQ7GaAW/nt3K9KTkNLGv518= + + Headers/GULLoggerLevel.h + + kI/Q5XKyjxY19Tph/lUMaOC09ZE= + + Headers/GULMutableDictionary.h + + vXJrGiuz0ZHqo7dvfPTSAmrs/cQ= + + Headers/GULNSData+zlib.h + + kFWywRhiZKZSTElPxadV/AaoVqA= + + Headers/GULNetwork.h + + XY0HNvrV7Ix19MVmXQhwqmtEehQ= + + Headers/GULNetworkConstants.h + + C/Rd83INyheH99BEZTEMvGyXDM0= + + Headers/GULNetworkLoggerProtocol.h + + 9b/K5TWGEMavvYpn6qJWb9/cUlA= + + Headers/GULNetworkMessageCode.h + + lq7cI8Bjyfw3Y99bm948lM9iKw0= + + Headers/GULNetworkURLSession.h + + zakav2dnnHEg+jKlDffWx35g+4E= + + Headers/GULOriginalIMPConvenienceMacros.h + + ioFNLvVtBav6ChtkDGBfImNqRJg= + + Headers/GULReachabilityChecker.h + + UHZxn2/zMhUivGD/BRSg0Tiuez4= + + Headers/GULSceneDelegateSwizzler.h + + bPpaDYnJswtol+pFfw3KNbviSFo= + + Headers/GULSecureCoding.h + + t/fXV0x5vnY3wbVku4mOWIkSf9o= + + Headers/GULSwizzler.h + + kqRN0S855mcEoeddcbC6llfp/j0= + + Headers/GULUserDefaults.h + + EBGg0ZapNUzyIzb6nCliBREczUA= + + Headers/GoogleUtilities-umbrella.h + + FmO/iwlkJ7HrdtIc7mazUjXN/sk= + + Info.plist + + BdK3z2CFKcbcZnG6AIk5UIPXy48= + + Modules/module.modulemap + + jNNM5/vRCkspln7DuMCSYf0cbB8= + + + files2 + + Headers/GULAppDelegateSwizzler.h + + hash + + syLcTf4iZM/zGTHKReVOIYHhIJI= + + hash2 + + F5UYKBNVsprmfMdo2SG/GqIaHjGQuapQzUCrV4D+Ky0= + + + Headers/GULAppEnvironmentUtil.h + + hash + + oLIlvIclqXKwr63bfXf7r+1rsDE= + + hash2 + + UWgWQD+n1Z3WquD3rEgnnDiqYuvU+ntF9zwbTmsX11U= + + + Headers/GULApplication.h + + hash + + 7eqiPaw5GXPL0Rb2twRgpT07iNg= + + hash2 + + eZpoHvYOXMgzAAEqsISAZMJGy+uKtlq+EUPNiZkZUv0= + + + Headers/GULHeartbeatDateStorage.h + + hash + + dQjZtlXKLOHOKRu3PyACBqLdb3I= + + hash2 + + RkyYx6fyC+iLb58QnDqqepC0KSKTyr27hZerf7lE4Rg= + + + Headers/GULKeychainStorage.h + + hash + + o2DEAQa/+zOClWtKDeRy4iy+ONg= + + hash2 + + 962QpxFg2iz+Ik7wBk/lUH8nVxzKEH2CZ0/5J1r4V5c= + + + Headers/GULKeychainUtils.h + + hash + + bSt0Sx0S0D2jdw79sWwVx+MnabY= + + hash2 + + AKRVwSvjjWCNm+D0Woh8JzC7OB4RF+TRxCTZCqHe5p8= + + + Headers/GULLogger.h + + hash + + BejMmQ7GaAW/nt3K9KTkNLGv518= + + hash2 + + c1WEe4nCsZudVh5moNxdO17desHOxLh0iqxl5BlyMTU= + + + Headers/GULLoggerLevel.h + + hash + + kI/Q5XKyjxY19Tph/lUMaOC09ZE= + + hash2 + + LiP2jwqqzSGdPL/LiTSObUXRHghVvIJYdV2SXCW8M+k= + + + Headers/GULMutableDictionary.h + + hash + + vXJrGiuz0ZHqo7dvfPTSAmrs/cQ= + + hash2 + + QXoNxOahBNYlL0rsqw+JxKXX75mOgf8xEPopV/ei0T0= + + + Headers/GULNSData+zlib.h + + hash + + kFWywRhiZKZSTElPxadV/AaoVqA= + + hash2 + + QD8Y96XnfDAahzjrGk4My5T2g8CL4crH1xVR4Hu0PRU= + + + Headers/GULNetwork.h + + hash + + XY0HNvrV7Ix19MVmXQhwqmtEehQ= + + hash2 + + iN5zDoDlPvg1bwP/GxuVMbbPbyWr2aMpHHoLwqFjd/g= + + + Headers/GULNetworkConstants.h + + hash + + C/Rd83INyheH99BEZTEMvGyXDM0= + + hash2 + + 4qBeGGAjYO8vmRK5wSzJZw14njF2tVvw/nYT61ZjJdY= + + + Headers/GULNetworkLoggerProtocol.h + + hash + + 9b/K5TWGEMavvYpn6qJWb9/cUlA= + + hash2 + + WMH0FNgquG55nV87qEdu/VkMVKtIaF3qGUjnzIJRqPU= + + + Headers/GULNetworkMessageCode.h + + hash + + lq7cI8Bjyfw3Y99bm948lM9iKw0= + + hash2 + + AKPzeda4C5iUfNojWbGUDYu3FyRPJ0uIRugy/IyJsM8= + + + Headers/GULNetworkURLSession.h + + hash + + zakav2dnnHEg+jKlDffWx35g+4E= + + hash2 + + v1KWie2xQxLa73blnQdgSwWNYSFbijx3l7mixX1BAsw= + + + Headers/GULOriginalIMPConvenienceMacros.h + + hash + + ioFNLvVtBav6ChtkDGBfImNqRJg= + + hash2 + + fNvM52Y4+ks99B81gcFB9L3SghXwZrd5S2dBJEKW5mw= + + + Headers/GULReachabilityChecker.h + + hash + + UHZxn2/zMhUivGD/BRSg0Tiuez4= + + hash2 + + E4RZSWCTO7NAjQH99yeYm4kokSomy1hmM/ZdculvEuc= + + + Headers/GULSceneDelegateSwizzler.h + + hash + + bPpaDYnJswtol+pFfw3KNbviSFo= + + hash2 + + 5W12naXydBD+Keb+iC2Jn3qlu2rWyq+V8Z93R+F6/oU= + + + Headers/GULSecureCoding.h + + hash + + t/fXV0x5vnY3wbVku4mOWIkSf9o= + + hash2 + + kWT1ykqi+tOoUFBDwqhOPx7axNyeUYgduCruJb7EaTQ= + + + Headers/GULSwizzler.h + + hash + + kqRN0S855mcEoeddcbC6llfp/j0= + + hash2 + + nHEVLRZiAlaBzWwIgNfNZ9l61OpmGZSCbpSaKf3yIqs= + + + Headers/GULUserDefaults.h + + hash + + EBGg0ZapNUzyIzb6nCliBREczUA= + + hash2 + + ys09g5WqzZ5D/IaWg2v2AyTadtZDy7y+bS/G95iNTnE= + + + Headers/GoogleUtilities-umbrella.h + + hash + + FmO/iwlkJ7HrdtIc7mazUjXN/sk= + + hash2 + + nn07CiNXTSS9D0cG7xo6FMIH9oMU85swi/RsDaj1rlY= + + + Modules/module.modulemap + + hash + + jNNM5/vRCkspln7DuMCSYf0cbB8= + + hash2 + + AWXmNXv9PVCSYOCWhqKqLRqCRav50cANCfQhM5gsw5M= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/src/ios/EmbeddedFrameworksSim/Readme.markdown b/src/ios/EmbeddedFrameworksSim/Readme.markdown new file mode 100644 index 0000000..e12598f --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/Readme.markdown @@ -0,0 +1,2 @@ + +put embedded frameworks for a plugin here diff --git a/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/nanopb-umbrella.h b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/nanopb-umbrella.h new file mode 100644 index 0000000..07e77b3 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/nanopb-umbrella.h @@ -0,0 +1,26 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "pb.h" +#import "pb_common.h" +#import "pb_decode.h" +#import "pb_encode.h" +#import "pb.h" +#import "pb_decode.h" +#import "pb_common.h" +#import "pb.h" +#import "pb_encode.h" +#import "pb_common.h" + +FOUNDATION_EXPORT double nanopbVersionNumber; +FOUNDATION_EXPORT const unsigned char nanopbVersionString[]; + diff --git a/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/pb.h b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/pb.h new file mode 100644 index 0000000..2ba6c63 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/pb.h @@ -0,0 +1,599 @@ +/* Common parts of the nanopb library. Most of these are quite low-level + * stuff. For the high-level interface, see pb_encode.h and pb_decode.h. + */ + +#ifndef PB_H_INCLUDED +#define PB_H_INCLUDED + +/***************************************************************** + * Nanopb compilation time options. You can change these here by * + * uncommenting the lines, or on the compiler command line. * + *****************************************************************/ + +/* Enable support for dynamically allocated fields */ +/* #define PB_ENABLE_MALLOC 1 */ + +/* Define this if your CPU / compiler combination does not support + * unaligned memory access to packed structures. */ +/* #define PB_NO_PACKED_STRUCTS 1 */ + +/* Increase the number of required fields that are tracked. + * A compiler warning will tell if you need this. */ +/* #define PB_MAX_REQUIRED_FIELDS 256 */ + +/* Add support for tag numbers > 255 and fields larger than 255 bytes. */ +/* #define PB_FIELD_16BIT 1 */ + +/* Add support for tag numbers > 65536 and fields larger than 65536 bytes. */ +/* #define PB_FIELD_32BIT 1 */ + +/* Disable support for error messages in order to save some code space. */ +/* #define PB_NO_ERRMSG 1 */ + +/* Disable support for custom streams (support only memory buffers). */ +/* #define PB_BUFFER_ONLY 1 */ + +/* Switch back to the old-style callback function signature. + * This was the default until nanopb-0.2.1. */ +/* #define PB_OLD_CALLBACK_STYLE */ + + +/* Don't encode scalar arrays as packed. This is only to be used when + * the decoder on the receiving side cannot process packed scalar arrays. + * Such example is older protobuf.js. */ +/* #define PB_ENCODE_ARRAYS_UNPACKED 1 */ + +/****************************************************************** + * You usually don't need to change anything below this line. * + * Feel free to look around and use the defined macros, though. * + ******************************************************************/ + + +/* Version of the nanopb library. Just in case you want to check it in + * your own program. */ +#define NANOPB_VERSION nanopb-0.3.9.6 + +/* Include all the system headers needed by nanopb. You will need the + * definitions of the following: + * - strlen, memcpy, memset functions + * - [u]int_least8_t, uint_fast8_t, [u]int_least16_t, [u]int32_t, [u]int64_t + * - size_t + * - bool + * + * If you don't have the standard header files, you can instead provide + * a custom header that defines or includes all this. In that case, + * define PB_SYSTEM_HEADER to the path of this file. + */ +#ifdef PB_SYSTEM_HEADER +#include PB_SYSTEM_HEADER +#else +#include +#include +#include +#include + +#ifdef PB_ENABLE_MALLOC +#include +#endif +#endif + +/* Macro for defining packed structures (compiler dependent). + * This just reduces memory requirements, but is not required. + */ +#if defined(PB_NO_PACKED_STRUCTS) + /* Disable struct packing */ +# define PB_PACKED_STRUCT_START +# define PB_PACKED_STRUCT_END +# define pb_packed +#elif defined(__GNUC__) || defined(__clang__) + /* For GCC and clang */ +# define PB_PACKED_STRUCT_START +# define PB_PACKED_STRUCT_END +# define pb_packed __attribute__((packed)) +#elif defined(__ICCARM__) || defined(__CC_ARM) + /* For IAR ARM and Keil MDK-ARM compilers */ +# define PB_PACKED_STRUCT_START _Pragma("pack(push, 1)") +# define PB_PACKED_STRUCT_END _Pragma("pack(pop)") +# define pb_packed +#elif defined(_MSC_VER) && (_MSC_VER >= 1500) + /* For Microsoft Visual C++ */ +# define PB_PACKED_STRUCT_START __pragma(pack(push, 1)) +# define PB_PACKED_STRUCT_END __pragma(pack(pop)) +# define pb_packed +#else + /* Unknown compiler */ +# define PB_PACKED_STRUCT_START +# define PB_PACKED_STRUCT_END +# define pb_packed +#endif + +/* Handly macro for suppressing unreferenced-parameter compiler warnings. */ +#ifndef PB_UNUSED +#define PB_UNUSED(x) (void)(x) +#endif + +/* Compile-time assertion, used for checking compatible compilation options. + * If this does not work properly on your compiler, use + * #define PB_NO_STATIC_ASSERT to disable it. + * + * But before doing that, check carefully the error message / place where it + * comes from to see if the error has a real cause. Unfortunately the error + * message is not always very clear to read, but you can see the reason better + * in the place where the PB_STATIC_ASSERT macro was called. + */ +#ifndef PB_NO_STATIC_ASSERT +#ifndef PB_STATIC_ASSERT +#define PB_STATIC_ASSERT(COND,MSG) typedef char PB_STATIC_ASSERT_MSG(MSG, __LINE__, __COUNTER__)[(COND)?1:-1]; +#define PB_STATIC_ASSERT_MSG(MSG, LINE, COUNTER) PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) +#define PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) pb_static_assertion_##MSG##LINE##COUNTER +#endif +#else +#define PB_STATIC_ASSERT(COND,MSG) +#endif + +/* Number of required fields to keep track of. */ +#ifndef PB_MAX_REQUIRED_FIELDS +#define PB_MAX_REQUIRED_FIELDS 64 +#endif + +#if PB_MAX_REQUIRED_FIELDS < 64 +#error You should not lower PB_MAX_REQUIRED_FIELDS from the default value (64). +#endif + +/* List of possible field types. These are used in the autogenerated code. + * Least-significant 4 bits tell the scalar type + * Most-significant 4 bits specify repeated/required/packed etc. + */ + +typedef uint_least8_t pb_type_t; + +/**** Field data types ****/ + +/* Numeric types */ +#define PB_LTYPE_BOOL 0x00 /* bool */ +#define PB_LTYPE_VARINT 0x01 /* int32, int64, enum, bool */ +#define PB_LTYPE_UVARINT 0x02 /* uint32, uint64 */ +#define PB_LTYPE_SVARINT 0x03 /* sint32, sint64 */ +#define PB_LTYPE_FIXED32 0x04 /* fixed32, sfixed32, float */ +#define PB_LTYPE_FIXED64 0x05 /* fixed64, sfixed64, double */ + +/* Marker for last packable field type. */ +#define PB_LTYPE_LAST_PACKABLE 0x05 + +/* Byte array with pre-allocated buffer. + * data_size is the length of the allocated PB_BYTES_ARRAY structure. */ +#define PB_LTYPE_BYTES 0x06 + +/* String with pre-allocated buffer. + * data_size is the maximum length. */ +#define PB_LTYPE_STRING 0x07 + +/* Submessage + * submsg_fields is pointer to field descriptions */ +#define PB_LTYPE_SUBMESSAGE 0x08 + +/* Extension pseudo-field + * The field contains a pointer to pb_extension_t */ +#define PB_LTYPE_EXTENSION 0x09 + +/* Byte array with inline, pre-allocated byffer. + * data_size is the length of the inline, allocated buffer. + * This differs from PB_LTYPE_BYTES by defining the element as + * pb_byte_t[data_size] rather than pb_bytes_array_t. */ +#define PB_LTYPE_FIXED_LENGTH_BYTES 0x0A + +/* Number of declared LTYPES */ +#define PB_LTYPES_COUNT 0x0B +#define PB_LTYPE_MASK 0x0F + +/**** Field repetition rules ****/ + +#define PB_HTYPE_REQUIRED 0x00 +#define PB_HTYPE_OPTIONAL 0x10 +#define PB_HTYPE_REPEATED 0x20 +#define PB_HTYPE_ONEOF 0x30 +#define PB_HTYPE_MASK 0x30 + +/**** Field allocation types ****/ + +#define PB_ATYPE_STATIC 0x00 +#define PB_ATYPE_POINTER 0x80 +#define PB_ATYPE_CALLBACK 0x40 +#define PB_ATYPE_MASK 0xC0 + +#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK) +#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK) +#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK) + +/* Data type used for storing sizes of struct fields + * and array counts. + */ +#if defined(PB_FIELD_32BIT) + typedef uint32_t pb_size_t; + typedef int32_t pb_ssize_t; +#elif defined(PB_FIELD_16BIT) + typedef uint_least16_t pb_size_t; + typedef int_least16_t pb_ssize_t; +#else + typedef uint_least8_t pb_size_t; + typedef int_least8_t pb_ssize_t; +#endif +#define PB_SIZE_MAX ((pb_size_t)-1) + +/* Data type for storing encoded data and other byte streams. + * This typedef exists to support platforms where uint8_t does not exist. + * You can regard it as equivalent on uint8_t on other platforms. + */ +typedef uint_least8_t pb_byte_t; + +/* This structure is used in auto-generated constants + * to specify struct fields. + * You can change field sizes if you need structures + * larger than 256 bytes or field tags larger than 256. + * The compiler should complain if your .proto has such + * structures. Fix that by defining PB_FIELD_16BIT or + * PB_FIELD_32BIT. + */ +PB_PACKED_STRUCT_START +typedef struct pb_field_s pb_field_t; +struct pb_field_s { + pb_size_t tag; + pb_type_t type; + pb_size_t data_offset; /* Offset of field data, relative to previous field. */ + pb_ssize_t size_offset; /* Offset of array size or has-boolean, relative to data */ + pb_size_t data_size; /* Data size in bytes for a single item */ + pb_size_t array_size; /* Maximum number of entries in array */ + + /* Field definitions for submessage + * OR default value for all other non-array, non-callback types + * If null, then field will zeroed. */ + const void *ptr; +} pb_packed; +PB_PACKED_STRUCT_END + +/* Make sure that the standard integer types are of the expected sizes. + * Otherwise fixed32/fixed64 fields can break. + * + * If you get errors here, it probably means that your stdint.h is not + * correct for your platform. + */ +#ifndef PB_WITHOUT_64BIT +PB_STATIC_ASSERT(sizeof(int64_t) == 2 * sizeof(int32_t), INT64_T_WRONG_SIZE) +PB_STATIC_ASSERT(sizeof(uint64_t) == 2 * sizeof(uint32_t), UINT64_T_WRONG_SIZE) +#endif + +/* This structure is used for 'bytes' arrays. + * It has the number of bytes in the beginning, and after that an array. + * Note that actual structs used will have a different length of bytes array. + */ +#define PB_BYTES_ARRAY_T(n) struct { pb_size_t size; pb_byte_t bytes[n]; } +#define PB_BYTES_ARRAY_T_ALLOCSIZE(n) ((size_t)n + offsetof(pb_bytes_array_t, bytes)) + +struct pb_bytes_array_s { + pb_size_t size; + pb_byte_t bytes[1]; +}; +typedef struct pb_bytes_array_s pb_bytes_array_t; + +/* This structure is used for giving the callback function. + * It is stored in the message structure and filled in by the method that + * calls pb_decode. + * + * The decoding callback will be given a limited-length stream + * If the wire type was string, the length is the length of the string. + * If the wire type was a varint/fixed32/fixed64, the length is the length + * of the actual value. + * The function may be called multiple times (especially for repeated types, + * but also otherwise if the message happens to contain the field multiple + * times.) + * + * The encoding callback will receive the actual output stream. + * It should write all the data in one call, including the field tag and + * wire type. It can write multiple fields. + * + * The callback can be null if you want to skip a field. + */ +typedef struct pb_istream_s pb_istream_t; +typedef struct pb_ostream_s pb_ostream_t; +typedef struct pb_callback_s pb_callback_t; +struct pb_callback_s { +#ifdef PB_OLD_CALLBACK_STYLE + /* Deprecated since nanopb-0.2.1 */ + union { + bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void *arg); + bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, const void *arg); + } funcs; +#else + /* New function signature, which allows modifying arg contents in callback. */ + union { + bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void **arg); + bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, void * const *arg); + } funcs; +#endif + + /* Free arg for use by callback */ + void *arg; +}; + +/* Wire types. Library user needs these only in encoder callbacks. */ +typedef enum { + PB_WT_VARINT = 0, + PB_WT_64BIT = 1, + PB_WT_STRING = 2, + PB_WT_32BIT = 5 +} pb_wire_type_t; + +/* Structure for defining the handling of unknown/extension fields. + * Usually the pb_extension_type_t structure is automatically generated, + * while the pb_extension_t structure is created by the user. However, + * if you want to catch all unknown fields, you can also create a custom + * pb_extension_type_t with your own callback. + */ +typedef struct pb_extension_type_s pb_extension_type_t; +typedef struct pb_extension_s pb_extension_t; +struct pb_extension_type_s { + /* Called for each unknown field in the message. + * If you handle the field, read off all of its data and return true. + * If you do not handle the field, do not read anything and return true. + * If you run into an error, return false. + * Set to NULL for default handler. + */ + bool (*decode)(pb_istream_t *stream, pb_extension_t *extension, + uint32_t tag, pb_wire_type_t wire_type); + + /* Called once after all regular fields have been encoded. + * If you have something to write, do so and return true. + * If you do not have anything to write, just return true. + * If you run into an error, return false. + * Set to NULL for default handler. + */ + bool (*encode)(pb_ostream_t *stream, const pb_extension_t *extension); + + /* Free field for use by the callback. */ + const void *arg; +}; + +struct pb_extension_s { + /* Type describing the extension field. Usually you'll initialize + * this to a pointer to the automatically generated structure. */ + const pb_extension_type_t *type; + + /* Destination for the decoded data. This must match the datatype + * of the extension field. */ + void *dest; + + /* Pointer to the next extension handler, or NULL. + * If this extension does not match a field, the next handler is + * automatically called. */ + pb_extension_t *next; + + /* The decoder sets this to true if the extension was found. + * Ignored for encoding. */ + bool found; +}; + +/* Memory allocation functions to use. You can define pb_realloc and + * pb_free to custom functions if you want. */ +#ifdef PB_ENABLE_MALLOC +# ifndef pb_realloc +# define pb_realloc(ptr, size) realloc(ptr, size) +# endif +# ifndef pb_free +# define pb_free(ptr) free(ptr) +# endif +#endif + +/* This is used to inform about need to regenerate .pb.h/.pb.c files. */ +#define PB_PROTO_HEADER_VERSION 30 + +/* These macros are used to declare pb_field_t's in the constant array. */ +/* Size of a structure member, in bytes. */ +#define pb_membersize(st, m) (sizeof ((st*)0)->m) +/* Number of entries in an array. */ +#define pb_arraysize(st, m) (pb_membersize(st, m) / pb_membersize(st, m[0])) +/* Delta from start of one member to the start of another member. */ +#define pb_delta(st, m1, m2) ((int)offsetof(st, m1) - (int)offsetof(st, m2)) +/* Marks the end of the field list */ +#define PB_LAST_FIELD {0,(pb_type_t) 0,0,0,0,0,0} + +/* Macros for filling in the data_offset field */ +/* data_offset for first field in a message */ +#define PB_DATAOFFSET_FIRST(st, m1, m2) (offsetof(st, m1)) +/* data_offset for subsequent fields */ +#define PB_DATAOFFSET_OTHER(st, m1, m2) (offsetof(st, m1) - offsetof(st, m2) - pb_membersize(st, m2)) +/* data offset for subsequent fields inside an union (oneof) */ +#define PB_DATAOFFSET_UNION(st, m1, m2) (PB_SIZE_MAX) +/* Choose first/other based on m1 == m2 (deprecated, remains for backwards compatibility) */ +#define PB_DATAOFFSET_CHOOSE(st, m1, m2) (int)(offsetof(st, m1) == offsetof(st, m2) \ + ? PB_DATAOFFSET_FIRST(st, m1, m2) \ + : PB_DATAOFFSET_OTHER(st, m1, m2)) + +/* Required fields are the simplest. They just have delta (padding) from + * previous field end, and the size of the field. Pointer is used for + * submessages and default values. + */ +#define PB_REQUIRED_STATIC(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_REQUIRED | ltype, \ + fd, 0, pb_membersize(st, m), 0, ptr} + +/* Optional fields add the delta to the has_ variable. */ +#define PB_OPTIONAL_STATIC(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | ltype, \ + fd, \ + pb_delta(st, has_ ## m, m), \ + pb_membersize(st, m), 0, ptr} + +#define PB_SINGULAR_STATIC(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | ltype, \ + fd, 0, pb_membersize(st, m), 0, ptr} + +/* Repeated fields have a _count field and also the maximum number of entries. */ +#define PB_REPEATED_STATIC(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_REPEATED | ltype, \ + fd, \ + pb_delta(st, m ## _count, m), \ + pb_membersize(st, m[0]), \ + pb_arraysize(st, m), ptr} + +/* Allocated fields carry the size of the actual data, not the pointer */ +#define PB_REQUIRED_POINTER(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_POINTER | PB_HTYPE_REQUIRED | ltype, \ + fd, 0, pb_membersize(st, m[0]), 0, ptr} + +/* Optional fields don't need a has_ variable, as information would be redundant */ +#define PB_OPTIONAL_POINTER(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_POINTER | PB_HTYPE_OPTIONAL | ltype, \ + fd, 0, pb_membersize(st, m[0]), 0, ptr} + +/* Same as optional fields*/ +#define PB_SINGULAR_POINTER(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_POINTER | PB_HTYPE_OPTIONAL | ltype, \ + fd, 0, pb_membersize(st, m[0]), 0, ptr} + +/* Repeated fields have a _count field and a pointer to array of pointers */ +#define PB_REPEATED_POINTER(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_POINTER | PB_HTYPE_REPEATED | ltype, \ + fd, pb_delta(st, m ## _count, m), \ + pb_membersize(st, m[0]), 0, ptr} + +/* Callbacks are much like required fields except with special datatype. */ +#define PB_REQUIRED_CALLBACK(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_CALLBACK | PB_HTYPE_REQUIRED | ltype, \ + fd, 0, pb_membersize(st, m), 0, ptr} + +#define PB_OPTIONAL_CALLBACK(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_CALLBACK | PB_HTYPE_OPTIONAL | ltype, \ + fd, 0, pb_membersize(st, m), 0, ptr} + +#define PB_SINGULAR_CALLBACK(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_CALLBACK | PB_HTYPE_OPTIONAL | ltype, \ + fd, 0, pb_membersize(st, m), 0, ptr} + +#define PB_REPEATED_CALLBACK(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_CALLBACK | PB_HTYPE_REPEATED | ltype, \ + fd, 0, pb_membersize(st, m), 0, ptr} + +/* Optional extensions don't have the has_ field, as that would be redundant. + * Furthermore, the combination of OPTIONAL without has_ field is used + * for indicating proto3 style fields. Extensions exist in proto2 mode only, + * so they should be encoded according to proto2 rules. To avoid the conflict, + * extensions are marked as REQUIRED instead. + */ +#define PB_OPTEXT_STATIC(tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_REQUIRED | ltype, \ + 0, \ + 0, \ + pb_membersize(st, m), 0, ptr} + +#define PB_OPTEXT_POINTER(tag, st, m, fd, ltype, ptr) \ + PB_OPTIONAL_POINTER(tag, st, m, fd, ltype, ptr) + +#define PB_OPTEXT_CALLBACK(tag, st, m, fd, ltype, ptr) \ + PB_OPTIONAL_CALLBACK(tag, st, m, fd, ltype, ptr) + +/* The mapping from protobuf types to LTYPEs is done using these macros. */ +#define PB_LTYPE_MAP_BOOL PB_LTYPE_BOOL +#define PB_LTYPE_MAP_BYTES PB_LTYPE_BYTES +#define PB_LTYPE_MAP_DOUBLE PB_LTYPE_FIXED64 +#define PB_LTYPE_MAP_ENUM PB_LTYPE_VARINT +#define PB_LTYPE_MAP_UENUM PB_LTYPE_UVARINT +#define PB_LTYPE_MAP_FIXED32 PB_LTYPE_FIXED32 +#define PB_LTYPE_MAP_FIXED64 PB_LTYPE_FIXED64 +#define PB_LTYPE_MAP_FLOAT PB_LTYPE_FIXED32 +#define PB_LTYPE_MAP_INT32 PB_LTYPE_VARINT +#define PB_LTYPE_MAP_INT64 PB_LTYPE_VARINT +#define PB_LTYPE_MAP_MESSAGE PB_LTYPE_SUBMESSAGE +#define PB_LTYPE_MAP_SFIXED32 PB_LTYPE_FIXED32 +#define PB_LTYPE_MAP_SFIXED64 PB_LTYPE_FIXED64 +#define PB_LTYPE_MAP_SINT32 PB_LTYPE_SVARINT +#define PB_LTYPE_MAP_SINT64 PB_LTYPE_SVARINT +#define PB_LTYPE_MAP_STRING PB_LTYPE_STRING +#define PB_LTYPE_MAP_UINT32 PB_LTYPE_UVARINT +#define PB_LTYPE_MAP_UINT64 PB_LTYPE_UVARINT +#define PB_LTYPE_MAP_EXTENSION PB_LTYPE_EXTENSION +#define PB_LTYPE_MAP_FIXED_LENGTH_BYTES PB_LTYPE_FIXED_LENGTH_BYTES + +/* This is the actual macro used in field descriptions. + * It takes these arguments: + * - Field tag number + * - Field type: BOOL, BYTES, DOUBLE, ENUM, UENUM, FIXED32, FIXED64, + * FLOAT, INT32, INT64, MESSAGE, SFIXED32, SFIXED64 + * SINT32, SINT64, STRING, UINT32, UINT64 or EXTENSION + * - Field rules: REQUIRED, OPTIONAL or REPEATED + * - Allocation: STATIC, CALLBACK or POINTER + * - Placement: FIRST or OTHER, depending on if this is the first field in structure. + * - Message name + * - Field name + * - Previous field name (or field name again for first field) + * - Pointer to default value or submsg fields. + */ + +#define PB_FIELD(tag, type, rules, allocation, placement, message, field, prevfield, ptr) \ + PB_ ## rules ## _ ## allocation(tag, message, field, \ + PB_DATAOFFSET_ ## placement(message, field, prevfield), \ + PB_LTYPE_MAP_ ## type, ptr) + +/* Field description for repeated static fixed count fields.*/ +#define PB_REPEATED_FIXED_COUNT(tag, type, placement, message, field, prevfield, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_REPEATED | PB_LTYPE_MAP_ ## type, \ + PB_DATAOFFSET_ ## placement(message, field, prevfield), \ + 0, \ + pb_membersize(message, field[0]), \ + pb_arraysize(message, field), ptr} + +/* Field description for oneof fields. This requires taking into account the + * union name also, that's why a separate set of macros is needed. + */ +#define PB_ONEOF_STATIC(u, tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_ONEOF | ltype, \ + fd, pb_delta(st, which_ ## u, u.m), \ + pb_membersize(st, u.m), 0, ptr} + +#define PB_ONEOF_POINTER(u, tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_POINTER | PB_HTYPE_ONEOF | ltype, \ + fd, pb_delta(st, which_ ## u, u.m), \ + pb_membersize(st, u.m[0]), 0, ptr} + +#define PB_ONEOF_FIELD(union_name, tag, type, rules, allocation, placement, message, field, prevfield, ptr) \ + PB_ONEOF_ ## allocation(union_name, tag, message, field, \ + PB_DATAOFFSET_ ## placement(message, union_name.field, prevfield), \ + PB_LTYPE_MAP_ ## type, ptr) + +#define PB_ANONYMOUS_ONEOF_STATIC(u, tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_STATIC | PB_HTYPE_ONEOF | ltype, \ + fd, pb_delta(st, which_ ## u, m), \ + pb_membersize(st, m), 0, ptr} + +#define PB_ANONYMOUS_ONEOF_POINTER(u, tag, st, m, fd, ltype, ptr) \ + {tag, PB_ATYPE_POINTER | PB_HTYPE_ONEOF | ltype, \ + fd, pb_delta(st, which_ ## u, m), \ + pb_membersize(st, m[0]), 0, ptr} + +#define PB_ANONYMOUS_ONEOF_FIELD(union_name, tag, type, rules, allocation, placement, message, field, prevfield, ptr) \ + PB_ANONYMOUS_ONEOF_ ## allocation(union_name, tag, message, field, \ + PB_DATAOFFSET_ ## placement(message, field, prevfield), \ + PB_LTYPE_MAP_ ## type, ptr) + +/* These macros are used for giving out error messages. + * They are mostly a debugging aid; the main error information + * is the true/false return value from functions. + * Some code space can be saved by disabling the error + * messages if not used. + * + * PB_SET_ERROR() sets the error message if none has been set yet. + * msg must be a constant string literal. + * PB_GET_ERROR() always returns a pointer to a string. + * PB_RETURN_ERROR() sets the error and returns false from current + * function. + */ +#ifdef PB_NO_ERRMSG +#define PB_SET_ERROR(stream, msg) PB_UNUSED(stream) +#define PB_GET_ERROR(stream) "(errmsg disabled)" +#else +#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg)) +#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)") +#endif + +#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false + +#endif diff --git a/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/pb_common.h b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/pb_common.h new file mode 100644 index 0000000..60b3d37 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/pb_common.h @@ -0,0 +1,42 @@ +/* pb_common.h: Common support functions for pb_encode.c and pb_decode.c. + * These functions are rarely needed by applications directly. + */ + +#ifndef PB_COMMON_H_INCLUDED +#define PB_COMMON_H_INCLUDED + +#include "pb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Iterator for pb_field_t list */ +struct pb_field_iter_s { + const pb_field_t *start; /* Start of the pb_field_t array */ + const pb_field_t *pos; /* Current position of the iterator */ + unsigned required_field_index; /* Zero-based index that counts only the required fields */ + void *dest_struct; /* Pointer to start of the structure */ + void *pData; /* Pointer to current field value */ + void *pSize; /* Pointer to count/has field */ +}; +typedef struct pb_field_iter_s pb_field_iter_t; + +/* Initialize the field iterator structure to beginning. + * Returns false if the message type is empty. */ +bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct); + +/* Advance the iterator to the next field. + * Returns false when the iterator wraps back to the first field. */ +bool pb_field_iter_next(pb_field_iter_t *iter); + +/* Advance the iterator until it points at a field with the given tag. + * Returns false if no such field exists. */ +bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif + diff --git a/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/pb_decode.h b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/pb_decode.h new file mode 100644 index 0000000..3577c20 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/pb_decode.h @@ -0,0 +1,178 @@ +/* pb_decode.h: Functions to decode protocol buffers. Depends on pb_decode.c. + * The main function is pb_decode. You also need an input stream, and the + * field descriptions created by nanopb_generator.py. + */ + +#ifndef PB_DECODE_H_INCLUDED +#define PB_DECODE_H_INCLUDED + +#include "pb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Structure for defining custom input streams. You will need to provide + * a callback function to read the bytes from your storage, which can be + * for example a file or a network socket. + * + * The callback must conform to these rules: + * + * 1) Return false on IO errors. This will cause decoding to abort. + * 2) You can use state to store your own data (e.g. buffer pointer), + * and rely on pb_read to verify that no-body reads past bytes_left. + * 3) Your callback may be used with substreams, in which case bytes_left + * is different than from the main stream. Don't use bytes_left to compute + * any pointers. + */ +struct pb_istream_s +{ +#ifdef PB_BUFFER_ONLY + /* Callback pointer is not used in buffer-only configuration. + * Having an int pointer here allows binary compatibility but + * gives an error if someone tries to assign callback function. + */ + int *callback; +#else + bool (*callback)(pb_istream_t *stream, pb_byte_t *buf, size_t count); +#endif + + void *state; /* Free field for use by callback implementation */ + size_t bytes_left; + +#ifndef PB_NO_ERRMSG + const char *errmsg; +#endif +}; + +/*************************** + * Main decoding functions * + ***************************/ + +/* Decode a single protocol buffers message from input stream into a C structure. + * Returns true on success, false on any failure. + * The actual struct pointed to by dest must match the description in fields. + * Callback fields of the destination structure must be initialized by caller. + * All other fields will be initialized by this function. + * + * Example usage: + * MyMessage msg = {}; + * uint8_t buffer[64]; + * pb_istream_t stream; + * + * // ... read some data into buffer ... + * + * stream = pb_istream_from_buffer(buffer, count); + * pb_decode(&stream, MyMessage_fields, &msg); + */ +bool pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); + +/* Same as pb_decode, except does not initialize the destination structure + * to default values. This is slightly faster if you need no default values + * and just do memset(struct, 0, sizeof(struct)) yourself. + * + * This can also be used for 'merging' two messages, i.e. update only the + * fields that exist in the new message. + * + * Note: If this function returns with an error, it will not release any + * dynamically allocated fields. You will need to call pb_release() yourself. + */ +bool pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); + +/* Same as pb_decode, except expects the stream to start with the message size + * encoded as varint. Corresponds to parseDelimitedFrom() in Google's + * protobuf API. + */ +bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); + +/* Same as pb_decode_delimited, except that it does not initialize the destination structure. + * See pb_decode_noinit + */ +bool pb_decode_delimited_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); + +/* Same as pb_decode, except allows the message to be terminated with a null byte. + * NOTE: Until nanopb-0.4.0, pb_decode() also allows null-termination. This behaviour + * is not supported in most other protobuf implementations, so pb_decode_delimited() + * is a better option for compatibility. + */ +bool pb_decode_nullterminated(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); + +#ifdef PB_ENABLE_MALLOC +/* Release any allocated pointer fields. If you use dynamic allocation, you should + * call this for any successfully decoded message when you are done with it. If + * pb_decode() returns with an error, the message is already released. + */ +void pb_release(const pb_field_t fields[], void *dest_struct); +#endif + + +/************************************** + * Functions for manipulating streams * + **************************************/ + +/* Create an input stream for reading from a memory buffer. + * + * Alternatively, you can use a custom stream that reads directly from e.g. + * a file or a network socket. + */ +pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize); + +/* Function to read from a pb_istream_t. You can use this if you need to + * read some custom header data, or to read data in field callbacks. + */ +bool pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count); + + +/************************************************ + * Helper functions for writing field callbacks * + ************************************************/ + +/* Decode the tag for the next field in the stream. Gives the wire type and + * field tag. At end of the message, returns false and sets eof to true. */ +bool pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof); + +/* Skip the field payload data, given the wire type. */ +bool pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type); + +/* Decode an integer in the varint format. This works for enum, int32, + * int64, uint32 and uint64 field types. */ +#ifndef PB_WITHOUT_64BIT +bool pb_decode_varint(pb_istream_t *stream, uint64_t *dest); +#else +#define pb_decode_varint pb_decode_varint32 +#endif + +/* Decode an integer in the varint format. This works for enum, int32, + * and uint32 field types. */ +bool pb_decode_varint32(pb_istream_t *stream, uint32_t *dest); + +/* Decode a bool value in varint format. */ +bool pb_decode_bool(pb_istream_t *stream, bool *dest); + +/* Decode an integer in the zig-zagged svarint format. This works for sint32 + * and sint64. */ +#ifndef PB_WITHOUT_64BIT +bool pb_decode_svarint(pb_istream_t *stream, int64_t *dest); +#else +bool pb_decode_svarint(pb_istream_t *stream, int32_t *dest); +#endif + +/* Decode a fixed32, sfixed32 or float value. You need to pass a pointer to + * a 4-byte wide C variable. */ +bool pb_decode_fixed32(pb_istream_t *stream, void *dest); + +#ifndef PB_WITHOUT_64BIT +/* Decode a fixed64, sfixed64 or double value. You need to pass a pointer to + * a 8-byte wide C variable. */ +bool pb_decode_fixed64(pb_istream_t *stream, void *dest); +#endif + +/* Make a limited-length substream for reading a PB_WT_STRING field. */ +bool pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream); +bool pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/pb_encode.h b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/pb_encode.h new file mode 100644 index 0000000..8bf78dd --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Headers/pb_encode.h @@ -0,0 +1,170 @@ +/* pb_encode.h: Functions to encode protocol buffers. Depends on pb_encode.c. + * The main function is pb_encode. You also need an output stream, and the + * field descriptions created by nanopb_generator.py. + */ + +#ifndef PB_ENCODE_H_INCLUDED +#define PB_ENCODE_H_INCLUDED + +#include "pb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Structure for defining custom output streams. You will need to provide + * a callback function to write the bytes to your storage, which can be + * for example a file or a network socket. + * + * The callback must conform to these rules: + * + * 1) Return false on IO errors. This will cause encoding to abort. + * 2) You can use state to store your own data (e.g. buffer pointer). + * 3) pb_write will update bytes_written after your callback runs. + * 4) Substreams will modify max_size and bytes_written. Don't use them + * to calculate any pointers. + */ +struct pb_ostream_s +{ +#ifdef PB_BUFFER_ONLY + /* Callback pointer is not used in buffer-only configuration. + * Having an int pointer here allows binary compatibility but + * gives an error if someone tries to assign callback function. + * Also, NULL pointer marks a 'sizing stream' that does not + * write anything. + */ + int *callback; +#else + bool (*callback)(pb_ostream_t *stream, const pb_byte_t *buf, size_t count); +#endif + void *state; /* Free field for use by callback implementation. */ + size_t max_size; /* Limit number of output bytes written (or use SIZE_MAX). */ + size_t bytes_written; /* Number of bytes written so far. */ + +#ifndef PB_NO_ERRMSG + const char *errmsg; +#endif +}; + +/*************************** + * Main encoding functions * + ***************************/ + +/* Encode a single protocol buffers message from C structure into a stream. + * Returns true on success, false on any failure. + * The actual struct pointed to by src_struct must match the description in fields. + * All required fields in the struct are assumed to have been filled in. + * + * Example usage: + * MyMessage msg = {}; + * uint8_t buffer[64]; + * pb_ostream_t stream; + * + * msg.field1 = 42; + * stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); + * pb_encode(&stream, MyMessage_fields, &msg); + */ +bool pb_encode(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); + +/* Same as pb_encode, but prepends the length of the message as a varint. + * Corresponds to writeDelimitedTo() in Google's protobuf API. + */ +bool pb_encode_delimited(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); + +/* Same as pb_encode, but appends a null byte to the message for termination. + * NOTE: This behaviour is not supported in most other protobuf implementations, so pb_encode_delimited() + * is a better option for compatibility. + */ +bool pb_encode_nullterminated(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); + +/* Encode the message to get the size of the encoded data, but do not store + * the data. */ +bool pb_get_encoded_size(size_t *size, const pb_field_t fields[], const void *src_struct); + +/************************************** + * Functions for manipulating streams * + **************************************/ + +/* Create an output stream for writing into a memory buffer. + * The number of bytes written can be found in stream.bytes_written after + * encoding the message. + * + * Alternatively, you can use a custom stream that writes directly to e.g. + * a file or a network socket. + */ +pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize); + +/* Pseudo-stream for measuring the size of a message without actually storing + * the encoded data. + * + * Example usage: + * MyMessage msg = {}; + * pb_ostream_t stream = PB_OSTREAM_SIZING; + * pb_encode(&stream, MyMessage_fields, &msg); + * printf("Message size is %d\n", stream.bytes_written); + */ +#ifndef PB_NO_ERRMSG +#define PB_OSTREAM_SIZING {0,0,0,0,0} +#else +#define PB_OSTREAM_SIZING {0,0,0,0} +#endif + +/* Function to write into a pb_ostream_t stream. You can use this if you need + * to append or prepend some custom headers to the message. + */ +bool pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count); + + +/************************************************ + * Helper functions for writing field callbacks * + ************************************************/ + +/* Encode field header based on type and field number defined in the field + * structure. Call this from the callback before writing out field contents. */ +bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_t *field); + +/* Encode field header by manually specifing wire type. You need to use this + * if you want to write out packed arrays from a callback field. */ +bool pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number); + +/* Encode an integer in the varint format. + * This works for bool, enum, int32, int64, uint32 and uint64 field types. */ +#ifndef PB_WITHOUT_64BIT +bool pb_encode_varint(pb_ostream_t *stream, uint64_t value); +#else +bool pb_encode_varint(pb_ostream_t *stream, uint32_t value); +#endif + +/* Encode an integer in the zig-zagged svarint format. + * This works for sint32 and sint64. */ +#ifndef PB_WITHOUT_64BIT +bool pb_encode_svarint(pb_ostream_t *stream, int64_t value); +#else +bool pb_encode_svarint(pb_ostream_t *stream, int32_t value); +#endif + +/* Encode a string or bytes type field. For strings, pass strlen(s) as size. */ +bool pb_encode_string(pb_ostream_t *stream, const pb_byte_t *buffer, size_t size); + +/* Encode a fixed32, sfixed32 or float value. + * You need to pass a pointer to a 4-byte wide C variable. */ +bool pb_encode_fixed32(pb_ostream_t *stream, const void *value); + +#ifndef PB_WITHOUT_64BIT +/* Encode a fixed64, sfixed64 or double value. + * You need to pass a pointer to a 8-byte wide C variable. */ +bool pb_encode_fixed64(pb_ostream_t *stream, const void *value); +#endif + +/* Encode a submessage field. + * You need to pass the pb_field_t array and pointer to struct, just like + * with pb_encode(). This internally encodes the submessage twice, first to + * calculate message size and then to actually write it out. + */ +bool pb_encode_submessage(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/ios/EmbeddedFrameworksSim/nanopb.framework/Info.plist b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Info.plist new file mode 100644 index 0000000..c16b129 Binary files /dev/null and b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Info.plist differ diff --git a/src/ios/EmbeddedFrameworksSim/nanopb.framework/Modules/module.modulemap b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Modules/module.modulemap new file mode 100644 index 0000000..e8d4b53 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/nanopb.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module nanopb { + umbrella header "nanopb-umbrella.h" + + export * + module * { export * } +} diff --git a/src/ios/EmbeddedFrameworksSim/nanopb.framework/_CodeSignature/CodeResources b/src/ios/EmbeddedFrameworksSim/nanopb.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..53935b8 --- /dev/null +++ b/src/ios/EmbeddedFrameworksSim/nanopb.framework/_CodeSignature/CodeResources @@ -0,0 +1,192 @@ + + + + + files + + Headers/nanopb-umbrella.h + + 3AHKVvUiwH5st6WulWFEieJUQMI= + + Headers/pb.h + + az8iWOkZacekqg3N1rQF6ugIfTA= + + Headers/pb_common.h + + AdSOtv4HeHxYwkFyKB6MbxGs1Ns= + + Headers/pb_decode.h + + 71k8w9HgFHTP3y98V/i9ExE9UYU= + + Headers/pb_encode.h + + 6/gafH6qX9WyvTK0TqL9Dpy3Qys= + + Info.plist + + BNkmz/U98IHVty6Qd6YZsivtfPk= + + Modules/module.modulemap + + VE0n+HvVm7YDki/SnnYSYzJdaOE= + + + files2 + + Headers/nanopb-umbrella.h + + hash + + 3AHKVvUiwH5st6WulWFEieJUQMI= + + hash2 + + ua0swQdCw9NqdpzW1vnyfp6Sep7qcaFrByRxT8BolY0= + + + Headers/pb.h + + hash + + az8iWOkZacekqg3N1rQF6ugIfTA= + + hash2 + + lLB3CA75JLYHM+Tov6hodGTwuSY25M7QrmgAgivj6wY= + + + Headers/pb_common.h + + hash + + AdSOtv4HeHxYwkFyKB6MbxGs1Ns= + + hash2 + + PtDnUYzSxgTyYx84uo0xGdqu6zxbOcttuWjKVAMtdUE= + + + Headers/pb_decode.h + + hash + + 71k8w9HgFHTP3y98V/i9ExE9UYU= + + hash2 + + rf5T82EuZcRWFPEpIm6LAN3nzI8c9+0y61h2WYpbKJQ= + + + Headers/pb_encode.h + + hash + + 6/gafH6qX9WyvTK0TqL9Dpy3Qys= + + hash2 + + J5QP7VKFBpKH/6nLRdy2Oc1TFbCenMNCROzTx2Di2T4= + + + Modules/module.modulemap + + hash + + VE0n+HvVm7YDki/SnnYSYzJdaOE= + + hash2 + + 964ewTQFnBAQHHPXRiTBEL9kMV+4JU4sMGWXVlK03/s= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/src/ios/EmbeddedFrameworksSim/nanopb.framework/nanopb b/src/ios/EmbeddedFrameworksSim/nanopb.framework/nanopb new file mode 100755 index 0000000..b1eb6c1 Binary files /dev/null and b/src/ios/EmbeddedFrameworksSim/nanopb.framework/nanopb differ diff --git a/src/ios/GoogleService-Info.plist b/src/ios/GoogleService-Info.plist new file mode 100644 index 0000000..5488a07 --- /dev/null +++ b/src/ios/GoogleService-Info.plist @@ -0,0 +1,38 @@ + + + + + CLIENT_ID + 269847656539-68a88n853uauiflldm7ksu8fungbt53f.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.269847656539-68a88n853uauiflldm7ksu8fungbt53f + ANDROID_CLIENT_ID + 269847656539-hm7n42af4qr8ndmu4hkqtfr9qauss53t.apps.googleusercontent.com + API_KEY + AIzaSyC_LgDXzWxRCS8T4YaBi52y_CP57W9_pXs + GCM_SENDER_ID + 269847656539 + PLIST_VERSION + 1 + BUNDLE_ID + com.coronalabs.firebase.messaging + PROJECT_ID + leafy-valor-187712 + STORAGE_BUCKET + leafy-valor-187712.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:269847656539:ios:57128d3b378f61168b677e + DATABASE_URL + https://leafy-valor-187712.firebaseio.com + + \ No newline at end of file diff --git a/src/ios/NotificationsV2.xcodeproj/project.pbxproj b/src/ios/NotificationsV2.xcodeproj/project.pbxproj new file mode 100644 index 0000000..054152b --- /dev/null +++ b/src/ios/NotificationsV2.xcodeproj/project.pbxproj @@ -0,0 +1,1076 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + A447B610165D72FB009EA762 /* AppCoronaDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = A447B60F165D72FB009EA762 /* AppCoronaDelegate.mm */; }; + A447B6671666FD02009EA762 /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = A447B6641666FD02009EA762 /* MainWindow-iPad.xib */; }; + A447B6681666FD02009EA762 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A447B6651666FD02009EA762 /* MainWindow.xib */; }; + A447B66A1666FD43009EA762 /* Corona3rdPartyLicenses.txt in Resources */ = {isa = PBXBuildFile; fileRef = A447B6691666FD43009EA762 /* Corona3rdPartyLicenses.txt */; }; + A46885F218068C2200381941 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484112315114F700074BD57 /* GLKit.framework */; }; + A46885F418068C2900381941 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A46885F318068C2900381941 /* CoreVideo.framework */; }; + A484111E15114F700074BD57 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484111D15114F700074BD57 /* UIKit.framework */; }; + A484112015114F700074BD57 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484111F15114F700074BD57 /* Foundation.framework */; }; + A484112215114F700074BD57 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484112115114F700074BD57 /* CoreGraphics.framework */; }; + A484112615114F700074BD57 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484112515114F700074BD57 /* OpenGLES.framework */; }; + A484112C15114F700074BD57 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A484112A15114F700074BD57 /* InfoPlist.strings */; }; + A484112E15114F700074BD57 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = A484112D15114F700074BD57 /* main.mm */; }; + A484117715128D5D0074BD57 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116315128D5C0074BD57 /* AddressBook.framework */; }; + A484117815128D5D0074BD57 /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116415128D5C0074BD57 /* AddressBookUI.framework */; }; + A484117915128D5D0074BD57 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116515128D5C0074BD57 /* AudioToolbox.framework */; }; + A484117A15128D5D0074BD57 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116615128D5C0074BD57 /* AVFoundation.framework */; }; + A484117B15128D5D0074BD57 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116715128D5C0074BD57 /* CFNetwork.framework */; }; + A484117C15128D5D0074BD57 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116815128D5C0074BD57 /* CoreLocation.framework */; }; + A484117D15128D5D0074BD57 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116915128D5C0074BD57 /* CoreMedia.framework */; }; + A484117E15128D5D0074BD57 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116A15128D5C0074BD57 /* CoreMotion.framework */; }; + A484117F15128D5D0074BD57 /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116B15128D5D0074BD57 /* GameKit.framework */; }; + A484118015128D5D0074BD57 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116C15128D5D0074BD57 /* ImageIO.framework */; }; + A484118115128D5D0074BD57 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116D15128D5D0074BD57 /* libobjc.dylib */; }; + A484118215128D5D0074BD57 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116E15128D5D0074BD57 /* MapKit.framework */; }; + A484118315128D5D0074BD57 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116F15128D5D0074BD57 /* MediaPlayer.framework */; }; + A484118415128D5D0074BD57 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117015128D5D0074BD57 /* MessageUI.framework */; }; + A484118515128D5D0074BD57 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117115128D5D0074BD57 /* MobileCoreServices.framework */; }; + A484118615128D5D0074BD57 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117215128D5D0074BD57 /* OpenAL.framework */; }; + A484118715128D5D0074BD57 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117315128D5D0074BD57 /* QuartzCore.framework */; }; + A484118815128D5D0074BD57 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117415128D5D0074BD57 /* Security.framework */; }; + A484118915128D5D0074BD57 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117515128D5D0074BD57 /* StoreKit.framework */; }; + A484118A15128D5D0074BD57 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117615128D5D0074BD57 /* SystemConfiguration.framework */; }; + A48411CA15129F610074BD57 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A48411C915129F610074BD57 /* libsqlite3.dylib */; }; + A498B81A16D70EFC0091A148 /* CoronaResources.bundle in Resources */ = {isa = PBXBuildFile; fileRef = A498B81916D70EFC0091A148 /* CoronaResources.bundle */; }; + A4C2449A1683FA5300C395D1 /* Accounts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4C244971683FA5300C395D1 /* Accounts.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + A4C2449C1683FA5300C395D1 /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4C244991683FA5300C395D1 /* Social.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + A4E2537F166AE3DC00DCDC2C /* Twitter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4E2537E166AE3DC00DCDC2C /* Twitter.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + C22C1E4B1E981D9000D74196 /* LaunchScreen.storyboardc in Resources */ = {isa = PBXBuildFile; fileRef = C22C1E4A1E981D9000D74196 /* LaunchScreen.storyboardc */; }; + E640B2F21BFC00B00031FAE9 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E640B2F11BFC00B00031FAE9 /* AssetsLibrary.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + E640B2F41BFC00BA0031FAE9 /* Photos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E640B2F31BFC00BA0031FAE9 /* Photos.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + F51C66D61EE0D3B20040E4BE /* libNotificationsV2Plugin.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A4E253E2166DE7C800DCDC2C /* libNotificationsV2Plugin.a */; }; + F535649B2598AC7400F9A089 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A484112A15114F700074BD57 /* InfoPlist.strings */; }; + F535649C2598AC7400F9A089 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F56712391F73451B006B502D /* Images.xcassets */; }; + F535649D2598AC7400F9A089 /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = A447B6641666FD02009EA762 /* MainWindow-iPad.xib */; }; + F535649E2598AC7400F9A089 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A447B6651666FD02009EA762 /* MainWindow.xib */; }; + F535649F2598AC7400F9A089 /* _CoronaSplashScreen.png in Resources */ = {isa = PBXBuildFile; fileRef = C277D3B51EBB9F8E00966BA1 /* _CoronaSplashScreen.png */; }; + F53564A02598AC7400F9A089 /* Corona3rdPartyLicenses.txt in Resources */ = {isa = PBXBuildFile; fileRef = A447B6691666FD43009EA762 /* Corona3rdPartyLicenses.txt */; }; + F53564A12598AC7400F9A089 /* CoronaResources.bundle in Resources */ = {isa = PBXBuildFile; fileRef = A498B81916D70EFC0091A148 /* CoronaResources.bundle */; }; + F53564A22598AC7400F9A089 /* LaunchScreen.storyboardc in Resources */ = {isa = PBXBuildFile; fileRef = C22C1E4A1E981D9000D74196 /* LaunchScreen.storyboardc */; }; + F53564A42598AC7400F9A089 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = A484112D15114F700074BD57 /* main.mm */; }; + F53564A52598AC7400F9A089 /* AppCoronaDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = A447B60F165D72FB009EA762 /* AppCoronaDelegate.mm */; }; + F53564A82598AC7400F9A089 /* Photos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E640B2F31BFC00BA0031FAE9 /* Photos.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + F53564AB2598AC7400F9A089 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E640B2F11BFC00B00031FAE9 /* AssetsLibrary.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + F53564AC2598AC7400F9A089 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5BB41521BC42ACF0033F6FA /* CoreText.framework */; }; + F53564AD2598AC7400F9A089 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A46885F318068C2900381941 /* CoreVideo.framework */; }; + F53564AE2598AC7400F9A089 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484112315114F700074BD57 /* GLKit.framework */; }; + F53564B02598AC7400F9A089 /* Accounts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4C244971683FA5300C395D1 /* Accounts.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + F53564B12598AC7400F9A089 /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4C244991683FA5300C395D1 /* Social.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + F53564B32598AC7400F9A089 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116315128D5C0074BD57 /* AddressBook.framework */; }; + F53564B42598AC7400F9A089 /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116415128D5C0074BD57 /* AddressBookUI.framework */; }; + F53564B52598AC7400F9A089 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116515128D5C0074BD57 /* AudioToolbox.framework */; }; + F53564B62598AC7400F9A089 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116615128D5C0074BD57 /* AVFoundation.framework */; }; + F53564B72598AC7400F9A089 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116715128D5C0074BD57 /* CFNetwork.framework */; }; + F53564B82598AC7400F9A089 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484112115114F700074BD57 /* CoreGraphics.framework */; }; + F53564B92598AC7400F9A089 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116815128D5C0074BD57 /* CoreLocation.framework */; }; + F53564BA2598AC7400F9A089 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116915128D5C0074BD57 /* CoreMedia.framework */; }; + F53564BB2598AC7400F9A089 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116A15128D5C0074BD57 /* CoreMotion.framework */; }; + F53564BC2598AC7400F9A089 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484111F15114F700074BD57 /* Foundation.framework */; }; + F53564BD2598AC7400F9A089 /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116B15128D5D0074BD57 /* GameKit.framework */; }; + F53564BE2598AC7400F9A089 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5E548081BE7FF0200091810 /* GameController.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + F53564BF2598AC7400F9A089 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116C15128D5D0074BD57 /* ImageIO.framework */; }; + F53564C02598AC7400F9A089 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116D15128D5D0074BD57 /* libobjc.dylib */; }; + F53564C12598AC7400F9A089 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A48411C915129F610074BD57 /* libsqlite3.dylib */; }; + F53564C22598AC7400F9A089 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116E15128D5D0074BD57 /* MapKit.framework */; }; + F53564C32598AC7400F9A089 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484116F15128D5D0074BD57 /* MediaPlayer.framework */; }; + F53564C42598AC7400F9A089 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117015128D5D0074BD57 /* MessageUI.framework */; }; + F53564C52598AC7400F9A089 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117115128D5D0074BD57 /* MobileCoreServices.framework */; }; + F53564C62598AC7400F9A089 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117215128D5D0074BD57 /* OpenAL.framework */; }; + F53564C82598AC7400F9A089 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484112515114F700074BD57 /* OpenGLES.framework */; }; + F53564C92598AC7400F9A089 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117315128D5D0074BD57 /* QuartzCore.framework */; }; + F53564CA2598AC7400F9A089 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117415128D5D0074BD57 /* Security.framework */; }; + F53564CB2598AC7400F9A089 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117515128D5D0074BD57 /* StoreKit.framework */; }; + F53564CC2598AC7400F9A089 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484117615128D5D0074BD57 /* SystemConfiguration.framework */; }; + F53564CE2598AC7400F9A089 /* Twitter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4E2537E166AE3DC00DCDC2C /* Twitter.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + F53564CF2598AC7400F9A089 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A484111D15114F700074BD57 /* UIKit.framework */; }; + F53564E82598ACF200F9A089 /* libNotificationsV2Plugin.firebase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F53564952598AC6C00F9A089 /* libNotificationsV2Plugin.firebase.a */; }; + F53565632598D08500F9A089 /* FirebaseCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F583389F23EA7ABB00E0B97E /* FirebaseCore.framework */; }; + F53565642598D08500F9A089 /* FirebaseCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F583389F23EA7ABB00E0B97E /* FirebaseCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F53565662598D08700F9A089 /* FirebaseInstanceID.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F583389E23EA7ABB00E0B97E /* FirebaseInstanceID.framework */; }; + F53565672598D08700F9A089 /* FirebaseInstanceID.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F583389E23EA7ABB00E0B97E /* FirebaseInstanceID.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F53565682598D08900F9A089 /* FirebaseMessaging.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F583389C23EA7ABB00E0B97E /* FirebaseMessaging.framework */; }; + F53565692598D08900F9A089 /* FirebaseMessaging.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F583389C23EA7ABB00E0B97E /* FirebaseMessaging.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F535656A2598D0DA00F9A089 /* FirebaseInstallations.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F583389D23EA7ABB00E0B97E /* FirebaseInstallations.framework */; }; + F535656B2598D0DA00F9A089 /* FirebaseInstallations.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F583389D23EA7ABB00E0B97E /* FirebaseInstallations.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F535656C2598D11900F9A089 /* GoogleUtilities.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F58338A123EA7ABB00E0B97E /* GoogleUtilities.framework */; }; + F535656D2598D11900F9A089 /* GoogleUtilities.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F58338A123EA7ABB00E0B97E /* GoogleUtilities.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F535656F2598D14B00F9A089 /* FirebaseCoreDiagnostics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F535656E2598D14B00F9A089 /* FirebaseCoreDiagnostics.framework */; }; + F53565702598D14B00F9A089 /* FirebaseCoreDiagnostics.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F535656E2598D14B00F9A089 /* FirebaseCoreDiagnostics.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F53565722598D17200F9A089 /* GoogleDataTransport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F53565712598D17200F9A089 /* GoogleDataTransport.framework */; }; + F53565732598D17200F9A089 /* GoogleDataTransport.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F53565712598D17200F9A089 /* GoogleDataTransport.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F53565752598D18E00F9A089 /* nanopb.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F53565742598D18E00F9A089 /* nanopb.framework */; }; + F53565762598D18E00F9A089 /* nanopb.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F53565742598D18E00F9A089 /* nanopb.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F53565772598D1BE00F9A089 /* FBLPromises.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F58338A023EA7ABB00E0B97E /* FBLPromises.framework */; }; + F53565782598D1BE00F9A089 /* FBLPromises.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F58338A023EA7ABB00E0B97E /* FBLPromises.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F56457D91FA108F500EC8C29 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F56712391F73451B006B502D /* Images.xcassets */; }; + F5BB41531BC42ACF0033F6FA /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5BB41521BC42ACF0033F6FA /* CoreText.framework */; }; + F5C9F4811ED39AD100D34A2D /* _CoronaSplashScreen.png in Resources */ = {isa = PBXBuildFile; fileRef = C277D3B51EBB9F8E00966BA1 /* _CoronaSplashScreen.png */; }; + F5E548091BE7FF0200091810 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5E548081BE7FF0200091810 /* GameController.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + A4E253E1166DE7C800DCDC2C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A4E253DA166DE7C800DCDC2C /* Plugin.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = A4E253B6166D6FB300DCDC2C; + remoteInfo = plugin_library; + }; + A4E253E3166DE7D800DCDC2C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A4E253DA166DE7C800DCDC2C /* Plugin.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = A4E253B5166D6FB300DCDC2C; + remoteInfo = plugin_library; + }; + F53564942598AC6C00F9A089 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A4E253DA166DE7C800DCDC2C /* Plugin.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = F53564902598ABD300F9A089; + remoteInfo = NotificationsV2Plugin.firebase; + }; + F53564E62598ACE500F9A089 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A4E253DA166DE7C800DCDC2C /* Plugin.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = F53564832598ABD300F9A089; + remoteInfo = NotificationsV2Plugin.firebase; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + F53565652598D08500F9A089 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F53565692598D08900F9A089 /* FirebaseMessaging.framework in Embed Frameworks */, + F535656B2598D0DA00F9A089 /* FirebaseInstallations.framework in Embed Frameworks */, + F53565762598D18E00F9A089 /* nanopb.framework in Embed Frameworks */, + F53565642598D08500F9A089 /* FirebaseCore.framework in Embed Frameworks */, + F53565732598D17200F9A089 /* GoogleDataTransport.framework in Embed Frameworks */, + F53565702598D14B00F9A089 /* FirebaseCoreDiagnostics.framework in Embed Frameworks */, + F53565782598D1BE00F9A089 /* FBLPromises.framework in Embed Frameworks */, + F535656D2598D11900F9A089 /* GoogleUtilities.framework in Embed Frameworks */, + F53565672598D08700F9A089 /* FirebaseInstanceID.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F58338AC23EA7AF700E0B97E /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + A447B60E165D72FB009EA762 /* AppCoronaDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppCoronaDelegate.h; sourceTree = SOURCE_ROOT; }; + A447B60F165D72FB009EA762 /* AppCoronaDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppCoronaDelegate.mm; sourceTree = SOURCE_ROOT; }; + A447B6641666FD02009EA762 /* MainWindow-iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "MainWindow-iPad.xib"; path = "Corona/ios/resource/MainWindow-iPad.xib"; sourceTree = ""; }; + A447B6651666FD02009EA762 /* MainWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = MainWindow.xib; path = Corona/ios/resource/MainWindow.xib; sourceTree = ""; }; + A447B6691666FD43009EA762 /* Corona3rdPartyLicenses.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Corona3rdPartyLicenses.txt; path = Corona/shared/resource/Corona3rdPartyLicenses.txt; sourceTree = ""; }; + A447B824166856F3009EA762 /* main.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = main.lua; path = ../Corona/main.lua; sourceTree = SOURCE_ROOT; }; + A46885F318068C2900381941 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + A484111915114F700074BD57 /* Notifications.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Notifications.app; sourceTree = BUILT_PRODUCTS_DIR; }; + A484111D15114F700074BD57 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + A484111F15114F700074BD57 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + A484112115114F700074BD57 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + A484112315114F700074BD57 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; }; + A484112515114F700074BD57 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + A484112915114F700074BD57 /* App-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "App-Info.plist"; sourceTree = SOURCE_ROOT; }; + A484112B15114F700074BD57 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + A484112D15114F700074BD57 /* main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = SOURCE_ROOT; }; + A484112F15114F700074BD57 /* Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = SOURCE_ROOT; }; + A484116315128D5C0074BD57 /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; + A484116415128D5C0074BD57 /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; }; + A484116515128D5C0074BD57 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + A484116615128D5C0074BD57 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + A484116715128D5C0074BD57 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; + A484116815128D5C0074BD57 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; + A484116915128D5C0074BD57 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + A484116A15128D5C0074BD57 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; + A484116B15128D5D0074BD57 /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; }; + A484116C15128D5D0074BD57 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; + A484116D15128D5D0074BD57 /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = usr/lib/libobjc.dylib; sourceTree = SDKROOT; }; + A484116E15128D5D0074BD57 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; }; + A484116F15128D5D0074BD57 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; }; + A484117015128D5D0074BD57 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; + A484117115128D5D0074BD57 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; + A484117215128D5D0074BD57 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; + A484117315128D5D0074BD57 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + A484117415128D5D0074BD57 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + A484117515128D5D0074BD57 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; + A484117615128D5D0074BD57 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + A48411C915129F610074BD57 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; }; + A498B81916D70EFC0091A148 /* CoronaResources.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = CoronaResources.bundle; path = Corona/ios/resource/CoronaResources.bundle; sourceTree = ""; }; + A4C244971683FA5300C395D1 /* Accounts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accounts.framework; path = System/Library/Frameworks/Accounts.framework; sourceTree = SDKROOT; }; + A4C244991683FA5300C395D1 /* Social.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Social.framework; path = System/Library/Frameworks/Social.framework; sourceTree = SDKROOT; }; + A4E2537E166AE3DC00DCDC2C /* Twitter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Twitter.framework; path = System/Library/Frameworks/Twitter.framework; sourceTree = SDKROOT; }; + A4E253DA166DE7C800DCDC2C /* Plugin.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = Plugin.xcodeproj; sourceTree = ""; }; + C22C1E4A1E981D9000D74196 /* LaunchScreen.storyboardc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.storyboardc; name = LaunchScreen.storyboardc; path = ../Corona/LaunchScreen.storyboardc; sourceTree = ""; }; + C277D3B51EBB9F8E00966BA1 /* _CoronaSplashScreen.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = _CoronaSplashScreen.png; sourceTree = ""; }; + E640B2F11BFC00B00031FAE9 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; }; + E640B2F31BFC00BA0031FAE9 /* Photos.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Photos.framework; path = System/Library/Frameworks/Photos.framework; sourceTree = SDKROOT; }; + F53564E02598AC7400F9A089 /* NotificationsFirebase.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NotificationsFirebase.app; sourceTree = BUILT_PRODUCTS_DIR; }; + F535656E2598D14B00F9A089 /* FirebaseCoreDiagnostics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FirebaseCoreDiagnostics.framework; path = EmbeddedFrameworks/FirebaseCoreDiagnostics.framework; sourceTree = ""; }; + F53565712598D17200F9A089 /* GoogleDataTransport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GoogleDataTransport.framework; path = EmbeddedFrameworks/GoogleDataTransport.framework; sourceTree = ""; }; + F53565742598D18E00F9A089 /* nanopb.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = nanopb.framework; path = EmbeddedFrameworks/nanopb.framework; sourceTree = ""; }; + F54A40BD1EE07F9100AF417D /* build.settings */ = {isa = PBXFileReference; lastKnownFileType = text; name = build.settings; path = ../Corona/build.settings; sourceTree = ""; }; + F54A40BE1EE07F9100AF417D /* config.lua */ = {isa = PBXFileReference; lastKnownFileType = text; name = config.lua; path = ../Corona/config.lua; sourceTree = ""; }; + F55829801ED23E1200E5808C /* CoronaApp.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CoronaApp.xcconfig; sourceTree = ""; }; + F5594FE723E9793C007AB768 /* NotificationsV2Sample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NotificationsV2Sample.entitlements; sourceTree = ""; }; + F56712391F73451B006B502D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ../Corona/Images.xcassets; sourceTree = ""; }; + F572F8191EE06E45001BC814 /* CoronaNative.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = CoronaNative.xcconfig; sourceTree = ""; }; + F583389C23EA7ABB00E0B97E /* FirebaseMessaging.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FirebaseMessaging.framework; path = EmbeddedFrameworks/FirebaseMessaging.framework; sourceTree = ""; }; + F583389D23EA7ABB00E0B97E /* FirebaseInstallations.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FirebaseInstallations.framework; path = EmbeddedFrameworks/FirebaseInstallations.framework; sourceTree = ""; }; + F583389E23EA7ABB00E0B97E /* FirebaseInstanceID.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FirebaseInstanceID.framework; path = EmbeddedFrameworks/FirebaseInstanceID.framework; sourceTree = ""; }; + F583389F23EA7ABB00E0B97E /* FirebaseCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FirebaseCore.framework; path = EmbeddedFrameworks/FirebaseCore.framework; sourceTree = ""; }; + F58338A023EA7ABB00E0B97E /* FBLPromises.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FBLPromises.framework; path = EmbeddedFrameworks/FBLPromises.framework; sourceTree = ""; }; + F58338A123EA7ABB00E0B97E /* GoogleUtilities.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GoogleUtilities.framework; path = EmbeddedFrameworks/GoogleUtilities.framework; sourceTree = ""; }; + F58338A223EA7ABB00E0B97E /* protobuf.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = protobuf.framework; path = EmbeddedFrameworks/protobuf.framework; sourceTree = ""; }; + F5BB41521BC42ACF0033F6FA /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; }; + F5E548081BE7FF0200091810 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A484111615114F700074BD57 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F51C66D61EE0D3B20040E4BE /* libNotificationsV2Plugin.a in Frameworks */, + E640B2F41BFC00BA0031FAE9 /* Photos.framework in Frameworks */, + E640B2F21BFC00B00031FAE9 /* AssetsLibrary.framework in Frameworks */, + F5BB41531BC42ACF0033F6FA /* CoreText.framework in Frameworks */, + A46885F418068C2900381941 /* CoreVideo.framework in Frameworks */, + A46885F218068C2200381941 /* GLKit.framework in Frameworks */, + A4C2449A1683FA5300C395D1 /* Accounts.framework in Frameworks */, + A4C2449C1683FA5300C395D1 /* Social.framework in Frameworks */, + A484117715128D5D0074BD57 /* AddressBook.framework in Frameworks */, + A484117815128D5D0074BD57 /* AddressBookUI.framework in Frameworks */, + A484117915128D5D0074BD57 /* AudioToolbox.framework in Frameworks */, + A484117A15128D5D0074BD57 /* AVFoundation.framework in Frameworks */, + A484117B15128D5D0074BD57 /* CFNetwork.framework in Frameworks */, + A484112215114F700074BD57 /* CoreGraphics.framework in Frameworks */, + A484117C15128D5D0074BD57 /* CoreLocation.framework in Frameworks */, + A484117D15128D5D0074BD57 /* CoreMedia.framework in Frameworks */, + A484117E15128D5D0074BD57 /* CoreMotion.framework in Frameworks */, + A484112015114F700074BD57 /* Foundation.framework in Frameworks */, + A484117F15128D5D0074BD57 /* GameKit.framework in Frameworks */, + F5E548091BE7FF0200091810 /* GameController.framework in Frameworks */, + A484118015128D5D0074BD57 /* ImageIO.framework in Frameworks */, + A484118115128D5D0074BD57 /* libobjc.dylib in Frameworks */, + A48411CA15129F610074BD57 /* libsqlite3.dylib in Frameworks */, + A484118215128D5D0074BD57 /* MapKit.framework in Frameworks */, + A484118315128D5D0074BD57 /* MediaPlayer.framework in Frameworks */, + A484118415128D5D0074BD57 /* MessageUI.framework in Frameworks */, + A484118515128D5D0074BD57 /* MobileCoreServices.framework in Frameworks */, + A484118615128D5D0074BD57 /* OpenAL.framework in Frameworks */, + A484112615114F700074BD57 /* OpenGLES.framework in Frameworks */, + A484118715128D5D0074BD57 /* QuartzCore.framework in Frameworks */, + A484118815128D5D0074BD57 /* Security.framework in Frameworks */, + A484118915128D5D0074BD57 /* StoreKit.framework in Frameworks */, + A484118A15128D5D0074BD57 /* SystemConfiguration.framework in Frameworks */, + A4E2537F166AE3DC00DCDC2C /* Twitter.framework in Frameworks */, + A484111E15114F700074BD57 /* UIKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F53564A62598AC7400F9A089 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F53564E82598ACF200F9A089 /* libNotificationsV2Plugin.firebase.a in Frameworks */, + F53564A82598AC7400F9A089 /* Photos.framework in Frameworks */, + F53564AB2598AC7400F9A089 /* AssetsLibrary.framework in Frameworks */, + F53565772598D1BE00F9A089 /* FBLPromises.framework in Frameworks */, + F53565722598D17200F9A089 /* GoogleDataTransport.framework in Frameworks */, + F53565662598D08700F9A089 /* FirebaseInstanceID.framework in Frameworks */, + F53564AC2598AC7400F9A089 /* CoreText.framework in Frameworks */, + F53565752598D18E00F9A089 /* nanopb.framework in Frameworks */, + F53564AD2598AC7400F9A089 /* CoreVideo.framework in Frameworks */, + F53564AE2598AC7400F9A089 /* GLKit.framework in Frameworks */, + F53564B02598AC7400F9A089 /* Accounts.framework in Frameworks */, + F53564B12598AC7400F9A089 /* Social.framework in Frameworks */, + F53564B32598AC7400F9A089 /* AddressBook.framework in Frameworks */, + F53564B42598AC7400F9A089 /* AddressBookUI.framework in Frameworks */, + F53564B52598AC7400F9A089 /* AudioToolbox.framework in Frameworks */, + F53564B62598AC7400F9A089 /* AVFoundation.framework in Frameworks */, + F535656F2598D14B00F9A089 /* FirebaseCoreDiagnostics.framework in Frameworks */, + F53564B72598AC7400F9A089 /* CFNetwork.framework in Frameworks */, + F53564B82598AC7400F9A089 /* CoreGraphics.framework in Frameworks */, + F53564B92598AC7400F9A089 /* CoreLocation.framework in Frameworks */, + F53564BA2598AC7400F9A089 /* CoreMedia.framework in Frameworks */, + F535656A2598D0DA00F9A089 /* FirebaseInstallations.framework in Frameworks */, + F53564BB2598AC7400F9A089 /* CoreMotion.framework in Frameworks */, + F53564BC2598AC7400F9A089 /* Foundation.framework in Frameworks */, + F53564BD2598AC7400F9A089 /* GameKit.framework in Frameworks */, + F53564BE2598AC7400F9A089 /* GameController.framework in Frameworks */, + F53564BF2598AC7400F9A089 /* ImageIO.framework in Frameworks */, + F53564C02598AC7400F9A089 /* libobjc.dylib in Frameworks */, + F53564C12598AC7400F9A089 /* libsqlite3.dylib in Frameworks */, + F53564C22598AC7400F9A089 /* MapKit.framework in Frameworks */, + F53564C32598AC7400F9A089 /* MediaPlayer.framework in Frameworks */, + F53564C42598AC7400F9A089 /* MessageUI.framework in Frameworks */, + F53564C52598AC7400F9A089 /* MobileCoreServices.framework in Frameworks */, + F53564C62598AC7400F9A089 /* OpenAL.framework in Frameworks */, + F53564C82598AC7400F9A089 /* OpenGLES.framework in Frameworks */, + F53564C92598AC7400F9A089 /* QuartzCore.framework in Frameworks */, + F53564CA2598AC7400F9A089 /* Security.framework in Frameworks */, + F53564CB2598AC7400F9A089 /* StoreKit.framework in Frameworks */, + F53564CC2598AC7400F9A089 /* SystemConfiguration.framework in Frameworks */, + F53565682598D08900F9A089 /* FirebaseMessaging.framework in Frameworks */, + F53564CE2598AC7400F9A089 /* Twitter.framework in Frameworks */, + F53565632598D08500F9A089 /* FirebaseCore.framework in Frameworks */, + F535656C2598D11900F9A089 /* GoogleUtilities.framework in Frameworks */, + F53564CF2598AC7400F9A089 /* UIKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A447B66F16670015009EA762 /* CoronaNative */ = { + isa = PBXGroup; + children = ( + F572F8191EE06E45001BC814 /* CoronaNative.xcconfig */, + F55829801ED23E1200E5808C /* CoronaApp.xcconfig */, + A4841153151161300074BD57 /* resource */, + ); + name = CoronaNative; + sourceTree = ""; + }; + A447B823166856C7009EA762 /* Corona */ = { + isa = PBXGroup; + children = ( + A447B824166856F3009EA762 /* main.lua */, + F54A40BD1EE07F9100AF417D /* build.settings */, + F54A40BE1EE07F9100AF417D /* config.lua */, + ); + name = Corona; + sourceTree = ""; + }; + A484110E15114F700074BD57 = { + isa = PBXGroup; + children = ( + F5594FE723E9793C007AB768 /* NotificationsV2Sample.entitlements */, + A4E253DA166DE7C800DCDC2C /* Plugin.xcodeproj */, + A484112715114F700074BD57 /* App */, + A447B823166856C7009EA762 /* Corona */, + A447B66F16670015009EA762 /* CoronaNative */, + A484111C15114F700074BD57 /* Frameworks */, + A484111A15114F700074BD57 /* Products */, + ); + sourceTree = ""; + }; + A484111A15114F700074BD57 /* Products */ = { + isa = PBXGroup; + children = ( + A484111915114F700074BD57 /* Notifications.app */, + F53564E02598AC7400F9A089 /* NotificationsFirebase.app */, + ); + name = Products; + sourceTree = ""; + }; + A484111C15114F700074BD57 /* Frameworks */ = { + isa = PBXGroup; + children = ( + F53565742598D18E00F9A089 /* nanopb.framework */, + F53565712598D17200F9A089 /* GoogleDataTransport.framework */, + F535656E2598D14B00F9A089 /* FirebaseCoreDiagnostics.framework */, + F583389B23EA7A9C00E0B97E /* Firebase */, + E640B2F31BFC00BA0031FAE9 /* Photos.framework */, + E640B2F11BFC00B00031FAE9 /* AssetsLibrary.framework */, + F5E548081BE7FF0200091810 /* GameController.framework */, + F5BB41521BC42ACF0033F6FA /* CoreText.framework */, + A46885F318068C2900381941 /* CoreVideo.framework */, + A4C244971683FA5300C395D1 /* Accounts.framework */, + A4C244991683FA5300C395D1 /* Social.framework */, + A484116315128D5C0074BD57 /* AddressBook.framework */, + A484116415128D5C0074BD57 /* AddressBookUI.framework */, + A484116515128D5C0074BD57 /* AudioToolbox.framework */, + A484116615128D5C0074BD57 /* AVFoundation.framework */, + A484116715128D5C0074BD57 /* CFNetwork.framework */, + A484112115114F700074BD57 /* CoreGraphics.framework */, + A484116815128D5C0074BD57 /* CoreLocation.framework */, + A484116915128D5C0074BD57 /* CoreMedia.framework */, + A484116A15128D5C0074BD57 /* CoreMotion.framework */, + A484111F15114F700074BD57 /* Foundation.framework */, + A484116B15128D5D0074BD57 /* GameKit.framework */, + A484112315114F700074BD57 /* GLKit.framework */, + A484116C15128D5D0074BD57 /* ImageIO.framework */, + A484116D15128D5D0074BD57 /* libobjc.dylib */, + A48411C915129F610074BD57 /* libsqlite3.dylib */, + A484116E15128D5D0074BD57 /* MapKit.framework */, + A484116F15128D5D0074BD57 /* MediaPlayer.framework */, + A484117015128D5D0074BD57 /* MessageUI.framework */, + A484117115128D5D0074BD57 /* MobileCoreServices.framework */, + A484117215128D5D0074BD57 /* OpenAL.framework */, + A484112515114F700074BD57 /* OpenGLES.framework */, + A484117315128D5D0074BD57 /* QuartzCore.framework */, + A484117415128D5D0074BD57 /* Security.framework */, + A484117515128D5D0074BD57 /* StoreKit.framework */, + A484117615128D5D0074BD57 /* SystemConfiguration.framework */, + A4E2537E166AE3DC00DCDC2C /* Twitter.framework */, + A484111D15114F700074BD57 /* UIKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + A484112715114F700074BD57 /* App */ = { + isa = PBXGroup; + children = ( + F56712391F73451B006B502D /* Images.xcassets */, + C277D3B51EBB9F8E00966BA1 /* _CoronaSplashScreen.png */, + A484112915114F700074BD57 /* App-Info.plist */, + A484112A15114F700074BD57 /* InfoPlist.strings */, + C22C1E4A1E981D9000D74196 /* LaunchScreen.storyboardc */, + A484112D15114F700074BD57 /* main.mm */, + A484112F15114F700074BD57 /* Prefix.pch */, + A447B60E165D72FB009EA762 /* AppCoronaDelegate.h */, + A447B60F165D72FB009EA762 /* AppCoronaDelegate.mm */, + ); + name = App; + sourceTree = ""; + }; + A4841153151161300074BD57 /* resource */ = { + isa = PBXGroup; + children = ( + A498B81916D70EFC0091A148 /* CoronaResources.bundle */, + A447B6691666FD43009EA762 /* Corona3rdPartyLicenses.txt */, + A447B6641666FD02009EA762 /* MainWindow-iPad.xib */, + A447B6651666FD02009EA762 /* MainWindow.xib */, + ); + name = resource; + path = "$HOME/Library/Application Support/Corona/Native"; + sourceTree = ""; + }; + A4E253DB166DE7C800DCDC2C /* Products */ = { + isa = PBXGroup; + children = ( + A4E253E2166DE7C800DCDC2C /* libNotificationsV2Plugin.a */, + F53564952598AC6C00F9A089 /* libNotificationsV2Plugin.firebase.a */, + ); + name = Products; + sourceTree = ""; + }; + F583389B23EA7A9C00E0B97E /* Firebase */ = { + isa = PBXGroup; + children = ( + F58338A023EA7ABB00E0B97E /* FBLPromises.framework */, + F583389F23EA7ABB00E0B97E /* FirebaseCore.framework */, + F583389D23EA7ABB00E0B97E /* FirebaseInstallations.framework */, + F583389E23EA7ABB00E0B97E /* FirebaseInstanceID.framework */, + F583389C23EA7ABB00E0B97E /* FirebaseMessaging.framework */, + F58338A123EA7ABB00E0B97E /* GoogleUtilities.framework */, + F58338A223EA7ABB00E0B97E /* protobuf.framework */, + ); + name = Firebase; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A484111815114F700074BD57 /* Notifications */ = { + isa = PBXNativeTarget; + buildConfigurationList = A484114215114F700074BD57 /* Build configuration list for PBXNativeTarget "Notifications" */; + buildPhases = ( + C28A3B451EE9F8FD00F08609 /* Corona Native */, + A484111715114F700074BD57 /* Resources */, + A484111515114F700074BD57 /* Sources */, + A484111615114F700074BD57 /* Frameworks */, + A4841162151268030074BD57 /* Compile Corona Project */, + A484118B15128E320074BD57 /* build.settings to Info.plist */, + A484118F1512906B0074BD57 /* Certify Corona Build */, + A484119015129A930074BD57 /* Touch main.mm to ensure build */, + F58338AC23EA7AF700E0B97E /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + A4E253E4166DE7D800DCDC2C /* PBXTargetDependency */, + ); + name = Notifications; + productName = App; + productReference = A484111915114F700074BD57 /* Notifications.app */; + productType = "com.apple.product-type.application"; + }; + F53564962598AC7400F9A089 /* NotificationsFirebase */ = { + isa = PBXNativeTarget; + buildConfigurationList = F53564DD2598AC7400F9A089 /* Build configuration list for PBXNativeTarget "NotificationsFirebase" */; + buildPhases = ( + F53564992598AC7400F9A089 /* Corona Native */, + F535649A2598AC7400F9A089 /* Resources */, + F53564A32598AC7400F9A089 /* Sources */, + F53564A62598AC7400F9A089 /* Frameworks */, + F53564D12598AC7400F9A089 /* Compile Corona Project */, + F53564D22598AC7400F9A089 /* build.settings to Info.plist */, + F53564D32598AC7400F9A089 /* Certify Corona Build */, + F53564D42598AC7400F9A089 /* Touch main.mm to ensure build */, + F53565652598D08500F9A089 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + F53564E72598ACE500F9A089 /* PBXTargetDependency */, + ); + name = NotificationsFirebase; + productName = App; + productReference = F53564E02598AC7400F9A089 /* NotificationsFirebase.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A484111015114F700074BD57 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1230; + TargetAttributes = { + A484111815114F700074BD57 = { + DevelopmentTeam = BG2J43EA88; + }; + F53564962598AC7400F9A089 = { + DevelopmentTeam = BG2J43EA88; + }; + }; + }; + buildConfigurationList = A484111315114F700074BD57 /* Build configuration list for PBXProject "NotificationsV2" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + English, + en, + ); + mainGroup = A484110E15114F700074BD57; + productRefGroup = A484111A15114F700074BD57 /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = A4E253DB166DE7C800DCDC2C /* Products */; + ProjectRef = A4E253DA166DE7C800DCDC2C /* Plugin.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + A484111815114F700074BD57 /* Notifications */, + F53564962598AC7400F9A089 /* NotificationsFirebase */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + A4E253E2166DE7C800DCDC2C /* libNotificationsV2Plugin.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libNotificationsV2Plugin.a; + remoteRef = A4E253E1166DE7C800DCDC2C /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F53564952598AC6C00F9A089 /* libNotificationsV2Plugin.firebase.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libNotificationsV2Plugin.firebase.a; + remoteRef = F53564942598AC6C00F9A089 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + A484111715114F700074BD57 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A484112C15114F700074BD57 /* InfoPlist.strings in Resources */, + F56457D91FA108F500EC8C29 /* Images.xcassets in Resources */, + A447B6671666FD02009EA762 /* MainWindow-iPad.xib in Resources */, + A447B6681666FD02009EA762 /* MainWindow.xib in Resources */, + F5C9F4811ED39AD100D34A2D /* _CoronaSplashScreen.png in Resources */, + A447B66A1666FD43009EA762 /* Corona3rdPartyLicenses.txt in Resources */, + A498B81A16D70EFC0091A148 /* CoronaResources.bundle in Resources */, + C22C1E4B1E981D9000D74196 /* LaunchScreen.storyboardc in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F535649A2598AC7400F9A089 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F535649B2598AC7400F9A089 /* InfoPlist.strings in Resources */, + F535649C2598AC7400F9A089 /* Images.xcassets in Resources */, + F535649D2598AC7400F9A089 /* MainWindow-iPad.xib in Resources */, + F535649E2598AC7400F9A089 /* MainWindow.xib in Resources */, + F535649F2598AC7400F9A089 /* _CoronaSplashScreen.png in Resources */, + F53564A02598AC7400F9A089 /* Corona3rdPartyLicenses.txt in Resources */, + F53564A12598AC7400F9A089 /* CoronaResources.bundle in Resources */, + F53564A22598AC7400F9A089 /* LaunchScreen.storyboardc in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + A4841162151268030074BD57 /* Compile Corona Project */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Compile Corona Project"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/bash; + shellScript = "export TARGET_PLATFORM=ios\nCORONA_MAC_BIN=\"$CORONA_ROOT/Corona/mac/bin\"\nCORONA_SHARED_BIN=\"$CORONA_ROOT/Corona/shared/bin\"\nexport LUA_CPATH=\"$CORONA_MAC_BIN/?.so\"\n\"$CORONA_MAC_BIN\"/lua -e \"package.path='$CORONA_SHARED_BIN/?.lua;$CORONA_SHARED_BIN/?/init.lua;'..package.path\" \"$CORONA_SHARED_BIN\"/Compile.lua mac \"$CORONA_ROOT\"\nif [ $? -ne 0 ]\nthen\n echo \"Exiting due to errors (above)\"\n exit -1\nfi\n"; + showEnvVarsInLog = 0; + }; + A484118B15128E320074BD57 /* build.settings to Info.plist */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "build.settings to Info.plist"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$CORONA_ROOT\"/Corona/mac/bin/CreateInfoPlist.sh\n\nif [ $? -ne 0 ]\nthen\n echo \"Exiting due to errors (above)\"\n exit -1\nfi\n"; + showEnvVarsInLog = 0; + }; + A484118F1512906B0074BD57 /* Certify Corona Build */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Certify Corona Build"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$CORONA_ROOT\"/Corona/mac/bin/CertifyBuild.sh\n\nif [ $? -ne 0 ]\nthen\n echo \"Exiting due to errors (above)\"\n exit -1\nfi\n"; + showEnvVarsInLog = 0; + }; + A484119015129A930074BD57 /* Touch main.mm to ensure build */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Touch main.mm to ensure build"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Ensures that next attempt to build actually rebuilds the executable so it can be (re)app_sign(ed)\necho \"Updating modification time of $PROJECT_DIR/main.mm to trigger relink of $BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH\"\necho \"We need to do this b/c app_sign can only sign an unsigned executable.\"\ntouch \"$PROJECT_DIR/main.mm\""; + showEnvVarsInLog = 0; + }; + C28A3B451EE9F8FD00F08609 /* Corona Native */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Corona Native"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# echo \"CORONA_ROOT: ${CORONA_ROOT}\"\nif [ ! -d \"${CORONA_ROOT}\" ]\nthen\necho \"error: Corona Native has not been setup. Run 'Native/SetupCoronaNative.app' in your Corona install to set it up\" >&2\n\nexit 1\nelse\necho \"Building with Corona Native from $(readlink \"${CORONA_ROOT}\")\"\nfi\n\n# Check for difficult to debug error involving an item in the Corona\n# project directory having the same name as a file in the app bundle\nif [ -d \"${PROJECT_DIR}/../Corona/${EXECUTABLE_NAME}\" ]\nthen\necho \"ERROR: cannot have a directory called '$(ls \"${PROJECT_DIR}/../Corona\" | grep -iw ${EXECUTABLE_NAME})' in the Corona project directory because it has the same name as the app\"\nexit 1\nfi"; + showEnvVarsInLog = 0; + }; + F53564992598AC7400F9A089 /* Corona Native */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Corona Native"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# echo \"CORONA_ROOT: ${CORONA_ROOT}\"\nif [ ! -d \"${CORONA_ROOT}\" ]\nthen\necho \"error: Corona Native has not been setup. Run 'Native/SetupCoronaNative.app' in your Corona install to set it up\" >&2\n\nexit 1\nelse\necho \"Building with Corona Native from $(readlink \"${CORONA_ROOT}\")\"\nfi\n\n# Check for difficult to debug error involving an item in the Corona\n# project directory having the same name as a file in the app bundle\nif [ -d \"${PROJECT_DIR}/../Corona/${EXECUTABLE_NAME}\" ]\nthen\necho \"ERROR: cannot have a directory called '$(ls \"${PROJECT_DIR}/../Corona\" | grep -iw ${EXECUTABLE_NAME})' in the Corona project directory because it has the same name as the app\"\nexit 1\nfi"; + showEnvVarsInLog = 0; + }; + F53564D12598AC7400F9A089 /* Compile Corona Project */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Compile Corona Project"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/bash; + shellScript = "export TARGET_PLATFORM=ios\nCORONA_MAC_BIN=\"$CORONA_ROOT/Corona/mac/bin\"\nCORONA_SHARED_BIN=\"$CORONA_ROOT/Corona/shared/bin\"\nexport LUA_CPATH=\"$CORONA_MAC_BIN/?.so\"\n\"$CORONA_MAC_BIN\"/lua -e \"package.path='$CORONA_SHARED_BIN/?.lua;$CORONA_SHARED_BIN/?/init.lua;'..package.path\" \"$CORONA_SHARED_BIN\"/Compile.lua mac \"$CORONA_ROOT\"\nif [ $? -ne 0 ]\nthen\n echo \"Exiting due to errors (above)\"\n exit -1\nfi\n"; + showEnvVarsInLog = 0; + }; + F53564D22598AC7400F9A089 /* build.settings to Info.plist */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "build.settings to Info.plist"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$CORONA_ROOT\"/Corona/mac/bin/CreateInfoPlist.sh\n\nif [ $? -ne 0 ]\nthen\n echo \"Exiting due to errors (above)\"\n exit -1\nfi\n"; + showEnvVarsInLog = 0; + }; + F53564D32598AC7400F9A089 /* Certify Corona Build */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Certify Corona Build"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$CORONA_ROOT\"/Corona/mac/bin/CertifyBuild.sh\n\nif [ $? -ne 0 ]\nthen\n echo \"Exiting due to errors (above)\"\n exit -1\nfi\n"; + showEnvVarsInLog = 0; + }; + F53564D42598AC7400F9A089 /* Touch main.mm to ensure build */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Touch main.mm to ensure build"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Ensures that next attempt to build actually rebuilds the executable so it can be (re)app_sign(ed)\necho \"Updating modification time of $PROJECT_DIR/main.mm to trigger relink of $BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH\"\necho \"We need to do this b/c app_sign can only sign an unsigned executable.\"\ntouch \"$PROJECT_DIR/main.mm\""; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A484111515114F700074BD57 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A484112E15114F700074BD57 /* main.mm in Sources */, + A447B610165D72FB009EA762 /* AppCoronaDelegate.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F53564A32598AC7400F9A089 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F53564A42598AC7400F9A089 /* main.mm in Sources */, + F53564A52598AC7400F9A089 /* AppCoronaDelegate.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + A4E253E4166DE7D800DCDC2C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = plugin_library; + targetProxy = A4E253E3166DE7D800DCDC2C /* PBXContainerItemProxy */; + }; + F53564E72598ACE500F9A089 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = NotificationsV2Plugin.firebase; + targetProxy = F53564E62598ACE500F9A089 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + A484112A15114F700074BD57 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + A484112B15114F700074BD57 /* en */, + ); + name = InfoPlist.strings; + sourceTree = SOURCE_ROOT; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + A484114015114F700074BD57 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + EXCLUDED_ARCHS = ""; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A484114115114F700074BD57 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + EXCLUDED_ARCHS = ""; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + A484114315114F700074BD57 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F55829801ED23E1200E5808C /* CoronaApp.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_ENTITLEMENTS = NotificationsV2Sample.entitlements; + DEAD_CODE_STRIPPING = NO; + DEVELOPMENT_TEAM = BG2J43EA88; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/EmbeddedFrameworks", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Prefix.pch; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + "GCC_THUMB_SUPPORT[arch=armv6]" = ""; + INFOPLIST_FILE = "App-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.coronalabs.firebase.messaging; + PRODUCT_NAME = "$(TARGET_NAME)"; + SEPARATE_STRIP = YES; + STRIP_INSTALLED_PRODUCT = YES; + STRIP_STYLE = "non-global"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + A484114415114F700074BD57 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F55829801ED23E1200E5808C /* CoronaApp.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_ENTITLEMENTS = NotificationsV2Sample.entitlements; + DEAD_CODE_STRIPPING = NO; + DEVELOPMENT_TEAM = BG2J43EA88; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/EmbeddedFrameworks", + ); + GCC_OPTIMIZATION_LEVEL = 2; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Prefix.pch; + "GCC_THUMB_SUPPORT[arch=armv6]" = ""; + INFOPLIST_FILE = "App-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.coronalabs.firebase.messaging; + PRODUCT_NAME = "$(TARGET_NAME)"; + SEPARATE_STRIP = YES; + STRIP_INSTALLED_PRODUCT = YES; + STRIP_STYLE = "non-global"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + F53564DE2598AC7400F9A089 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F55829801ED23E1200E5808C /* CoronaApp.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_ENTITLEMENTS = NotificationsV2Sample.entitlements; + DEAD_CODE_STRIPPING = NO; + DEVELOPMENT_TEAM = BG2J43EA88; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/EmbeddedFrameworks", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Prefix.pch; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + "GCC_THUMB_SUPPORT[arch=armv6]" = ""; + INFOPLIST_FILE = "App-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.coronalabs.firebase.messaging; + PRODUCT_NAME = "$(TARGET_NAME)"; + SEPARATE_STRIP = YES; + STRIP_INSTALLED_PRODUCT = YES; + STRIP_STYLE = "non-global"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + F53564DF2598AC7400F9A089 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F55829801ED23E1200E5808C /* CoronaApp.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_ENTITLEMENTS = NotificationsV2Sample.entitlements; + DEAD_CODE_STRIPPING = NO; + DEVELOPMENT_TEAM = BG2J43EA88; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/EmbeddedFrameworks", + ); + GCC_OPTIMIZATION_LEVEL = 2; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Prefix.pch; + "GCC_THUMB_SUPPORT[arch=armv6]" = ""; + INFOPLIST_FILE = "App-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.coronalabs.firebase.messaging; + PRODUCT_NAME = "$(TARGET_NAME)"; + SEPARATE_STRIP = YES; + STRIP_INSTALLED_PRODUCT = YES; + STRIP_STYLE = "non-global"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A484111315114F700074BD57 /* Build configuration list for PBXProject "NotificationsV2" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A484114015114F700074BD57 /* Debug */, + A484114115114F700074BD57 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A484114215114F700074BD57 /* Build configuration list for PBXNativeTarget "Notifications" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A484114315114F700074BD57 /* Debug */, + A484114415114F700074BD57 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F53564DD2598AC7400F9A089 /* Build configuration list for PBXNativeTarget "NotificationsFirebase" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F53564DE2598AC7400F9A089 /* Debug */, + F53564DF2598AC7400F9A089 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A484111015114F700074BD57 /* Project object */; +} diff --git a/src/ios/NotificationsV2.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/src/ios/NotificationsV2.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/src/ios/NotificationsV2.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/src/ios/NotificationsV2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/src/ios/NotificationsV2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/src/ios/NotificationsV2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/src/ios/NotificationsV2Sample.entitlements b/src/ios/NotificationsV2Sample.entitlements new file mode 100644 index 0000000..903def2 --- /dev/null +++ b/src/ios/NotificationsV2Sample.entitlements @@ -0,0 +1,8 @@ + + + + + aps-environment + development + + diff --git a/src/ios/Plugin.xcodeproj/project.pbxproj b/src/ios/Plugin.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c118ed1 --- /dev/null +++ b/src/ios/Plugin.xcodeproj/project.pbxproj @@ -0,0 +1,461 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + F53564862598ABD300F9A089 /* NotificationEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5594FEA23E97992007AB768 /* NotificationEvent.mm */; }; + F53564872598ABD300F9A089 /* CoronaNotificationsDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5594FEF23E97992007AB768 /* CoronaNotificationsDelegate.mm */; }; + F53564882598ABD300F9A089 /* IPhoneNotificationEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5594FF123E97992007AB768 /* IPhoneNotificationEvent.mm */; }; + F53564892598ABD300F9A089 /* NotificationsV2Plugin.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5594FEB23E97992007AB768 /* NotificationsV2Plugin.mm */; }; + F535648A2598ABD300F9A089 /* CoronaNotificationsV2Helper.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5594FEC23E97992007AB768 /* CoronaNotificationsV2Helper.mm */; }; + F5594FF223E97992007AB768 /* NotificationEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5594FEA23E97992007AB768 /* NotificationEvent.mm */; }; + F5594FF323E97992007AB768 /* NotificationsV2Plugin.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5594FEB23E97992007AB768 /* NotificationsV2Plugin.mm */; }; + F5594FF423E97992007AB768 /* CoronaNotificationsV2Helper.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5594FEC23E97992007AB768 /* CoronaNotificationsV2Helper.mm */; }; + F5594FF523E97992007AB768 /* CoronaNotificationsDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5594FEF23E97992007AB768 /* CoronaNotificationsDelegate.mm */; }; + F5594FF623E97992007AB768 /* IPhoneNotificationEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5594FF123E97992007AB768 /* IPhoneNotificationEvent.mm */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + A4E253B4166D6FB300DCDC2C /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/${PRODUCT_NAME}"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F535648C2598ABD300F9A089 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/${PRODUCT_NAME}"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + A4E253B6166D6FB300DCDC2C /* libNotificationsV2Plugin.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNotificationsV2Plugin.a; sourceTree = BUILT_PRODUCTS_DIR; }; + F53564902598ABD300F9A089 /* libNotificationsV2Plugin.firebase.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNotificationsV2Plugin.firebase.a; sourceTree = BUILT_PRODUCTS_DIR; }; + F5594FE823E97992007AB768 /* IPhoneNotificationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IPhoneNotificationEvent.h; path = Plugin/IPhoneNotificationEvent.h; sourceTree = ""; }; + F5594FE923E97992007AB768 /* NotificationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotificationEvent.h; path = Plugin/NotificationEvent.h; sourceTree = ""; }; + F5594FEA23E97992007AB768 /* NotificationEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NotificationEvent.mm; path = Plugin/NotificationEvent.mm; sourceTree = ""; }; + F5594FEB23E97992007AB768 /* NotificationsV2Plugin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NotificationsV2Plugin.mm; path = Plugin/NotificationsV2Plugin.mm; sourceTree = ""; }; + F5594FEC23E97992007AB768 /* CoronaNotificationsV2Helper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CoronaNotificationsV2Helper.mm; path = Plugin/CoronaNotificationsV2Helper.mm; sourceTree = ""; }; + F5594FED23E97992007AB768 /* NotificationsV2Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotificationsV2Plugin.h; path = Plugin/NotificationsV2Plugin.h; sourceTree = ""; }; + F5594FEE23E97992007AB768 /* CoronaNotificationsV2Helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CoronaNotificationsV2Helper.h; path = Plugin/CoronaNotificationsV2Helper.h; sourceTree = ""; }; + F5594FEF23E97992007AB768 /* CoronaNotificationsDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CoronaNotificationsDelegate.mm; path = Plugin/CoronaNotificationsDelegate.mm; sourceTree = ""; }; + F5594FF023E97992007AB768 /* CoronaNotificationsDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CoronaNotificationsDelegate.h; path = Plugin/CoronaNotificationsDelegate.h; sourceTree = ""; }; + F5594FF123E97992007AB768 /* IPhoneNotificationEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = IPhoneNotificationEvent.mm; path = Plugin/IPhoneNotificationEvent.mm; sourceTree = ""; }; + F572F81A1EE0705B001BC814 /* CoronaNative.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = CoronaNative.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A4E253B3166D6FB300DCDC2C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F535648B2598ABD300F9A089 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A447B609165D72A6009EA762 /* Source */ = { + isa = PBXGroup; + children = ( + F5594FF023E97992007AB768 /* CoronaNotificationsDelegate.h */, + F5594FEF23E97992007AB768 /* CoronaNotificationsDelegate.mm */, + F5594FEE23E97992007AB768 /* CoronaNotificationsV2Helper.h */, + F5594FEC23E97992007AB768 /* CoronaNotificationsV2Helper.mm */, + F5594FE823E97992007AB768 /* IPhoneNotificationEvent.h */, + F5594FF123E97992007AB768 /* IPhoneNotificationEvent.mm */, + F5594FE923E97992007AB768 /* NotificationEvent.h */, + F5594FEA23E97992007AB768 /* NotificationEvent.mm */, + F5594FED23E97992007AB768 /* NotificationsV2Plugin.h */, + F5594FEB23E97992007AB768 /* NotificationsV2Plugin.mm */, + ); + name = Source; + sourceTree = ""; + }; + A484110E15114F700074BD57 = { + isa = PBXGroup; + children = ( + A447B609165D72A6009EA762 /* Source */, + F54A40C01EE083A300AF417D /* CoronaNative */, + A484111A15114F700074BD57 /* Products */, + ); + sourceTree = ""; + }; + A484111A15114F700074BD57 /* Products */ = { + isa = PBXGroup; + children = ( + A4E253B6166D6FB300DCDC2C /* libNotificationsV2Plugin.a */, + F53564902598ABD300F9A089 /* libNotificationsV2Plugin.firebase.a */, + ); + name = Products; + sourceTree = ""; + }; + F54A40C01EE083A300AF417D /* CoronaNative */ = { + isa = PBXGroup; + children = ( + F572F81A1EE0705B001BC814 /* CoronaNative.xcconfig */, + ); + name = CoronaNative; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A4E253B5166D6FB300DCDC2C /* NotificationsV2Plugin */ = { + isa = PBXNativeTarget; + buildConfigurationList = A4E253BF166D6FB300DCDC2C /* Build configuration list for PBXNativeTarget "NotificationsV2Plugin" */; + buildPhases = ( + C2E70B581EE9F110006E4570 /* Corona Native */, + A4E253B2166D6FB300DCDC2C /* Sources */, + A4E253B3166D6FB300DCDC2C /* Frameworks */, + A4E253B4166D6FB300DCDC2C /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = NotificationsV2Plugin; + productName = plugin_library; + productReference = A4E253B6166D6FB300DCDC2C /* libNotificationsV2Plugin.a */; + productType = "com.apple.product-type.library.static"; + }; + F53564832598ABD300F9A089 /* NotificationsV2Plugin.firebase */ = { + isa = PBXNativeTarget; + buildConfigurationList = F535648D2598ABD300F9A089 /* Build configuration list for PBXNativeTarget "NotificationsV2Plugin.firebase" */; + buildPhases = ( + F53564842598ABD300F9A089 /* Corona Native */, + F53564852598ABD300F9A089 /* Sources */, + F535648B2598ABD300F9A089 /* Frameworks */, + F535648C2598ABD300F9A089 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = NotificationsV2Plugin.firebase; + productName = plugin_library; + productReference = F53564902598ABD300F9A089 /* libNotificationsV2Plugin.firebase.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A484111015114F700074BD57 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1230; + }; + buildConfigurationList = A484111315114F700074BD57 /* Build configuration list for PBXProject "Plugin" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + English, + en, + ); + mainGroup = A484110E15114F700074BD57; + productRefGroup = A484111A15114F700074BD57 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A4E253B5166D6FB300DCDC2C /* NotificationsV2Plugin */, + F53564832598ABD300F9A089 /* NotificationsV2Plugin.firebase */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + C2E70B581EE9F110006E4570 /* Corona Native */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Corona Native"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# echo \"CORONA_ROOT: ${CORONA_ROOT}\"\nif [ ! -d \"${CORONA_ROOT}\" ]\nthen\n echo \"error: Corona Native has not been setup. Run 'Native/SetupCoronaNative.app' in your Corona install to set it up\" >&2\n\n exit 1\nelse\n echo \"Building with Corona Native from $(readlink \"${CORONA_ROOT}\")\"\nfi"; + showEnvVarsInLog = 0; + }; + F53564842598ABD300F9A089 /* Corona Native */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Corona Native"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# echo \"CORONA_ROOT: ${CORONA_ROOT}\"\nif [ ! -d \"${CORONA_ROOT}\" ]\nthen\n echo \"error: Corona Native has not been setup. Run 'Native/SetupCoronaNative.app' in your Corona install to set it up\" >&2\n\n exit 1\nelse\n echo \"Building with Corona Native from $(readlink \"${CORONA_ROOT}\")\"\nfi"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A4E253B2166D6FB300DCDC2C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F5594FF223E97992007AB768 /* NotificationEvent.mm in Sources */, + F5594FF523E97992007AB768 /* CoronaNotificationsDelegate.mm in Sources */, + F5594FF623E97992007AB768 /* IPhoneNotificationEvent.mm in Sources */, + F5594FF323E97992007AB768 /* NotificationsV2Plugin.mm in Sources */, + F5594FF423E97992007AB768 /* CoronaNotificationsV2Helper.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F53564852598ABD300F9A089 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F53564862598ABD300F9A089 /* NotificationEvent.mm in Sources */, + F53564872598ABD300F9A089 /* CoronaNotificationsDelegate.mm in Sources */, + F53564882598ABD300F9A089 /* IPhoneNotificationEvent.mm in Sources */, + F53564892598ABD300F9A089 /* NotificationsV2Plugin.mm in Sources */, + F535648A2598ABD300F9A089 /* CoronaNotificationsV2Helper.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + A484114015114F700074BD57 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F572F81A1EE0705B001BC814 /* CoronaNative.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A484114115114F700074BD57 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F572F81A1EE0705B001BC814 /* CoronaNative.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + A4E253C0166D6FB300DCDC2C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + DSTROOT = /tmp/plugin_library.dst; + ENABLE_BITCODE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "PLUGIN_FIREBASE=0", + "$(inherited)", + ); + GCC_WARN_UNINITIALIZED_AUTOS = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + A4E253C1166D6FB300DCDC2C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + DSTROOT = /tmp/plugin_library.dst; + ENABLE_BITCODE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "PLUGIN_FIREBASE=0", + "$(inherited)", + ); + GCC_WARN_UNINITIALIZED_AUTOS = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; + F535648E2598ABD300F9A089 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + DSTROOT = /tmp/plugin_library.dst; + ENABLE_BITCODE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "PLUGIN_FIREBASE=1", + "$(inherited)", + ); + GCC_WARN_UNINITIALIZED_AUTOS = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + F535648F2598ABD300F9A089 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + DSTROOT = /tmp/plugin_library.dst; + ENABLE_BITCODE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + "PLUGIN_FIREBASE=1", + "$(inherited)", + ); + GCC_WARN_UNINITIALIZED_AUTOS = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A484111315114F700074BD57 /* Build configuration list for PBXProject "Plugin" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A484114015114F700074BD57 /* Debug */, + A484114115114F700074BD57 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A4E253BF166D6FB300DCDC2C /* Build configuration list for PBXNativeTarget "NotificationsV2Plugin" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A4E253C0166D6FB300DCDC2C /* Debug */, + A4E253C1166D6FB300DCDC2C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F535648D2598ABD300F9A089 /* Build configuration list for PBXNativeTarget "NotificationsV2Plugin.firebase" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F535648E2598ABD300F9A089 /* Debug */, + F535648F2598ABD300F9A089 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A484111015114F700074BD57 /* Project object */; +} diff --git a/src/ios/Plugin.xcodeproj/xcshareddata/xcschemes/NotificationsV2Plugin.firebase.xcscheme b/src/ios/Plugin.xcodeproj/xcshareddata/xcschemes/NotificationsV2Plugin.firebase.xcscheme new file mode 100644 index 0000000..f5cc1d9 --- /dev/null +++ b/src/ios/Plugin.xcodeproj/xcshareddata/xcschemes/NotificationsV2Plugin.firebase.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ios/Plugin/CoronaNotificationsDelegate.h b/src/ios/Plugin/CoronaNotificationsDelegate.h new file mode 100644 index 0000000..d800f1f --- /dev/null +++ b/src/ios/Plugin/CoronaNotificationsDelegate.h @@ -0,0 +1,20 @@ +// +// CoronaNotificationsDelegate.h +// Notifications V2 Plugin +// +// Copyright (c) 2017 Corona Labs. All rights reserved. +// + +#ifndef _CoronaNotificationsDelegate_H__ +#define _CoronaNotificationsDelegate_H__ + +#import "CoronaDelegate.h" +#import "CoronaLua.h" + +@interface CoronaNotificationsDelegate : NSObject + +@property(strong) id runtime; + +@end + +#endif // _CoronaNotificationsDelegate_H__ diff --git a/src/ios/Plugin/CoronaNotificationsDelegate.mm b/src/ios/Plugin/CoronaNotificationsDelegate.mm new file mode 100644 index 0000000..b5dc07b --- /dev/null +++ b/src/ios/Plugin/CoronaNotificationsDelegate.mm @@ -0,0 +1,119 @@ +// +// CoronaNotificationsDelegate.mm +// Notifications V2 Plugin +// +// Copyright (c) 2017 Corona Labs. All rights reserved. +// + +#import + +#import "CoronaNotificationsDelegate.h" +#import "CoronaLua.h" +#import "CoronaRuntime.h" + +#import "IPhoneNotificationEvent.h" +#import "CoronaNotificationsV2Helper.h" +#if PLUGIN_FIREBASE +#import +#endif + +@implementation CoronaNotificationsDelegate + +- (void)willLoadMain:(id)runtime +{ + // NOP +} + +- (void)didLoadMain:(id)runtime +{ + _runtime = runtime; + + // log plugin version to device log + NSLog(@"%s: %s", PLUGIN_NAME, PLUGIN_VERSION); +} + +#pragma mark UIApplicationDelegate methods +-(void)applicationDidFinishLaunching:(UIApplication *)application +{ + +} + +// didReceiveRemoteNotification is only called for iOS 9 or earlier +-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler +{ +#if PLUGIN_FIREBASE + // must call appDidReceiveMessage manually since Firebase App Delegate Method Swizzling is disabled + [[FIRMessaging messaging] appDidReceiveMessage:userInfo]; +#endif + // send Lua event + IPhoneRemoteNotificationEvent event( + userInfo, + IPhoneNotificationEvent::ToApplicationState( application.applicationState ) + ); + event.Dispatch( self.runtime.L ); + + if ( completionHandler ) { + completionHandler( UIBackgroundFetchResultNewData ); + } +} + +- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification +{ + IPhoneLocalNotificationEvent event( + notification, + IPhoneNotificationEvent::ToApplicationState( application.applicationState ) + ); + event.Dispatch( self.runtime.L ); +} + +- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo +{ +#if PLUGIN_FIREBASE + // must call appDidReceiveMessage manually since Firebase App Delegate Method Swizzling is disabled + [[FIRMessaging messaging] appDidReceiveMessage:userInfo]; +#endif + + IPhoneRemoteNotificationEvent event( + userInfo, + IPhoneNotificationEvent::ToApplicationState( application.applicationState ) + ); + event.Dispatch( self.runtime.L ); +} + +static NSString* +DataToHex( NSData *data ) +{ + NSMutableString *result = [NSMutableString stringWithCapacity:([data length] * 2)]; + const unsigned char *buffer = (const unsigned char *)[data bytes]; + for ( int i = 0, iMax = (int)[data length]; i < iMax; i++ ) { + [result appendFormat:@"%02lx", (unsigned long)buffer[i]]; + } + + return result; +} + +- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken +{ + NSString *data = DataToHex( deviceToken ); + [[CoronaNotificationsV2Helper shared] setAPNsToken:data]; + if ([[CoronaNotificationsV2Helper shared] useFCM]) { +#if PLUGIN_FIREBASE + // must call setAPNSToken manually since Firebase App Delegate Method Swizzling is disabled + // FIRInstanceIDAPNSTokenTypeUnknown will determine Sandbox-type or Production-type based on the provisioning profile + [[FIRMessaging messaging] setAPNSToken:deviceToken type:FIRMessagingAPNSTokenTypeUnknown]; +#endif + } + else { + IPhoneRemoteNotificationRegistrationEvent event( data ); + event.Dispatch(self.runtime.L); + } +} + +- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error +{ + NSLog(@"CoronaNotificationsDelegate.mm: didFailToRegisterForRemoteNotificationsWithError: %@", [error localizedDescription]); + IPhoneRemoteNotificationRegistrationEvent event( error ); + event.Dispatch( self.runtime.L ); +} + +@end diff --git a/src/ios/Plugin/CoronaNotificationsV2Helper.h b/src/ios/Plugin/CoronaNotificationsV2Helper.h new file mode 100644 index 0000000..dcd7dcd --- /dev/null +++ b/src/ios/Plugin/CoronaNotificationsV2Helper.h @@ -0,0 +1,25 @@ +// +// CoronaNotificationsV2Helper.h +// Notifications V2 Plugin +// +// (C) Corona Labs 2017 +// + +#import + +#define PLUGIN_NAME "plugin.notifications.v2" // used for plugin name / Corona Beacon +#define PLUGIN_VERSION "1.0.1" // used for Corona Beacon + + +@interface CoronaNotificationsV2Helper : NSObject +{ + NSString *APNsToken; + BOOL useFCM; +} + +@property (nonatomic, copy) NSString *APNsToken; // save APNs token for future use +@property (nonatomic, assign) BOOL useFCM; // when false, the APNs token will be reported instead on FCM token + ++ (instancetype)shared; + +@end diff --git a/src/ios/Plugin/CoronaNotificationsV2Helper.mm b/src/ios/Plugin/CoronaNotificationsV2Helper.mm new file mode 100644 index 0000000..ee61ecc --- /dev/null +++ b/src/ios/Plugin/CoronaNotificationsV2Helper.mm @@ -0,0 +1,35 @@ +// +// CoronaNotificationsV2Helper.mm +// Notifications V2 Plugin +// +// (C) Corona Labs 2017 +// + +#import "CoronaNotificationsV2Helper.h" + +@implementation CoronaNotificationsV2Helper + +@synthesize APNsToken; +@synthesize useFCM; + ++ (instancetype)shared +{ + static CoronaNotificationsV2Helper *helper = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + helper = [[self alloc] init]; + }); + + return helper; +} + +- (instancetype)init { + if (self = [super init]) { + self.APNsToken = nil; + self.useFCM = NO; + } + + return self; +} + +@end diff --git a/src/ios/Plugin/IPhoneNotificationEvent.h b/src/ios/Plugin/IPhoneNotificationEvent.h new file mode 100644 index 0000000..53d383d --- /dev/null +++ b/src/ios/Plugin/IPhoneNotificationEvent.h @@ -0,0 +1,96 @@ +// +// IPhoneNotificationEvent.h +// Copyright (c) 2017 Corona Labs, Inc. All rights reserved. +// + +#ifndef _IPhoneNotificationEvent_H__ +#define _IPhoneNotificationEvent_H__ + +#import "NotificationEvent.h" +#import +#import + +// ---------------------------------------------------------------------------- + +@class UILocalNotification; +@class NSData; +@class NSDictionary; + +struct lua_State; + +// ---------------------------------------------------------------------------- + +class IPhoneNotificationEvent : public NotificationEvent +{ + public: + typedef NotificationEvent Super; + + public: + static NotificationEvent::ApplicationState ToApplicationState( UIApplicationState state ); + + public: + IPhoneNotificationEvent( Type t, ApplicationState state, id notification ); + virtual ~IPhoneNotificationEvent(); + + public: + id GetNotification() const { return fNotification; } + + private: + id fNotification; +}; + +// ---------------------------------------------------------------------------- + +class IPhoneLocalNotificationEvent : public IPhoneNotificationEvent +{ + public: + typedef IPhoneNotificationEvent Super; + + public: + // expects arg 'index' to be fireTime and arg 'index + 1' to be the options table + static UILocalNotification* CreateAndSchedule( lua_State *L, int index ); + + public: + IPhoneLocalNotificationEvent( UILocalNotification *notification, ApplicationState state ); + + public: + virtual int Push( lua_State *L ) const; +}; + +// ---------------------------------------------------------------------------- + +class IPhoneRemoteNotificationRegistrationEvent : public NotificationEvent +{ + public: + typedef NotificationEvent Super; + + public: + IPhoneRemoteNotificationRegistrationEvent( NSString *token ); + IPhoneRemoteNotificationRegistrationEvent( NSError *error ); + virtual ~IPhoneRemoteNotificationRegistrationEvent(); + + public: + virtual int Push( lua_State *L ) const; + + private: + NSString *fToken; + NSError *fError; +}; + +// ---------------------------------------------------------------------------- + +class IPhoneRemoteNotificationEvent : public IPhoneNotificationEvent +{ + public: + typedef IPhoneNotificationEvent Super; + + public: + IPhoneRemoteNotificationEvent( NSDictionary *notification, ApplicationState state ); + + public: + virtual int Push( lua_State *L ) const; +}; + +// ---------------------------------------------------------------------------- + +#endif // _IPhoneNotificationEvent_H__ diff --git a/src/ios/Plugin/IPhoneNotificationEvent.mm b/src/ios/Plugin/IPhoneNotificationEvent.mm new file mode 100644 index 0000000..7ac4e44 --- /dev/null +++ b/src/ios/Plugin/IPhoneNotificationEvent.mm @@ -0,0 +1,383 @@ +// +// IPhoneNotificationEvent.mm +// Copyright (c) 2017 Corona Labs, Inc. All rights reserved. +// + +#import +#import "IPhoneNotificationEvent.h" + +#import "CoronaLua.h" +#import "CoronaLuaIOS.h" + +// ---------------------------------------------------------------------------- + + +static void +SetStringField( lua_State *L, int index, const char *dstKey, id srcObject, NSString *srcKey ) +{ + id value = [srcObject valueForKey:srcKey]; + if ( [value isKindOfClass:[NSString class]] ) { + const char *str = [(NSString*)value UTF8String]; + if ( str ) { + lua_pushstring( L, str ); + lua_setfield( L, index, dstKey ); + } + } + else if ( [value isKindOfClass:[NSDictionary class]] ){ + if ( CoronaLuaPushValue( L, (NSDictionary *)value ) > 0 ) { + lua_setfield( L, index, dstKey ); + } + } +} + +NotificationEvent::ApplicationState +IPhoneNotificationEvent::ToApplicationState( UIApplicationState state ) +{ + NotificationEvent::ApplicationState result = NotificationEvent::kBackground; + + switch ( state ) + { + case UIApplicationStateActive: + result = NotificationEvent::kActive; + break; + case UIApplicationStateInactive: + result = NotificationEvent::kInactive; + break; + default: + break; + } + + return result; +} + +// ---------------------------------------------------------------------------- + +IPhoneNotificationEvent::IPhoneNotificationEvent( Type t, ApplicationState state, id notification ) +: Super( t, state ), + fNotification( notification ) +{ +} + +IPhoneNotificationEvent::~IPhoneNotificationEvent() +{ +} + +// ---------------------------------------------------------------------------- + +UILocalNotification* +IPhoneLocalNotificationEvent::CreateAndSchedule( lua_State *L, int index ) +{ + UILocalNotification *notification = [[UILocalNotification alloc] init]; + NSDate *fireTime = nil; + + // Get fire time + if ( lua_istable( L, index ) ) + { + NSDateComponents *components = [[NSDateComponents alloc] init]; + NSDate *now = [NSDate date]; + NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; + NSDateComponents *nowComp = [gregorian components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay ) fromDate:now]; + + NSTimeZone *timeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"]; + [gregorian setTimeZone:timeZone]; + + lua_getfield( L, index, "year" ); + [components setYear: lua_isnumber( L, -1 ) ? lua_tointeger( L, -1 ) : [nowComp year]]; + lua_pop( L, 1 ); + + lua_getfield( L, index, "month" ); + lua_Integer month = lua_tointeger( L, -1 ); + if ( month <= 0 || month > 12 ) + { + month = [nowComp month]; + } + [components setMonth:month]; + lua_pop( L, 1 ); + + lua_getfield( L, index, "day" ); + [components setDay: lua_isnumber( L, -1 ) ? lua_tointeger( L, -1 ) : [nowComp day]]; + lua_pop( L, 1 ); + + lua_getfield( L, index, "hour" ); + [components setHour: lua_tointeger( L, -1 )]; + lua_pop( L, 1 ); + + lua_getfield( L, index, "min" ); + [components setMinute: lua_tointeger( L, -1 )]; + lua_pop( L, 1 ); + + lua_getfield( L, index, "sec" ); + [components setSecond: lua_tointeger( L, -1 )]; + lua_pop( L, 1 ); + + fireTime = [gregorian dateFromComponents:components]; + } + else if ( LUA_TNUMBER == lua_type( L, index ) ) + { + fireTime = [NSDate dateWithTimeIntervalSinceNow:lua_tonumber( L, index )]; + } + else + { + luaL_typerror( L, index, "number or table" ); + } + + notification.fireDate = fireTime; + + // Move to next argument + ++index; + if ( lua_istable( L, index ) ) + { + lua_getfield( L, index, "alert" ); + const char *body = lua_tostring( L, -1 ); + if ( body ) + { + notification.alertBody = [NSString stringWithUTF8String:body]; + } + else if ( lua_istable( L, -1 ) ) + { + lua_getfield( L, -1, "body" ); + body = lua_tostring( L, -1 ); + if ( body ) + { + notification.alertBody = [NSString stringWithUTF8String:body]; + } + lua_pop( L, 1 ); + + lua_getfield( L, -1, "action" ); + const char *action = lua_tostring( L, -1 ); + if ( action ) + { + notification.alertAction = [NSString stringWithUTF8String:action]; + } + lua_pop( L, 1 ); + + lua_getfield( L, -1, "launchImage" ); + const char *launchImage = lua_tostring( L, -1 ); + if ( launchImage ) + { + notification.alertLaunchImage = [NSString stringWithUTF8String:launchImage]; + } + lua_pop( L, 1 ); + } + lua_pop( L, 1 ); + + // if tonumber "fails", it returns 0, which means "no change" + lua_getfield( L, index, "badge" ); + notification.applicationIconBadgeNumber = lua_tonumber( L, -1 ); + lua_pop( L, 1 ); + + lua_getfield( L, index, "sound" ); + const char *soundName = lua_tostring( L, -1 ); + if ( soundName ) + { + notification.soundName = [NSString stringWithUTF8String:soundName]; + } + lua_pop( L, 1 ); + + lua_getfield( L, index, "custom" ); + if ( lua_istable( L, -1 ) ) + { + int index = lua_gettop( L ); + NSDictionary *custom = CoronaLuaCreateDictionary( L, index ); + notification.userInfo = custom; + } + lua_pop( L, 1 ); + } + + return notification; +} + + +IPhoneLocalNotificationEvent::IPhoneLocalNotificationEvent( UILocalNotification *notification, ApplicationState state ) +: Super( Super::kLocal, state, notification ) +{ +} + +int +IPhoneLocalNotificationEvent::Push( lua_State *L ) const +{ + if ( Super::Push( L ) ) + { + UILocalNotification *notification = GetNotification(); + + int index = lua_gettop( L ); + + SetStringField( L, index, "alert", notification, @"alertBody" ); + SetStringField( L, index, "action", notification, @"alertAction" ); + SetStringField( L, index, "launchImage", notification, @"alertLaunchImage" ); + SetStringField( L, index, "sound", notification, @"soundName" ); + + lua_pushinteger( L, notification.applicationIconBadgeNumber ); + lua_setfield( L, -2, "badge" ); + + CoronaLuaPushValue( L, notification.userInfo ); + lua_setfield( L, -2, "custom" ); + } + + return 1; +} + +// ---------------------------------------------------------------------------- + +IPhoneRemoteNotificationRegistrationEvent::IPhoneRemoteNotificationRegistrationEvent( NSString *token ) +: Super( Super::kRemoteRegistration, Super::kActive ), // App is active when registering for the event + fToken(token != nil ? token : @"unknown"), + fError( nil ) +{ +} + +IPhoneRemoteNotificationRegistrationEvent::IPhoneRemoteNotificationRegistrationEvent( NSError *error ) +: Super( Super::kRemoteRegistration, Super::kActive ), // App is active when registering for the event + fToken( nil ), + fError( error ) +{ +} + +IPhoneRemoteNotificationRegistrationEvent::~IPhoneRemoteNotificationRegistrationEvent() +{ +} + +int +IPhoneRemoteNotificationRegistrationEvent::Push( lua_State *L ) const +{ + if ( Super::Push( L ) ) + { + if ( fToken ) + { + NSString *data = fToken; + lua_pushstring( L, [data UTF8String] ); + lua_setfield( L, -2, "token" ); + } + else + { + lua_pushstring( L, [[fError localizedDescription] UTF8String] ); + lua_setfield( L, -2, "error" ); + } + } + + return 1; +} + +// ---------------------------------------------------------------------------- + +IPhoneRemoteNotificationEvent::IPhoneRemoteNotificationEvent( NSDictionary *notification, ApplicationState state ) +: Super( Super::kRemote, state, notification ) +{ +} + +int +IPhoneRemoteNotificationEvent::Push( lua_State *L ) const +{ + if ( Super::Push( L )) { + NSDictionary *receivedNotification = GetNotification(); + NSDictionary *notificationData = nil; + NSDictionary *customDictionary = receivedNotification; + + int index = lua_gettop( L ); + BOOL isNotificationTypeMessage = NO; + + // check for notification-type message + notificationData = [receivedNotification valueForKey:@"notification"]; + + if ( notificationData != nil ) { + isNotificationTypeMessage = YES; + } + else { + // check for aps key (iOS 9 or earlier) + notificationData = [receivedNotification valueForKey:@"aps"]; + + // if no aps key found assume all keys are in the root of the recieved notification (iOS 10+) + if ( notificationData == nil ) { + notificationData = receivedNotification; + } + + // check if this is a notification type message on iOS 9 or earlier + isNotificationTypeMessage = [receivedNotification valueForKey:@"gcm.message_id"] != nil; + } + + if ( isNotificationTypeMessage ) { + if ( notificationData[@"body"] != nil ) { + SetStringField( L, index, "alert", notificationData, @"body" ); + } + else { + SetStringField( L, index, "alert", notificationData, @"alert" ); + } + SetStringField( L, index, "action", notificationData, @"action-loc-key" ); + SetStringField( L, index, "launchImage", notificationData, @"launch-image" ); + + NSNumber *badge = [notificationData valueForKey:@"badge"]; + if ( badge ) { + lua_pushinteger( L, [badge intValue] ); + lua_setfield( L, -2, "badge" ); + } + + SetStringField( L, index, "sound", notificationData, @"sound" ); + + // build custom data + NSMutableDictionary *notificationTypeCustomData = [NSMutableDictionary new]; + for (NSString *key in receivedNotification) { + if (! [key isEqualToString:@"collapse_key"] && + ! [key isEqualToString:@"notification"] && + ! [key isEqualToString:@"from"] && + ! [key isEqualToString:@"aps"] && + ! [key hasPrefix:@"google."] && + ! [key hasPrefix:@"gcm."] + ) { + notificationTypeCustomData[key] = receivedNotification[key]; + } + } + + if ( [notificationTypeCustomData count] > 0 ) { + customDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:notificationTypeCustomData, @"custom", nil]; + } + } + else { // assume data-type message + id alert = [notificationData valueForKey:@"alert"]; + if ( alert ) { + if ( [alert isKindOfClass:[NSDictionary class]] ) { + SetStringField( L, index, "alert", alert, @"body" ); + SetStringField( L, index, "action", alert, @"action-loc-key" ); + SetStringField( L, index, "launchImage", alert, @"launch-image" ); + } + else { + SetStringField( L, index, "alert", notificationData, @"alert" ); + } + } + + NSNumber *badge = [notificationData valueForKey:@"badge"]; + if ( badge ) { + lua_pushinteger( L, [badge intValue] ); + lua_setfield( L, -2, "badge" ); + } + + SetStringField( L, index, "sound", notificationData, @"sound" ); + } + + // This is to preserve backwards compatibility + // We check and see if the custom field is in the main dictionary and + // if it is we use that custom field, otherwise we set our custom field source + // to the aps dictionary (which is how Android works and previous iOS functionality worked) + if (! [customDictionary objectForKey:@"custom"]) { + customDictionary = notificationData; + } + + if ( CoronaLuaPushValue( L, [customDictionary valueForKey:@"custom"] ) > 0 ) { + lua_setfield( L, -2, "custom" ); + } + + // This code allows us to convert the dictionary and push it to the listener in the case + // new fields have been added + NSError *error; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:receivedNotification options:NSJSONWritingPrettyPrinted error:&error]; + if ( jsonData ) { + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + lua_pushstring( L, [jsonString UTF8String] ); + lua_setfield( L, -2, "iosPayload" ); + } + } + + return 1; +} + +// ---------------------------------------------------------------------------- + diff --git a/src/ios/Plugin/NotificationEvent.h b/src/ios/Plugin/NotificationEvent.h new file mode 100644 index 0000000..8e91574 --- /dev/null +++ b/src/ios/Plugin/NotificationEvent.h @@ -0,0 +1,60 @@ +// +// NotificationEvent.h +// Copyright (c) 2017 Corona Labs, Inc. All rights reserved. +// + + +#ifndef _NotificationEvent_H__ +#define _NotificationEvent_H__ + +// ---------------------------------------------------------------------------- +#import "stdint.h" + +struct lua_State; + +class NotificationEvent +{ + public: + typedef enum _Type + { + kLocal = 0, + kRemote, + kRemoteRegistration, + + kNumTypes + } + Type; + + typedef enum _ApplicationState + { + kBackground = 0, + kActive, + kInactive, + + kNumStates + } + ApplicationState; + + public: + static const char* StringForType( Type type ); + static const char* StringForApplicationState( ApplicationState state ); + + public: + NotificationEvent( Type t, ApplicationState state ); + + protected: + virtual const char* Name() const; + virtual int Push( lua_State *L ) const; + virtual int PrepareDispatch( lua_State *L ) const; + + public: + virtual void Dispatch( lua_State *L ) const; + + private: + uint8_t fType; + uint8_t fApplicationState; +}; + +// ---------------------------------------------------------------------------- + +#endif // NotificationEvent_H__ diff --git a/src/ios/Plugin/NotificationEvent.mm b/src/ios/Plugin/NotificationEvent.mm new file mode 100644 index 0000000..5cbfa5d --- /dev/null +++ b/src/ios/Plugin/NotificationEvent.mm @@ -0,0 +1,102 @@ +// +// NotificationEvent.mm +// Copyright (c) 2017 Corona Labs, Inc. All rights reserved. +// + +#import "IPhoneNotificationEvent.h" + +#import "CoronaEvent.h" +#import "CoronaLua.h" +#import "CoronaLuaIOS.h" + +const char* +NotificationEvent::StringForType( Type type ) +{ + static const char kLocalString[] = "local"; + static const char kRemoteString[] = "remote"; + static const char kRemoteRegistrationString[] = "remoteRegistration"; + + const char *result = kLocalString; + + switch ( type ) + { + case kRemote: + result = kRemoteString; + break; + case kRemoteRegistration: + result = kRemoteRegistrationString; + default: + break; + } + + return result; +} + +const char* +NotificationEvent::StringForApplicationState( ApplicationState state ) +{ + static const char kBackgroundString[] = "background"; + static const char kActiveString[] = "active"; + static const char kInactiveString[] = "inactive"; + + const char *result = kBackgroundString; + switch ( state ) + { + case kActive: + result = kActiveString; + break; + case kInactive: + result = kInactiveString; + break; + default: + break; + } + + return result; +} + +NotificationEvent::NotificationEvent( Type t, ApplicationState state ) +: fType( t ), + fApplicationState( state ) +{ +} + +int +NotificationEvent::PrepareDispatch( lua_State *L ) const +{ + CoronaLuaPushRuntime( L ); + lua_getfield( L, -1, "dispatchEvent" ); + lua_insert( L, -2 ); // swap stack positions for "Runtime" and "dispatchEvent" + return 1 + Push( L ); +} + +void +NotificationEvent::Dispatch( lua_State *L ) const +{ + // Invoke Lua code: "Runtime:dispatchEvent( eventKey )" + int nargs = PrepareDispatch( L ); + CoronaLuaDoCall( L, nargs, 0 ); +} + +const char* +NotificationEvent::Name() const +{ + static const char kName[] = "notification"; + return kName; +} + +int +NotificationEvent::Push( lua_State *L ) const +{ + CoronaLuaNewEvent( L, Name() ); + + lua_pushstring( L, StringForType( (Type)fType ) ); + lua_setfield( L, -2, CoronaEventTypeKey() ); + + lua_pushstring( L, StringForApplicationState( (ApplicationState)fApplicationState ) ); + lua_setfield( L, -2, "applicationState" ); + + return 1; +} +// ---------------------------------------------------------------------------- + diff --git a/src/ios/Plugin/NotificationsV2Plugin.h b/src/ios/Plugin/NotificationsV2Plugin.h new file mode 100644 index 0000000..49cd5a0 --- /dev/null +++ b/src/ios/Plugin/NotificationsV2Plugin.h @@ -0,0 +1,21 @@ +// +// NotificationsV2Plugin.h +// Notifications V2 Plugin +// +// Copyright (c) 2017 Corona Labs Inc. All rights reserved. +// + +#ifndef NotificationsV2Plugin_H +#define NotificationsV2Plugin_H + +#import "CoronaLua.h" +#import "CoronaMacros.h" + +// This corresponds to the name of the library, e.g. [Lua] require "plugin.library" +// where the '.' is replaced with '_' +CORONA_EXPORT int luaopen_plugin_notifications_v2( lua_State *L ); +#if PLUGIN_FIREBASE +CORONA_EXPORT int luaopen_plugin_notifications_v2_firebase( lua_State *L ); +#endif + +#endif // NotificationsV2Plugin_H diff --git a/src/ios/Plugin/NotificationsV2Plugin.mm b/src/ios/Plugin/NotificationsV2Plugin.mm new file mode 100755 index 0000000..30109f9 --- /dev/null +++ b/src/ios/Plugin/NotificationsV2Plugin.mm @@ -0,0 +1,720 @@ +// +// NotificationsV2Plugin.mm +// Notifications V2 Plugin +// +// Copyright (c) 2017 Corona Labs Inc. All rights reserved. +// + +#import +#import + +#import "CoronaRuntime.h" +#import "CoronaAssert.h" +#import "CoronaEvent.h" +#import "CoronaLua.h" +#import "CoronaLibrary.h" +#import "CoronaLuaIOS.h" + +// Local and Firebase Messaging +#import "NotificationsV2Plugin.h" +#import "IPhoneNotificationEvent.h" +#import "CoronaNotificationsV2Helper.h" +#if PLUGIN_FIREBASE +#import +#import +#import +#endif +#import // iOS 10+ + +// some macros to make life easier, and code more readable +#define UTF8StringWithFormat(format, ...) [[NSString stringWithFormat:format, ##__VA_ARGS__] UTF8String] +#define UTF8IsEqual(utf8str1, utf8str2) (strcmp(utf8str1, utf8str2) == 0) +#define MsgFormat(format, ...) [NSString stringWithFormat:format, ##__VA_ARGS__] + +// ---------------------------------------------------------------------------- +// Plugin Constants +// ---------------------------------------------------------------------------- + +static const char NOTIFICATION_METATABLE[] = "notification"; + +// message constants +static NSString * const ERROR_MSG = @"ERROR: "; + +static BOOL pluginDidInit = NO; + +// ---------------------------------------------------------------------------- +// plugin class and delegate definitions +// ---------------------------------------------------------------------------- + +#if PLUGIN_FIREBASE +@interface CoronaNotificationsPluginDelegate: NSObject +#else +@interface CoronaNotificationsPluginDelegate: NSObject +#endif + +@property (nonatomic, assign) id coronaRuntime; // Pointer to the Corona runtime +@end + +// ---------------------------------------------------------------------------- + +class NotificationsV2Plugin +{ + public: + typedef NotificationsV2Plugin Self; + + public: + static const char kName[]; + + public: + static int Open( lua_State *L ); + static int Finalizer( lua_State *L ); + static Self *ToLibrary( lua_State *L ); + + protected: + NotificationsV2Plugin(); + bool Initialize( void *platformContext ); + + public: // plugin API + static int registerForPushNotifications( lua_State *L ); + static int getDeviceToken( lua_State *L ); + static int scheduleNotification( lua_State *L ); + static int cancelNotification( lua_State *L ); + static int subscribe( lua_State *L ); + static int unsubscribe( lua_State *L ); + + private: // internal helper functions + static void logMsg( lua_State *L, NSString *msgType, NSString *errorMsg ); + + private: + NSString *functionSignature; // used in logMsg to identify function + UIViewController *coronaViewController; // application's view controller +}; + +const char NotificationsV2Plugin::kName[] = PLUGIN_NAME; +CoronaNotificationsPluginDelegate *notificationsPluginDelegate; // Notifications V2 delegate + +static bool isFirebaseLinked() { +#if PLUGIN_FIREBASE + return true; +#else + return false; +#endif +} +// ---------------------------------------------------------------------------- +// helper functions +// ---------------------------------------------------------------------------- + +static int +NotificationTypeForString( const char *value ) +{ + int result; + + if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) { + result = UIUserNotificationTypeNone; + + if ( UTF8IsEqual(value, "badge") ) { + result = UIUserNotificationTypeBadge; + } + else if ( UTF8IsEqual(value, "sound") ) { + result = UIUserNotificationTypeSound; + } + else if ( UTF8IsEqual(value, "alert") ) { + result = UIUserNotificationTypeAlert; + } + } + else { // iOS 10 or later +#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 + result = UNAuthorizationOptionNone; + + if ( UTF8IsEqual(value, "badge") ) { + result = UNAuthorizationOptionBadge; + } + else if ( UTF8IsEqual(value, "sound") ) { + result = UNAuthorizationOptionSound; + } + else if ( UTF8IsEqual(value, "alert") ) { + result = UNAuthorizationOptionAlert; + } +#endif + } + + return result; +} + +// log message to console +void +NotificationsV2Plugin::logMsg(lua_State *L, NSString* msgType, NSString* errorMsg) +{ + Self *context = ToLibrary(L); + + if (context) { + Self& library = *context; + + NSString *functionID = [library.functionSignature copy]; + if (functionID.length > 0) { + functionID = [functionID stringByAppendingString:@", "]; + } + + CoronaLuaLogPrefix(L, [msgType UTF8String], UTF8StringWithFormat(@"%@%@", functionID, errorMsg)); + } +} + +// ---------------------------------------------------------------------------- +// plugin implementation +// ---------------------------------------------------------------------------- + +int +NotificationsV2Plugin::Open( lua_State *L ) +{ + // Register __gc callback + const char kMetatableName[] = __FILE__; // Globally unique string to prevent collision + CoronaLuaInitializeGCMetatable( L, kMetatableName, Finalizer ); + + void *platformContext = CoronaLuaGetContext(L); + + // Set library as upvalue for each library function + Self *library = new Self; + + if (library->Initialize(platformContext)) { + // Functions in library + static const luaL_Reg kFunctions[] = { + {"registerForPushNotifications", registerForPushNotifications}, + {"scheduleNotification", scheduleNotification}, + {"cancelNotification", cancelNotification}, + {"getDeviceToken", getDeviceToken}, + {"subscribe", subscribe}, + {"unsubscribe", unsubscribe}, + {NULL, NULL} + }; + + // Register functions as closures, giving each access to the + // 'library' instance via ToLibrary() + { + CoronaLuaPushUserdata(L, library, kMetatableName); + luaL_openlib(L, kName, kFunctions, 1); // leave "library" on top of stack + } + } + + return 1; +} + +int +NotificationsV2Plugin::Finalizer( lua_State *L ) +{ + Self *library = (Self *)CoronaLuaToUserdata(L, 1); + + notificationsPluginDelegate = nil; + delete library; + + return 0; +} + +NotificationsV2Plugin* +NotificationsV2Plugin::ToLibrary( lua_State *L ) +{ + // library is pushed as part of the closure + Self *library = (Self *)CoronaLuaToUserdata( L, lua_upvalueindex( 1 ) ); + return library; +} + +NotificationsV2Plugin::NotificationsV2Plugin() +: coronaViewController(nil) +{ +} + +bool +NotificationsV2Plugin::Initialize( void *platformContext ) +{ + bool shouldInit = ( ! coronaViewController ); + + if ( shouldInit ) { + id runtime = (__bridge id)platformContext; + coronaViewController = runtime.appViewController; + + functionSignature = @""; + + // initialize delegate + notificationsPluginDelegate = [CoronaNotificationsPluginDelegate new]; + notificationsPluginDelegate.coronaRuntime = runtime; + } + + return shouldInit; +} + +// [Lua] registerForPushNotifications( [ options ] ) +int +NotificationsV2Plugin::registerForPushNotifications(lua_State *L) +{ + Self *context = ToLibrary(L); + + if (! context) { // abort if no valid context + return 0; + } + + Self& library = *context; + + library.functionSignature = @"notifications.registerForPushNotifications( [ options ] )"; + + // check number or args + int nargs = lua_gettop(L); + if (nargs > 1) { + logMsg(L, ERROR_MSG, MsgFormat(@"Expected 0 or 1 argument, got %d", nargs)); + return 0; + } + + if (pluginDidInit) { + logMsg(L, ERROR_MSG, @"notifications V2 already initialized"); + return 0; + } + + bool useFCM = false; + + // check for options table + if (! lua_isnoneornil(L, 1)) { + if (lua_type(L, 1) == LUA_TTABLE) { + // traverse and validate all the options + for (lua_pushnil(L); lua_next(L, 1) != 0; lua_pop(L, 1)) { + const char *key = lua_tostring(L, -2); + + // check for FCM usage (for backward compatibility) + if (UTF8IsEqual(key, "useFCM")) { + if (lua_type(L, -1) == LUA_TBOOLEAN) { + useFCM = lua_toboolean(L, -1); + if(useFCM && !isFirebaseLinked()) { + logMsg(L, ERROR_MSG, MsgFormat(@"options.useFCM is true but no Firebase framework is linked!")); + useFCM = false; + } + } + else { + logMsg(L, ERROR_MSG, MsgFormat(@"options.useFCM (boolean) expected, got %s", luaL_typename(L, -1))); + return 0; + } + } + else { + logMsg(L, ERROR_MSG, MsgFormat(@"Invalid option '%s'", key)); + return 0; + } + } + } + else { + logMsg(L, ERROR_MSG, MsgFormat(@"options table expected, got %s", luaL_typename(L, 1))); + return 0; + } + } + + // set FCM usage (for backwards compatibility with legacy plugin). + // when false, only the APNs token will be reported in the registration event + [[CoronaNotificationsV2Helper shared] setUseFCM:useFCM]; + +#if PLUGIN_FIREBASE + if (useFCM) { + + // get options from plist generated by Firebase + NSString *filePath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]; + FIROptions *firOptions = [[FIROptions alloc] initWithContentsOfFile:filePath]; + if (firOptions == nil) { + logMsg(L, ERROR_MSG, @"Cannot find GoogleService-Info.plist"); + return 0; + } + + // configure and connect + [FIRApp configureWithOptions:firOptions]; + } +#endif + + // Looks in config.lua to see if the following table exists: + // application = + // { + // notification = + // { + // iphone = + // { + // types = + // { + // "badge", + // "sound", + // "alert" + // } + // }, + // }, + // } + + int allowedTypes = 0; + + // check if config has been loaded before + lua_getglobal( L, "package" ); + lua_getfield( L, -1, "loaded" ); + lua_getfield( L, -1, "config" ); + bool userLoadedConfig = lua_type( L, -1 ) != LUA_TNIL; + lua_pop( L, 3 ); + + // load config + lua_getglobal( L, "require" ); + lua_pushstring( L, "config" ); + lua_call( L, 1, 0 ); + + // read config + lua_getglobal( L, "application" ); + if ( lua_type( L, -1 ) == LUA_TTABLE ) + { + lua_getfield( L, -1, "notification" ); + if ( lua_type( L, -1 ) == LUA_TTABLE ) + { + lua_getfield( L, -1, "iphone" ); + if ( lua_type( L, -1 ) == LUA_TTABLE ) + { + lua_getfield( L, -1, "types" ); + if ( lua_type( L, -1 ) == LUA_TTABLE ) + { + int configTypes = lua_gettop( L ); + size_t maxTypes = lua_objlen( L, -1 ); + + for ( int i = 1; i <= maxTypes; i++ ) { + lua_rawgeti( L, configTypes, i ); + int notificationType = NotificationTypeForString( lua_tostring( L, -1 ) ); + allowedTypes = ( allowedTypes | notificationType ); + lua_pop( L, 1 ); + } + } + lua_pop( L, 1 ); // pop types + } + lua_pop( L, 1 ); // pop iphone + } + lua_pop( L, 1 ); // pop notification + } + lua_pop( L, 1 ); // pop application + + // Clean up but make sure that if require("config") was already called it won't wipe it out + if ( ! userLoadedConfig ) { + // set application = nil + lua_pushnil( L ); + lua_setglobal( L, "application" ); + + // set package.loaded.config = nil + lua_getglobal( L, "package" ); + lua_getfield( L, -1, "loaded" ); + lua_pushnil( L ); + lua_setfield( L, -2, "config" ); + lua_pop( L, 2 ); + } + + if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) { + UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:allowedTypes categories:nil]; + [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; + } + else { // iOS 10 or later +#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 + [[UNUserNotificationCenter currentNotificationCenter] + requestAuthorizationWithOptions:allowedTypes + completionHandler:^(BOOL granted, NSError * _Nullable error) { + if (granted) { + NSLog(@"UNUserNotificationCenter permissions granted"); + } + else { + NSLog(@"UNUserNotificationCenter permissions NOT GRANTED"); + } + } + ]; + + [UNUserNotificationCenter currentNotificationCenter].delegate = notificationsPluginDelegate; + #if PLUGIN_FIREBASE + [FIRMessaging messaging].delegate = notificationsPluginDelegate; + #endif +#endif + } + + [[UIApplication sharedApplication] registerForRemoteNotifications]; + + return 0; +} + +// [Lua] getDeviceToken() +int +NotificationsV2Plugin::getDeviceToken(lua_State *L) +{ + Self *context = ToLibrary(L); + + if (! context) { // abort if no valid context + return 0; + } + + Self& library = *context; + + library.functionSignature = @"notifications.getDeviceToken()"; + + // check number or args + int nargs = lua_gettop(L); + if ((nargs != 0)) { + logMsg(L, ERROR_MSG, MsgFormat(@"Expected no arguments, got %d", nargs)); + return 0; + } + + NSString *token = nil; + + if ([[CoronaNotificationsV2Helper shared] useFCM]) { +#if PLUGIN_FIREBASE + token = [[FIRMessaging messaging] FCMToken]; +#endif + } + else { + token = [[CoronaNotificationsV2Helper shared] APNsToken]; + } + + lua_pushstring(L, token == nil ? "unknown" : [token UTF8String]); + + return 1; +} + +// [Lua] subscribe( topic ) +int +NotificationsV2Plugin::subscribe(lua_State *L) +{ + Self *context = ToLibrary(L); + + if (! context) { // abort if no valid context + return 0; + } + + Self& library = *context; + + library.functionSignature = @"notifications.subscribe( topic )"; + + // check number or args + int nargs = lua_gettop(L); + if ((nargs != 1)) { + logMsg(L, ERROR_MSG, MsgFormat(@"Expected 1 argument, got %d", nargs)); + return 0; + } + + const char *topic = NULL; + + // check topic + if ( lua_type( L, 1 ) == LUA_TSTRING ) { + topic = lua_tostring( L, 1 ); + } + else { + logMsg( L, ERROR_MSG, MsgFormat(@"options.topic (string) expected, got %s", luaL_typename( L, 1 ))); + return 0; + } + +#if PLUGIN_FIREBASE + [[FIRMessaging messaging] subscribeToTopic:@(topic)]; +#else + logMsg( L, ERROR_MSG, @"notification.subscribe only work in Firebase plugin"); +#endif + + return 0; +} + +// [Lua] unsubscribe( topic ) +int +NotificationsV2Plugin::unsubscribe(lua_State *L) +{ + Self *context = ToLibrary(L); + + if (! context) { // abort if no valid context + return 0; + } + + Self& library = *context; + + library.functionSignature = @"notifications.unsubscribe( topic )"; + + // check number or args + int nargs = lua_gettop(L); + if ((nargs != 1)) { + logMsg(L, ERROR_MSG, MsgFormat(@"Expected 1 argument, got %d", nargs)); + return 0; + } + + const char *topic = NULL; + + // check for topic + if ( lua_type( L, 1 ) == LUA_TSTRING ) { + topic = lua_tostring( L, 1 ); + } + else { + logMsg( L, ERROR_MSG, MsgFormat(@"options.topic (string) expected, got %s", luaL_typename( L, 1 ))); + return 0; + } + +#if PLUGIN_FIREBASE + [[FIRMessaging messaging] unsubscribeFromTopic:@(topic)]; +#else + logMsg( L, ERROR_MSG, @"notifications.unsubscribe only work in Firebase plugin"); +#endif + + return 0; +} + +// [Lua] scheduleNotification() +int +NotificationsV2Plugin::scheduleNotification(lua_State *L) +{ + Self *context = ToLibrary(L); + + if (! context) { // abort if no valid context + return 0; + } + + Self& library = *context; + + library.functionSignature = @"notifications.scheduleNotification(time [,options])"; + + // check number or args + int nargs = lua_gettop(L); + if ((nargs < 1) || (nargs > 2)) { + logMsg(L, ERROR_MSG, MsgFormat(@"Expected 1 or 2 arguments, got %d", nargs)); + return 0; + } + + UILocalNotification *notification = IPhoneLocalNotificationEvent::CreateAndSchedule( L, 1 ); + int allowedNotificationTypes = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert; + id settings = [UIUserNotificationSettings settingsForTypes:allowedNotificationTypes categories:nil]; + [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; + [[UIApplication sharedApplication] scheduleLocalNotification:notification]; + + if ( notification ) { + NSLog(@"we have a notification"); + CoronaLuaPushUserdata( L, (void *)CFBridgingRetain(notification), NOTIFICATION_METATABLE ); + } + else { + lua_pushnil( L ); + } + + return 1; +} + +// [Lua] cancelNotification() +int +NotificationsV2Plugin::cancelNotification( lua_State *L ) +{ + Self *context = ToLibrary( L ); + + if (! context) { // abort if no valid context + return 0; + } + + Self& library = *context; + + library.functionSignature = @"notifications.cancelNotification( time [, options ])"; + + // check number or args + int nargs = lua_gettop( L ); + if ( nargs > 1 ) { + logMsg( L, ERROR_MSG, MsgFormat( @"Expected 0 or 1 argument, got %d", nargs )); + return 0; + } + + if ( lua_isuserdata( L, 1 ) || lua_isnoneornil( L, 1 )) { + void *notificationId = lua_isnone( L, 1 ) ? NULL : CoronaLuaCheckUserdata( L, 1, NOTIFICATION_METATABLE ); + + UIApplication *application = [UIApplication sharedApplication]; + + if ( notificationId ) { + UILocalNotification *notification = (__bridge UILocalNotification *) notificationId; + [application cancelLocalNotification: notification]; + } + else { + [application cancelAllLocalNotifications]; + application.applicationIconBadgeNumber = 0; + } + } + + return 0; +} + +// ============================================================================ +// plugin delegate implementation +// ============================================================================ + +@implementation CoronaNotificationsPluginDelegate +/* +//TODO: Migrate to modern notifications for iOS10+ + +// Receive displayed notifications for iOS 10 devices. +// Handle incoming notification messages while app is in the foreground. +- (void)userNotificationCenter:(UNUserNotificationCenter *)center + willPresentNotification:(UNNotification *)notification + withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler { + + NSDictionary *userInfo = [[[notification request] content] userInfo]; + if(userInfo) { + if([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) { + + IPhoneRemoteNotificationEvent event( + userInfo, + IPhoneNotificationEvent::ToApplicationState( [UIApplication sharedApplication].applicationState ) + ); + event.Dispatch( self.coronaRuntime.L ); + +#if PLUGIN_FIREBASE + [[FIRMessaging messaging] appDidReceiveMessage:userInfo]; +#endif + } else { + IPhoneLocalNotificationEvent event( + notification, + IPhoneNotificationEvent::ToApplicationState( [UIApplication sharedApplication].applicationState ) + ); + event.Dispatch( self.coronaRuntime.L ); + } + } + + // Change this to your preferred presentation option + completionHandler(UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionAlert); +} + +// Handle notification messages after display notification is tapped by the user. +- (void)userNotificationCenter:(UNUserNotificationCenter *)center +didReceiveNotificationResponse:(UNNotificationResponse *)response + withCompletionHandler:(void(^)(void))completionHandler { + NSDictionary *userInfo = [[[[response notification] request] content ] userInfo]; + + if(userInfo) { + IPhoneRemoteNotificationEvent event( + userInfo, + IPhoneNotificationEvent::ToApplicationState( [UIApplication sharedApplication].applicationState ) + ); + event.Dispatch( self.coronaRuntime.L ); + +#if PLUGIN_FIREBASE + [[FIRMessaging messaging] appDidReceiveMessage:userInfo]; +#endif + } + + completionHandler(); +} +*/ + +#if PLUGIN_FIREBASE + + +- (void)messaging:(FIRMessaging *)messaging didReceiveRegistrationToken:(NSString *)fcmToken { + if ([[CoronaNotificationsV2Helper shared] useFCM]) { + // abort if no token + if (fcmToken == nil) { + return; + } + + // send Corona Lua event + IPhoneRemoteNotificationRegistrationEvent event( fcmToken ); + event.Dispatch( self.coronaRuntime.L ); + } +} +#endif + +@end + +// ---------------------------------------------------------------------------- + +CORONA_EXPORT int luaopen_plugin_notifications_v2( lua_State *L ) +{ + return NotificationsV2Plugin::Open(L); +} + +#if PLUGIN_FIREBASE +CORONA_EXPORT int luaopen_plugin_notifications_v2_firebase( lua_State *L ) +{ + return NotificationsV2Plugin::Open(L); +} +#endif diff --git a/src/ios/Prefix.pch b/src/ios/Prefix.pch new file mode 100644 index 0000000..529d141 --- /dev/null +++ b/src/ios/Prefix.pch @@ -0,0 +1,8 @@ +// +// Prefix header for all source files of the 'TemplateApp' target in the 'TemplateApp' project +// + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/src/ios/_CoronaSplashScreen.png b/src/ios/_CoronaSplashScreen.png new file mode 100644 index 0000000..1d0d748 Binary files /dev/null and b/src/ios/_CoronaSplashScreen.png differ diff --git a/src/ios/build.sh b/src/ios/build.sh new file mode 100755 index 0000000..0edf4f3 --- /dev/null +++ b/src/ios/build.sh @@ -0,0 +1,131 @@ +#!/bin/bash -e + +path=$(dirname "$0") + +OUTPUT_DIR=$1 +TARGET_NAME=NotificationsV2Plugin.firebase +OUTPUT_SUFFIX=a +CONFIG=Release + +# +# Checks exit value for error +# +checkError() { + if [ $? -ne 0 ] + then + echo "Exiting due to errors (above)" + exit -1 + fi +} + +# +# Canonicalize relative paths to absolute paths +# +pushd "$path" > /dev/null +dir=$(pwd) +path=$dir +popd > /dev/null + +if [ -z "$OUTPUT_DIR" ] +then + OUTPUT_DIR=. +fi + +pushd "$OUTPUT_DIR" > /dev/null +dir=$(pwd) +OUTPUT_DIR=$dir +popd > /dev/null + +echo "OUTPUT_DIR: $OUTPUT_DIR" + +# Clean +# xcodebuild -project "$path/Plugin.xcodeproj" -configuration $CONFIG clean +checkError + +# iOS +xcodebuild -project "$path/Plugin.xcodeproj" -configuration $CONFIG -sdk iphoneos -alltargets +checkError + +# iOS-sim +xcodebuild -project "$path/Plugin.xcodeproj" -configuration $CONFIG -sdk iphonesimulator -alltargets +checkError + +# create universal binary +lipo -create "$path"/build/$CONFIG-iphoneos/lib$TARGET_NAME.$OUTPUT_SUFFIX "$path"/build/$CONFIG-iphonesimulator/lib$TARGET_NAME.$OUTPUT_SUFFIX -output "$OUTPUT_DIR"/lib$TARGET_NAME.$OUTPUT_SUFFIX +checkError + + +# copy corona plugin structure + +build_plugin_structure() { + + PLUGIN_DEST=$1 + mkdir -p "$PLUGIN_DEST" + PLATFORM=$2 + ARCH=$3 + EmbeddedFrameworks=$4 + + cp "$path/build/$CONFIG-$PLATFORM/lib$TARGET_NAME.$OUTPUT_SUFFIX" "$PLUGIN_DEST/" + cp "$path/${5:-metadata.lua}" "$PLUGIN_DEST/metadata.lua" + + if ls "$path/build/$CONFIG-$PLATFORM/"*.framework 1> /dev/null 2>&1; then + echo "Copying bult frameworks for $PLATFORM" + mkdir -p "$PLUGIN_DEST"/resources/Frameworks + "$(xcrun -f rsync)" --exclude _CodeSignature --exclude .DS_Store --exclude CVS --exclude .svn --exclude .git --exclude .hg --exclude Headers --exclude PrivateHeaders --exclude Modules -resolve-src-symlinks "$path/build/$CONFIG-$PLATFORM"/*.framework "$PLUGIN_DEST"/resources/Frameworks + else + echo "No built frameworks" + fi + + + if ls "$path"/$EmbeddedFrameworks/*.framework 1> /dev/null 2>&1; then + echo "Copying Embedded frameworks frameworks for $PLATFORM:" + + for f in "$path"/$EmbeddedFrameworks/*.framework; do + FRAMEWORK_NAME=$(basename "$f") + BIN_NAME=${FRAMEWORK_NAME%.framework} + SRC_BIN="$f"/$BIN_NAME + + if [[ $(file "$SRC_BIN" | grep -c "ar archive") -ne 0 ]]; then + echo " - $FRAMEWORK_NAME: is a static Framework, extracting." + + DEST_BIN="$PLUGIN_DEST"/$FRAMEWORK_NAME/$BIN_NAME + "$(xcrun -f rsync)" --links --exclude '*.xcconfig' --exclude _CodeSignature --exclude .DS_Store --exclude CVS --exclude .svn --exclude .git --exclude .hg --exclude Headers --exclude PrivateHeaders --exclude Modules -resolve-src-symlinks "$f" "$PLUGIN_DEST" + rm "$DEST_BIN" + lipo "$SRC_BIN" $ARCH -o "$DEST_BIN.tmp" + $(xcrun -f bitcode_strip) "$DEST_BIN.tmp" -r -o "$DEST_BIN" + rm "$DEST_BIN.tmp" + rm -rf "$PLUGIN_DEST/$FRAMEWORK_NAME/Versions" + else + echo " + $FRAMEWORK_NAME: embedding" + + mkdir -p "$PLUGIN_DEST"/resources/Frameworks + DEST_BIN="$PLUGIN_DEST"/resources/Frameworks/$FRAMEWORK_NAME/$BIN_NAME + "$(xcrun -f rsync)" --links --exclude '*.xcconfig' --exclude _CodeSignature --exclude .DS_Store --exclude CVS --exclude .svn --exclude .git --exclude .hg --exclude Headers --exclude PrivateHeaders --exclude Modules -resolve-src-symlinks "$f" "$PLUGIN_DEST"/resources/Frameworks + rm "$DEST_BIN" + lipo "$SRC_BIN" $ARCH -o "$DEST_BIN.tmp" + $(xcrun -f bitcode_strip) "$DEST_BIN.tmp" -r -o "$DEST_BIN" + rm "$DEST_BIN.tmp" + rm -rf "$PLUGIN_DEST/$FRAMEWORK_NAME/Versions" + fi + done + else + echo "No 3rd party frameworks" + fi +} + +rm -rf "$OUTPUT_DIR/BuiltPlugin/" + +build_plugin_structure "$OUTPUT_DIR/BuiltPlugin/Firebase/iphone" iphoneos " -extract armv7 -extract arm64 " EmbeddedFrameworks metadata.firebase.lua + +build_plugin_structure "$OUTPUT_DIR/BuiltPlugin/Firebase/iphone-sim" iphonesimulator " -extract i386 -extract x86_64 " EmbeddedFrameworksSim metadata.firebase.lua + +echo "$OUTPUT_DIR"/lib$TARGET_NAME.$OUTPUT_SUFFIX + +TARGET_NAME=NotificationsV2Plugin + +build_plugin_structure "$OUTPUT_DIR/BuiltPlugin/Regular/iphone" iphoneos " -extract armv7 -extract arm64 " EmbeddedFrameworks-none + +build_plugin_structure "$OUTPUT_DIR/BuiltPlugin/Regular/iphone-sim" iphonesimulator " -extract i386 -extract x86_64 " EmbeddedFrameworksSim-none + + + diff --git a/src/ios/en.lproj/InfoPlist.strings b/src/ios/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/src/ios/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/src/ios/main.mm b/src/ios/main.mm new file mode 100644 index 0000000..eb06d20 --- /dev/null +++ b/src/ios/main.mm @@ -0,0 +1,19 @@ +// +// main.mm +// +// Copyright (c) 2017 __MyCompanyName__. All rights reserved. +// + +#import + +#import "AppCoronaDelegate.h" + +int main(int argc, char *argv[]) +{ + @autoreleasepool + { + CoronaApplicationMain( argc, argv, [AppCoronaDelegate class] ); + } + + return 0; +} diff --git a/src/ios/metadata.firebase.lua b/src/ios/metadata.firebase.lua new file mode 100644 index 0000000..b4e9538 --- /dev/null +++ b/src/ios/metadata.firebase.lua @@ -0,0 +1,13 @@ +local metadata = +{ + plugin = + { + format = 'staticLibrary', + staticLibs = { 'NotificationsV2Plugin.firebase', }, + frameworks = { 'FBLPromises', 'FirebaseCore', 'FirebaseCoreDiagnostics', 'FirebaseInstallations', 'FirebaseInstanceID', 'FirebaseMessaging', 'GoogleDataTransport', 'GoogleUtilities', 'nanopb', }, + frameworksOptional = { 'UserNotifications', 'UserNotificationsUI' }, + delegates = { 'CoronaNotificationsDelegate' } + } +} + +return metadata diff --git a/src/ios/metadata.lua b/src/ios/metadata.lua new file mode 100644 index 0000000..0d8628f --- /dev/null +++ b/src/ios/metadata.lua @@ -0,0 +1,13 @@ +local metadata = +{ + plugin = + { + format = "staticLibrary", + staticLibs = { 'NotificationsV2Plugin', }, + frameworks = { }, + frameworksOptional = { "UserNotifications", "UserNotificationsUI" }, + delegates = { "CoronaNotificationsDelegate" } + } +} + +return metadata