Skip to content

Commit

Permalink
Merge pull request #351 from mindbox-cloud/release/2.9.0
Browse files Browse the repository at this point in the history
Release/2.9.0
  • Loading branch information
AndreyEmtsov authored Apr 22, 2024
2 parents e5ffd73 + 640ffa3 commit 25f051f
Show file tree
Hide file tree
Showing 72 changed files with 2,426 additions and 271 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
run: gem install bundler
- name: Install bundler dependencies
run: bundle install
- name: Install yeetd
run: |
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg
sudo installer -pkg yeetd-normal.pkg -target /
yeetd &
- name: Run unit tests
run: bundle exec fastlane unitTestLane

91 changes: 91 additions & 0 deletions .github/workflows/prepare_release_branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Preparation for release

on:
push:
tags:
- '*'

jobs:
preparation:
runs-on: macos-14
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract version from branch name
run: echo "VERSION=${GITHUB_REF#refs/heads/release/}" >> $GITHUB_ENV

- name: Check for existing branch
run: |
if git ls-remote --heads origin release/${{ env.VERSION }} | grep release/${{ env.VERSION }}; then
echo "Branch release/${{ env.VERSION }} already exists."
exit 1
fi
shell: bash

- name: Bump version
run: ./git-release-branch-create.sh "${{ env.VERSION }}"

- name: Check if sdkVersion matches VERSION
run: |
SDK_VERSION=$(sed -n 's/^.*sdkVersion = "\(.*\)"/\1/p' SDKVersionProvider/SDKVersionProvider.swift)
if [ "$SDK_VERSION" != "${{ env.VERSION }}" ]; then
echo "SDK version ($SDK_VERSION) does not match the branch version (${{ env.VERSION }})."
exit 1
fi
shell: bash

- name: Create Pull Request
id: create-pr
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update release version to ${{ env.VERSION }}
title: "Release/${{ env.VERSION }}"
body: |
Updates the release version to ${{ env.VERSION }}.
branch: "release/${{ env.VERSION }}"
base: "master"

- name: Post to a Slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: 'C06RXV161RA'
payload: |
{
"text": "iOS Release Branch Notification",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "🚀 iOS Release Branch Created"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Branch Name:* *`release/${{ env.VERSION }}`*\n*Status:* Success :white_check_mark:"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Pull Request"
},
"url": "${{ steps.create-pr.outputs.pull-request-url }}"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_MOBILE_NOTIFIER_TOKEN }}
837 changes: 837 additions & 0 deletions Example/Example.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
78 changes: 78 additions & 0 deletions Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0AEDBC752BB6F8F200EE8722"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0AEDBC752BB6F8F200EE8722"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0AEDBC752BB6F8F200EE8722"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
10 changes: 10 additions & 0 deletions Example/Example.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
69 changes: 69 additions & 0 deletions Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//
// AppDelegate.swift
// Example
//
// Created by Дмитрий Ерофеев on 29.03.2024.
//

import Mindbox
import Foundation
import UIKit

@main
class AppDelegate: MindboxAppDelegate {

//https://developers.mindbox.ru/docs/ios-sdk-initialization
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
super.application(application, didFinishLaunchingWithOptions: launchOptions)

do {
let mindboxSdkConfig = try MBConfiguration(
//To run the application on a physical device you need to change the endpoint
//You should also change the application bundle ID in all targets, more details in the readme
//You can still run the application on the simulator to see In-Apps
endpoint: "Mpush-test.ReleaseExample.IosApp",
domain: "api.mindbox.ru",
subscribeCustomerIfCreated: true,
shouldCreateCustomer: true
)
Mindbox.shared.initialization(configuration: mindboxSdkConfig)
} catch {
print(error)
}
//https://developers.mindbox.ru/docs/ios-send-push-notifications-appdelegate
registerForRemoteNotifications()
return true
}

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

//https://developers.mindbox.ru/docs/ios-send-push-notifications-appdelegate
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.list, .badge, .sound])

//https://developers.mindbox.ru/docs/ios-sdk-methods
print("Is mindbox notification: \(Mindbox.shared.isMindboxPush(userInfo: notification.request.content.userInfo))")
print("Notification data: \(String(describing: Mindbox.shared.getMindboxPushData(userInfo: notification.request.content.userInfo)))")
if let uniqueKey = Mindbox.shared.getMindboxPushData(userInfo: notification.request.content.userInfo)?.uniqueKey {
Mindbox.shared.pushClicked(uniqueKey: uniqueKey)
}
}

//https://developers.mindbox.ru/docs/ios-send-push-notifications-appdelegate
func registerForRemoteNotifications() {
UNUserNotificationCenter.current().delegate = self
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
UNUserNotificationCenter.current().requestAuthorization(options: [ .alert, .sound, .badge]) { granted, error in
print("Permission granted: \(granted)")
if let error = error {
print("NotificationsRequestAuthorization failed with error: \(error.localizedDescription)")
}
Mindbox.shared.notificationsRequestAuthorization(granted: granted)
}
}
}
}

11 changes: 11 additions & 0 deletions Example/Example/Assets.xcassets/AccentColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"images" : [
{
"filename" : "AppIcon1024x1024.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions Example/Example/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.165",
"green" : "0.176",
"red" : "0.169"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading

0 comments on commit 25f051f

Please sign in to comment.