This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refact: get app version & set curl user-agent
- Loading branch information
Showing
5 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// version.h | ||
// EasyHautX | ||
// | ||
// Created by zengxs on 2018/12/21. | ||
// Copyright © 2018 ehaut. All rights reserved. | ||
// | ||
|
||
#ifndef __VERSION_H__ | ||
#define __VERSION_H__ 1 | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
const char *ehautx_version(void); | ||
const char *ehautx_short_version(void); | ||
const char *ehautx_user_agent(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __VERSION_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// version.m | ||
// EasyHautX | ||
// | ||
// Created by zengxs on 2018/12/21. | ||
// Copyright © 2018 ehaut. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import "version.h" | ||
|
||
static char short_vesrion[30]; | ||
static char full_version[60]; | ||
static char user_agent[60]; | ||
|
||
const char *ehautx_short_version(void) { | ||
@autoreleasepool { | ||
NSString *version = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleShortVersionString"]; | ||
snprintf(short_vesrion, sizeof(short_vesrion), "%s", [version UTF8String]); | ||
return short_vesrion; | ||
} | ||
} | ||
|
||
const char *ehautx_version(void) { | ||
snprintf(full_version, sizeof(full_version), "EasyHautX v%s", ehautx_short_version()); | ||
return full_version; | ||
} | ||
|
||
const char *ehautx_user_agent(void) { | ||
snprintf(user_agent, sizeof(user_agent), "EasyHautX/%s", ehautx_short_version()); | ||
return user_agent; | ||
} |