mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-07 05:52:57 +00:00
refactor: add mulitple customization features
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
app
|
||||
playstore_api_key.json
|
||||
playstore.keystore
|
||||
app.conf
|
||||
Gemfile.lock
|
||||
42
Makefile
42
Makefile
@@ -1,12 +1,12 @@
|
||||
SHELL = /bin/bash
|
||||
APP_DIR = $(PWD)/app
|
||||
VERSION ?= develop
|
||||
SHELL := /bin/bash
|
||||
APP_DIR := $(PWD)/app
|
||||
BRANCH ?= develop
|
||||
|
||||
clean:
|
||||
rm -rf app
|
||||
|
||||
clone: clean
|
||||
sh static/scripts/clone_app.sh ${VERSION}
|
||||
sh static/scripts/clone_app.sh ${BRANCH}
|
||||
|
||||
install: clone
|
||||
cd app && NG_CLI_ANALYTICS="false" npm ci --unsafe-perm
|
||||
@@ -14,24 +14,38 @@ install: clone
|
||||
assets: install
|
||||
cp -rf customizable/assets/. app/src/assets/ && cp -rf customizable/assets-mobile/. app/resources/
|
||||
|
||||
configuration: assets
|
||||
source app.conf && sh static/scripts/ionic.sh
|
||||
configuration-web: assets
|
||||
sh static/scripts/ionic.sh
|
||||
|
||||
web-build: configuration
|
||||
configuration-android: assets
|
||||
CONFIG_MODE=ANDROID sh static/scripts/ionic.sh
|
||||
|
||||
configuration-ios: assets
|
||||
CONFIG_MODE=IOS sh static/scripts/ionic.sh
|
||||
|
||||
web-build: configuration-web
|
||||
cd app && ionic build --prod
|
||||
|
||||
web: web-build
|
||||
zip -r www.zip app/www
|
||||
cd app && zip -r ../www.zip www
|
||||
echo "Web application artifact for version ${VERSION} is archived in www.zip"
|
||||
|
||||
prepare-android: configuration
|
||||
source app.conf && cd app && rm -rf android www && ionic capacitor add android && npm run resources:android && ionic capacitor build android --no-open --prod && cd .. && sh static/scripts/android.sh
|
||||
prepare-android: configuration-android
|
||||
source app.conf && cd app && rm -rf android www && ionic capacitor add android && npm run resources:android && ionic capacitor build android --no-open --prod && cd .. && sh static/scripts/android.sh
|
||||
cp -rf static/fastlane-android/. app/android/fastlane/ && cp -rf app.conf app/android/.env
|
||||
|
||||
android: prepare-android
|
||||
source app.conf && cp -rf static/fastlane-android/. app/android/fastlane/ && cp -rf app.conf app/ios/App/fastlane/.env && cd app/android && bundler exec fastlane android release
|
||||
cd app/android && bundler exec fastlane android release
|
||||
|
||||
prepare-ios: configuration
|
||||
android-beta: prepare-android
|
||||
cd app/android && bundler exec fastlane android beta
|
||||
|
||||
prepare-ios: configuration-ios
|
||||
source app.conf && cd app && rm -rf ios www && ionic capacitor add ios && npm run resources:ios && ionic capacitor build ios --no-open --prod && cd .. && sh static/scripts/ios.sh
|
||||
cp -rf static/fastlane-ios/. app/ios/App/fastlane/ && cp -rf app.conf app/ios/App/fastlane/.env
|
||||
|
||||
ios: prepare-ios
|
||||
source app.conf && cp -rf static/fastlane-ios/. app/ios/App/fastlane/ && cp -rf app.conf app/ios/App/fastlane/.env && cd app/ios/App && bundler exec fastlane ios release
|
||||
ios: prepare-ios
|
||||
cd app/ios/App && bundler exec fastlane ios release
|
||||
|
||||
ios-beta: prepare-ios
|
||||
cd app/ios/App && bundler exec fastlane ios beta
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# App Release Template (ART)
|
||||
|
||||
This project can be used to generate mobile device apps (android / ios) and angular web app. Beware that this is only the app/frontend part and your need a fully functioning backend deployment first.
|
||||
This project can be used to generate mobile device apps (Android / iOS) and the standalone Angular web app. Beware that this is only the app/frontend part and your need a fully functioning backend deployment first.
|
||||
|
||||
## Requirements
|
||||
|
||||
* A fully functioning and publicly accessible [backend](https://gitlab.com/openstapps/backend) deployment
|
||||
* An active Apple App Store Developer Account and/or Google Playstore Developer Account
|
||||
* Docker (Android and Angular builds)
|
||||
* MacOS Device with latest Xcode, fastlane and xmlstartletn, node v14 and npm package @ionic/cli (iOS builds only)
|
||||
* MacOS Device with latest Xcode, fastlane and xmlstarlet, node v14 and npm package @ionic/cli (iOS builds only)
|
||||
|
||||
## Docker
|
||||
|
||||
@@ -21,6 +21,6 @@ sudo docker build -t openstapps-art .
|
||||
|
||||
0. If neccessary make adjustments to your app / profiles / entitlements in your corresponding developer/store portal
|
||||
1. Overwrite assets in customizable directory with your own ones (keeping the same size and file format)
|
||||
2. Edit app.conf to your liking (needs info you can find in your corresponding developer/store portal)
|
||||
2. Edit app.conf.sample to your liking and rename it to app.conf (needs info you can find in your corresponding developer/store portal)
|
||||
3. Use docker to run `make web` and `make android` (i.e. `docker run -it -v $(pwd):/build --rm openstapps-art:latest make web`)
|
||||
4. On a macOS device run `make ios` (make sure you have all required certificates / profiles set up in Xcode)
|
||||
|
||||
21
app.conf
21
app.conf
@@ -1,21 +0,0 @@
|
||||
# Edit the following entires if necessary
|
||||
|
||||
APP_NAME="Open StApps"
|
||||
APP_DISPLAY_NAME="StApps" # App name on homescreen =Not much space
|
||||
BACKEND_URL="https://your.backend.server.tld" # Publicly available backend url
|
||||
BACKEND_VERSION="2.0.0" # Minimum backend version the app will request
|
||||
APP_LINK_URL="your.deep.link.host.tld" # Your host used for universal =deep links
|
||||
|
||||
# Android specific configuration
|
||||
|
||||
ANDROID_PACKAGE_NAME="de.any_school.app" # e.g. com.krausefx.app
|
||||
|
||||
|
||||
# iOS specific sonfiguration
|
||||
|
||||
LOCATION_USAGE_DESCRIPTION="Die Ortungsdienste werden für die Kartenansichten und bessere Suchergebnisse benötigt"
|
||||
IOS_APP_IDENTIFIER="com.any_school.app.ABCDEV1234" # The bundle identifier of your ios app
|
||||
APPLE_ID="example@domain.tld" # Your Apple Developer email address
|
||||
ITC_TEAM_ID="123412345" # App Store Connect Team ID
|
||||
TEAM_ID="ABCDEV1234" # Developer Team ID
|
||||
PROVISIONING_PROFILE_NAME="App Deployment Profile" # Name of the apps own provisioning profile used for signing
|
||||
23
app.conf.sample
Normal file
23
app.conf.sample
Normal file
@@ -0,0 +1,23 @@
|
||||
# Edit the following entires if necessary
|
||||
|
||||
APP_NAME="Open StApps" # Full app name
|
||||
APP_DISPLAY_NAME="StApps" # App name on mobile device homescreen (Not much space)
|
||||
BACKEND_URL="https://your.backend.server.tld" # Publicly available backend url
|
||||
BACKEND_VERSION="2.0.0" # Minimum backend version the app will request
|
||||
APP_LINK_HOST="your.deep.link.host.tld" # Your host used for universal (deep) links
|
||||
APP_URL_SCHEME="de.anyschool.app" # Custom url scheme for native app versions
|
||||
|
||||
# Android specific configuration
|
||||
|
||||
ANDROID_PACKAGE_NAME="de.anyschool.app.droid" # e.g. com.krausefx.app
|
||||
|
||||
|
||||
# iOS specific sonfiguration
|
||||
|
||||
LOCATION_USAGE_DESCRIPTION="Die Ortungsdienste werden für die Kartenansichten und bessere Suchergebnisse benötigt"
|
||||
CALENDAR_USAGE_DESCRIPTION="Zugriff auf Kalender wird für die Synchronisierung deiner Uni Termine benötigt"
|
||||
IOS_BUNDLE_IDENTIFIER="com.anyschool.app.ios" # The bundle identifier of your ios app
|
||||
APPLE_ID="example@domain.tld" # Your Apple Developer email address
|
||||
ITC_TEAM_ID="123412345" # App Store Connect Team ID
|
||||
TEAM_ID="ABCDEV1234" # Developer Team ID
|
||||
PROVISIONING_PROFILE_NAME="App Deployment Profile" # Name of the apps own provisioning profile used for signing
|
||||
7
customizable/theme/variables.scss
Normal file
7
customizable/theme/variables.scss
Normal file
@@ -0,0 +1,7 @@
|
||||
:root {
|
||||
/*
|
||||
Use this section to overwrite theme variables
|
||||
A color scheme can be tested and generated at:
|
||||
https://ionicframework.com/docs/theming/color-generator
|
||||
*/
|
||||
}
|
||||
1
playstore.keystore.sample
Normal file
1
playstore.keystore.sample
Normal file
@@ -0,0 +1 @@
|
||||
Replace this with your valid playstore keystore file used for signing your binaries and remove '.sample' from file name
|
||||
@@ -1 +1,2 @@
|
||||
json_key_file("../../../playstore_api_key.json") # Don't Change
|
||||
json_key_file("../../playstore_api_key.json") # Don't Change
|
||||
package_name ENV["ANDROID_PACKAGE_NAME"] || "de.anyschool.app.droid" # Don't Change
|
||||
@@ -13,22 +13,61 @@
|
||||
# Uncomment the line if you want fastlane to automatically update itself
|
||||
# update_fastlane
|
||||
|
||||
require 'json'
|
||||
|
||||
default_platform(:android)
|
||||
|
||||
version_code = 1
|
||||
playstore_track = "internal"
|
||||
package_json = JSON.parse(File.read('../../package.json'))
|
||||
|
||||
platform :android do
|
||||
desc "Runs all the tests"
|
||||
lane :test do
|
||||
gradle(task: "test")
|
||||
end
|
||||
|
||||
desc "Submit a new Beta Build to Crashlytics Beta"
|
||||
lane :fetch_version_code do
|
||||
version_code = google_play_track_version_codes(
|
||||
package_name: ENV['ANDROID_PACKAGE_NAME'],
|
||||
track: playstore_track,
|
||||
json_key: '../../playstore_api_key.json'
|
||||
).max
|
||||
end
|
||||
|
||||
lane :build do
|
||||
gradle(
|
||||
task: "clean assemble",
|
||||
build_type: "Release",
|
||||
print_command: false,
|
||||
properties: {
|
||||
"android.injected.signing.store.file" => "../../../playstore.keystore",
|
||||
"android.injected.signing.store.password" => "",
|
||||
"android.injected.signing.key.alias" => "",
|
||||
"android.injected.signing.key.password" => "",
|
||||
"versionCode" => version_code,
|
||||
"versionName" => package_json['version']
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
desc "Submit a new beta build to internal testing track"
|
||||
lane :beta do
|
||||
gradle(task: "clean assembleRelease")
|
||||
playstore_track = "internal"
|
||||
|
||||
build
|
||||
upload_to_play_store(
|
||||
track: playstore_track,
|
||||
json_key: '../../playstore_api_key.json',
|
||||
skip_upload_metadata: true,
|
||||
skip_upload_images: true,
|
||||
skip_upload_screenshots: true
|
||||
)
|
||||
end
|
||||
|
||||
desc "Deploy a new version to the Google Play"
|
||||
lane :release do
|
||||
gradle(task: "clean assembleRelease")
|
||||
#upload_to_play_store
|
||||
build
|
||||
#upload_to_play_store(json_key: '../../playstore_api_key.json', skip_upload_metadata: true, skip_upload_images: true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,26 +13,61 @@
|
||||
# Uncomment the line if you want fastlane to automatically update itself
|
||||
# update_fastlane
|
||||
|
||||
require 'json'
|
||||
|
||||
default_platform(:ios)
|
||||
|
||||
package_json = JSON.parse(File.read('../../package.json'))
|
||||
|
||||
platform :ios do
|
||||
desc "Push a new release build to the App Store"
|
||||
|
||||
lane :release do
|
||||
lane :configure do
|
||||
set_info_plist_value(
|
||||
path: "App/Info.plist",
|
||||
key: "NSLocationAlwaysAndWhenInUseUsageDescription",
|
||||
value: ENV['LOCATION_USAGE_DESCRIPTION']
|
||||
)
|
||||
update_build_settings(
|
||||
use_automatic_signing: false,
|
||||
set_info_plist_value(
|
||||
path: "App/Info.plist",
|
||||
key: "NSLocationWhenInUseUsageDescription",
|
||||
value: ENV['LOCATION_USAGE_DESCRIPTION']
|
||||
)
|
||||
set_info_plist_value(
|
||||
path: "App/Info.plist",
|
||||
key: "NSCalendarsUsageDescription",
|
||||
value: ENV['CALENDAR_USAGE_DESCRIPTION']
|
||||
)
|
||||
update_url_schemes(
|
||||
path: "App/Info.plist",
|
||||
url_schemes: [ENV['APP_URL_SCHEME']]
|
||||
)
|
||||
update_code_signing_settings(
|
||||
use_automatic_signing: true,
|
||||
path: "App.xcodeproj",
|
||||
team_id: ENV['TEAM_ID'],
|
||||
bundle_identifier: ENV['IOS_APP_IDENTIFIER'],
|
||||
profile_name: ENV['PROVISIONING_PROFILE_NAME'],
|
||||
bundle_identifier: ENV['IOS_BUNDLE_IDENTIFIER'],
|
||||
entitlements_file_path: "App/App.entitlements"
|
||||
)
|
||||
increment_version_number(
|
||||
version_number: package_json['version'],
|
||||
xcodeproj: "App.xcodeproj"
|
||||
)
|
||||
end
|
||||
|
||||
lane :build do
|
||||
build_app(workspace: "App.xcworkspace", scheme: "App")
|
||||
# upload_to_app_store(skip_metadata: true, skip_screenshots: true)
|
||||
end
|
||||
|
||||
lane :release do
|
||||
configure
|
||||
build
|
||||
#upload_to_app_store(skip_metadata: true, skip_screenshots: true)
|
||||
end
|
||||
|
||||
lane :beta do
|
||||
configure
|
||||
build
|
||||
upload_to_testflight(skip_submission: true)
|
||||
end
|
||||
end
|
||||
@@ -1,213 +0,0 @@
|
||||
require 'xcodeproj'
|
||||
module Fastlane
|
||||
module Actions
|
||||
class UpdateBuildSettingsAction < Action
|
||||
def self.run(params)
|
||||
FastlaneCore::PrintTable.print_values(config: params, title: "Summary for code signing settings")
|
||||
path = params[:path]
|
||||
path = File.join(File.expand_path(path), "project.pbxproj")
|
||||
|
||||
project = Xcodeproj::Project.open(params[:path])
|
||||
UI.user_error!("Could not find path to project config '#{path}'. Pass the path to your project (not workspace)!") unless File.exist?(path)
|
||||
UI.message("Updating the Automatic Codesigning flag to #{params[:use_automatic_signing] ? 'enabled' : 'disabled'} for the given project '#{path}'")
|
||||
|
||||
unless project.root_object.attributes["TargetAttributes"]
|
||||
UI.user_error!("Seems to be a very old project file format - please open your project file in a more recent version of Xcode")
|
||||
return false
|
||||
end
|
||||
|
||||
changed_targets = []
|
||||
changed_build_configurations = []
|
||||
|
||||
project.targets.each do |target|
|
||||
if params[:targets]
|
||||
unless params[:targets].include?(target.name)
|
||||
UI.important("Skipping #{target.name} not selected (#{params[:targets].join(',')})")
|
||||
next
|
||||
end
|
||||
end
|
||||
|
||||
target.build_configurations.each do |config|
|
||||
if params[:build_configurations]
|
||||
unless params[:build_configurations].include?(config.name)
|
||||
UI.important("Skipping #{config.name} not selected (#{params[:build_configurations].join(',')})")
|
||||
next
|
||||
end
|
||||
end
|
||||
|
||||
style_value = params[:use_automatic_signing] ? 'Automatic' : 'Manual'
|
||||
set_build_setting(config, "CODE_SIGN_STYLE", style_value)
|
||||
|
||||
if params[:team_id]
|
||||
set_build_setting(config, "DEVELOPMENT_TEAM", params[:team_id])
|
||||
UI.important("Set Team id to: #{params[:team_id]} for target: #{target.name} for build configuration: #{config.name}")
|
||||
end
|
||||
if params[:code_sign_identity]
|
||||
set_build_setting(config, "CODE_SIGN_IDENTITY", params[:code_sign_identity])
|
||||
UI.important("Set Code Sign identity to: #{params[:code_sign_identity]} for target: #{target.name} for build configuration: #{config.name}")
|
||||
end
|
||||
if params[:profile_name]
|
||||
set_build_setting(config, "PROVISIONING_PROFILE_SPECIFIER", params[:profile_name])
|
||||
UI.important("Set Provisioning Profile name to: #{params[:profile_name]} for target: #{target.name} for build configuration: #{config.name}")
|
||||
end
|
||||
if params[:entitlements_file_path]
|
||||
set_build_setting(config, "CODE_SIGN_ENTITLEMENTS", params[:entitlements_file_path])
|
||||
UI.important("Set Entitlements file path to: #{params[:entitlements_file_path]} for target: #{target.name} for build configuration: #{config.name}")
|
||||
end
|
||||
# Since Xcode 8, this is no longer needed, you simply use PROVISIONING_PROFILE_SPECIFIER
|
||||
if params[:profile_uuid]
|
||||
set_build_setting(config, "PROVISIONING_PROFILE", params[:profile_uuid])
|
||||
UI.important("Set Provisioning Profile UUID to: #{params[:profile_uuid]} for target: #{target.name} for build configuration: #{config.name}")
|
||||
end
|
||||
if params[:bundle_identifier]
|
||||
set_build_setting(config, "PRODUCT_BUNDLE_IDENTIFIER", params[:bundle_identifier])
|
||||
UI.important("Set Bundle identifier to: #{params[:bundle_identifier]} for target: #{target.name} for build configuration: #{config.name}")
|
||||
end
|
||||
|
||||
changed_build_configurations << config.name
|
||||
end
|
||||
|
||||
changed_targets << target.name
|
||||
end
|
||||
project.save
|
||||
|
||||
if changed_targets.empty?
|
||||
UI.important("None of the specified targets has been modified")
|
||||
UI.important("available targets:")
|
||||
project.targets.each do |target|
|
||||
UI.important("\t* #{target.name}")
|
||||
end
|
||||
else
|
||||
UI.success("Successfully updated project settings to use Code Sign Style = '#{params[:use_automatic_signing] ? 'Automatic' : 'Manual'}'")
|
||||
UI.success("Modified Targets:")
|
||||
changed_targets.each do |target|
|
||||
UI.success("\t * #{target}")
|
||||
end
|
||||
|
||||
UI.success("Modified Build Configurations:")
|
||||
changed_build_configurations.each do |name|
|
||||
UI.success("\t * #{name}")
|
||||
end
|
||||
end
|
||||
|
||||
params[:use_automatic_signing]
|
||||
end
|
||||
|
||||
def self.set_build_setting(configuration, name, value)
|
||||
# Iterate over any keys that start with this name
|
||||
# This will also set keys that have filtering like [sdk=iphoneos*]
|
||||
keys = configuration.build_settings.keys.select { |key| key.to_s.match(/#{name}.*/) }
|
||||
keys.each do |key|
|
||||
configuration.build_settings[key] = value
|
||||
end
|
||||
|
||||
# Explicitly set the key with value if keys don't exist
|
||||
configuration.build_settings[name] = value
|
||||
end
|
||||
|
||||
def self.description
|
||||
"Configures Xcode's Codesigning options"
|
||||
end
|
||||
|
||||
def self.details
|
||||
"Configures Xcode's Codesigning options of all targets in the project"
|
||||
end
|
||||
|
||||
def self.available_options
|
||||
[
|
||||
FastlaneCore::ConfigItem.new(key: :path,
|
||||
env_name: "FL_PROJECT_SIGNING_PROJECT_PATH",
|
||||
description: "Path to your Xcode project",
|
||||
code_gen_sensitive: true,
|
||||
default_value: Dir['*.xcodeproj'].first,
|
||||
default_value_dynamic: true,
|
||||
verify_block: proc do |value|
|
||||
UI.user_error!("Path is invalid") unless File.exist?(File.expand_path(value))
|
||||
end),
|
||||
FastlaneCore::ConfigItem.new(key: :use_automatic_signing,
|
||||
env_name: "FL_PROJECT_USE_AUTOMATIC_SIGNING",
|
||||
description: "Defines if project should use automatic signing",
|
||||
type: Boolean,
|
||||
default_value: false),
|
||||
FastlaneCore::ConfigItem.new(key: :team_id,
|
||||
env_name: "FASTLANE_TEAM_ID",
|
||||
optional: true,
|
||||
description: "Team ID, is used when upgrading project"),
|
||||
FastlaneCore::ConfigItem.new(key: :targets,
|
||||
env_name: "FL_PROJECT_SIGNING_TARGETS",
|
||||
optional: true,
|
||||
type: Array,
|
||||
description: "Specify targets you want to toggle the signing mech. (default to all targets)"),
|
||||
FastlaneCore::ConfigItem.new(key: :build_configurations,
|
||||
env_name: "FL_PROJECT_SIGNING_BUILD_CONFIGURATIONS",
|
||||
optional: true,
|
||||
type: Array,
|
||||
description: "Specify build_configurations you want to toggle the signing mech. (default to all configurations)"),
|
||||
FastlaneCore::ConfigItem.new(key: :code_sign_identity,
|
||||
env_name: "FL_CODE_SIGN_IDENTITY",
|
||||
description: "Code signing identity type (iPhone Developer, iPhone Distribution)",
|
||||
optional: true),
|
||||
FastlaneCore::ConfigItem.new(key: :entitlements_file_path,
|
||||
env_name: "FL_CODE_SIGN_ENTITLEMENTS_FILE_PATH",
|
||||
description: "Path to your entitlements file",
|
||||
optional: true),
|
||||
FastlaneCore::ConfigItem.new(key: :profile_name,
|
||||
env_name: "FL_PROVISIONING_PROFILE_SPECIFIER",
|
||||
description: "Provisioning profile name to use for code signing",
|
||||
optional: true),
|
||||
FastlaneCore::ConfigItem.new(key: :profile_uuid,
|
||||
env_name: "FL_PROVISIONING_PROFILE",
|
||||
description: "Provisioning profile UUID to use for code signing",
|
||||
optional: true),
|
||||
FastlaneCore::ConfigItem.new(key: :bundle_identifier,
|
||||
env_name: "FL_APP_IDENTIFIER",
|
||||
description: "Application Product Bundle Identifier",
|
||||
optional: true)
|
||||
]
|
||||
end
|
||||
|
||||
def self.output
|
||||
end
|
||||
|
||||
def self.example_code
|
||||
[
|
||||
' # manual code signing
|
||||
update_code_signing_settings(
|
||||
use_automatic_signing: false,
|
||||
path: "demo-project/demo/demo.xcodeproj"
|
||||
)',
|
||||
' # automatic code signing
|
||||
update_code_signing_settings(
|
||||
use_automatic_signing: true,
|
||||
path: "demo-project/demo/demo.xcodeproj"
|
||||
)',
|
||||
' # more advanced manual code signing
|
||||
update_code_signing_settings(
|
||||
use_automatic_signing: true,
|
||||
path: "demo-project/demo/demo.xcodeproj",
|
||||
team_id: "QABC123DEV",
|
||||
bundle_identifier: "com.demoapp.QABC123DEV",
|
||||
profile_name: "Demo App Deployment Profile",
|
||||
entitlements_file_path: "Demo App/generated/New.entitlements"
|
||||
)'
|
||||
]
|
||||
end
|
||||
|
||||
def self.category
|
||||
:code_signing
|
||||
end
|
||||
|
||||
def self.return_value
|
||||
"The current status (boolean) of codesigning after modification"
|
||||
end
|
||||
|
||||
def self.authors
|
||||
["mathiasAichinger", "hjanuschka", "p4checo", "portellaa", "aeons", "att55", "abcdev"]
|
||||
end
|
||||
|
||||
def self.is_supported?(platform)
|
||||
[:ios, :mac].include?(platform)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,35 +1,37 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
DEFAULT_APP_LINK_URL="your.deep.link.host.tld"
|
||||
APP_LINK_URL="${APP_LINK_URL:-$DEFAULT_APP_LINK_URL}"
|
||||
. $PWD/app.conf
|
||||
|
||||
if [ -n "$(xmlstarlet sel -T -t -v "/manifest/application/activity[intent-filter/@android:autoVerify='true']" app/android/app/src/main/AndroidManifest.xml)" ]; then
|
||||
echo "Deep link capability already defined in AndroidManifest.xml"
|
||||
else
|
||||
echo "Adding deep link capability to AndroidManifest.xml"
|
||||
xmlstarlet edit -L -s /manifest/application/activity -t elem -n tmpElement -v "" \
|
||||
-i //tmpElement -t attr -n "android:autoVerify" -v "true" \
|
||||
-r //tmpElement -v intent-filter \
|
||||
app/android/app/src/main/AndroidManifest.xml
|
||||
DEFAULT_APP_URL_SCHEME="de.anyschool.app"
|
||||
APP_URL_SCHEME="${APP_URL_SCHEME:-$DEFAULT_APP_URL_SCHEME}"
|
||||
|
||||
xmlstarlet edit -L -s "/manifest/application/activity/intent-filter[@android:autoVerify='true']" -t elem -n tmpElement -v "" \
|
||||
-i //tmpElement -t attr -n "android:name" -v "android.intent.action.VIEW" \
|
||||
-r //tmpElement -v action \
|
||||
app/android/app/src/main/AndroidManifest.xml
|
||||
ANDROID_MANIFEST_PATH="app/android/app/src/main/AndroidManifest.xml"
|
||||
ANDROID_STRINGS_PATH="app/android/app/src/main/res/values/strings.xml"
|
||||
|
||||
xmlstarlet edit -L -s "/manifest/application/activity/intent-filter[@android:autoVerify='true']" -t elem -n tmpElement -v "" \
|
||||
-i //tmpElement -t attr -n "android:name" -v "android.intent.action.DEFAULT" \
|
||||
-r //tmpElement -v category \
|
||||
app/android/app/src/main/AndroidManifest.xml
|
||||
|
||||
xmlstarlet edit -L -s "/manifest/application/activity/intent-filter[@android:autoVerify='true']" -t elem -n tmpElement -v "" \
|
||||
-i //tmpElement -t attr -n "android:name" -v "android.intent.action.BROWSABLE" \
|
||||
-r //tmpElement -v category \
|
||||
app/android/app/src/main/AndroidManifest.xml
|
||||
git -C app checkout -- android/build.gradle
|
||||
git -C app checkout -- android/app/src/main/AndroidManifest.xml
|
||||
|
||||
xmlstarlet edit -L -s "/manifest/application/activity/intent-filter[@android:autoVerify='true']" -t elem -n tmpElement -v "" \
|
||||
-i //tmpElement -t attr -n "android:scheme" -v "https" \
|
||||
-i //tmpElement -t attr -n "android:host" -v "$APP_LINK_URL" \
|
||||
-r //tmpElement -v data \
|
||||
app/android/app/src/main/AndroidManifest.xml
|
||||
fi
|
||||
# AndroidManifest.xml
|
||||
xmlstarlet edit --pf --inplace \
|
||||
--update "/manifest/@package" --value "$ANDROID_PACKAGE_NAME" \
|
||||
$ANDROID_MANIFEST_PATH
|
||||
|
||||
xmlstarlet edit --pf --inplace \
|
||||
--update "/manifest/application/activity/@android:name" --value "$ANDROID_PACKAGE_NAME".MainActivity \
|
||||
$ANDROID_MANIFEST_PATH
|
||||
|
||||
# strings.xml
|
||||
xmlstarlet edit --pf --inplace \
|
||||
--update "/resources/string[@name='package_name']" --value "$ANDROID_PACKAGE_NAME" \
|
||||
$ANDROID_STRINGS_PATH
|
||||
|
||||
xmlstarlet edit --pf --inplace \
|
||||
--update "/resources/string[@name='custom_url_scheme']" --value "$APP_URL_SCHEME" \
|
||||
$ANDROID_STRINGS_PATH
|
||||
|
||||
xmlstarlet edit --inplace \
|
||||
--delete "/resources/string[@name='app_host']" \
|
||||
--append "/resources/string[@name='custom_url_scheme']" --type elem -n string --value "$APP_LINK_HOST" \
|
||||
--insert "/resources/string[not(@name)]" --type attr -n name --value "app_host" \
|
||||
$ANDROID_STRINGS_PATH
|
||||
|
||||
@@ -1,17 +1,37 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
DEFAULT_APP_NAME="Open StApps"
|
||||
DEFAULT_APP_DISPLAY_NAME="StApps"
|
||||
DEFAULT_APP_ID="de.any_school.app"
|
||||
. $PWD/app.conf
|
||||
|
||||
DEFAULT_APP_ID="de.anyschool.app"
|
||||
DEFAULT_CONFIG_MODE="WEB"
|
||||
|
||||
APP_NAME="${APP_NAME:-$DEFAULT_APP_NAME}"
|
||||
APP_DISPLAY_NAME="${APP_DISPLAY_NAME:-$DEFAULT_APP_DISPLAY_NAME}"
|
||||
APP_ID="${APP_ID:-$DEFAULT_APP_ID}"
|
||||
|
||||
APP_VERSION=$(jq '.version' app/package.json)
|
||||
CONFIG_MODE="${CONFIG_MODE:-$DEFAULT_CONFIG_MODE}"
|
||||
|
||||
if [ "$CONFIG_MODE" = 'ANDROID' ]; then
|
||||
APP_ID="$ANDROID_PACKAGE_NAME"
|
||||
fi
|
||||
|
||||
if [ "$CONFIG_MODE" = 'IOS' ]; then
|
||||
APP_ID="$IOS_BUNDLE_IDENTIFIER"
|
||||
fi
|
||||
|
||||
# ionic config
|
||||
cat app/ionic.config.json | jq '.name = $newName' --arg newName "$APP_NAME" > tmp.$$.json && mv tmp.$$.json app/ionic.config.json
|
||||
sed -i -e 's@<title>StApps<\/title>@<title>'"$APP_DISPLAY_NAME"'<\/title>@g' app/src/index.html
|
||||
|
||||
ROOT_THEME_DEFINITONS=$(cat app/src/theme/variables.scss | grep -o :root | wc -l)
|
||||
|
||||
if [ $ROOT_THEME_DEFINITONS -gt 1 ]; then
|
||||
#update
|
||||
echo "SCSS theme has already been set"
|
||||
else
|
||||
#insert
|
||||
cat customizable/theme/variables.scss >> app/src/theme/variables.scss
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# capacitor config
|
||||
awk "/appName:.*,/ && !done { gsub(/appName:.*,/, \"appName: '$APP_NAME',\"); done=1}; 1" app/capacitor.config.ts > tmp.$$.json && mv tmp.$$.json app/capacitor.config.ts
|
||||
@@ -22,7 +42,9 @@ xmlstarlet edit -L --update "/widget/@id" --value "$APP_ID" app/config.xml
|
||||
xmlstarlet edit -L --update "/widget/@version" --value "$APP_VERSION" app/config.xml
|
||||
xmlstarlet edit -L -N x="http://www.w3.org/ns/widgets" --update "//x:name" --value "$APP_NAME" app/config.xml
|
||||
|
||||
if [ -n $(xmlstarlet sel -N x="http://www.w3.org/ns/widgets" -T -t -v "//x:name[@short]" app/config.xml) ]; then
|
||||
SHORT_EXISTS=$(xmlstarlet sel -N x='http://www.w3.org/ns/widgets' -T -t -v '//x:name[@short]' app/config.xml)
|
||||
|
||||
if [ -z "${SHORT_EXISTS:-}" ]; then
|
||||
#insert
|
||||
xmlstarlet edit -L -N x="http://www.w3.org/ns/widgets" -s "//x:name" -t attr -n "short" -v "$APP_DISPLAY_NAME" app/config.xml
|
||||
else
|
||||
@@ -31,5 +53,7 @@ else
|
||||
fi
|
||||
|
||||
# environment config
|
||||
awk "/backend_url:.*,/ && !done { gsub(/backend_url:.*,/, \"backend_url: '$BACKEND_URL',\"); done=1}; 1" app/src/environments/environment.prod.ts > tmp.$$.json && mv tmp.$$.json app/src/environments/environment.prod.t
|
||||
awk "/backend_version:.*,/ && !done { gsub(/backend_version:.*,/, \"backend_version: '$BACKEND_VERSION',\"); done=1}; 1" app/src/environments/environment.prod.t > tmp.$$.json && mv tmp.$$.json app/src/environments/environment.prod.t
|
||||
awk "/backend_url:.*,/ && !done { gsub(/backend_url:.*,/, \"backend_url: '$BACKEND_URL',\"); done=1}; 1" app/src/environments/environment.prod.ts > tmp.$$.json && mv tmp.$$.json app/src/environments/environment.prod.ts
|
||||
awk "/backend_version:.*,/ && !done { gsub(/backend_version:.*,/, \"backend_version: '$BACKEND_VERSION',\"); done=1}; 1" app/src/environments/environment.prod.ts > tmp.$$.json && mv tmp.$$.json app/src/environments/environment.prod.ts
|
||||
awk "/app_host:.*,/ && !done { gsub(/app_host:.*,/, \"app_host: '$APP_LINK_HOST',\"); done=1}; 1" app/src/environments/environment.prod.ts > tmp.$$.json && mv tmp.$$.json app/src/environments/environment.prod.ts
|
||||
awk "/custom_url_scheme:.*,/ && !done { gsub(/custom_url_scheme:.*,/, \"custom_url_scheme: '$APP_URL_SCHEME',\"); done=1}; 1" app/src/environments/environment.prod.ts > tmp.$$.json && mv tmp.$$.json app/src/environments/environment.prod.ts
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
DEFAULT_APP_LINK_URL="your.deep.link.host.tld"
|
||||
APP_LINK_URL="${APP_LINK_URL:-$DEFAULT_APP_LINK_URL}"
|
||||
ENTITLEMENTS_FILE="app/ios/App/App/App.entitlements"
|
||||
. $PWD/app.conf
|
||||
|
||||
/usr/libexec/PlistBuddy -c "Delete :com.apple.developer.associated-domains string $APP_LINK_URL" $ENTITLEMENTS_FILE
|
||||
ENTITLEMENTS_FILE="app/ios/App/App/App.entitlements"
|
||||
INFOPLIST_FILE="app/ios/App/App/Info.plist"
|
||||
|
||||
|
||||
/usr/libexec/PlistBuddy -c "Delete :com.apple.developer.associated-domains string applinks:$APP_LINK_HOST" $ENTITLEMENTS_FILE
|
||||
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.associated-domains array" $ENTITLEMENTS_FILE
|
||||
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.associated-domains:0 string $APP_LINK_URL" $ENTITLEMENTS_FILE
|
||||
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.associated-domains:0 string applinks:$APP_LINK_HOST" $ENTITLEMENTS_FILE
|
||||
|
||||
/usr/libexec/PlistBuddy -c "Delete :BGTaskSchedulerPermittedIdentifiers string com.transistorsoft.fetch" $INFOPLIST_FILE
|
||||
/usr/libexec/PlistBuddy -c "Add :BGTaskSchedulerPermittedIdentifiers array" $INFOPLIST_FILE
|
||||
/usr/libexec/PlistBuddy -c "Add :BGTaskSchedulerPermittedIdentifiers:0 string com.transistorsoft.fetch" $INFOPLIST_FILE
|
||||
|
||||
git -C app checkout -- ios/App/App/AppDelegate.swift
|
||||
|
||||
Reference in New Issue
Block a user